mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-14 20:29:32 +01:00
minor input code cleanup & fixes
it's now possible to change the input configuration when J-CART is detected: this let you play 6-player mode in Super Skidmarks by connecting 4-WayPlay
This commit is contained in:
parent
283c251cc8
commit
c44daa134b
@ -56,6 +56,7 @@ of samples per frame and keeping PSG & FM chips in sync.
|
|||||||
* added accurate TMSS emulation (VDP lock-out)
|
* added accurate TMSS emulation (VDP lock-out)
|
||||||
* fixed Realtec mapper emulation: fixes missing sound in Balloon Boy / Funny World.
|
* fixed Realtec mapper emulation: fixes missing sound in Balloon Boy / Funny World.
|
||||||
* fixed lightgun auto-detection: fixes default cursor position in Lethal Enforcers II.
|
* fixed lightgun auto-detection: fixes default cursor position in Lethal Enforcers II.
|
||||||
|
* enabled simultaneous use of multitap & J-CART (Super Skidmarks 6-player mode)
|
||||||
* lots of code cleanup, bugfixes & optimization.
|
* lots of code cleanup, bugfixes & optimization.
|
||||||
|
|
||||||
|
|
||||||
|
@ -609,8 +609,8 @@ unsigned int jcart_read(unsigned int address)
|
|||||||
|
|
||||||
void jcart_write(unsigned int address, unsigned int data)
|
void jcart_write(unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
gamepad_write(5, (data&1) << 6);
|
gamepad_write(5, (data & 1) << 6);
|
||||||
gamepad_write(6, (data&1) << 6);
|
gamepad_write(6, (data & 1) << 6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,8 +706,12 @@ void input_init(void)
|
|||||||
/* J-CART: add two gamepad inputs */
|
/* J-CART: add two gamepad inputs */
|
||||||
if (cart.jcart)
|
if (cart.jcart)
|
||||||
{
|
{
|
||||||
input.dev[5] = config.input[2].padtype;
|
if (player == MAX_INPUTS) return;
|
||||||
input.dev[6] = config.input[3].padtype;
|
input.dev[5] = config.input[player].padtype;
|
||||||
|
player ++;
|
||||||
|
if (player == MAX_INPUTS) return;
|
||||||
|
input.dev[6] = config.input[player].padtype;
|
||||||
|
player ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +719,7 @@ void input_reset(void)
|
|||||||
{
|
{
|
||||||
/* Reset Controller device */
|
/* Reset Controller device */
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<MAX_INPUTS; i++)
|
for (i=0; i<MAX_DEVICES; i++)
|
||||||
{
|
{
|
||||||
switch (input.dev[i])
|
switch (input.dev[i])
|
||||||
{
|
{
|
||||||
@ -746,10 +750,10 @@ void input_reset(void)
|
|||||||
wayplay.current = 0;
|
wayplay.current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_update(void)
|
void input_refresh(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<MAX_INPUTS; i++)
|
for (i=0; i<MAX_DEVICES; i++)
|
||||||
{
|
{
|
||||||
switch (input.dev[i])
|
switch (input.dev[i])
|
||||||
{
|
{
|
||||||
@ -870,15 +874,12 @@ void input_autodetect(void)
|
|||||||
{
|
{
|
||||||
cart.jcart = 1;
|
cart.jcart = 1;
|
||||||
|
|
||||||
/* save current setting */
|
/* set default port 1 setting */
|
||||||
if (old_system[0] == -1)
|
if (input.system[1] != SYSTEM_WAYPLAY)
|
||||||
old_system[0] = input.system[0];
|
{
|
||||||
if (old_system[1] == -1)
|
|
||||||
old_system[1] = input.system[1];
|
old_system[1] = input.system[1];
|
||||||
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
/* set default settings */
|
}
|
||||||
input.system[0] = SYSTEM_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_GAMEPAD;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,7 @@ extern t_input input;
|
|||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void input_init(void);
|
extern void input_init(void);
|
||||||
extern void input_reset(void);
|
extern void input_reset(void);
|
||||||
extern void input_update(void);
|
extern void input_refresh(void);
|
||||||
extern void input_raz(void);
|
|
||||||
extern void input_autodetect(void);
|
extern void input_autodetect(void);
|
||||||
|
|
||||||
/* Peripherals specific */
|
/* Peripherals specific */
|
||||||
|
@ -1472,53 +1472,70 @@ static void ctrlmenu_raz(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* update buttons navigation */
|
/* update buttons navigation */
|
||||||
|
|
||||||
if (input.dev[0] != NO_DEVICE)
|
if (input.dev[0] != NO_DEVICE)
|
||||||
m->buttons[0].shift[3] = 2;
|
m->buttons[0].shift[3] = 2;
|
||||||
else if (input.dev[4] != NO_DEVICE)
|
else if (input.dev[4] != NO_DEVICE)
|
||||||
m->buttons[0].shift[3] = 6;
|
m->buttons[0].shift[3] = 6;
|
||||||
|
else if (input.dev[5] != NO_DEVICE)
|
||||||
|
m->buttons[0].shift[3] = 7;
|
||||||
else
|
else
|
||||||
m->buttons[0].shift[3] = 0;
|
m->buttons[0].shift[3] = 0;
|
||||||
if (input.dev[4] != NO_DEVICE)
|
if (input.dev[4] != NO_DEVICE)
|
||||||
m->buttons[1].shift[3] = 5;
|
m->buttons[1].shift[3] = 5;
|
||||||
|
else if (input.dev[5] != NO_DEVICE)
|
||||||
|
m->buttons[1].shift[3] = 6;
|
||||||
else if (input.dev[0] != NO_DEVICE)
|
else if (input.dev[0] != NO_DEVICE)
|
||||||
m->buttons[1].shift[3] = 1;
|
m->buttons[1].shift[3] = 1;
|
||||||
else
|
else
|
||||||
m->buttons[1].shift[3] = 0;
|
m->buttons[1].shift[3] = 0;
|
||||||
|
|
||||||
if (input.dev[1] != NO_DEVICE)
|
if (input.dev[1] != NO_DEVICE)
|
||||||
m->buttons[2].shift[1] = 1;
|
m->buttons[2].shift[1] = 1;
|
||||||
else if (input.dev[4] != NO_DEVICE)
|
else if (input.dev[4] != NO_DEVICE)
|
||||||
m->buttons[2].shift[1] = 4;
|
m->buttons[2].shift[1] = 4;
|
||||||
|
else if (input.dev[5] != NO_DEVICE)
|
||||||
|
m->buttons[2].shift[1] = 5;
|
||||||
else
|
else
|
||||||
m->buttons[2].shift[1] = 0;
|
m->buttons[2].shift[1] = 0;
|
||||||
|
|
||||||
|
if (input.dev[4] != NO_DEVICE)
|
||||||
|
m->buttons[5].shift[1] = 1;
|
||||||
|
else if (input.dev[5] != NO_DEVICE)
|
||||||
|
m->buttons[5].shift[1] = 2;
|
||||||
|
else
|
||||||
|
m->buttons[5].shift[1] = 0;
|
||||||
|
|
||||||
if (input.dev[3] != NO_DEVICE)
|
if (input.dev[3] != NO_DEVICE)
|
||||||
m->buttons[6].shift[0] = 1;
|
m->buttons[6].shift[0] = 1;
|
||||||
else if (input.dev[0] != NO_DEVICE)
|
else if (input.dev[0] != NO_DEVICE)
|
||||||
m->buttons[6].shift[0] = 4;
|
m->buttons[6].shift[0] = 4;
|
||||||
else
|
else
|
||||||
m->buttons[6].shift[0] = 0;
|
m->buttons[6].shift[0] = 0;
|
||||||
if (input.dev[4] != NO_DEVICE)
|
|
||||||
m->buttons[5].shift[1] = 1;
|
|
||||||
else
|
|
||||||
m->buttons[5].shift[1] = 0;
|
|
||||||
|
|
||||||
if (input.dev[5] != NO_DEVICE)
|
if (input.dev[5] != NO_DEVICE)
|
||||||
{
|
|
||||||
m->buttons[6].shift[1] = 1;
|
m->buttons[6].shift[1] = 1;
|
||||||
if (input.dev[6] != NO_DEVICE)
|
|
||||||
{
|
|
||||||
m->buttons[7].shift[1] = 1;
|
|
||||||
if (input.dev[7] != NO_DEVICE) m->buttons[8].shift[1] = 1;
|
|
||||||
else m->buttons[8].shift[1] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m->buttons[7].shift[1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m->buttons[6].shift[1] = 0;
|
m->buttons[6].shift[1] = 0;
|
||||||
}
|
|
||||||
|
if (input.dev[6] != NO_DEVICE)
|
||||||
|
m->buttons[7].shift[1] = 1;
|
||||||
|
else
|
||||||
|
m->buttons[7].shift[1] = 0;
|
||||||
|
|
||||||
|
if (input.dev[7] != NO_DEVICE)
|
||||||
|
m->buttons[8].shift[1] = 1;
|
||||||
|
else
|
||||||
|
m->buttons[8].shift[1] = 0;
|
||||||
|
|
||||||
|
if (input.dev[4] != NO_DEVICE)
|
||||||
|
m->buttons[7].shift[0] = 1;
|
||||||
|
else if (input.dev[3] != NO_DEVICE)
|
||||||
|
m->buttons[7].shift[0] = 2;
|
||||||
|
else if (input.dev[0] != NO_DEVICE)
|
||||||
|
m->buttons[7].shift[0] = 5;
|
||||||
|
else
|
||||||
|
m->buttons[7].shift[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ctrlmenu(void)
|
static void ctrlmenu(void)
|
||||||
@ -1643,7 +1660,6 @@ static void ctrlmenu(void)
|
|||||||
switch (m->selected)
|
switch (m->selected)
|
||||||
{
|
{
|
||||||
case 0: /* update port 1 system */
|
case 0: /* update port 1 system */
|
||||||
if (cart.jcart) break;
|
|
||||||
if (input.system[0] == SYSTEM_MOUSE)
|
if (input.system[0] == SYSTEM_MOUSE)
|
||||||
input.system[0] +=3; /* lightguns are never used on Port 1 */
|
input.system[0] +=3; /* lightguns are never used on Port 1 */
|
||||||
else
|
else
|
||||||
@ -1658,7 +1674,7 @@ static void ctrlmenu(void)
|
|||||||
input.system[1] = SYSTEM_GAMEPAD;
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
}
|
}
|
||||||
io_init();
|
io_init();
|
||||||
io_reset();
|
input_reset();
|
||||||
old_system[0] = input.system[0];
|
old_system[0] = input.system[0];
|
||||||
old_system[1] = input.system[1];
|
old_system[1] = input.system[1];
|
||||||
|
|
||||||
@ -1708,7 +1724,7 @@ static void ctrlmenu(void)
|
|||||||
input.system[0] = SYSTEM_GAMEPAD;
|
input.system[0] = SYSTEM_GAMEPAD;
|
||||||
}
|
}
|
||||||
io_init();
|
io_init();
|
||||||
io_reset();
|
input_reset();
|
||||||
old_system[0] = input.system[0];
|
old_system[0] = input.system[0];
|
||||||
old_system[1] = input.system[1];
|
old_system[1] = input.system[1];
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ void system_frame (int do_skip)
|
|||||||
/* update VCounter */
|
/* update VCounter */
|
||||||
v_counter = line;
|
v_counter = line;
|
||||||
|
|
||||||
/* update 6-Buttons or Menacer */
|
/* update 6-Buttons & Lightguns */
|
||||||
input_update();
|
input_refresh();
|
||||||
|
|
||||||
/* update VDP DMA */
|
/* update VDP DMA */
|
||||||
if (dma_length) vdp_update_dma();
|
if (dma_length) vdp_update_dma();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user