summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/fantland.c
diff options
context:
space:
mode:
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
commit2a88e54278acc526c11dba7961204f234f1f6e05 (patch)
tree1d78e932e47bb535e7e56ddac05232cdf551c3a1 /src/mame/drivers/fantland.c
parent605a48921b48e0127ff0330f1e895dcf16d084fb (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/fantland.c')
-rw-r--r--src/mame/drivers/fantland.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c
index daf3ac136fb..a21d3ed496f 100644
--- a/src/mame/drivers/fantland.c
+++ b/src/mame/drivers/fantland.c
@@ -179,20 +179,20 @@ READ8_MEMBER(fantland_state::borntofi_inputs_r)
{
int x, y, f;
- switch (input_port_read(machine(), "Controls") & 0x03)
+ switch (ioport("Controls")->read() & 0x03)
{
case 3:
- case 1: return input_port_read(machine(), offset ? "P2_GUN" : "P1_GUN"); // Lightgun buttons
- case 2: return input_port_read(machine(), offset ? "P2_JOY" : "P1_JOY"); // Joystick
+ case 1: return ioport(offset ? "P2_GUN" : "P1_GUN")->read(); // Lightgun buttons
+ case 2: return ioport(offset ? "P2_JOY" : "P1_JOY")->read(); // Joystick
}
// Trackball
- x = input_port_read(machine(), offset ? "P2 Trackball X" : "P1 Trackball X");
- y = input_port_read(machine(), offset ? "P2 Trackball Y" : "P1 Trackball Y");
+ x = ioport(offset ? "P2 Trackball X" : "P1 Trackball X")->read();
+ y = ioport(offset ? "P2 Trackball Y" : "P1 Trackball Y")->read();
f = machine().primary_screen->frame_number();
- m_input_ret[offset] = (m_input_ret[offset] & 0x14) | (input_port_read(machine(), offset ? "P2_TRACK" : "P1_TRACK") & 0xc3);
+ m_input_ret[offset] = (m_input_ret[offset] & 0x14) | (ioport(offset ? "P2_TRACK" : "P1_TRACK")->read() & 0xc3);
x = (x & 0x7f) - (x & 0x80);
y = (y & 0x7f) - (y & 0x80);
@@ -368,7 +368,7 @@ static void borntofi_adpcm_int( device_t *device, int voice )
if (!state->m_adpcm_playing[voice])
return;
- rom = device->machine().root_device().memregion("adpcm")->base();
+ rom = state->memregion("adpcm")->base();
len = state->memregion("adpcm")->bytes() * 2;
start = state->m_adpcm_addr[0][voice] + state->m_adpcm_nibble[voice];
@@ -585,64 +585,64 @@ INPUT_PORTS_END
static INPUT_PORTS_START( borntofi )
PORT_START("P1_GUN") /* 53000 (Lightgun) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
PORT_START("P2_GUN") /* 53001 (Lightgun) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x03)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x03)
PORT_START("P1_TRACK") /* 53000 (Trackball) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball x
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball x
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball y
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball y
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball x
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball x
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball y
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball y
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
PORT_START("P2_TRACK") /* 53001 (Trackball) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00)
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball x
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball x
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball y
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) // trackball y
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) PORT_PLAYER(2)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x00) PORT_PLAYER(2)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00)
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball x
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball x
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball y
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) // trackball y
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) PORT_PLAYER(2)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x00) PORT_PLAYER(2)
PORT_START("P1_JOY") /* 53000 (Joystick) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
PORT_START("P2_JOY") /* 53001 (Joystick) */
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("Controls", 0x03, EQUALS, 0x02) PORT_PLAYER(2)
PORT_START("DSW") /* 53002 */
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW1:1,2,3")
@@ -721,7 +721,7 @@ INPUT_PORTS_END
CUSTOM_INPUT_MEMBER(fantland_state::wheelrun_wheel_r)
{
int player = (FPTR)param;
- int delta = input_port_read(machine(), player ? "WHEEL1" : "WHEEL0");
+ int delta = ioport(player ? "WHEEL1" : "WHEEL0")->read();
delta = (delta & 0x7f) - (delta & 0x80) + 4;
if (delta > 7) delta = 7;