diff --git a/source/cart_hw/cart_hw.c b/source/cart_hw/cart_hw.c index 6c06731..90f998c 100644 --- a/source/cart_hw/cart_hw.c +++ b/source/cart_hw/cart_hw.c @@ -30,6 +30,12 @@ #define CART_CNT 26 +/* Global Variables */ +T_CART_HW cart_hw; +uint8 j_cart; +uint8 *default_rom; +int old_system[2] = {-1,-1}; + /* Function prototypes */ void default_time_w(uint32 address, uint32 data); void special_mapper_w(uint32 address, uint32 data); @@ -54,7 +60,7 @@ typedef struct - copy protection device - custom ROM banking device */ -T_CART_ENTRY rom_database[CART_CNT] = +static const T_CART_ENTRY rom_database[CART_CNT] = { /* Game no Kanzume Otokuyou */ {0x0000,0xf9d1,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,seganet_mapper_w,0,0}}, @@ -110,12 +116,9 @@ T_CART_ENTRY rom_database[CART_CNT] = {0x30b9,0x1c2a,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,0,default_regs_r,0}} }; - -/* previous inputs */ -int old_system[2] = {-1,-1}; - /* temporary memory chunk */ -uint8 mem_chunk[0x10000]; +static uint8 mem_chunk[0x10000]; + /************************************************************ Cart Hardware initialization diff --git a/source/cart_hw/cart_hw.h b/source/cart_hw/cart_hw.h index 492c373..bc36d9c 100644 --- a/source/cart_hw/cart_hw.h +++ b/source/cart_hw/cart_hw.h @@ -42,9 +42,10 @@ typedef struct } T_CART_HW; /* global variables */ -T_CART_HW cart_hw; -uint8 j_cart; -uint8 *default_rom; +extern T_CART_HW cart_hw; +extern uint8 j_cart; +extern uint8 *default_rom; +extern int old_system[2]; /* Function prototypes */ extern void cart_hw_reset(); diff --git a/source/cart_hw/eeprom.c b/source/cart_hw/eeprom.c index 3cbd6ae..68f61c1 100644 --- a/source/cart_hw/eeprom.c +++ b/source/cart_hw/eeprom.c @@ -21,6 +21,10 @@ #include "shared.h" +#define GAME_CNT 25 + +T_EEPROM eeprom; + typedef struct { char game_id[14]; @@ -28,7 +32,7 @@ typedef struct T_EEPROM_TYPE type; } T_GAME_ENTRY; -T_GAME_ENTRY database[25] = +static const T_GAME_ENTRY database[GAME_CNT] = { /* ACCLAIM mappers */ /* 24C02 (old mapper) */ @@ -73,12 +77,9 @@ T_GAME_ENTRY database[25] = {{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */ }; - -T_EEPROM eeprom; - void eeprom_init() { - uint8 i = 0; + int i = 0; /* initialize eeprom */ memset(&eeprom, 0, sizeof(T_EEPROM)); @@ -86,10 +87,11 @@ void eeprom_init() eeprom.scl = eeprom.old_scl = 1; eeprom.state = STAND_BY; + /* no eeprom by default */ sram.custom = 0; /* look into game database */ - while ((i<25) && (!sram.custom)) + while ((i