Hooked up lightgun inputs for Virtua Cop 2

This commit is contained in:
Angelo Salese 2014-04-25 18:32:58 +00:00
parent 7ec27bdb4f
commit 3bba9db73f
2 changed files with 112 additions and 14 deletions

View File

@ -8,7 +8,10 @@
MAME driver by R. Belmont, Olivier Galibert, and ElSemi.
TODO (updated as for April 2014):
- all Model 2B games: FIFO comms looks way wrong, and 3d is mostly missing/incomplete. Games also stalls at some point;
- all Model 2B games: FIFO comms looks way wrong, and 3d is mostly missing/incomplete. Games also tends to stalls at some point, culprit might be when i960 tries
to use a burst type opcode read;
- Inputs needs device-ification and clean-ups;
- Sound comms actually passes thru a 8251-compatible device, hook it up;
- daytona: runs at half speed in gameplay;
- desert: several 3d bugs, presumably down to FIFO;
- dynamcop: stalls at stage select screen;
@ -23,10 +26,10 @@
- srallyc: opponent cars flickers like wild;
- vcop: lightgun input is offsetted;
- vcop: sound dies at enter initial screen (i.e. after played the game once);
- vcop: priority bug at stage select screen;
- vcop2: no textures;
- vcop: tilemap priority bug at stage select screen;
- vf2: stalls after disclaimer screen;
- vstriker: countdown in team select goes way too fast;
- vstriker: countdown in team select goes way too fast ...
- vstriker: ... meanwhile gameplay is way too slow!?
- zeroguna: stalls after some seconds of gameplay;
OK (controls may be wrong/missing/incomplete)
@ -1033,11 +1036,42 @@ WRITE32_MEMBER(model2_state::geo_w)
/*****************************************************************************/
READ32_MEMBER(model2_state::hotd_unk_r)
READ32_MEMBER(model2_state::hotd_lightgun_r)
{
return 0x000c0000;
static const char *const ports[] = { "P1_Y", "P1_X", "P2_Y", "P2_X" };
UINT16 res = 0xffff;
if(m_lightgun_mux < 8)
res = (ioport(ports[m_lightgun_mux >> 1])->read_safe(0) >> ((m_lightgun_mux & 1)*8)) & 0xff;
else
{
UINT16 p1x,p1y,p2x,p2y;
res = 0xfffc;
p1x = ioport("P1_X")->read_safe(0);
p1y = ioport("P1_Y")->read_safe(0);
p2x = ioport("P2_X")->read_safe(0);
p2y = ioport("P2_Y")->read_safe(0);
/* TODO: might be better, supposedly user has to calibrate guns in order to make these settings to work ... */
if(p1x <= 0x28 || p1x >= 0x3e0 || p1y <= 0x40 || p1y >= 0x3c0)
res |= 1;
if(p2x <= 0x28 || p2x >= 0x3e0 || p2y <= 0x40 || p2y >= 0x3c0)
res |= 2;
}
/* upper bits are presumably related to lightgun latches */
return 0x000c0000 | res;
}
WRITE32_MEMBER(model2_state::hotd_lightgun_w)
{
m_lightgun_mux = data;
}
#ifdef UNUSED_FUNCTION
READ32_MEMBER(model2_state::sonic_unk_r)
{
@ -1630,8 +1664,8 @@ static ADDRESS_MAP_START( model2a_crx_mem, AS_PROGRAM, 32, model2_state )
AM_RANGE(0x01c00008, 0x01c0000f) AM_READNOP AM_WRITENOP
AM_RANGE(0x01c0000c, 0x01c0000f) AM_READ_PORT("1c0000c")
AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010") AM_WRITENOP
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014") AM_WRITENOP
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014") AM_WRITE(hotd_lightgun_w)
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_lightgun_r)
AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
AM_RANGE(0x01c00040, 0x01c00043) AM_WRITENOP
AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
@ -1671,8 +1705,8 @@ static ADDRESS_MAP_START( model2b_crx_mem, AS_PROGRAM, 32, model2_state )
AM_RANGE(0x01c00008, 0x01c0000b) AM_READNOP AM_WRITENOP
AM_RANGE(0x01c0000c, 0x01c0000f) AM_READNOP
AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014") AM_WRITE(hotd_lightgun_w)
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_lightgun_r)
AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
AM_RANGE(0x01c00040, 0x01c00043) AM_WRITENOP
AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
@ -1699,8 +1733,8 @@ static ADDRESS_MAP_START( model2c_crx_mem, AS_PROGRAM, 32, model2_state )
AM_RANGE(0x01c00000, 0x01c00003) AM_READ_PORT("1c00000") AM_WRITE(ctrl0_w )
AM_RANGE(0x01c00004, 0x01c00007) AM_READ_PORT("1c00004")
AM_RANGE(0x01c00010, 0x01c00013) AM_READ_PORT("1c00010")
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_unk_r )
AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014") AM_WRITE(hotd_lightgun_w)
AM_RANGE(0x01c00018, 0x01c0001b) AM_READ(hotd_lightgun_r)
AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c") AM_WRITE(analog_2b_w )
AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2_serial_w )
@ -1988,6 +2022,68 @@ static INPUT_PORTS_START( srallyc )
PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(1)
INPUT_PORTS_END
static INPUT_PORTS_START( vcop2 )
PORT_START("1c00000")
PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c00000_r, NULL)
PORT_START("1c00004")
PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN3")
PORT_START("1c0000c")
PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("1c00010")
PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
PORT_START("1c00014")
PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN4")
PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("1c0001c")
PORT_BIT( 0x0000001a, IP_ACTIVE_HIGH, IPT_SPECIAL ) // these must be high
PORT_BIT( 0x0000ffe5, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c0001c_r, NULL)
PORT_START("IN0")
PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW )
PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT(0x00c0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT(0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Trigger")
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Trigger")
PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN2")
PORT_BIT(0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN3")
PORT_BIT(0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN4")
PORT_BIT(0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P1_X")
PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX( 0, 0x3ff ) PORT_SENSITIVITY( 50 ) PORT_KEYDELTA( 15 ) PORT_PLAYER(1)
PORT_START("P1_Y")
PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX( 0, 0x3ff ) PORT_SENSITIVITY( 50 ) PORT_KEYDELTA( 15 ) PORT_PLAYER(1)
PORT_START("P2_X")
PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX( 0, 0x3ff ) PORT_SENSITIVITY( 50 ) PORT_KEYDELTA( 15 ) PORT_PLAYER(2)
PORT_START("P2_Y")
PORT_BIT( 0x3ff, 0x200, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX( 0, 0x3ff ) PORT_SENSITIVITY( 50 ) PORT_KEYDELTA( 15 ) PORT_PLAYER(2)
INPUT_PORTS_END
static INPUT_PORTS_START( bel )
PORT_START("1c00000")
@ -5769,7 +5865,7 @@ GAME( 1995, vf2, 0, model2a, model2, driver_device, 0, ROT0,
GAME( 1995, vf2b, vf2, model2a, model2, driver_device, 0, ROT0, "Sega", "Virtua Fighter 2 (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1995, vf2a, vf2, model2a, model2, driver_device, 0, ROT0, "Sega", "Virtua Fighter 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1995, vf2o, vf2, model2a, model2, driver_device, 0, ROT0, "Sega", "Virtua Fighter 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1995, vcop2, 0, model2a, model2, driver_device, 0, ROT0, "Sega", "Virtua Cop 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1995, vcop2, 0, model2a, vcop2, driver_device, 0, ROT0, "Sega", "Virtua Cop 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1995, skytargt, 0, model2a, model2, driver_device, 0, ROT0, "Sega", "Sky Target", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1996, doaa, doa, model2a, model2, model2_state, doa, ROT0, "Sega", "Dead or Alive (Model 2A, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
GAME( 1997, zeroguna, zerogun, model2a, model2, model2_state, zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )

View File

@ -105,6 +105,7 @@ public:
void model2_check_irq_state();
void model2_check_irqack_state(UINT32 data);
UINT8 m_gearsel;
UINT8 m_lightgun_mux;
DECLARE_CUSTOM_INPUT_MEMBER(_1c00000_r);
DECLARE_CUSTOM_INPUT_MEMBER(_1c0001c_r);
@ -139,7 +140,8 @@ public:
DECLARE_WRITE32_MEMBER(geo_prg_w);
DECLARE_READ32_MEMBER(geo_r);
DECLARE_WRITE32_MEMBER(geo_w);
DECLARE_READ32_MEMBER(hotd_unk_r);
DECLARE_READ32_MEMBER(hotd_lightgun_r);
DECLARE_WRITE32_MEMBER(hotd_lightgun_w);
DECLARE_READ32_MEMBER(sonic_unk_r);
DECLARE_READ32_MEMBER(daytona_unk_r);
DECLARE_READ32_MEMBER(desert_unk_r);