summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/uiinput.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/emu/uiinput.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/emu/uiinput.c')
-rw-r--r--src/emu/uiinput.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/emu/uiinput.c b/src/emu/uiinput.c
index 2cb781a5d19..1be9eeb3c52 100644
--- a/src/emu/uiinput.c
+++ b/src/emu/uiinput.c
@@ -37,8 +37,8 @@ enum
struct _ui_input_private
{
/* pressed states; retrieved with ui_input_pressed() */
- osd_ticks_t next_repeat[__ipt_max];
- UINT8 seqpressed[__ipt_max];
+ osd_ticks_t next_repeat[IPT_COUNT];
+ UINT8 seqpressed[IPT_COUNT];
/* mouse position/info */
render_target * current_mouse_target;
@@ -97,12 +97,11 @@ void ui_input_init(running_machine &machine)
void ui_input_frame_update(running_machine &machine)
{
ui_input_private *uidata = machine.ui_input_data;
- int code;
/* update the state of all the UI keys */
- for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
+ for (ioport_type code = ioport_type(IPT_UI_FIRST + 1); code < IPT_UI_LAST; code++)
{
- int pressed = machine.input().seq_pressed(input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
+ bool pressed = machine.ioport().type_pressed(code);
if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
uidata->seqpressed[code] = pressed;
}
@@ -199,7 +198,7 @@ void ui_input_reset(running_machine &machine)
uidata->events_start = 0;
uidata->events_end = 0;
- for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
+ for (code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++)
{
uidata->seqpressed[code] = SEQ_PRESSED_RESET;
uidata->next_repeat[code] = 0;