Previous 199869 Revisions Next

r29552 Saturday 12th April, 2014 at 03:28:49 UTC by Angelo Salese
Hooked up lightgun inputs in Virtua Cop [Angelo Salese]
[src/mame/drivers]model2.c
[src/mame/includes]model2.h

trunk/src/mame/drivers/model2.c
r29551r29552
14051405   AM_RANGE(0x11680000, 0x116fffff) AM_RAM AM_SHARE("share1") // FB mirror
14061406ADDRESS_MAP_END
14071407
1408READ8_MEMBER(model2_state::virtuacop_lightgun_r)
1409{
1410   static const char *const ports[] = { "P1_Y", "P1_X", "P2_Y", "P2_X" };
1411   UINT8 res;
1412
1413   res = (ioport(ports[offset >> 1])->read_safe(0) >> ((offset & 1)*8)) & 0xff;
1414
1415   return res;
1416}
1417
1418/* handles offscreen gun trigger detection here */
1419READ8_MEMBER(model2_state::virtuacop_lightgun_offscreen_r)
1420{
1421   UINT16 special_res = 0xfffc;
1422   UINT16 p1x,p1y,p2x,p2y;
1423
1424   p1x = ioport("P1_X")->read_safe(0);
1425   p1y = ioport("P1_Y")->read_safe(0);
1426   p2x = ioport("P2_X")->read_safe(0);
1427   p2y = ioport("P2_Y")->read_safe(0);
1428
1429   /* TODO: might be better, supposedly user has to calibrate guns in order to make these settings to work ... */
1430   if(p1x <= 0x28 || p1x >= 0x3e0 || p1y <= 0x40 || p1y >= 0x3c0)
1431      special_res |= 1;
1432
1433   if(p2x <= 0x28 || p2x >= 0x3e0 || p2y <= 0x40 || p2y >= 0x3c0)
1434      special_res |= 2;
1435
1436   return (special_res >> ((offset & 1)*8)) & 0xff;
1437}
1438
14081439/* original Model 2 overrides */
14091440static ADDRESS_MAP_START( model2o_mem, AS_PROGRAM, 32, model2_state )
14101441   AM_RANGE(0x00200000, 0x0021ffff) AM_RAM
r29551r29552
14301461   AM_RANGE(0x01c00014, 0x01c00017) AM_READ_PORT("1c00014")
14311462   AM_RANGE(0x01c0001c, 0x01c0001f) AM_READ_PORT("1c0001c")
14321463   AM_RANGE(0x01c00040, 0x01c00043) AM_READ(daytona_unk_r )
1464   AM_RANGE(0x01c00100, 0x01c0010f) AM_READ8(virtuacop_lightgun_r,0x00ff00ff)
1465   AM_RANGE(0x01c00110, 0x01c00113) AM_READ8(virtuacop_lightgun_offscreen_r,0x00ff00ff)
14331466   AM_RANGE(0x01c00200, 0x01c002ff) AM_RAM AM_SHARE("backup2")
14341467   AM_RANGE(0x01c80000, 0x01c80003) AM_READWRITE(model2_serial_r, model2o_serial_w )
14351468
r29551r29552
16331666
16341667static INPUT_PORTS_START( vcop )
16351668   PORT_START("1c00000")
1636   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "STEER")
1637   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "ACCEL")
1669   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1670   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
16381671
16391672   PORT_START("1c00004")
1640   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "BRAKE")
1673   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
16411674   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
16421675
16431676   PORT_START("1c00010")
r29551r29552
16581691   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
16591692   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
16601693   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1 )
1661   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) // VR 1 (Blue)
1662   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) // VR 2 (Green)
1663   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) // VR 3 (Red)
1694   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START2 )
1695   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
16641696
16651697   PORT_START("IN1")
1666   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) // shift
1667   PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
1668   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)  // machine gun
1669   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)  // cannon
1670   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
1698   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Trigger")
1699   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Trigger")
1700   PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED )
16711701
16721702   PORT_START("IN2")
1673   MODEL2_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
1703   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) // <- one bit here enables "debug mode"
16741704
1675   PORT_START("STEER")
1676   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(1)
1705   PORT_START("TEST")
1706   PORT_DIPNAME( 0x01, 0x00, "SYSA" )
1707   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1708   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1709   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1710   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1711   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1712   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1713   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1714   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1715   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1716   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1717   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1718   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1719   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1720   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1721   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1722   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1723   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1724   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1725   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1726   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1727   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1728   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1729   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1730   PORT_DIPNAME( 0x0100, 0x00, "SYSA" )
1731   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1732   PORT_DIPSETTING(    0x0100, DEF_STR( On ) )
1733   PORT_DIPNAME( 0x0200, 0x00, DEF_STR( Unknown ) )
1734   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1735   PORT_DIPSETTING(    0x0200, DEF_STR( On ) )
1736   PORT_DIPNAME( 0x0400, 0x00, DEF_STR( Unknown ) )
1737   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1738   PORT_DIPSETTING(    0x0400, DEF_STR( On ) )
1739   PORT_DIPNAME( 0x0800, 0x00, DEF_STR( Unknown ) )
1740   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1741   PORT_DIPSETTING(    0x0800, DEF_STR( On ) )
1742   PORT_DIPNAME( 0x1000, 0x00, DEF_STR( Unknown ) )
1743   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1744   PORT_DIPSETTING(    0x1000, DEF_STR( On ) )
1745   PORT_DIPNAME( 0x2000, 0x00, DEF_STR( Unknown ) )
1746   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1747   PORT_DIPSETTING(    0x2000, DEF_STR( On ) )
1748   PORT_DIPNAME( 0x4000, 0x00, DEF_STR( Unknown ) )
1749   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1750   PORT_DIPSETTING(    0x4000, DEF_STR( On ) )
1751   PORT_DIPNAME( 0x8000, 0x00, DEF_STR( Unknown ) )
1752   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1753   PORT_DIPSETTING(    0x8000, DEF_STR( On ) )
16771754
1678   PORT_START("ACCEL")
1679   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(1)
1755   PORT_START("P1_X")
1756   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)
16801757
1681   PORT_START("BRAKE")
1682   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(1)
1758   PORT_START("P1_Y")
1759   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)
1760
1761   PORT_START("P2_X")
1762   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)
1763
1764   PORT_START("P2_Y")
1765   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)
16831766INPUT_PORTS_END
16841767
16851768static INPUT_PORTS_START( daytona )
trunk/src/mame/includes/model2.h
r29551r29552
196196   DECLARE_READ_LINE_MEMBER(copro_tgp_fifoin_pop_ok);
197197   DECLARE_READ32_MEMBER(copro_tgp_fifoin_pop);
198198   DECLARE_WRITE32_MEMBER(copro_tgp_fifoout_push);
199   DECLARE_READ8_MEMBER(virtuacop_lightgun_r);
200   DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r);
199201};
200202
201203/*----------- defined in video/model2.c -----------*/

Previous 199869 Revisions Next


© 1997-2024 The MAME Team