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/polepos.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/polepos.c')
-rw-r--r-- | src/mame/drivers/polepos.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c index c2503fd91bd..6aa48f740df 100644 --- a/src/mame/drivers/polepos.c +++ b/src/mame/drivers/polepos.c @@ -267,7 +267,7 @@ READ16_MEMBER(polepos_state::polepos2_ic25_r) READ8_MEMBER(polepos_state::polepos_adc_r) { - return input_port_read(machine(), m_adc_input ? "ACCEL" : "BRAKE"); + return ioport(m_adc_input ? "ACCEL" : "BRAKE")->read(); } READ8_MEMBER(polepos_state::polepos_ready_r) @@ -340,8 +340,8 @@ WRITE16_MEMBER(polepos_state::polepos_z8002_nvi_enable_w) } -CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return input_port_read(field.machine(), (const char *)param) >> 4; } -CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return input_port_read(field.machine(), (const char *)param) & 0x0f; } +CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return field.machine().root_device().ioport((const char *)param)->read() >> 4; } +CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return field.machine().root_device().ioport((const char *)param)->read() & 0x0f; } CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r) { return m_auto_start_mask; @@ -409,7 +409,7 @@ static READ8_DEVICE_HANDLER( steering_changed_r ) { polepos_state *state = device->machine().driver_data<polepos_state>(); /* read the current steering value and update our delta */ - UINT8 steer_new = input_port_read(device->machine(), "STEER"); + UINT8 steer_new = state->ioport("STEER")->read(); state->m_steer_accum += (INT8)(steer_new - state->m_steer_last) * 2; state->m_steer_last = steer_new; |