fixed input controllers not being properly changed after hard reset

This commit is contained in:
ekeeke31 2009-12-13 19:09:15 +00:00
parent ecb5f0617b
commit ee50adf375
3 changed files with 97 additions and 96 deletions

View File

@ -285,6 +285,83 @@ void cart_hw_init()
m68k_memory_map[0x3a].read16 = svp_read_cell_2; m68k_memory_map[0x3a].read16 = svp_read_cell_2;
} }
/**********************************************
SPECIAL PERIPHERALS
***********************************************/
/* restore previous settings */
if (old_system[0] != -1)
input.system[0] = old_system[0];
if (old_system[1] != -1)
input.system[1] = old_system[1];
/* initialize default GUN settings */
input.x_offset = 0x00;
input.y_offset = 0x00;
/**********************************************
SEGA MENACER
***********************************************/
if (strstr(rominfo.international,"MENACER") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = NO_SYSTEM;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x52;
input.y_offset = 0x00;
}
else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x84;
input.y_offset = 0x08;
}
else if (strstr(rominfo.international,"BODY COUNT") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_MOUSE;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x44;
input.y_offset = 0x18;
}
/**********************************************
KONAMI JUSTIFIER
***********************************************/
else if (strstr(rominfo.international,"LETHAL ENFORCERSII") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x18;
input.y_offset = 0x00;
}
else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x00;
input.y_offset = 0x00;
}
/********************************************** /**********************************************
J-CART J-CART
***********************************************/ ***********************************************/
@ -305,6 +382,14 @@ void cart_hw_init()
m68k_memory_map[0x38].write16 = jcart_write; m68k_memory_map[0x38].write16 = jcart_write;
m68k_memory_map[0x3f].read16 = jcart_read; m68k_memory_map[0x3f].read16 = jcart_read;
m68k_memory_map[0x3f].write16 = jcart_write; m68k_memory_map[0x3f].write16 = jcart_write;
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
/* set default settings */
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_GAMEPAD;
} }
} }

View File

@ -39,97 +39,7 @@ static struct port_t
*****************************************************************************/ *****************************************************************************/
void io_init(void) void io_init(void)
{ {
/* set region according to ROM header */ /* Initialize IO Ports handlers */
set_region();
/* restore previous setting */
if (old_system[0] != -1) input.system[0] = old_system[0];
if (old_system[1] != -1) input.system[1] = old_system[1];
/* initialize default GUN settings */
input.x_offset = 0x00;
input.y_offset = 0x00;
/**********************************************
SEGA MENACER
***********************************************/
if (strstr(rominfo.international,"MENACER") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = NO_SYSTEM;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x52;
input.y_offset = 0x00;
}
else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x84;
input.y_offset = 0x08;
}
else if (strstr(rominfo.international,"BODY COUNT") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_MOUSE;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 0x44;
input.y_offset = 0x18;
}
/**********************************************
KONAMI JUSTIFIER
***********************************************/
else if (strstr(rominfo.international,"LETHAL ENFORCERSII") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x18;
input.y_offset = 0x00;
}
else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = 0x00;
input.y_offset = 0x00;
}
/**********************************************
J-CART
***********************************************/
if (cart.hw.jcart)
{
/* save current setting */
if (old_system[0] == -1) old_system[0] = input.system[0];
if (old_system[1] == -1) old_system[1] = input.system[1];
/* set default settings */
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_GAMEPAD;
}
/**********************************************
Initialize IO Port handlers
***********************************************/
switch (input.system[0]) switch (input.system[0])
{ {
case SYSTEM_GAMEPAD: case SYSTEM_GAMEPAD:
@ -200,7 +110,7 @@ void io_init(void)
port[2].data_w = NULL; port[2].data_w = NULL;
port[2].data_r = NULL; port[2].data_r = NULL;
/* Initialize Input Devices */ /* Initialize connected input devices */
input_init(); input_init();
} }
@ -221,7 +131,7 @@ void io_reset(void)
/* Reset I/O registers */ /* Reset I/O registers */
memcpy (io_reg, io_def, 0x10); memcpy (io_reg, io_def, 0x10);
/* Reset Input Devices */ /* Reset connected input devices */
input_reset(); input_reset();
} }

View File

@ -291,6 +291,9 @@ int load_rom(char *filename)
/* get infos from ROM header */ /* get infos from ROM header */
getrominfo((char *)cart.rom); getrominfo((char *)cart.rom);
/* set system region */
set_region();
#ifdef LSB_FIRST #ifdef LSB_FIRST
/* Byteswap ROM */ /* Byteswap ROM */
uint8 temp; uint8 temp;
@ -316,9 +319,12 @@ int load_rom(char *filename)
} }
/* console hardware */ /* console hardware */
if (strstr(rominfo.consoletype, "SEGA PICO") != NULL) system_hw = SYSTEM_PICO; if (strstr(rominfo.consoletype, "SEGA PICO") != NULL)
else if (strstr(rominfo.consoletype, "SEGA MEGADRIVE") != NULL) system_hw = SYSTEM_MEGADRIVE; system_hw = SYSTEM_PICO;
else system_hw = SYSTEM_GENESIS; else if (strstr(rominfo.consoletype, "SEGA MEGADRIVE") != NULL)
system_hw = SYSTEM_MEGADRIVE;
else
system_hw = SYSTEM_GENESIS;
return(1); return(1);
} }