diff options
author | Aaron Giles <aaron@aarongiles.com> | 2012-05-03 09:00:08 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2012-05-03 09:00:08 +0000 |
commit | 2a88e54278acc526c11dba7961204f234f1f6e05 (patch) | |
tree | 1d78e932e47bb535e7e56ddac05232cdf551c3a1 /src/mame/drivers/cischeat.c | |
parent | 605a48921b48e0127ff0330f1e895dcf16d084fb (diff) |
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.
For member functions, this is actually simpler/cleaner:
value = ioport("tag")->read()
For legacy functions which have a driver_data state, it goes:
value = state->ioport("tag")->read()
For other legacy functions, they need to fetch the root device:
value = machine.root_device().ioport("tag")->read()
The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.
Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:
input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)
input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)
(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->
(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->
input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)
IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
Diffstat (limited to 'src/mame/drivers/cischeat.c')
-rw-r--r-- | src/mame/drivers/cischeat.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c index 96364eeff31..778184c75bd 100644 --- a/src/mame/drivers/cischeat.c +++ b/src/mame/drivers/cischeat.c @@ -429,7 +429,7 @@ WRITE16_MEMBER(cischeat_state::scudhamm_motor_command_w) READ16_MEMBER(cischeat_state::scudhamm_analog_r) { - int i=input_port_read(machine(), "IN1"),j; + int i=ioport("IN1")->read(),j; if ((i^m_prev)&0x4000) { if (i<m_prev) m_prev-=0x8000; @@ -527,17 +527,17 @@ READ16_MEMBER(cischeat_state::armchmp2_analog_r) { int armdelta; - armdelta = input_port_read(machine(), "IN1") - m_armold; - m_armold = input_port_read(machine(), "IN1"); + armdelta = ioport("IN1")->read() - m_armold; + m_armold = ioport("IN1")->read(); return ~( m_scudhamm_motor_command + armdelta ); // + x : x<=0 and player loses, x>0 and player wins } READ16_MEMBER(cischeat_state::armchmp2_buttons_r) { - int arm_x = input_port_read(machine(), "IN1"); + int arm_x = ioport("IN1")->read(); - UINT16 ret = input_port_read(machine(), "IN0"); + UINT16 ret = ioport("IN0")->read(); if (arm_x < 0x40) ret &= ~1; else if (arm_x > 0xc0) ret &= ~2; @@ -844,12 +844,12 @@ static INPUT_PORTS_START( bigrun ) // DSW 3 PORT_DIPNAME( 0x0003, 0x0003, "Extra Setting For Coin B" ) PORT_DIPLOCATION("SW302:8,7") /* 'Not used' (and must be OFF) according to the manual */ PORT_DIPSETTING( 0x0003, DEF_STR( Unused ) ) - PORT_DIPSETTING( 0x0001, DEF_STR( 1C_5C ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_NOTEQUALS, 0x0000) - PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_NOTEQUALS, 0x0000) - PORT_DIPSETTING( 0x0000, DEF_STR( 1C_7C ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_NOTEQUALS, 0x0000) - PORT_DIPSETTING( 0x0001, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_EQUALS, 0x0000) - PORT_DIPSETTING( 0x0002, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_EQUALS, 0x0000) - PORT_DIPSETTING( 0x0000, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, PORTCOND_EQUALS, 0x0000) + PORT_DIPSETTING( 0x0001, DEF_STR( 1C_5C ) ) PORT_CONDITION("IN4", 0x1c00, NOTEQUALS, 0x0000) + PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) PORT_CONDITION("IN4", 0x1c00, NOTEQUALS, 0x0000) + PORT_DIPSETTING( 0x0000, DEF_STR( 1C_7C ) ) PORT_CONDITION("IN4", 0x1c00, NOTEQUALS, 0x0000) + PORT_DIPSETTING( 0x0001, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, EQUALS, 0x0000) + PORT_DIPSETTING( 0x0002, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, EQUALS, 0x0000) + PORT_DIPSETTING( 0x0000, DEF_STR( Unused ) ) PORT_CONDITION("IN4", 0x1c00, EQUALS, 0x0000) PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW302:6") PORT_DIPSETTING( 0x0004, DEF_STR( No ) ) PORT_DIPSETTING( 0x0000, DEF_STR( Yes ) ) @@ -875,7 +875,7 @@ static INPUT_PORTS_START( bigrun ) PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW301:7") PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0200, DEF_STR( On ) ) - PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW301:6,5,4") PORT_CONDITION("IN4", 0x0003, PORTCOND_EQUALS, 0x0003) + PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW301:6,5,4") PORT_CONDITION("IN4", 0x0003, EQUALS, 0x0003) PORT_DIPSETTING( 0x1000, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x0800, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) ) @@ -884,7 +884,7 @@ static INPUT_PORTS_START( bigrun ) PORT_DIPSETTING( 0x1400, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x1c00, 0x1c00, "Set Coin B" ) PORT_DIPLOCATION("SW301:6,5,4") PORT_CONDITION("IN4", 0x0003, PORTCOND_NOTEQUALS, 0x0003) + PORT_DIPNAME( 0x1c00, 0x1c00, "Set Coin B" ) PORT_DIPLOCATION("SW301:6,5,4") PORT_CONDITION("IN4", 0x0003, NOTEQUALS, 0x0003) PORT_DIPSETTING( 0x1c00, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW301:3,2,1") @@ -1051,7 +1051,7 @@ static INPUT_PORTS_START( f1gpstar ) PORT_START("IN1") // DSW 1 & 2 - $80000.w -> !f9012 // DSW 1 // Coinage Japan & USA (it changes with Country) - PORT_DIPNAME( 0x0007, 0x0007, "Coin A (JP US)" ) PORT_DIPLOCATION("SW01:1,2,3") PORT_CONDITION("IN1", 0x0300, PORTCOND_GREATERTHAN, 0x0100) + PORT_DIPNAME( 0x0007, 0x0007, "Coin A (JP US)" ) PORT_DIPLOCATION("SW01:1,2,3") PORT_CONDITION("IN1", 0x0300, GREATERTHAN, 0x0100) PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) ) @@ -1060,7 +1060,7 @@ static INPUT_PORTS_START( f1gpstar ) PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x0038, 0x0038, "Coin B (JP US)" ) PORT_DIPLOCATION("SW01:4,5,6") PORT_CONDITION("IN1", 0x0300, PORTCOND_GREATERTHAN, 0x0100) + PORT_DIPNAME( 0x0038, 0x0038, "Coin B (JP US)" ) PORT_DIPLOCATION("SW01:4,5,6") PORT_CONDITION("IN1", 0x0300, GREATERTHAN, 0x0100) PORT_DIPSETTING( 0x0008, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x0010, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) ) @@ -1068,11 +1068,11 @@ static INPUT_PORTS_START( f1gpstar ) PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW01:7") PORT_CONDITION("IN1", 0x0300, PORTCOND_GREATERTHAN, 0x0100) // unused? + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW01:7") PORT_CONDITION("IN1", 0x0300, GREATERTHAN, 0x0100) // unused? PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) // Coinage Europe & France (it changes with Country) - PORT_DIPNAME( 0x0007, 0x0007, "Coin A (EU FR)" ) PORT_DIPLOCATION("SW01:1,2,3") PORT_CONDITION("IN1", 0x0300, PORTCOND_NOTGREATERTHAN, 0x0100) + PORT_DIPNAME( 0x0007, 0x0007, "Coin A (EU FR)" ) PORT_DIPLOCATION("SW01:1,2,3") PORT_CONDITION("IN1", 0x0300, NOTGREATERTHAN, 0x0100) PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x0000, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) @@ -1081,7 +1081,7 @@ static INPUT_PORTS_START( f1gpstar ) PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x0002, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x0001, DEF_STR( 1C_7C ) ) - PORT_DIPNAME( 0x0038, 0x0038, "Coin B (EU FR)" ) PORT_DIPLOCATION("SW01:4,5,6") PORT_CONDITION("IN1", 0x0300, PORTCOND_NOTGREATERTHAN, 0x0100) + PORT_DIPNAME( 0x0038, 0x0038, "Coin B (EU FR)" ) PORT_DIPLOCATION("SW01:4,5,6") PORT_CONDITION("IN1", 0x0300, NOTGREATERTHAN, 0x0100) PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x0008, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x0010, DEF_STR( 3C_1C ) ) @@ -1090,7 +1090,7 @@ static INPUT_PORTS_START( f1gpstar ) PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) - PORT_DIPNAME( 0x0040, 0x0040, "Free Play (EU & FR)" ) PORT_DIPLOCATION("SW01:7") PORT_CONDITION("IN1", 0x0300, PORTCOND_NOTGREATERTHAN, 0x0100) + PORT_DIPNAME( 0x0040, 0x0040, "Free Play (EU & FR)" ) PORT_DIPLOCATION("SW01:7") PORT_CONDITION("IN1", 0x0300, NOTGREATERTHAN, 0x0100) PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -1113,10 +1113,10 @@ static INPUT_PORTS_START( f1gpstar ) PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW02:6") PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x2000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW02:7") PORT_CONDITION("IN1", 0x0300, PORTCOND_EQUALS, 0x0300) // unused? + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW02:7") PORT_CONDITION("IN1", 0x0300, EQUALS, 0x0300) // unused? PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "Choose Race (US EU FR)" ) PORT_DIPLOCATION("SW02:7") PORT_CONDITION("IN1", 0x0300, PORTCOND_NOTEQUALS, 0x0300) // -> f0020 + PORT_DIPNAME( 0x4000, 0x4000, "Choose Race (US EU FR)" ) PORT_DIPLOCATION("SW02:7") PORT_CONDITION("IN1", 0x0300, NOTEQUALS, 0x0300) // -> f0020 PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x4000, DEF_STR( On ) ) PORT_DIPNAME( 0x8000, 0x8000, "Vibrations" ) PORT_DIPLOCATION("SW02:8") |