summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/inptport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/inptport.c')
-rw-r--r--src/emu/inptport.c482
1 files changed, 241 insertions, 241 deletions
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index 59d834634e2..22194da114e 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -297,9 +297,9 @@ struct _input_port_private
inputx_code *codes;
key_buffer *keybuffer;
emu_timer *inputx_timer;
- int (*queue_chars)(running_machine *machine, const unicode_char *text, size_t text_len);
- int (*accept_char)(running_machine *machine, unicode_char ch);
- int (*charqueue_empty)(running_machine *machine);
+ int (*queue_chars)(running_machine &machine, const unicode_char *text, size_t text_len);
+ int (*accept_char)(running_machine &machine, unicode_char ch);
+ int (*charqueue_empty)(running_machine &machine);
attotime current_rate;
};
@@ -623,8 +623,8 @@ static TIMER_CALLBACK(inputx_timerproc);
/* Debugging commands and handlers. */
-static void execute_input(running_machine *machine, int ref, int params, const char *param[]);
-static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[]);
+static void execute_input(running_machine &machine, int ref, int params, const char *param[]);
+static void execute_dumpkbd(running_machine &machine, int ref, int params, const char *param[]);
/***************************************************************************
COMMON SHARED STRINGS
@@ -774,17 +774,17 @@ static void input_port_exit(running_machine &machine);
static INT32 apply_analog_settings(INT32 current, analog_field_state *analog);
/* initialization helpers */
-static void init_port_types(running_machine *machine);
-static void init_port_state(running_machine *machine);
+static void init_port_types(running_machine &machine);
+static void init_port_state(running_machine &machine);
static void init_autoselect_devices(running_machine &machine, int type1, int type2, int type3, const char *option, const char *ananame);
static device_field_info *init_field_device_info(const input_field_config *field,const char *device_name);
static analog_field_state *init_field_analog_state(const input_field_config *field);
/* once-per-frame updates */
static void frame_update_callback(running_machine &machine);
-static void frame_update(running_machine *machine);
-static void frame_update_digital_joysticks(running_machine *machine);
-static void frame_update_analog_field(running_machine *machine, analog_field_state *analog);
+static void frame_update(running_machine &machine);
+static void frame_update_digital_joysticks(running_machine &machine);
+static void frame_update_analog_field(running_machine &machine, analog_field_state *analog);
static int frame_get_digital_field_state(const input_field_config *field, int mouse_down);
/* port configuration helpers */
@@ -798,33 +798,33 @@ static const input_field_diplocation *diplocation_list_alloc(const input_field_c
static void diplocation_free(input_field_diplocation **diplocptr);
/* tokenization helpers */
-static int token_to_input_field_type(running_machine *machine, const char *string, int *player);
-static const char *input_field_type_to_token(running_machine *machine, int type, int player);
+static int token_to_input_field_type(running_machine &machine, const char *string, int *player);
+static const char *input_field_type_to_token(running_machine &machine, int type, int player);
static int token_to_seq_type(const char *string);
/* settings load */
-static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode);
-static void load_remap_table(running_machine *machine, xml_data_node *parentnode);
-static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq);
-static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq);
+static void load_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode);
+static void load_remap_table(running_machine &machine, xml_data_node *parentnode);
+static int load_default_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq);
+static int load_game_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq);
/* settings save */
-static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode);
-static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq);
+static void save_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode);
+static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq);
static int save_this_input_field_type(int type);
-static void save_default_inputs(running_machine *machine, xml_data_node *parentnode);
-static void save_game_inputs(running_machine *machine, xml_data_node *parentnode);
+static void save_default_inputs(running_machine &machine, xml_data_node *parentnode);
+static void save_game_inputs(running_machine &machine, xml_data_node *parentnode);
/* input playback */
-static time_t playback_init(running_machine *machine);
-static void playback_end(running_machine *machine, const char *message);
-static void playback_frame(running_machine *machine, attotime curtime);
+static time_t playback_init(running_machine &machine);
+static void playback_end(running_machine &machine, const char *message);
+static void playback_frame(running_machine &machine, attotime curtime);
static void playback_port(const input_port_config *port);
/* input recording */
-static void record_init(running_machine *machine);
-static void record_end(running_machine *machine, const char *message);
-static void record_frame(running_machine *machine, attotime curtime);
+static void record_init(running_machine &machine);
+static void record_end(running_machine &machine, const char *message);
+static void record_frame(running_machine &machine, attotime curtime);
static void record_port(const input_port_config *port);
@@ -890,7 +890,7 @@ INLINE const char *get_port_tag(const input_port_config *port, char *tempbuffer)
if (port->tag != NULL)
return port->tag;
- for (curport = port->machine->m_portlist.first(); curport != NULL; curport = curport->next())
+ for (curport = port->machine().m_portlist.first(); curport != NULL; curport = curport->next())
{
if (curport == port)
break;
@@ -973,19 +973,19 @@ static WRITE_LINE_DEVICE_HANDLER( changed_write_line_device )
system
-------------------------------------------------*/
-time_t input_port_init(running_machine *machine, const input_port_token *tokens, const device_config_list &devicelist)
+time_t input_port_init(running_machine &machine, const input_port_token *tokens, const device_config_list &devicelist)
{
//input_port_private *portdata;
char errorbuf[1024];
time_t basetime;
/* allocate memory for our data structure */
- machine->input_port_data = auto_alloc_clear(machine, input_port_private);
- //portdata = machine->input_port_data;
+ machine.input_port_data = auto_alloc_clear(machine, input_port_private);
+ //portdata = machine.input_port_data;
/* add an exit callback and a frame callback */
- machine->add_notifier(MACHINE_NOTIFY_EXIT, input_port_exit);
- machine->add_notifier(MACHINE_NOTIFY_FRAME, frame_update_callback);
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, input_port_exit);
+ machine.add_notifier(MACHINE_NOTIFY_FRAME, frame_update_callback);
/* initialize the default port info from the OSD */
init_port_types(machine);
@@ -993,7 +993,7 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens,
/* if we have a token list, proceed */
if (tokens != NULL)
{
- input_port_list_init(machine->m_portlist, tokens, errorbuf, sizeof(errorbuf), TRUE, NULL);
+ input_port_list_init(machine.m_portlist, tokens, errorbuf, sizeof(errorbuf), TRUE, NULL);
if (errorbuf[0] != 0)
mame_printf_error("Input port errors:\n%s", errorbuf);
}
@@ -1001,7 +1001,7 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens,
for (device_config *config = devicelist.first(); config != NULL; config = config->next())
{
if (config->input_ports()!=NULL) {
- input_port_list_init(machine->m_portlist, config->input_ports(), errorbuf, sizeof(errorbuf), TRUE, config);
+ input_port_list_init(machine.m_portlist, config->input_ports(), errorbuf, sizeof(errorbuf), TRUE, config);
if (errorbuf[0] != 0)
mame_printf_error("Input port errors:\n%s", errorbuf);
}
@@ -1027,8 +1027,8 @@ time_t input_port_init(running_machine *machine, const input_port_token *tokens,
static void input_port_exit(running_machine &machine)
{
/* close any playback or recording files */
- playback_end(&machine, NULL);
- record_end(&machine, NULL);
+ playback_end(machine, NULL);
+ record_end(machine, NULL);
}
@@ -1097,7 +1097,7 @@ const char *input_field_name(const input_field_config *field)
return field->name;
/* otherwise, return the name associated with the type */
- return input_type_name(field->port->machine, field->type, field->player);
+ return input_type_name(field->port->machine(), field->type, field->player);
}
@@ -1120,7 +1120,7 @@ const input_seq *input_field_seq(const input_field_config *field, input_seq_type
/* if the portseq is the special default code, return the expanded default value */
if (input_seq_get_1(portseq) == SEQCODE_DEFAULT)
- return input_type_seq(field->port->machine, field->type, field->player, seqtype);
+ return input_type_seq(field->port->machine(), field->type, field->player, seqtype);
/* otherwise, return the sequence as-is */
return portseq;
@@ -1171,7 +1171,7 @@ void input_field_set_user_settings(const input_field_config *field, const input_
/* copy the basics */
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
{
- const input_seq *defseq = input_type_seq(field->port->machine, field->type, field->player, (input_seq_type)seqtype);
+ const input_seq *defseq = input_type_seq(field->port->machine(), field->type, field->player, (input_seq_type)seqtype);
if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0)
field->state->seq[seqtype] = default_seq;
else
@@ -1207,7 +1207,7 @@ const char *input_field_setting_name(const input_field_config *field)
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
- if (input_condition_true(field->port->machine, &setting->condition))
+ if (input_condition_true(field->port->machine(), &setting->condition))
if (setting->value == field->state->value)
return setting->name;
@@ -1229,7 +1229,7 @@ int input_field_has_previous_setting(const input_field_config *field)
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
- if (input_condition_true(field->port->machine, &setting->condition))
+ if (input_condition_true(field->port->machine(), &setting->condition))
return (setting->value != field->state->value);
return FALSE;
@@ -1253,7 +1253,7 @@ void input_field_select_previous_setting(const input_field_config *field)
/* scan the list of settings looking for a match on the current value */
prevsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
- if (input_condition_true(field->port->machine, &setting->condition))
+ if (input_condition_true(field->port->machine(), &setting->condition))
{
if (setting->value == field->state->value)
{
@@ -1268,7 +1268,7 @@ void input_field_select_previous_setting(const input_field_config *field)
if (!found_match)
{
for (prevsetting = field->settinglist; prevsetting != NULL; prevsetting = prevsetting->next)
- if (input_condition_true(field->port->machine, &prevsetting->condition))
+ if (input_condition_true(field->port->machine(), &prevsetting->condition))
break;
}
@@ -1293,7 +1293,7 @@ int input_field_has_next_setting(const input_field_config *field)
/* scan the list of settings looking for a match on the current value */
for (setting = field->settinglist; setting != NULL; setting = setting->next)
- if (input_condition_true(field->port->machine, &setting->condition))
+ if (input_condition_true(field->port->machine(), &setting->condition))
{
if (found)
return TRUE;
@@ -1321,20 +1321,20 @@ void input_field_select_next_setting(const input_field_config *field)
/* scan the list of settings looking for a match on the current value */
nextsetting = NULL;
for (setting = field->settinglist; setting != NULL; setting = setting->next)
- if (input_condition_true(field->port->machine, &setting->condition))
+ if (input_condition_true(field->port->machine(), &setting->condition))
if (setting->value == field->state->value)
break;
/* if we found one, scan forward for the next valid one */
if (setting != NULL)
for (nextsetting = setting->next; nextsetting != NULL; nextsetting = nextsetting->next)
- if (input_condition_true(field->port->machine, &nextsetting->condition))
+ if (input_condition_true(field->port->machine(), &nextsetting->condition))
break;
/* if we hit the end, search from the beginning */
if (nextsetting == NULL)
for (nextsetting = field->settinglist; nextsetting != NULL; nextsetting = nextsetting->next)
- if (input_condition_true(field->port->machine, &nextsetting->condition))
+ if (input_condition_true(field->port->machine(), &nextsetting->condition))
break;
/* update the value to the previous one */
@@ -1364,12 +1364,12 @@ int input_type_is_analog(int type)
for the given type/player
-------------------------------------------------*/
-const char *input_type_name(running_machine *machine, int type, int player)
+const char *input_type_name(running_machine &machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
- if (machine != NULL)
+ if (1)//machine != NULL)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.name;
@@ -1394,12 +1394,12 @@ const char *input_type_name(running_machine *machine, int type, int player)
for the given type/player
-------------------------------------------------*/
-int input_type_group(running_machine *machine, int type, int player)
+int input_type_group(running_machine &machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
- if (machine != NULL)
+ if (1)//machine != NULL)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.group;
@@ -1424,7 +1424,7 @@ int input_type_group(running_machine *machine, int type, int player)
sequence for the given type/player
-------------------------------------------------*/
-const input_seq *input_type_seq(running_machine *machine, int type, int player, input_seq_type seqtype)
+const input_seq *input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
@@ -1432,9 +1432,9 @@ const input_seq *input_type_seq(running_machine *machine, int type, int player,
assert((player >= 0) && (player < MAX_PLAYERS));
/* if we have a machine, use the live state and quick lookup */
- if (machine != NULL)
+ if (1)//machine != NULL)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return &typestate->seq[seqtype];
@@ -1459,9 +1459,9 @@ const input_seq *input_type_seq(running_machine *machine, int type, int player,
sequence for the given type/player
-------------------------------------------------*/
-void input_type_set_seq(running_machine *machine, int type, int player, input_seq_type seqtype, const input_seq *newseq)
+void input_type_set_seq(running_machine &machine, int type, int player, input_seq_type seqtype, const input_seq *newseq)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
typestate->seq[seqtype] = *newseq;
@@ -1474,7 +1474,7 @@ void input_type_set_seq(running_machine *machine, int type, int player, input_se
is pressed
-------------------------------------------------*/
-int input_type_pressed(running_machine *machine, int type, int player)
+int input_type_pressed(running_machine &machine, int type, int player)
{
return input_seq_pressed(machine, input_type_seq(machine, type, player, SEQ_TYPE_STANDARD));
}
@@ -1484,9 +1484,9 @@ int input_type_pressed(running_machine *machine, int type, int player)
input_type_list - return the list of types
-------------------------------------------------*/
-const input_type_desc *input_type_list(running_machine *machine)
+const input_type_desc *input_type_list(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
return &portdata->typestatelist->typedesc;
}
@@ -1502,9 +1502,9 @@ const input_type_desc *input_type_list(running_machine *machine)
port exists
-------------------------------------------------*/
-bool input_port_exists(running_machine *machine, const char *tag)
+bool input_port_exists(running_machine &machine, const char *tag)
{
- return machine->port(tag) != 0;
+ return machine.port(tag) != 0;
}
@@ -1514,9 +1514,9 @@ bool input_port_exists(running_machine *machine, const char *tag)
unused or unknown)
-------------------------------------------------*/
-input_port_value input_port_active(running_machine *machine, const char *tag)
+input_port_value input_port_active(running_machine &machine, const char *tag)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return port->active;
@@ -1530,9 +1530,9 @@ input_port_value input_port_active(running_machine *machine, const char *tag)
the port does not exist
-------------------------------------------------*/
-input_port_value input_port_active_safe(running_machine *machine, const char *tag, input_port_value defvalue)
+input_port_value input_port_active_safe(running_machine &machine, const char *tag, input_port_value defvalue)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
return port == NULL ? defvalue : port->active;
}
@@ -1549,7 +1549,7 @@ input_port_value input_port_active_safe(running_machine *machine, const char *ta
input_port_value input_port_read_direct(const input_port_config *port)
{
- input_port_private *portdata = port->machine->input_port_data;
+ input_port_private *portdata = port->machine().input_port_data;
analog_field_state *analog;
device_field_info *device_field;
input_port_value result;
@@ -1561,7 +1561,7 @@ input_port_value input_port_read_direct(const input_port_config *port)
/* update custom values */
for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next)
- if (input_condition_true(port->machine, &device_field->field->condition))
+ if (input_condition_true(port->machine(), &device_field->field->condition))
{
/* replace the bits with bits from the device */
input_port_value newval = (*device_field->field->read_line_device)(device_field->device);
@@ -1572,7 +1572,7 @@ input_port_value input_port_read_direct(const input_port_config *port)
/* update VBLANK bits */
if (port->state->vblank != 0)
{
- if (port->machine->primary_screen->vblank())
+ if (port->machine().primary_screen->vblank())
result |= port->state->vblank;
else
result &= ~port->state->vblank;
@@ -1583,7 +1583,7 @@ input_port_value input_port_read_direct(const input_port_config *port)
/* merge in analog portions */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
- if (input_condition_true(port->machine, &analog->field->condition))
+ if (input_condition_true(port->machine(), &analog->field->condition))
{
/* start with the raw value */
INT32 value = analog->accum;
@@ -1591,7 +1591,7 @@ input_port_value input_port_read_direct(const input_port_config *port)
/* interpolate if appropriate and if time has passed since the last update */
if (analog->interpolate && !(analog->field->flags & ANALOG_FLAG_RESET) && portdata->last_delta_nsec != 0)
{
- attoseconds_t nsec_since_last = (port->machine->time() - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND;
+ attoseconds_t nsec_since_last = (port->machine().time() - portdata->last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND;
value = analog->previous + ((INT64)(analog->accum - analog->previous) * nsec_since_last / portdata->last_delta_nsec);
}
@@ -1619,9 +1619,9 @@ input_port_value input_port_read_direct(const input_port_config *port)
an input port specified by tag
-------------------------------------------------*/
-input_port_value input_port_read(running_machine *machine, const char *tag)
+input_port_value input_port_read(running_machine &machine, const char *tag)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return input_port_read_direct(port);
@@ -1636,7 +1636,7 @@ input_port_value input_port_read(running_machine *machine, const char *tag)
input_port_value input_port_read(device_t *device, const char *tag)
{
astring tempstring;
- const input_port_config *port = device->machine->port(device->baseconfig().subtag(tempstring, tag));
+ const input_port_config *port = device->machine().port(device->baseconfig().subtag(tempstring, tag));
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return input_port_read_direct(port);
@@ -1649,9 +1649,9 @@ input_port_value input_port_read(device_t *device, const char *tag)
value if the port does not exist
-------------------------------------------------*/
-input_port_value input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue)
+input_port_value input_port_read_safe(running_machine &machine, const char *tag, UINT32 defvalue)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
return (port == NULL) ? defvalue : input_port_read_direct(port);
}
@@ -1662,14 +1662,14 @@ input_port_value input_port_read_safe(running_machine *machine, const char *tag,
player
-------------------------------------------------*/
-int input_port_get_crosshair_position(running_machine *machine, int player, float *x, float *y)
+int input_port_get_crosshair_position(running_machine &machine, int player, float *x, float *y)
{
const input_port_config *port;
const input_field_config *field;
int gotx = FALSE, goty = FALSE;
/* read all the lightgun values */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE)
if (input_condition_true(machine, &field->condition))
@@ -1728,7 +1728,7 @@ int input_port_get_crosshair_position(running_machine *machine, int player, floa
conditions
-------------------------------------------------*/
-void input_port_update_defaults(running_machine *machine)
+void input_port_update_defaults(running_machine &machine)
{
int loopnum;
@@ -1738,7 +1738,7 @@ void input_port_update_defaults(running_machine *machine)
const input_port_config *port;
/* loop over all input ports */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
@@ -1803,7 +1803,7 @@ void input_port_write_direct(const input_port_config *port, input_port_value dat
COMBINE_DATA(&port->state->outputvalue);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
- if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
+ if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition))
{
input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift;
@@ -1823,9 +1823,9 @@ void input_port_write_direct(const input_port_config *port, input_port_value dat
port specified by tag
-------------------------------------------------*/
-void input_port_write(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
+void input_port_write(running_machine &machine, const char *tag, input_port_value value, input_port_value mask)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
input_port_write_direct(port, value, mask);
@@ -1837,9 +1837,9 @@ void input_port_write(running_machine *machine, const char *tag, input_port_valu
a port, ignore if the port does not exist
-------------------------------------------------*/
-void input_port_write_safe(running_machine *machine, const char *tag, input_port_value value, input_port_value mask)
+void input_port_write_safe(running_machine &machine, const char *tag, input_port_value value, input_port_value mask)
{
- const input_port_config *port = machine->port(tag);
+ const input_port_config *port = machine.port(tag);
if (port != NULL)
input_port_write_direct(port, value, mask);
}
@@ -1855,7 +1855,7 @@ void input_port_write_safe(running_machine *machine, const char *tag, input_port
if the given condition attached is true
-------------------------------------------------*/
-int input_condition_true(running_machine *machine, const input_condition *condition)
+int input_condition_true(running_machine &machine, const input_condition *condition)
{
input_port_value condvalue;
@@ -1926,9 +1926,9 @@ const char *input_port_string_from_token(const input_port_token token)
type list
-------------------------------------------------*/
-static void init_port_types(running_machine *machine)
+static void init_port_types(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state **stateptr;
input_type_state *curtype;
input_type_desc *lasttype = NULL;
@@ -1953,7 +1953,7 @@ static void init_port_types(running_machine *machine)
}
/* ask the OSD to customize the list */
- machine->osd().customize_input_type_list(&portdata->typestatelist->typedesc);
+ machine.osd().customize_input_type_list(&portdata->typestatelist->typedesc);
/* now iterate over the OSD-modified types */
for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next)
@@ -2080,15 +2080,15 @@ static astring *get_keyboard_key_name(const input_field_config *field)
states based on the tokens
-------------------------------------------------*/
-static void init_port_state(running_machine *machine)
+static void init_port_state(running_machine &machine)
{
- const char *joystick_map_default = machine->options().joystick_map();
- input_port_private *portdata = machine->input_port_data;
+ const char *joystick_map_default = machine.options().joystick_map();
+ input_port_private *portdata = machine.input_port_data;
const input_field_config *field;
const input_port_config *port;
/* allocate live structures to mirror the configuration */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
analog_field_state **analogstatetail;
device_field_info **readdevicetail;
@@ -2098,7 +2098,7 @@ static void init_port_state(running_machine *machine)
/* allocate a new input_port_info structure */
portstate = auto_alloc_clear(machine, input_port_state);
((input_port_config *)port)->state = portstate;
- ((input_port_config *)port)->machine = machine;
+ ((input_port_config *)port)->m_machine = &machine;
/* start with tail pointers to all the data */
analogstatetail = &portstate->analoglist;
@@ -2164,18 +2164,18 @@ static void init_port_state(running_machine *machine)
}
/* handle autoselection of devices */
- init_autoselect_devices(*machine, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
- init_autoselect_devices(*machine, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
- init_autoselect_devices(*machine, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
- init_autoselect_devices(*machine, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
- init_autoselect_devices(*machine, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
- init_autoselect_devices(*machine, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
- init_autoselect_devices(*machine, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
- init_autoselect_devices(*machine, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
+ init_autoselect_devices(machine, IPT_PADDLE, IPT_PADDLE_V, 0, OPTION_PADDLE_DEVICE, "paddle");
+ init_autoselect_devices(machine, IPT_AD_STICK_X, IPT_AD_STICK_Y, IPT_AD_STICK_Z, OPTION_ADSTICK_DEVICE, "analog joystick");
+ init_autoselect_devices(machine, IPT_LIGHTGUN_X, IPT_LIGHTGUN_Y, 0, OPTION_LIGHTGUN_DEVICE, "lightgun");
+ init_autoselect_devices(machine, IPT_PEDAL, IPT_PEDAL2, IPT_PEDAL3, OPTION_PEDAL_DEVICE, "pedal");
+ init_autoselect_devices(machine, IPT_DIAL, IPT_DIAL_V, 0, OPTION_DIAL_DEVICE, "dial");
+ init_autoselect_devices(machine, IPT_TRACKBALL_X, IPT_TRACKBALL_Y, 0, OPTION_TRACKBALL_DEVICE, "trackball");
+ init_autoselect_devices(machine, IPT_POSITIONAL, IPT_POSITIONAL_V, 0, OPTION_POSITIONAL_DEVICE, "positional");
+ init_autoselect_devices(machine, IPT_MOUSE_X, IPT_MOUSE_Y, 0, OPTION_MOUSE_DEVICE, "mouse");
/* look for 4-way joysticks and change the default map if we find any */
if (joystick_map_default[0] == 0 || strcmp(joystick_map_default, "auto") == 0)
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (field->state->joystick != NULL && field->way == 4)
{
@@ -2229,7 +2229,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ
mame_printf_error("Invalid %s value %s; reverting to keyboard\n", option, stemp);
/* only scan the list if we haven't already enabled this class of control */
- if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine, autoenable))
+ if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine(), autoenable))
for (port = portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
@@ -2239,7 +2239,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ
(type3 != 0 && field->type == type3))
{
mame_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autostring, ananame);
- input_device_class_enable(port->machine, autoenable, TRUE);
+ input_device_class_enable(port->machine(), autoenable, TRUE);
break;
}
}
@@ -2256,7 +2256,7 @@ static device_field_info *init_field_device_info(const input_field_config *field
input_port_value mask;
/* allocate memory */
- info = auto_alloc_clear(field->port->machine, device_field_info);
+ info = auto_alloc_clear(field->port->machine(), device_field_info);
/* fill in the data */
info->field = field;
@@ -2264,7 +2264,7 @@ static device_field_info *init_field_device_info(const input_field_config *field
info->shift++;
if (device_name != NULL)
- info->device = field->port->machine->device(device_name);
+ info->device = field->port->machine().device(device_name);
else
info->device = (device_t *) info;
@@ -2284,7 +2284,7 @@ static analog_field_state *init_field_analog_state(const input_field_config *fie
input_port_value mask;
/* allocate memory */
- state = auto_alloc_clear(field->port->machine, analog_field_state);
+ state = auto_alloc_clear(field->port->machine(), analog_field_state);
/* compute the shift amount and number of bits */
for (mask = field->mask; !(mask & 1); mask >>= 1)
@@ -2459,12 +2459,12 @@ static void frame_update_callback(running_machine &machine)
return;
/* otherwise, use the common code */
- frame_update(&machine);
+ frame_update(machine);
}
-static key_buffer *get_buffer(running_machine *machine)
+static key_buffer *get_buffer(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
assert(inputx_can_post(machine));
return (key_buffer *)portdata->keybuffer;
}
@@ -2489,9 +2489,9 @@ static const inputx_code *find_code(inputx_code *codes, unicode_char ch)
called from core to allow for natural keyboard
-------------------------------------------------*/
-static void input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital)
+static void input_port_update_hook(running_machine &machine, const input_port_config *port, input_port_value *digital)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
const key_buffer *keybuf;
const inputx_code *code;
unicode_char ch;
@@ -2531,12 +2531,12 @@ static void input_port_update_hook(running_machine *machine, const input_port_co
port updating
-------------------------------------------------*/
-static void frame_update(running_machine *machine)
+static void frame_update(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
const input_field_config *mouse_field = NULL;
int ui_visible = ui_is_menu_active();
- attotime curtime = machine->time();
+ attotime curtime = machine.time();
const input_port_config *port;
render_target *mouse_target;
INT32 mouse_target_x;
@@ -2567,11 +2567,11 @@ g_profiler.start(PROFILER_INPUT);
input_port_value mask;
float x, y;
if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, tag, mask, x, y))
- mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
+ mouse_field = input_field_by_tag_and_mask(machine.m_portlist, tag, mask);
}
/* loop over all input ports */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
const input_field_config *field;
device_field_info *device_field;
@@ -2583,7 +2583,7 @@ g_profiler.start(PROFILER_INPUT);
/* now loop back and modify based on the inputs */
for (field = port->fieldlist; field != NULL; field = field->next)
- if (input_condition_true(port->machine, &field->condition))
+ if (input_condition_true(port->machine(), &field->condition))
{
/* accumulate VBLANK bits */
if (field->type == IPT_VBLANK)
@@ -2608,7 +2608,7 @@ g_profiler.start(PROFILER_INPUT);
/* call device line changed handlers */
newvalue = input_port_read_direct(port);
for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next)
- if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine, &device_field->field->condition))
+ if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition))
{
input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift;
@@ -2632,9 +2632,9 @@ g_profiler.stop();
accumulating the results in a port
-------------------------------------------------*/
-static void frame_update_digital_joysticks(running_machine *machine)
+static void frame_update_digital_joysticks(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
int player, joyindex;
/* loop over all the joysticks */
@@ -2699,7 +2699,7 @@ static void frame_update_digital_joysticks(running_machine *machine)
if ((joystick->current4way & (JOYDIR_UP_BIT | JOYDIR_DOWN_BIT)) &&
(joystick->current4way & (JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT)))
{
- if (machine->rand() & 1)
+ if (machine.rand() & 1)
joystick->current4way &= ~(JOYDIR_LEFT_BIT | JOYDIR_RIGHT_BIT);
else
joystick->current4way &= ~(JOYDIR_UP_BIT | JOYDIR_DOWN_BIT);
@@ -2715,7 +2715,7 @@ static void frame_update_digital_joysticks(running_machine *machine)
internals of a single analog field
-------------------------------------------------*/
-static void frame_update_analog_field(running_machine *machine, analog_field_state *analog)
+static void frame_update_analog_field(running_machine &machine, analog_field_state *analog)
{
input_item_class itemclass;
int keypressed = FALSE;
@@ -2861,7 +2861,7 @@ static void frame_update_analog_field(running_machine *machine, analog_field_sta
static int frame_get_digital_field_state(const input_field_config *field, int mouse_down)
{
- int curstate = mouse_down || input_seq_pressed(field->port->machine, input_field_seq(field, SEQ_TYPE_STANDARD));
+ int curstate = mouse_down || input_seq_pressed(field->port->machine(), input_field_seq(field, SEQ_TYPE_STANDARD));
int changed = FALSE;
/* if the state changed, look for switch down/switch up */
@@ -2871,7 +2871,7 @@ static int frame_get_digital_field_state(const input_field_config *field, int mo
changed = TRUE;
}
- if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine))
+ if (field->type == IPT_KEYBOARD && ui_get_use_natural_keyboard(field->port->machine()))
return FALSE;
/* if this is a switch-down event, handle impulse and toggle */
@@ -2917,7 +2917,7 @@ static int frame_get_digital_field_state(const input_field_config *field, int mo
}
/* skip locked-out coin inputs */
- if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine, field->type - IPT_COIN1) && field->port->machine->options().coin_lockout())
+ if (curstate && field->type >= IPT_COIN1 && field->type <= IPT_COIN12 && coin_lockout_get_state(field->port->machine(), field->type - IPT_COIN1) && field->port->machine().options().coin_lockout())
{
ui_popup_time(3, "Coinlock disabled %s.", input_field_name(field));
return FALSE;
@@ -3645,7 +3645,7 @@ input_port_config::input_port_config(const char *_tag)
tag(_tag),
fieldlist(NULL),
state(NULL),
- machine(NULL),
+ m_machine(NULL),
owner(NULL),
active(0)
{
@@ -3941,9 +3941,9 @@ static void diplocation_free(input_field_diplocation **diplocptr)
token to an input field type and player
-------------------------------------------------*/
-static int token_to_input_field_type(running_machine *machine, const char *string, int *player)
+static int token_to_input_field_type(running_machine &machine, const char *string, int *player)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
const input_type_desc *typedesc;
int ipnum;
@@ -3970,9 +3970,9 @@ static int token_to_input_field_type(running_machine *machine, const char *strin
field type and player to a string token
-------------------------------------------------*/
-static const char *input_field_type_to_token(running_machine *machine, int type, int player)
+static const char *input_field_type_to_token(running_machine &machine, int type, int player)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
static char tempbuf[32];
@@ -4015,9 +4015,9 @@ static int token_to_seq_type(const char *string)
configuration data from the XML nodes
-------------------------------------------------*/
-static void load_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
+static void load_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
xml_data_node *portnode;
int seqtype;
@@ -4090,9 +4090,9 @@ static void load_config_callback(running_machine *machine, int config_type, xml_
global remapping table
-------------------------------------------------*/
-static void load_remap_table(running_machine *machine, xml_data_node *parentnode)
+static void load_remap_table(running_machine &machine, xml_data_node *parentnode)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_code *oldtable, *newtable;
xml_data_node *remapnode;
int count;
@@ -4157,9 +4157,9 @@ static void load_remap_table(running_machine *machine, xml_data_node *parentnode
data to the default mappings
-------------------------------------------------*/
-static int load_default_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
+static int load_default_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
int seqtype;
@@ -4182,7 +4182,7 @@ static int load_default_config(running_machine *machine, xml_data_node *portnode
data to the current set of input ports
-------------------------------------------------*/
-static int load_game_config(running_machine *machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
+static int load_game_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_value mask, defvalue;
const input_field_config *field;
@@ -4196,7 +4196,7 @@ static int load_game_config(running_machine *machine, xml_data_node *portnode, i
defvalue = xml_get_attribute_int(portnode, "defvalue", 0);
/* find the port we want; if no tag, search them all */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
if (tag == NULL || strcmp(get_port_tag(port, tempbuffer), tag) == 0)
for (field = port->fieldlist; field != NULL; field = field->next)
@@ -4246,7 +4246,7 @@ static int load_game_config(running_machine *machine, xml_data_node *portnode, i
saving input port configuration
-------------------------------------------------*/
-static void save_config_callback(running_machine *machine, int config_type, xml_data_node *parentnode)
+static void save_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode)
{
/* if no parentnode, ignore */
if (parentnode == NULL)
@@ -4265,7 +4265,7 @@ static void save_config_callback(running_machine *machine, int config_type, xml_
sequence
-------------------------------------------------*/
-static void save_sequence(running_machine *machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
+static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
{
astring seqstring;
xml_data_node *seqnode;
@@ -4308,9 +4308,9 @@ static int save_this_input_field_type(int type)
mappings that have changed
-------------------------------------------------*/
-static void save_default_inputs(running_machine *machine, xml_data_node *parentnode)
+static void save_default_inputs(running_machine &machine, xml_data_node *parentnode)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
/* iterate over ports */
@@ -4352,13 +4352,13 @@ static void save_default_inputs(running_machine *machine, xml_data_node *parentn
mappings that have changed
-------------------------------------------------*/
-static void save_game_inputs(running_machine *machine, xml_data_node *parentnode)
+static void save_game_inputs(running_machine &machine, xml_data_node *parentnode)
{
const input_field_config *field;
const input_port_config *port;
/* iterate over ports */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist; field != NULL; field = field->next)
if (save_this_input_field_type(field->type))
{
@@ -4437,9 +4437,9 @@ static void save_game_inputs(running_machine *machine, xml_data_node *parentnode
from the playback file
-------------------------------------------------*/
-static UINT8 playback_read_uint8(running_machine *machine)
+static UINT8 playback_read_uint8(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT8 result;
/* protect against NULL handles if previous reads fail */
@@ -4463,9 +4463,9 @@ static UINT8 playback_read_uint8(running_machine *machine)
from the playback file
-------------------------------------------------*/
-static UINT32 playback_read_uint32(running_machine *machine)
+static UINT32 playback_read_uint32(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT32 result;
/* protect against NULL handles if previous reads fail */
@@ -4489,9 +4489,9 @@ static UINT32 playback_read_uint32(running_machine *machine)
from the playback file
-------------------------------------------------*/
-static UINT64 playback_read_uint64(running_machine *machine)
+static UINT64 playback_read_uint64(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT64 result;
/* protect against NULL handles if previous reads fail */
@@ -4514,10 +4514,10 @@ static UINT64 playback_read_uint64(running_machine *machine)
playback_init - initialize INP playback
-------------------------------------------------*/
-static time_t playback_init(running_machine *machine)
+static time_t playback_init(running_machine &machine)
{
- const char *filename = machine->options().playback();
- input_port_private *portdata = machine->input_port_data;
+ const char *filename = machine.options().playback();
+ input_port_private *portdata = machine.input_port_data;
UINT8 header[INP_HEADER_SIZE];
time_t basetime;
@@ -4526,7 +4526,7 @@ static time_t playback_init(running_machine *machine)
return 0;
/* open the playback file */
- portdata->playback_file = auto_alloc(machine, emu_file(machine->options().input_directory(), OPEN_FLAG_READ));
+ portdata->playback_file = auto_alloc(machine, emu_file(machine.options().input_directory(), OPEN_FLAG_READ));
file_error filerr = portdata->playback_file->open(filename);
assert_always(filerr == FILERR_NONE, "Failed to open file for playback");
@@ -4547,8 +4547,8 @@ static time_t playback_init(running_machine *machine)
mame_printf_info("Recorded using %s\n", header + 0x20);
/* verify the header against the current game */
- if (memcmp(machine->system().name, header + 0x14, strlen(machine->system().name) + 1) != 0)
- mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine->system().name);
+ if (memcmp(machine.system().name, header + 0x14, strlen(machine.system().name) + 1) != 0)
+ mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine.system().name);
/* enable compression */
portdata->playback_file->compress(FCOMPRESS_MEDIUM);
@@ -4561,9 +4561,9 @@ static time_t playback_init(running_machine *machine)
playback_end - end INP playback
-------------------------------------------------*/
-static void playback_end(running_machine *machine, const char *message)
+static void playback_end(running_machine &machine, const char *message)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
/* only applies if we have a live file */
if (portdata->playback_file != NULL)
@@ -4589,9 +4589,9 @@ static void playback_end(running_machine *machine, const char *message)
playback
-------------------------------------------------*/
-static void playback_frame(running_machine *machine, attotime curtime)
+static void playback_frame(running_machine &machine, attotime curtime)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
/* if playing back, fetch the information and verify */
if (portdata->playback_file != NULL)
@@ -4617,7 +4617,7 @@ static void playback_frame(running_machine *machine, attotime curtime)
static void playback_port(const input_port_config *port)
{
- input_port_private *portdata = port->machine->input_port_data;
+ input_port_private *portdata = port->machine().input_port_data;
/* if playing back, fetch information about this port */
if (portdata->playback_file != NULL)
@@ -4625,19 +4625,19 @@ static void playback_port(const input_port_config *port)
analog_field_state *analog;
/* read the default value and the digital state */
- port->state->defvalue = playback_read_uint32(port->machine);
- port->state->digital = playback_read_uint32(port->machine);
+ port->state->defvalue = playback_read_uint32(port->machine());
+ port->state->digital = playback_read_uint32(port->machine());
/* loop over analog ports and save their data */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
/* read current and previous values */
- analog->accum = playback_read_uint32(port->machine);
- analog->previous = playback_read_uint32(port->machine);
+ analog->accum = playback_read_uint32(port->machine());
+ analog->previous = playback_read_uint32(port->machine());
/* read configuration information */
- analog->sensitivity = playback_read_uint32(port->machine);
- analog->reverse = playback_read_uint8(port->machine);
+ analog->sensitivity = playback_read_uint32(port->machine());
+ analog->reverse = playback_read_uint8(port->machine());
}
}
}
@@ -4653,9 +4653,9 @@ static void playback_port(const input_port_config *port)
to the record file
-------------------------------------------------*/
-static void record_write_uint8(running_machine *machine, UINT8 data)
+static void record_write_uint8(running_machine &machine, UINT8 data)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT8 result = data;
/* protect against NULL handles if previous reads fail */
@@ -4673,9 +4673,9 @@ static void record_write_uint8(running_machine *machine, UINT8 data)
to the record file
-------------------------------------------------*/
-static void record_write_uint32(running_machine *machine, UINT32 data)
+static void record_write_uint32(running_machine &machine, UINT32 data)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT32 result = LITTLE_ENDIANIZE_INT32(data);
/* protect against NULL handles if previous reads fail */
@@ -4693,9 +4693,9 @@ static void record_write_uint32(running_machine *machine, UINT32 data)
to the record file
-------------------------------------------------*/
-static void record_write_uint64(running_machine *machine, UINT64 data)
+static void record_write_uint64(running_machine &machine, UINT64 data)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
UINT64 result = LITTLE_ENDIANIZE_INT64(data);
/* protect against NULL handles if previous reads fail */
@@ -4712,10 +4712,10 @@ static void record_write_uint64(running_machine *machine, UINT64 data)
record_init - initialize INP recording
-------------------------------------------------*/
-static void record_init(running_machine *machine)
+static void record_init(running_machine &machine)
{
- const char *filename = machine->options().record();
- input_port_private *portdata = machine->input_port_data;
+ const char *filename = machine.options().record();
+ input_port_private *portdata = machine.input_port_data;
UINT8 header[INP_HEADER_SIZE];
system_time systime;
@@ -4724,12 +4724,12 @@ static void record_init(running_machine *machine)
return;
/* open the record file */
- portdata->record_file = auto_alloc(machine, emu_file(machine->options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS));
+ portdata->record_file = auto_alloc(machine, emu_file(machine.options().input_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS));
file_error filerr = portdata->record_file->open(filename);
assert_always(filerr == FILERR_NONE, "Failed to open file for recording");
/* get the base time */
- machine->base_datetime(systime);
+ machine.base_datetime(systime);
/* fill in the header */
memset(header, 0, sizeof(header));
@@ -4744,7 +4744,7 @@ static void record_init(running_machine *machine)
header[0x0f] = systime.time >> 56;
header[0x10] = INP_HEADER_MAJVERSION;
header[0x11] = INP_HEADER_MINVERSION;
- strcpy((char *)header + 0x14, machine->system().name);
+ strcpy((char *)header + 0x14, machine.system().name);
sprintf((char *)header + 0x20, APPNAME " %s", build_version);
/* write it */
@@ -4759,9 +4759,9 @@ static void record_init(running_machine *machine)
record_end - end INP recording
-------------------------------------------------*/
-static void record_end(running_machine *machine, const char *message)
+static void record_end(running_machine &machine, const char *message)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
/* only applies if we have a live file */
if (portdata->record_file != NULL)
@@ -4782,9 +4782,9 @@ static void record_end(running_machine *machine, const char *message)
recording
-------------------------------------------------*/
-static void record_frame(running_machine *machine, attotime curtime)
+static void record_frame(running_machine &machine, attotime curtime)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
/* if recording, record information about the current frame */
if (portdata->record_file != NULL)
@@ -4794,7 +4794,7 @@ static void record_frame(running_machine *machine, attotime curtime)
record_write_uint64(machine, curtime.attoseconds);
/* then the current speed */
- record_write_uint32(machine, machine->video().speed_percent() * (double)(1 << 20));
+ record_write_uint32(machine, machine.video().speed_percent() * (double)(1 << 20));
}
}
@@ -4805,7 +4805,7 @@ static void record_frame(running_machine *machine, attotime curtime)
static void record_port(const input_port_config *port)
{
- input_port_private *portdata = port->machine->input_port_data;
+ input_port_private *portdata = port->machine().input_port_data;
/* if recording, store information about this port */
if (portdata->record_file != NULL)
@@ -4813,29 +4813,29 @@ static void record_port(const input_port_config *port)
analog_field_state *analog;
/* store the default value and digital state */
- record_write_uint32(port->machine, port->state->defvalue);
- record_write_uint32(port->machine, port->state->digital);
+ record_write_uint32(port->machine(), port->state->defvalue);
+ record_write_uint32(port->machine(), port->state->digital);
/* loop over analog ports and save their data */
for (analog = port->state->analoglist; analog != NULL; analog = analog->next)
{
/* store current and previous values */
- record_write_uint32(port->machine, analog->accum);
- record_write_uint32(port->machine, analog->previous);
+ record_write_uint32(port->machine(), analog->accum);
+ record_write_uint32(port->machine(), analog->previous);
/* store configuration information */
- record_write_uint32(port->machine, analog->sensitivity);
- record_write_uint8(port->machine, analog->reverse);
+ record_write_uint32(port->machine(), analog->sensitivity);
+ record_write_uint8(port->machine(), analog->reverse);
}
}
}
-int input_machine_has_keyboard(running_machine *machine)
+int input_machine_has_keyboard(running_machine &machine)
{
int have_keyboard = FALSE;
const input_field_config *field;
const input_port_config *port;
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
@@ -4858,7 +4858,7 @@ int input_machine_has_keyboard(running_machine *machine)
given code; used for logging and debugging
-------------------------------------------------*/
-static const char *code_point_string(running_machine *machine, unicode_char ch)
+static const char *code_point_string(running_machine &machine, unicode_char ch)
{
static char buf[16];
const char *result = buf;
@@ -4905,7 +4905,7 @@ static const char *code_point_string(running_machine *machine, unicode_char ch)
sets up natural keyboard input mapping
-------------------------------------------------*/
-static int scan_keys(running_machine *machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift)
+static int scan_keys(running_machine &machine, const input_port_config *portconfig, inputx_code *codes, const input_port_config * *ports, const input_field_config * *shift_ports, int keys, int shift)
{
int code_count = 0;
const input_port_config *port;
@@ -4967,7 +4967,7 @@ static int scan_keys(running_machine *machine, const input_port_config *portconf
chars
-------------------------------------------------*/
-static inputx_code *build_codes(running_machine *machine, const input_port_config *portconfig)
+static inputx_code *build_codes(running_machine &machine, const input_port_config *portconfig)
{
inputx_code *codes = NULL;
const input_port_config *ports[NUM_SIMUL_KEYS];
@@ -5045,19 +5045,19 @@ static void clear_keybuffer(running_machine &machine)
-static void setup_keybuffer(running_machine *machine)
+static void setup_keybuffer(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
- portdata->inputx_timer = machine->scheduler().timer_alloc(FUNC(inputx_timerproc));
+ input_port_private *portdata = machine.input_port_data;
+ portdata->inputx_timer = machine.scheduler().timer_alloc(FUNC(inputx_timerproc));
portdata->keybuffer = auto_alloc_clear(machine, key_buffer);
- machine->add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
+ machine.add_notifier(MACHINE_NOTIFY_EXIT, clear_keybuffer);
}
-void inputx_init(running_machine *machine)
+void inputx_init(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
portdata->codes = NULL;
portdata->inputx_timer = NULL;
portdata->queue_chars = NULL;
@@ -5065,7 +5065,7 @@ void inputx_init(running_machine *machine)
portdata->charqueue_empty = NULL;
portdata->keybuffer = NULL;
- if (machine->debug_flags & DEBUG_FLAG_ENABLED)
+ if (machine.debug_flags & DEBUG_FLAG_ENABLED)
{
debug_console_register_command(machine, "input", CMDFLAG_NONE, 0, 1, 1, execute_input);
debug_console_register_command(machine, "dumpkbd", CMDFLAG_NONE, 0, 0, 1, execute_dumpkbd);
@@ -5074,7 +5074,7 @@ void inputx_init(running_machine *machine)
/* posting keys directly only makes sense for a computer */
if (input_machine_has_keyboard(machine))
{
- portdata->codes = build_codes(machine, machine->m_portlist.first());
+ portdata->codes = build_codes(machine, machine.m_portlist.first());
setup_keybuffer(machine);
}
}
@@ -5082,27 +5082,27 @@ void inputx_init(running_machine *machine)
void inputx_setup_natural_keyboard(
- running_machine *machine,
- int (*queue_chars)(running_machine *machine, const unicode_char *text, size_t text_len),
- int (*accept_char)(running_machine *machine, unicode_char ch),
- int (*charqueue_empty)(running_machine *machine))
+ running_machine &machine,
+ int (*queue_chars)(running_machine &machine, const unicode_char *text, size_t text_len),
+ int (*accept_char)(running_machine &machine, unicode_char ch),
+ int (*charqueue_empty)(running_machine &machine))
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
portdata->queue_chars = queue_chars;
portdata->accept_char = accept_char;
portdata->charqueue_empty = charqueue_empty;
}
-int inputx_can_post(running_machine *machine)
+int inputx_can_post(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
return portdata->queue_chars || portdata->codes;
}
-static int can_post_key_directly(running_machine *machine, unicode_char ch)
+static int can_post_key_directly(running_machine &machine, unicode_char ch)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
int rc = FALSE;
const inputx_code *code;
@@ -5121,7 +5121,7 @@ static int can_post_key_directly(running_machine *machine, unicode_char ch)
-static int can_post_key_alternate(running_machine *machine, unicode_char ch)
+static int can_post_key_alternate(running_machine &machine, unicode_char ch)
{
const char *s;
const char_info *ci;
@@ -5173,9 +5173,9 @@ static attotime choose_delay(input_port_private *portdata, unicode_char ch)
-static void internal_post_key(running_machine *machine, unicode_char ch)
+static void internal_post_key(running_machine &machine, unicode_char ch)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
key_buffer *keybuf;
keybuf = get_buffer(machine);
@@ -5193,7 +5193,7 @@ static void internal_post_key(running_machine *machine, unicode_char ch)
-static int buffer_full(running_machine *machine)
+static int buffer_full(running_machine &machine)
{
key_buffer *keybuf;
keybuf = get_buffer(machine);
@@ -5202,9 +5202,9 @@ static int buffer_full(running_machine *machine)
-static void inputx_postn_rate(running_machine *machine, const unicode_char *text, size_t text_len, attotime rate)
+static void inputx_postn_rate(running_machine &machine, const unicode_char *text, size_t text_len, attotime rate)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
int last_cr = 0;
unicode_char ch;
const char *s;
@@ -5264,7 +5264,7 @@ static void inputx_postn_rate(running_machine *machine, const unicode_char *text
static TIMER_CALLBACK(inputx_timerproc)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
key_buffer *keybuf;
attotime delay;
@@ -5305,9 +5305,9 @@ static TIMER_CALLBACK(inputx_timerproc)
}
}
-int inputx_is_posting(running_machine *machine)
+int inputx_is_posting(running_machine &machine)
{
- input_port_private *portdata = machine->input_port_data;
+ input_port_private *portdata = machine.input_port_data;
const key_buffer *keybuf;
keybuf = get_buffer(machine);
return (keybuf->begin_pos != keybuf->end_pos) || (portdata->charqueue_empty && !(*portdata->charqueue_empty)(machine));
@@ -5318,9 +5318,9 @@ int inputx_is_posting(running_machine *machine)
Coded input
***************************************************************************/
-static void inputx_postc_rate(running_machine *machine, unicode_char ch, attotime rate);
+static void inputx_postc_rate(running_machine &machine, unicode_char ch, attotime rate);
-static void inputx_postn_coded_rate(running_machine *machine, const char *text, size_t text_len, attotime rate)
+static void inputx_postn_coded_rate(running_machine &machine, const char *text, size_t text_len, attotime rate)
{
size_t i, j, key_len, increment;
unicode_char ch;
@@ -5397,17 +5397,17 @@ static void inputx_postn_coded_rate(running_machine *machine, const char *text,
***************************************************************************/
-static void inputx_postc_rate(running_machine *machine, unicode_char ch, attotime rate)
+static void inputx_postc_rate(running_machine &machine, unicode_char ch, attotime rate)
{
inputx_postn_rate(machine, &ch, 1, rate);
}
-void inputx_postc(running_machine *machine, unicode_char ch)
+void inputx_postc(running_machine &machine, unicode_char ch)
{
inputx_postc_rate(machine, ch, attotime::zero);
}
-static void inputx_postn_utf8_rate(running_machine *machine, const char *text, size_t text_len, attotime rate)
+static void inputx_postn_utf8_rate(running_machine &machine, const char *text, size_t text_len, attotime rate)
{
size_t len = 0;
unicode_char buf[256];
@@ -5435,12 +5435,12 @@ static void inputx_postn_utf8_rate(running_machine *machine, const char *text, s
inputx_postn_rate(machine, buf, len, rate);
}
-void inputx_post_utf8(running_machine *machine, const char *text)
+void inputx_post_utf8(running_machine &machine, const char *text)
{
inputx_postn_utf8_rate(machine, text, strlen(text), attotime::zero);
}
-void inputx_post_utf8_rate(running_machine *machine, const char *text, attotime rate)
+void inputx_post_utf8_rate(running_machine &machine, const char *text, attotime rate)
{
inputx_postn_utf8_rate(machine, text, strlen(text), rate);
}
@@ -5538,12 +5538,12 @@ int input_player_number(const input_field_config *port)
particular input class is present
-------------------------------------------------*/
-int input_has_input_class(running_machine *machine, int inputclass)
+int input_has_input_class(running_machine &machine, int inputclass)
{
const input_port_config *port;
const input_field_config *field;
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
@@ -5561,14 +5561,14 @@ int input_has_input_class(running_machine *machine, int inputclass)
active players
-------------------------------------------------*/
-int input_count_players(running_machine *machine)
+int input_count_players(running_machine &machine)
{
const input_port_config *port;
const input_field_config *field;
int joystick_count;
joystick_count = 0;
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
@@ -5589,7 +5589,7 @@ int input_count_players(running_machine *machine)
specific category is active
-------------------------------------------------*/
-int input_category_active(running_machine *machine, int category)
+int input_category_active(running_machine &machine, int category)
{
const input_port_config *port;
const input_field_config *field = NULL;
@@ -5599,7 +5599,7 @@ int input_category_active(running_machine *machine, int category)
assert(category >= 1);
/* loop through the input ports */
- for (port = machine->m_portlist.first(); port != NULL; port = port->next())
+ for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->fieldlist; field != NULL; field = field->next)
{
@@ -5632,7 +5632,7 @@ int input_category_active(running_machine *machine, int category)
natural keyboard input
-------------------------------------------------*/
-static void execute_input(running_machine *machine, int ref, int params, const char *param[])
+static void execute_input(running_machine &machine, int ref, int params, const char *param[])
{
inputx_postn_coded_rate(machine, param[0], strlen(param[0]), attotime::zero);
}
@@ -5644,9 +5644,9 @@ static void execute_input(running_machine *machine, int ref, int params, const c
keyboard codes
-------------------------------------------------*/
-static void execute_dumpkbd(running_machine *machine, int ref, int params, const char *param[])
+static void execute_dumpkbd(running_machine &machine, int ref, int params, const char *param[])
{
- inputx_code *codes = machine->input_port_data->codes;
+ inputx_code *codes = machine.input_port_data->codes;
const char *filename;
FILE *file = NULL;
const inputx_code *code;