Added overloaded input_port_read() for reading device owned input ports. [Curt Coder]

This commit is contained in:
Curt Coder 2011-02-25 09:01:47 +00:00
parent 130a45928e
commit a6876a9980
2 changed files with 18 additions and 0 deletions

View File

@ -1582,6 +1582,21 @@ input_port_value input_port_read(running_machine *machine, const char *tag)
} }
/*-------------------------------------------------
input_port_read - return the value of
an device input port specified by tag
-------------------------------------------------*/
input_port_value input_port_read(running_machine *machine, device_t *device, const char *tag)
{
astring tempstring;
const input_port_config *port = machine->port(device->baseconfig().subtag(tempstring, tag));
if (port == NULL)
fatalerror("Unable to locate input port '%s'", tag);
return input_port_read_direct(port);
}
/*------------------------------------------------- /*-------------------------------------------------
input_port_read_safe - return the value of input_port_read_safe - return the value of
an input port specified by tag, or a default an input port specified by tag, or a default

View File

@ -1137,6 +1137,9 @@ input_port_value input_port_read_direct(const input_port_config *port);
/* return the value of an input port specified by tag */ /* return the value of 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);
/* return the value of an input port specified by tag */
input_port_value input_port_read(running_machine *machine, device_t *device, const char *tag);
/* return the value of an input port specified by tag, or a default value if the port does not exist */ /* return the value of an input port specified by tag, or a default value if the port does not exist */
input_port_value input_port_read_safe(running_machine *machine, const char *tag, input_port_value defvalue); input_port_value input_port_read_safe(running_machine *machine, const char *tag, input_port_value defvalue);