mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-28 19:05:28 +01:00
.fixed J-CART emulation (broken by previous revision)
.fixed 6-button controller support through J-CART
This commit is contained in:
parent
b758b0b57e
commit
84a2995700
@ -85,6 +85,13 @@ static void lightgun_reset(int num)
|
|||||||
|
|
||||||
static void lightgun_update(int num)
|
static void lightgun_update(int num)
|
||||||
{
|
{
|
||||||
|
/* update only one justifier at once */
|
||||||
|
if (input.system[1] == SYSTEM_JUSTIFIER)
|
||||||
|
{
|
||||||
|
if ((io_reg[2] & 0x30) != (num << 5))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((input.analog[num][1] == v_counter + y_offset))
|
if ((input.analog[num][1] == v_counter + y_offset))
|
||||||
{
|
{
|
||||||
/* HL enabled ? */
|
/* HL enabled ? */
|
||||||
@ -597,7 +604,7 @@ void teamplayer_2_write (unsigned int data)
|
|||||||
unsigned int jcart_read(unsigned int address)
|
unsigned int jcart_read(unsigned int address)
|
||||||
{
|
{
|
||||||
/* TH2 (output) fixed to 0 on read (fixes Micro Machines 2) */
|
/* TH2 (output) fixed to 0 on read (fixes Micro Machines 2) */
|
||||||
return (gamepad_read(5) | ((gamepad_read(6)&0x3f) << 8));
|
return ((gamepad[5].State & 0x40) | (gamepad_read(5) & 0x3f) | ((gamepad_read(6) & 0x3f) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
void jcart_write(unsigned int address, unsigned int data)
|
void jcart_write(unsigned int address, unsigned int data)
|
||||||
@ -718,7 +725,7 @@ void input_reset(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVICE_LIGHTGUN:
|
case DEVICE_LIGHTGUN:
|
||||||
lightgun_reset(i%4);
|
lightgun_reset(i%2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVICE_MOUSE:
|
case DEVICE_MOUSE:
|
||||||
@ -742,67 +749,22 @@ void input_reset(void)
|
|||||||
void input_update(void)
|
void input_update(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
switch (input.system[0])
|
for (i=0; i<MAX_INPUTS; i++)
|
||||||
{
|
{
|
||||||
case SYSTEM_GAMEPAD:
|
switch (input.dev[i])
|
||||||
if (input.dev[0] == DEVICE_6BUTTON)
|
{
|
||||||
gamepad_update(0);
|
case DEVICE_6BUTTON:
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_WAYPLAY:
|
|
||||||
for (i=0; i<4; i++)
|
|
||||||
{
|
{
|
||||||
if (input.dev[i] == DEVICE_6BUTTON)
|
gamepad_update(i);
|
||||||
gamepad_update(i);
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (input.system[1])
|
case DEVICE_LIGHTGUN:
|
||||||
{
|
|
||||||
case SYSTEM_GAMEPAD:
|
|
||||||
if (input.dev[4] == DEVICE_6BUTTON)
|
|
||||||
gamepad_update(4);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_MENACER:
|
|
||||||
lightgun_update(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_JUSTIFIER:
|
|
||||||
if ((io_reg[2] & 0x30) == 0x00)
|
|
||||||
lightgun_update(0);
|
|
||||||
if ((io_reg[2] & 0x30) == 0x20)
|
|
||||||
lightgun_update(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void input_raz(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
switch (input.system[0])
|
|
||||||
{
|
|
||||||
case SYSTEM_GAMEPAD:
|
|
||||||
if (input.dev[0] == DEVICE_6BUTTON)
|
|
||||||
gamepad_raz(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_WAYPLAY:
|
|
||||||
for (i=0; i<4; i++)
|
|
||||||
{
|
{
|
||||||
if (input.dev[i] == DEVICE_6BUTTON)
|
lightgun_update(i%2);
|
||||||
gamepad_raz(i);
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (input.system[1])
|
|
||||||
{
|
|
||||||
case SYSTEM_GAMEPAD:
|
|
||||||
if (input.dev[4] == DEVICE_6BUTTON)
|
|
||||||
gamepad_raz(4);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,7 +870,7 @@ void m68k_run (unsigned int cycles)
|
|||||||
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
|
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
|
||||||
}
|
}
|
||||||
#ifdef LOGVDP
|
#ifdef LOGVDP
|
||||||
error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, mcycles_68k/3420, mcycles_68k, mcycles_68k%3420,int_level,FLAG_INT_MASK,m68k_get_reg (NULL, M68K_REG_PC));
|
error("[%d(%d)][%d(%d)] IRQ Level = %d(0x%02x) (%x)\n", v_counter, mcycles_68k/3420, mcycles_68k, mcycles_68k%3420,CPU_INT_LEVEL,FLAG_INT_MASK,m68k_get_reg (NULL, M68K_REG_PC));
|
||||||
#endif
|
#endif
|
||||||
/* update internal interrupt level */
|
/* update internal interrupt level */
|
||||||
m68ki_check_interrupts();
|
m68ki_check_interrupts();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user