mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
Switch input ports to use function-based constructors instead of tokens.
Remove the old tokenizing helpers. Add basic classes for ports, fields, settings, and dip locations as a first step. These will be fully cleaned up later. Added machine() method to field to hide all the necessary indirection. Changed custom/changed handlers into generic read/write handlers, and added wrappers to convert them to device read/write lines. [Aaron Giles]
This commit is contained in:
parent
7940e28ae2
commit
d5af6b6a9b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1224,7 +1224,6 @@ src/emu/tilemap.c svneol=native#text/plain
|
||||
src/emu/tilemap.h svneol=native#text/plain
|
||||
src/emu/timer.c svneol=native#text/plain
|
||||
src/emu/timer.h svneol=native#text/plain
|
||||
src/emu/tokenize.h svneol=native#text/plain
|
||||
src/emu/ui.c svneol=native#text/plain
|
||||
src/emu/ui.h svneol=native#text/plain
|
||||
src/emu/uigfx.c svneol=native#text/plain
|
||||
|
@ -220,8 +220,8 @@ void crosshair_init(running_machine &machine)
|
||||
global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
|
||||
|
||||
/* determine who needs crosshairs */
|
||||
for (const input_port_config *port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (input_port_config *port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->crossaxis != CROSSHAIR_AXIS_NONE)
|
||||
{
|
||||
int player = field->player;
|
||||
|
@ -368,7 +368,7 @@ protected:
|
||||
// device-level overrides
|
||||
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); }
|
||||
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
|
||||
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
|
||||
virtual ioport_constructor device_input_ports() const { return reinterpret_cast<ioport_constructor>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_stop();
|
||||
|
@ -809,7 +809,7 @@ machine_config_constructor device_t::device_mconfig_additions() const
|
||||
// input ports description for this device
|
||||
//-------------------------------------------------
|
||||
|
||||
const input_port_token *device_t::device_input_ports() const
|
||||
ioport_constructor device_t::device_input_ports() const
|
||||
{
|
||||
// none by default
|
||||
return NULL;
|
||||
|
@ -93,7 +93,6 @@ class device_state_interface;
|
||||
struct rom_entry;
|
||||
class machine_config;
|
||||
class emu_timer;
|
||||
typedef union _input_port_token input_port_token;
|
||||
typedef struct _input_device_default input_device_default;
|
||||
|
||||
|
||||
@ -207,7 +206,7 @@ public:
|
||||
const input_device_default *input_ports_defaults() const { return m_input_defaults; }
|
||||
const rom_entry *rom_region() const { return device_rom_region(); }
|
||||
machine_config_constructor machine_config_additions() const { return device_mconfig_additions(); }
|
||||
const input_port_token *input_ports() const { return device_input_ports(); }
|
||||
ioport_constructor input_ports() const { return device_input_ports(); }
|
||||
|
||||
// iteration helpers
|
||||
device_t *next() const { return m_next; }
|
||||
@ -296,7 +295,7 @@ protected:
|
||||
// device-level overrides
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual const input_port_token *device_input_ports() const;
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
virtual void device_config_complete();
|
||||
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
|
||||
virtual void device_start() = 0;
|
||||
|
@ -390,7 +390,7 @@ union deviceinfo
|
||||
device_nvram_func nvram; // DEVINFO_FCT_NVRAM
|
||||
const rom_entry * romregion; // DEVINFO_PTR_ROM_REGION
|
||||
machine_config_constructor machine_config; // DEVINFO_PTR_MACHINE_CONFIG
|
||||
const input_port_token *ipt; // DEVINFO_PTR_INPUT_PORTS
|
||||
ioport_constructor ipt; // DEVINFO_PTR_INPUT_PORTS
|
||||
address_map_constructor internal_map8; // DEVINFO_PTR_INTERNAL_MEMORY_MAP
|
||||
address_map_constructor internal_map16; // DEVINFO_PTR_INTERNAL_MEMORY_MAP
|
||||
address_map_constructor internal_map32; // DEVINFO_PTR_INTERNAL_MEMORY_MAP
|
||||
@ -428,7 +428,7 @@ protected:
|
||||
// device-level overrides
|
||||
virtual const rom_entry *device_rom_region() const { return reinterpret_cast<const rom_entry *>(get_legacy_ptr(DEVINFO_PTR_ROM_REGION)); }
|
||||
virtual machine_config_constructor device_mconfig_additions() const { return reinterpret_cast<machine_config_constructor>(get_legacy_ptr(DEVINFO_PTR_MACHINE_CONFIG)); }
|
||||
virtual const input_port_token *device_input_ports() const { return reinterpret_cast<const input_port_token *>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
|
||||
virtual ioport_constructor device_input_ports() const { return reinterpret_cast<ioport_constructor>(get_legacy_ptr(DEVINFO_PTR_INPUT_PORTS)); }
|
||||
virtual bool device_validity_check(emu_options &options, const game_driver &driver) const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
@ -100,7 +100,7 @@ struct game_driver
|
||||
const char * year; /* year the game was released */
|
||||
const char * manufacturer; /* manufacturer of the game */
|
||||
machine_config_constructor machine_config; /* machine driver tokens */
|
||||
const input_port_token *ipt; /* pointer to array of input port tokens */
|
||||
ioport_constructor ipt; /* pointer to array of input port tokens */
|
||||
void (*driver_init)(running_machine &machine); /* DRIVER_INIT callback */
|
||||
const rom_entry * rom; /* pointer to list of ROMs for the game */
|
||||
const char * compatible_with;
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include "attotime.h"
|
||||
#include "hash.h"
|
||||
#include "fileio.h" // remove me once NVRAM is implemented as device
|
||||
#include "tokenize.h"
|
||||
#include "delegate.h"
|
||||
|
||||
// memory and address spaces
|
||||
@ -80,6 +79,12 @@
|
||||
class machine_config;
|
||||
typedef device_t * (*machine_config_constructor)(machine_config &config, device_t *owner);
|
||||
|
||||
// I/O
|
||||
#include "input.h"
|
||||
#include "inputseq.h"
|
||||
#include "inptport.h"
|
||||
#include "output.h"
|
||||
|
||||
// devices and callbacks
|
||||
#include "devintrf.h"
|
||||
#include "distate.h"
|
||||
@ -95,12 +100,6 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
|
||||
#include "schedule.h"
|
||||
#include "timer.h"
|
||||
|
||||
// I/O
|
||||
#include "input.h"
|
||||
#include "inputseq.h"
|
||||
#include "inptport.h"
|
||||
#include "output.h"
|
||||
|
||||
// timers, CPU and scheduling
|
||||
#include "devcpu.h"
|
||||
#include "watchdog.h"
|
||||
|
@ -141,10 +141,30 @@ public:
|
||||
return prepend(object);
|
||||
object.m_next = insert_after->m_next;
|
||||
insert_after->m_next = &object;
|
||||
if (m_tail == insert_after)
|
||||
m_tail = &object;
|
||||
m_count++;
|
||||
return object;
|
||||
}
|
||||
|
||||
// insert the given object before a particular object (NULL means append)
|
||||
_ElementType &insert_before(_ElementType &object, _ElementType *insert_before)
|
||||
{
|
||||
if (insert_before == NULL)
|
||||
return append(object);
|
||||
for (_ElementType **curptr = &m_head; *curptr != NULL; curptr = &(*curptr)->m_next)
|
||||
if (*curptr == insert_before)
|
||||
{
|
||||
object.m_next = insert_before;
|
||||
*curptr = &object;
|
||||
if (m_head == insert_before)
|
||||
m_head = &object;
|
||||
m_count++;
|
||||
return object;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
// replace an item in the list at the same location, and remove it
|
||||
_ElementType &replace_and_remove(_ElementType &object, _ElementType &toreplace)
|
||||
{
|
||||
|
@ -248,9 +248,9 @@ void info_xml_creator::output_one()
|
||||
// allocate input ports
|
||||
machine_config &config = m_drivlist.config();
|
||||
ioport_list portlist;
|
||||
astring errors;
|
||||
for (device_t *device = config.devicelist().first(); device != NULL; device = device->next())
|
||||
if (device->input_ports() != NULL)
|
||||
input_port_list_init(portlist, device->input_ports(), NULL, 0, FALSE, device);
|
||||
input_port_list_init(*device, portlist, errors);
|
||||
|
||||
// print the header and the game name
|
||||
fprintf(m_output, "\t<" XML_TOP);
|
||||
@ -693,8 +693,8 @@ void info_xml_creator::output_input(const ioport_list &portlist)
|
||||
bool keyboard = false;
|
||||
|
||||
// iterate over the ports
|
||||
for (const input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
{
|
||||
int analogtype = -1;
|
||||
|
||||
@ -889,18 +889,18 @@ void info_xml_creator::output_input(const ioport_list &portlist)
|
||||
void info_xml_creator::output_switches(const ioport_list &portlist, int type, const char *outertag, const char *innertag)
|
||||
{
|
||||
// iterate looking for DIP switches
|
||||
for (const input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->type == type)
|
||||
{
|
||||
// output the switch name information
|
||||
fprintf(m_output, "\t\t<%s name=\"%s\"", outertag, xml_normalize_string(input_field_name(field)));
|
||||
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(field->port->tag));
|
||||
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(field->port().tag()));
|
||||
fprintf(m_output, " mask=\"%u\"", field->mask);
|
||||
fprintf(m_output, ">\n");
|
||||
|
||||
// loop over settings
|
||||
for (const input_setting_config *setting = field->settinglist; setting != NULL; setting = setting->next)
|
||||
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
|
||||
{
|
||||
fprintf(m_output, "\t\t\t<%s name=\"%s\"", innertag, xml_normalize_string(setting->name));
|
||||
fprintf(m_output, " value=\"%u\"", setting->value);
|
||||
@ -923,8 +923,8 @@ void info_xml_creator::output_switches(const ioport_list &portlist, int type, co
|
||||
void info_xml_creator::output_adjusters(const ioport_list &portlist)
|
||||
{
|
||||
// iterate looking for Adjusters
|
||||
for (const input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->type == IPT_ADJUSTER)
|
||||
fprintf(m_output, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", xml_normalize_string(input_field_name(field)), field->defvalue);
|
||||
}
|
||||
@ -1002,15 +1002,15 @@ void info_xml_creator::output_driver()
|
||||
void info_xml_creator::output_categories(const ioport_list &portlist)
|
||||
{
|
||||
// iterate looking for Categories
|
||||
for (const input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (const input_field_config *field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
|
||||
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->type == IPT_CATEGORY)
|
||||
{
|
||||
// output the category name information
|
||||
fprintf(m_output, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
|
||||
|
||||
// loop over item settings
|
||||
for (const input_setting_config *setting = field->settinglist; setting != NULL; setting = setting->next)
|
||||
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
|
||||
{
|
||||
fprintf(m_output, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
|
||||
if (setting->value == field->defvalue)
|
||||
|
1325
src/emu/inptport.c
1325
src/emu/inptport.c
File diff suppressed because it is too large
Load Diff
@ -373,68 +373,6 @@ enum
|
||||
};
|
||||
|
||||
|
||||
/* token types */
|
||||
enum
|
||||
{
|
||||
INPUT_TOKEN_INVALID,
|
||||
INPUT_TOKEN_END,
|
||||
INPUT_TOKEN_INCLUDE,
|
||||
INPUT_TOKEN_START,
|
||||
INPUT_TOKEN_MODIFY,
|
||||
INPUT_TOKEN_FIELD,
|
||||
INPUT_TOKEN_SPECIAL_ONOFF,
|
||||
INPUT_TOKEN_CODE,
|
||||
INPUT_TOKEN_CODE_DEC,
|
||||
INPUT_TOKEN_CODE_INC,
|
||||
INPUT_TOKEN_2WAY,
|
||||
INPUT_TOKEN_4WAY,
|
||||
INPUT_TOKEN_8WAY,
|
||||
INPUT_TOKEN_16WAY,
|
||||
INPUT_TOKEN_ROTATED,
|
||||
INPUT_TOKEN_PLAYER1,
|
||||
INPUT_TOKEN_PLAYER2,
|
||||
INPUT_TOKEN_PLAYER3,
|
||||
INPUT_TOKEN_PLAYER4,
|
||||
INPUT_TOKEN_PLAYER5,
|
||||
INPUT_TOKEN_PLAYER6,
|
||||
INPUT_TOKEN_PLAYER7,
|
||||
INPUT_TOKEN_PLAYER8,
|
||||
INPUT_TOKEN_COCKTAIL,
|
||||
INPUT_TOKEN_TOGGLE,
|
||||
INPUT_TOKEN_NAME,
|
||||
INPUT_TOKEN_IMPULSE,
|
||||
INPUT_TOKEN_REVERSE,
|
||||
INPUT_TOKEN_RESET,
|
||||
INPUT_TOKEN_MINMAX,
|
||||
INPUT_TOKEN_SENSITIVITY,
|
||||
INPUT_TOKEN_KEYDELTA,
|
||||
INPUT_TOKEN_CENTERDELTA,
|
||||
INPUT_TOKEN_CROSSHAIR,
|
||||
INPUT_TOKEN_CROSSHAIR_MAPPER,
|
||||
INPUT_TOKEN_FULL_TURN_COUNT,
|
||||
INPUT_TOKEN_POSITIONS,
|
||||
INPUT_TOKEN_WRAPS,
|
||||
INPUT_TOKEN_REMAP_TABLE,
|
||||
INPUT_TOKEN_INVERT,
|
||||
INPUT_TOKEN_UNUSED,
|
||||
INPUT_TOKEN_CUSTOM,
|
||||
INPUT_TOKEN_CHANGED,
|
||||
INPUT_TOKEN_DIPNAME,
|
||||
INPUT_TOKEN_DIPSETTING,
|
||||
INPUT_TOKEN_DIPLOCATION,
|
||||
INPUT_TOKEN_CONDITION,
|
||||
INPUT_TOKEN_ADJUSTER,
|
||||
INPUT_TOKEN_CONFNAME,
|
||||
INPUT_TOKEN_CONFSETTING,
|
||||
INPUT_TOKEN_CHAR,
|
||||
INPUT_TOKEN_CATEGORY,
|
||||
INPUT_TOKEN_CATEGORY_NAME,
|
||||
INPUT_TOKEN_CATEGORY_SETTING,
|
||||
INPUT_TOKEN_READ_LINE_DEVICE,
|
||||
INPUT_TOKEN_WRITE_LINE_DEVICE,
|
||||
};
|
||||
|
||||
|
||||
/* default strings used in port definitions */
|
||||
enum
|
||||
{
|
||||
@ -595,37 +533,23 @@ typedef struct _input_field_state input_field_state;
|
||||
|
||||
/* forward declarations */
|
||||
class input_port_config;
|
||||
typedef struct _input_field_config input_field_config;
|
||||
class input_field_config;
|
||||
|
||||
|
||||
/* template specializations */
|
||||
typedef tagged_list<input_port_config> ioport_list;
|
||||
|
||||
|
||||
/* custom input port callback function */
|
||||
typedef UINT32 (*input_field_custom_func)(const input_field_config *field, void *param);
|
||||
/* read input port callback function */
|
||||
typedef UINT32 (*input_field_read_func)(device_t &device, const input_field_config *field, void *param);
|
||||
|
||||
/* input port changed callback function */
|
||||
typedef void (*input_field_changed_func)(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval);
|
||||
/* input port write callback function */
|
||||
typedef void (*input_field_write_func)(device_t &device, const input_field_config *field, void *param, UINT32 oldval, UINT32 newval);
|
||||
|
||||
/* crosshair mapping function */
|
||||
typedef float (*input_field_crossmap_func)(const input_field_config *field, float linear_value);
|
||||
|
||||
|
||||
/* this type is used to encode input port definitions */
|
||||
typedef union _input_port_token input_port_token;
|
||||
union _input_port_token
|
||||
{
|
||||
TOKEN_COMMON_FIELDS
|
||||
const input_port_token * tokenptr;
|
||||
input_field_custom_func customptr;
|
||||
input_field_changed_func changedptr;
|
||||
input_field_crossmap_func crossmapptr;
|
||||
read_line_device_func read_line_device;
|
||||
write_line_device_func write_line_device;
|
||||
};
|
||||
|
||||
|
||||
/* encapsulates a condition on a port field or setting */
|
||||
typedef struct _input_condition input_condition;
|
||||
struct _input_condition
|
||||
@ -638,35 +562,63 @@ struct _input_condition
|
||||
|
||||
|
||||
/* a single setting for a configuration or DIP switch */
|
||||
typedef struct _input_setting_config input_setting_config;
|
||||
struct _input_setting_config
|
||||
class input_setting_config
|
||||
{
|
||||
const input_setting_config *next; /* pointer to next setting in sequence */
|
||||
const input_field_config * field; /* pointer back to the field that owns us */
|
||||
DISABLE_COPYING(input_setting_config);
|
||||
friend class simple_list<input_setting_config>;
|
||||
|
||||
public:
|
||||
input_setting_config(input_field_config &field, input_port_value value, const char *name);
|
||||
input_setting_config *next() const { return m_next; }
|
||||
|
||||
input_port_value value; /* value of the bits in this setting */
|
||||
input_condition condition; /* condition under which this setting is valid */
|
||||
const char * name; /* user-friendly name to display */
|
||||
UINT16 category; /* (MESS-specific) category */
|
||||
|
||||
private:
|
||||
input_field_config & m_field; /* pointer back to the field that owns us */
|
||||
input_setting_config * m_next; /* pointer to next setting in sequence */
|
||||
};
|
||||
|
||||
|
||||
/* a mapping from a bit to a physical DIP switch description */
|
||||
typedef struct _input_field_diplocation input_field_diplocation;
|
||||
struct _input_field_diplocation
|
||||
class input_field_diplocation
|
||||
{
|
||||
input_field_diplocation * next; /* pointer to the next bit */
|
||||
const char * swname; /* name of the physical DIP switch */
|
||||
DISABLE_COPYING(input_field_diplocation);
|
||||
friend class simple_list<input_field_diplocation>;
|
||||
|
||||
public:
|
||||
input_field_diplocation(const char *string, UINT8 swnum, bool invert);
|
||||
input_field_diplocation *next() const { return m_next; }
|
||||
|
||||
astring swname; /* name of the physical DIP switch */
|
||||
UINT8 swnum; /* physical switch number */
|
||||
UINT8 invert; /* is this an active-high DIP? */
|
||||
bool invert; /* is this an active-high DIP? */
|
||||
|
||||
private:
|
||||
input_field_diplocation * m_next; /* pointer to the next bit */
|
||||
};
|
||||
|
||||
|
||||
/* a single bitfield within an input port */
|
||||
struct _input_field_config
|
||||
class input_field_config
|
||||
{
|
||||
DISABLE_COPYING(input_field_config);
|
||||
friend class simple_list<input_field_config>;
|
||||
|
||||
public:
|
||||
input_field_config(input_port_config &port, int type, input_port_value defvalue, input_port_value maskbits, const char *name = NULL);
|
||||
|
||||
input_field_config *next() const { return m_next; }
|
||||
input_port_config &port() const { return m_port; }
|
||||
running_machine &machine() const;
|
||||
simple_list<input_setting_config> &settinglist() { return m_settinglist; }
|
||||
const simple_list<input_setting_config> &settinglist() const { return m_settinglist; }
|
||||
simple_list<input_field_diplocation> &diploclist() { return m_diploclist; }
|
||||
int modcount() const { return m_modcount; }
|
||||
|
||||
/* generally-applicable data */
|
||||
const input_field_config * next; /* pointer to next field in sequence */
|
||||
const input_port_config * port; /* pointer back to the port that owns us */
|
||||
input_port_value mask; /* mask of bits belonging to the field */
|
||||
input_port_value defvalue; /* default value of these bits */
|
||||
input_condition condition; /* condition under which this field is relevant */
|
||||
@ -677,14 +629,12 @@ struct _input_field_config
|
||||
UINT8 impulse; /* number of frames before reverting to defvalue */
|
||||
const char * name; /* user-friendly name to display */
|
||||
input_seq seq[SEQ_TYPE_TOTAL];/* sequences of all types */
|
||||
read_line_device_func read_line_device; /* input device handler */
|
||||
const char * read_device_name; /* input device name */
|
||||
write_line_device_func write_line_device; /* output device handler */
|
||||
const char * write_device_name; /* input device name */
|
||||
input_field_custom_func custom; /* custom callback routine */
|
||||
void * custom_param; /* parameter for custom callback routine */
|
||||
input_field_changed_func changed; /* changed callback routine */
|
||||
void * changed_param; /* parameter for changed callback routine */
|
||||
input_field_read_func read; /* read callback routine */
|
||||
void * read_param; /* parameter for read callback routine */
|
||||
const char * read_device; /* parameter for read callback routine */
|
||||
input_field_write_func write; /* write callback routine */
|
||||
void * write_param; /* parameter for write callback routine */
|
||||
const char * write_device; /* parameter for write callback routine */
|
||||
|
||||
/* data relevant to analog control types */
|
||||
INT32 min; /* minimum value for absolute axes */
|
||||
@ -701,13 +651,18 @@ struct _input_field_config
|
||||
const input_port_value * remap_table; /* pointer to an array that remaps the port value */
|
||||
|
||||
/* data relevant to other specific types */
|
||||
const input_setting_config *settinglist; /* list of input_setting_configs */
|
||||
const input_field_diplocation *diploclist; /* list of locations for various bits */
|
||||
UINT8 way; /* digital joystick 2/4/8-way descriptions */
|
||||
unicode_char chars[3]; /* (MESS-specific) unicode key data */
|
||||
|
||||
/* this field is only valid if the device is live */
|
||||
input_field_state * state; /* live state of field (NULL if not live) */
|
||||
|
||||
private:
|
||||
input_field_config * m_next; /* pointer to next field in sequence */
|
||||
input_port_config & m_port; /* pointer back to the port that owns us */
|
||||
int m_modcount;
|
||||
simple_list<input_setting_config> m_settinglist; /* list of input_setting_configs */
|
||||
simple_list<input_field_diplocation> m_diploclist; /* list of locations for various bits */
|
||||
};
|
||||
|
||||
|
||||
@ -731,30 +686,40 @@ struct _input_device_default
|
||||
input_port_value mask; /* mask to apply to the port */
|
||||
input_port_value defvalue; /* new default value */
|
||||
};
|
||||
|
||||
/* a single input port configuration */
|
||||
class input_port_config
|
||||
{
|
||||
DISABLE_COPYING(input_port_config);
|
||||
friend class simple_list<input_port_config>;
|
||||
|
||||
public:
|
||||
input_port_config(const char *tag);
|
||||
~input_port_config();
|
||||
// construction/destruction
|
||||
input_port_config(device_t &owner, const char *tag);
|
||||
|
||||
// getters
|
||||
input_port_config *next() const { return m_next; }
|
||||
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
|
||||
void set_machine(running_machine &machine) { m_machine = &machine; }
|
||||
|
||||
input_port_config * m_next; /* pointer to next port */
|
||||
const char * tag; /* pointer to this port's tag */
|
||||
const input_field_config * fieldlist; /* list of input_field_configs */
|
||||
device_t &owner() const { return m_owner; }
|
||||
running_machine &machine() const;
|
||||
input_field_config *first_field() const { return m_fieldlist.first(); }
|
||||
simple_list<input_field_config> &fieldlist() { return m_fieldlist; }
|
||||
const char *tag() const { return m_tag; }
|
||||
int modcount() const { return m_modcount; }
|
||||
|
||||
void bump_modcount() { m_modcount++; }
|
||||
|
||||
void collapse_fields(astring &errorbuf);
|
||||
|
||||
/* these fields are only valid if the port is live */
|
||||
input_port_state * state; /* live state of port (NULL if not live) */
|
||||
device_t * owner; /* associated device, when appropriate */
|
||||
input_port_value active; /* mask of active bits in the port */
|
||||
|
||||
private:
|
||||
running_machine * m_machine; /* machine if port is live */
|
||||
input_port_config * m_next; /* pointer to next port */
|
||||
device_t & m_owner; /* associated device, when appropriate */
|
||||
simple_list<input_field_config> m_fieldlist; /* list of input_field_configs */
|
||||
astring m_tag; /* pointer to this port's tag */
|
||||
int m_modcount;
|
||||
};
|
||||
|
||||
|
||||
@ -791,11 +756,11 @@ struct _inp_header
|
||||
MACROS
|
||||
***************************************************************************/
|
||||
|
||||
/* macro for a custom callback functions (PORT_CUSTOM) */
|
||||
#define CUSTOM_INPUT(name) UINT32 name(const input_field_config *field, void *param)
|
||||
/* macro for a read callback function (PORT_CUSTOM) */
|
||||
#define CUSTOM_INPUT(name) input_port_value name(device_t &device, const input_field_config *field, void *param)
|
||||
|
||||
/* macro for port changed callback functions (PORT_CHANGED) */
|
||||
#define INPUT_CHANGED(name) void name(const input_field_config *field, void *param, UINT32 oldval, UINT32 newval)
|
||||
/* macro for port write callback functions (PORT_CHANGED) */
|
||||
#define INPUT_CHANGED(name) void name(device_t &device, const input_field_config *field, void *param, input_port_value oldval, input_port_value newval)
|
||||
|
||||
/* macro for port changed callback functions (PORT_CROSSHAIR_MAPPER) */
|
||||
#define CROSSHAIR_MAPPER(name) float name(const input_field_config *field, float linear_value)
|
||||
@ -804,235 +769,255 @@ struct _inp_header
|
||||
#define DEF_STR(str_num) ((const char *)INPUT_STRING_##str_num)
|
||||
|
||||
|
||||
template<int (*_ReadLine)(device_t *)>
|
||||
input_port_value ioport_read_line_wrapper(device_t &device, const input_field_config *field, void *param)
|
||||
{
|
||||
return (*_ReadLine)(&device);
|
||||
}
|
||||
|
||||
template<void (*_WriteLine)(device_t *, int)>
|
||||
void ioport_write_line_wrapper(device_t &device, const input_field_config *field, void *param, input_port_value oldval, input_port_value newval)
|
||||
{
|
||||
return (*_WriteLine)(&device, newval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
MACROS FOR BUILDING INPUT PORTS
|
||||
***************************************************************************/
|
||||
|
||||
typedef void (*ioport_constructor)(device_t &owner, ioport_list &portlist, astring &errorbuf);
|
||||
|
||||
/* so that "0" can be used for unneeded input ports */
|
||||
#define ipt_0 NULL
|
||||
#define construct_ioport_0 NULL
|
||||
|
||||
/* name of table */
|
||||
#define INPUT_PORTS_NAME(_name) ipt_##_name
|
||||
#define INPUT_PORTS_NAME(_name) construct_ioport_##_name
|
||||
|
||||
/* start of table */
|
||||
#define INPUT_PORTS_START(_name) \
|
||||
const input_port_token INPUT_PORTS_NAME(_name)[] = {
|
||||
void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &errorbuf) \
|
||||
{ \
|
||||
astring fulltag; \
|
||||
input_setting_config *cursetting = NULL; \
|
||||
input_field_config *curfield = NULL; \
|
||||
input_port_config *curport = NULL; \
|
||||
input_port_value maskbits = 0; \
|
||||
(void)cursetting; (void)curfield; (void)curport; (void)maskbits; \
|
||||
|
||||
/* end of table */
|
||||
#define INPUT_PORTS_END \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_END, 8) };
|
||||
}
|
||||
|
||||
/* aliasing */
|
||||
#define INPUT_PORTS_EXTERN(_name) \
|
||||
extern const input_port_token INPUT_PORTS_NAME(_name)[]
|
||||
extern void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &errorbuf)
|
||||
|
||||
/* including */
|
||||
#define PORT_INCLUDE(_name) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_INCLUDE, 8), \
|
||||
TOKEN_PTR(tokenptr, &INPUT_PORTS_NAME(_name)[0]),
|
||||
INPUT_PORTS_NAME(_name)(owner, portlist, errorbuf); \
|
||||
|
||||
/* start of a new input port (with included tag) */
|
||||
#define PORT_START(_tag) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_START, 8), \
|
||||
TOKEN_STRING(_tag),
|
||||
curport = ioconfig_alloc_port(portlist, owner, _tag); \
|
||||
curfield = NULL; \
|
||||
cursetting = NULL; \
|
||||
maskbits = 0; \
|
||||
|
||||
/* modify an existing port */
|
||||
#define PORT_MODIFY(_tag) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_MODIFY, 8), \
|
||||
TOKEN_STRING(_tag),
|
||||
curport = ioconfig_modify_port(portlist, owner, _tag); \
|
||||
curfield = NULL; \
|
||||
cursetting = NULL; \
|
||||
maskbits = 0; \
|
||||
|
||||
/* input bit definition */
|
||||
#define PORT_BIT(_mask, _default, _type) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_FIELD, 8, _type, 24), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32),
|
||||
curfield = ioconfig_alloc_field(*curport, (_type), (_default), (_mask)); \
|
||||
cursetting = NULL;
|
||||
|
||||
#define PORT_SPECIAL_ONOFF(_mask, _default, _strindex) \
|
||||
TOKEN_UINT32_PACK3(INPUT_TOKEN_SPECIAL_ONOFF, 8, FALSE, 1, INPUT_STRING_##_strindex, 23), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32),
|
||||
#define PORT_SPECIAL_ONOFF(_mask, _default, _strindex) PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, NULL)
|
||||
|
||||
#define PORT_SPECIAL_ONOFF_DIPLOC(_mask, _default, _strindex, _diploc) \
|
||||
TOKEN_UINT32_PACK3(INPUT_TOKEN_SPECIAL_ONOFF, 8, TRUE, 1, INPUT_STRING_##_strindex, 23), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \
|
||||
TOKEN_STRING(_diploc),
|
||||
curfield = ioconfig_alloc_onoff(*curport, DEF_STR(_strindex), _default, _mask, _diploc, errorbuf); \
|
||||
cursetting = NULL;
|
||||
|
||||
/* append a code */
|
||||
#define PORT_CODE(_code) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_CODE, 8, _code, 32),
|
||||
ioconfig_add_code(*curfield, SEQ_TYPE_STANDARD, _code);
|
||||
|
||||
#define PORT_CODE_DEC(_code) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_CODE_DEC, 8, _code, 32),
|
||||
ioconfig_add_code(*curfield, SEQ_TYPE_DECREMENT, _code);
|
||||
|
||||
#define PORT_CODE_INC(_code) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_CODE_INC, 8, _code, 32),
|
||||
ioconfig_add_code(*curfield, SEQ_TYPE_INCREMENT, _code);
|
||||
|
||||
/* joystick flags */
|
||||
#define PORT_2WAY \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_2WAY, 8),
|
||||
curfield->way = 2;
|
||||
|
||||
#define PORT_4WAY \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_4WAY, 8),
|
||||
curfield->way = 4;
|
||||
|
||||
#define PORT_8WAY \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_8WAY, 8),
|
||||
curfield->way = 8;
|
||||
|
||||
#define PORT_16WAY \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_16WAY, 8),
|
||||
curfield->way = 16;
|
||||
|
||||
#define PORT_ROTATED \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_ROTATED, 8),
|
||||
curfield->flags |= FIELD_FLAG_ROTATED
|
||||
|
||||
/* general flags */
|
||||
#define PORT_NAME(_name) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_NAME, 8), \
|
||||
TOKEN_STRING(_name),
|
||||
curfield->name = input_port_string_from_token(_name);
|
||||
|
||||
#define PORT_PLAYER(player_) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_PLAYER1 + (((player_) - 1) % MAX_PLAYERS), 8),
|
||||
#define PORT_PLAYER(_player) \
|
||||
curfield->player = (_player) - 1;
|
||||
|
||||
#define PORT_COCKTAIL \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_COCKTAIL, 8),
|
||||
curfield->flags |= FIELD_FLAG_COCKTAIL; \
|
||||
curfield->player = 1;
|
||||
|
||||
#define PORT_TOGGLE \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_TOGGLE, 8),
|
||||
curfield->flags |= FIELD_FLAG_TOGGLE;
|
||||
|
||||
#define PORT_IMPULSE(_duration) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_IMPULSE, 8, _duration, 24),
|
||||
curfield->impulse = _duration;
|
||||
|
||||
#define PORT_REVERSE \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_REVERSE, 8),
|
||||
curfield->flags |= ANALOG_FLAG_REVERSE;
|
||||
|
||||
#define PORT_RESET \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_RESET, 8),
|
||||
curfield->flags |= ANALOG_FLAG_RESET;
|
||||
|
||||
#define PORT_UNUSED \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_UNUSED, 8),
|
||||
curfield->flags |= FIELD_FLAG_UNUSED;
|
||||
|
||||
/* analog settings */
|
||||
/* if this macro is not used, the minimum defaluts to 0 and maximum defaults to the mask value */
|
||||
#define PORT_MINMAX(_min, _max) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_MINMAX, 8), \
|
||||
TOKEN_UINT64_PACK2(_min, 32, _max, 32),
|
||||
curfield->min = _min; \
|
||||
curfield->max = _max;
|
||||
|
||||
#define PORT_SENSITIVITY(_sensitivity) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_SENSITIVITY, 8, _sensitivity, 24),
|
||||
curfield->sensitivity = _sensitivity;
|
||||
|
||||
#define PORT_KEYDELTA(_delta) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_KEYDELTA, 8, _delta, 24),
|
||||
curfield->delta = curfield->centerdelta = _delta;
|
||||
|
||||
/* note that PORT_CENTERDELTA must appear after PORT_KEYDELTA */
|
||||
#define PORT_CENTERDELTA(_delta) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_CENTERDELTA, 8, _delta, 24),
|
||||
curfield->delta = curfield->centerdelta = _delta;
|
||||
|
||||
#define PORT_CROSSHAIR(axis, scale, offset, altaxis) \
|
||||
TOKEN_UINT32_PACK3(INPUT_TOKEN_CROSSHAIR, 8, CROSSHAIR_AXIS_##axis, 4, (INT32)((altaxis) * 65536.0f), 20), \
|
||||
TOKEN_UINT64_PACK2((INT32)((scale) * 65536.0f), 32, (INT32)((offset) * 65536.0f), 32),
|
||||
curfield->crossaxis = CROSSHAIR_AXIS_##axis; \
|
||||
curfield->crossaltaxis = altaxis; \
|
||||
curfield->crossscale = scale; \
|
||||
curfield->crossoffset = offset;
|
||||
|
||||
#define PORT_CROSSHAIR_MAPPER(_callback) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_CROSSHAIR_MAPPER, 8), \
|
||||
TOKEN_PTR(crossmapptr, _callback),
|
||||
curfield->crossmapper = _callback;
|
||||
|
||||
/* how many optical counts for 1 full turn of the control */
|
||||
#define PORT_FULL_TURN_COUNT(_count) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_FULL_TURN_COUNT, 8, _count, 24),
|
||||
curfield->full_turn_count = _count;
|
||||
|
||||
/* positional controls can be binary or 1 of X */
|
||||
/* 1 of X not completed yet */
|
||||
/* if it is specified as PORT_REMAP_TABLE then it is binary, but remapped */
|
||||
/* otherwise it is binary */
|
||||
#define PORT_POSITIONS(_positions) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_POSITIONS, 8, _positions, 24),
|
||||
curfield->max = _positions;
|
||||
|
||||
/* positional control wraps at min/max */
|
||||
#define PORT_WRAPS \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_WRAPS, 8),
|
||||
curfield->flags |= ANALOG_FLAG_WRAPS;
|
||||
|
||||
/* positional control uses this remap table */
|
||||
#define PORT_REMAP_TABLE(_table) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_REMAP_TABLE, 8), \
|
||||
TOKEN_PTR(ui32ptr, _table),
|
||||
curfield->remap_table = _table;
|
||||
|
||||
/* positional control bits are active low */
|
||||
#define PORT_INVERT \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_INVERT, 8),
|
||||
curfield->flags |= ANALOG_FLAG_INVERT;
|
||||
|
||||
/* custom callbacks */
|
||||
/* read callbacks */
|
||||
#define PORT_CUSTOM(_callback, _param) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_CUSTOM, 8), \
|
||||
TOKEN_PTR(customptr, _callback), \
|
||||
TOKEN_PTR(voidptr, _param),
|
||||
curfield->read = _callback; \
|
||||
curfield->read_param = (void *)(_param); \
|
||||
curfield->read_device = NULL;
|
||||
|
||||
/* changed callbacks */
|
||||
/* write callbacks */
|
||||
#define PORT_CHANGED(_callback, _param) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_CHANGED, 8), \
|
||||
TOKEN_PTR(changedptr, _callback), \
|
||||
TOKEN_PTR(voidptr, _param),
|
||||
curfield->write = _callback; \
|
||||
curfield->write_param = (void *)(_param); \
|
||||
curfield->write_device = NULL;
|
||||
|
||||
/* input device handler */
|
||||
#define PORT_READ_LINE_DEVICE(_device, _read_line_device) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_READ_LINE_DEVICE, 8), \
|
||||
TOKEN_STRING(_device), \
|
||||
TOKEN_PTR(read_line_device, _read_line_device),
|
||||
curfield->read = &ioport_read_line_wrapper<_read_line_device>; \
|
||||
curfield->read_param = NULL; \
|
||||
curfield->read_device = _device;
|
||||
|
||||
/* output device handler */
|
||||
#define PORT_WRITE_LINE_DEVICE(_device, _write_line_device) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_WRITE_LINE_DEVICE, 8), \
|
||||
TOKEN_STRING(_device), \
|
||||
TOKEN_PTR(write_line_device, _write_line_device),
|
||||
curfield->write = &ioport_write_line_wrapper<_write_line_device>; \
|
||||
curfield->write_param = NULL; \
|
||||
curfield->write_device = _device;
|
||||
|
||||
/* dip switch definition */
|
||||
#define PORT_DIPNAME(_mask, _default, _name) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_DIPNAME, 8), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
curfield = ioconfig_alloc_field(*curport, IPT_DIPSWITCH, (_default), (_mask), (_name)); \
|
||||
cursetting = NULL;
|
||||
|
||||
#define PORT_DIPSETTING(_default, _name) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_DIPSETTING, 8, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name));
|
||||
|
||||
/* physical location, of the form: name:[!]sw,[name:][!]sw,... */
|
||||
/* note that these are specified LSB-first */
|
||||
#define PORT_DIPLOCATION(_location) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_DIPLOCATION, 8), \
|
||||
TOKEN_STRING(_location),
|
||||
diplocation_list_alloc(*curfield, _location, errorbuf);
|
||||
|
||||
/* conditionals for dip switch settings */
|
||||
#define PORT_CONDITION(_tag, _mask, _condition, _value) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_CONDITION, 8, _condition, 24), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _value, 32), \
|
||||
TOKEN_STRING(_tag),
|
||||
{ \
|
||||
input_condition &condition = (cursetting != NULL) ? cursetting->condition : curfield->condition; \
|
||||
condition.tag = (_tag); \
|
||||
condition.mask = (_mask); \
|
||||
condition.condition = (_condition); \
|
||||
condition.value = (_value); \
|
||||
}
|
||||
|
||||
/* analog adjuster definition */
|
||||
#define PORT_ADJUSTER(_default, _name) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_ADJUSTER, 8, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
curfield = ioconfig_alloc_field(*curport, IPT_ADJUSTER, (_default), 0xff, (_name)); \
|
||||
cursetting = NULL; \
|
||||
|
||||
/* config definition */
|
||||
#define PORT_CONFNAME(_mask, _default, _name) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_CONFNAME, 8), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
curfield = ioconfig_alloc_field(*curport, IPT_CONFIG, (_default), (_mask), (_name)); \
|
||||
cursetting = NULL; \
|
||||
|
||||
#define PORT_CONFSETTING(_default, _name) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_CONFSETTING, 8, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name));
|
||||
|
||||
/* keyboard chars */
|
||||
#define PORT_CHAR(_ch) \
|
||||
TOKEN_UINT64_PACK2(INPUT_TOKEN_CHAR, 8, _ch, 32), \
|
||||
ioconfig_field_add_char(*curfield, _ch, errorbuf);
|
||||
|
||||
/* categories */
|
||||
#define PORT_CATEGORY(_category) \
|
||||
TOKEN_UINT32_PACK2(INPUT_TOKEN_CATEGORY, 8, _category, 24),
|
||||
curfield->category = (_category);
|
||||
|
||||
#define PORT_CATEGORY_CLASS(_mask, _default, _name) \
|
||||
TOKEN_UINT32_PACK1(INPUT_TOKEN_CATEGORY_NAME, 8), \
|
||||
TOKEN_UINT64_PACK2(_mask, 32, _default, 32), \
|
||||
TOKEN_STRING(_name),
|
||||
curfield = ioconfig_alloc_field(*curport, IPT_CATEGORY, (_default), (_mask), (_name)); \
|
||||
cursetting = NULL;
|
||||
|
||||
#define PORT_CATEGORY_ITEM(_default, _name, _category) \
|
||||
TOKEN_UINT64_PACK3(INPUT_TOKEN_CATEGORY_SETTING, 8, _default, 32, _category, 16), \
|
||||
TOKEN_STRING(_name),
|
||||
cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name)); \
|
||||
cursetting->category = (_category);
|
||||
|
||||
|
||||
/* name of table */
|
||||
@ -1085,14 +1070,14 @@ struct _inp_header
|
||||
/* ----- core system management ----- */
|
||||
|
||||
/* initialize the input ports, processing the given token list */
|
||||
time_t input_port_init(running_machine &machine, const device_list &devicelist);
|
||||
time_t input_port_init(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
/* ----- port configurations ----- */
|
||||
|
||||
/* initialize an input port list structure and allocate ports according to the given tokens */
|
||||
void input_port_list_init(ioport_list &portlist, const input_port_token *tokens, char *errorbuf, int errorbuflen, int allocmap, device_t *owner);
|
||||
void input_port_list_init(device_t &device, ioport_list &portlist, astring &errorbuf);
|
||||
|
||||
/* return the field that matches the given tag and mask */
|
||||
const input_field_config *input_field_by_tag_and_mask(const ioport_list &portlist, const char *tag, input_port_value mask);
|
||||
@ -1207,7 +1192,7 @@ void input_port_write_safe(running_machine &machine, const char *tag, input_port
|
||||
int input_condition_true(running_machine &machine, const input_condition *condition);
|
||||
|
||||
/* convert an input_port_token to a default string */
|
||||
const char *input_port_string_from_token(const input_port_token token);
|
||||
const char *input_port_string_from_token(const char *token);
|
||||
|
||||
/* return TRUE if machine use full keyboard emulation */
|
||||
int input_machine_has_keyboard(running_machine &machine);
|
||||
@ -1240,4 +1225,24 @@ int input_player_number(const input_field_config *field);
|
||||
int input_count_players(running_machine &machine);
|
||||
int input_category_active(running_machine &machine, int category);
|
||||
|
||||
|
||||
inline running_machine &input_field_config::machine() const
|
||||
{
|
||||
return m_port.machine();
|
||||
}
|
||||
|
||||
|
||||
// temporary construction helpers
|
||||
void field_config_insert(input_field_config &newfield, input_port_value &disallowedbits, astring &errorbuf);
|
||||
void diplocation_list_alloc(input_field_config &field, const char *location, astring &errorbuf);
|
||||
|
||||
|
||||
input_port_config *ioconfig_alloc_port(ioport_list &portlist, device_t &device, const char *tag);
|
||||
input_port_config *ioconfig_modify_port(ioport_list &portlist, device_t &device, const char *tag);
|
||||
input_field_config *ioconfig_alloc_field(input_port_config &port, int type, input_port_value defval, input_port_value mask, const char *name = NULL);
|
||||
input_field_config *ioconfig_alloc_onoff(input_port_config &port, const char *name, input_port_value defval, input_port_value mask, const char *diplocation, astring &errorbuf);
|
||||
input_setting_config *ioconfig_alloc_setting(input_field_config &field, input_port_value value, const char *name);
|
||||
void ioconfig_field_add_char(input_field_config &field, unicode_char ch, astring &errorbuf);
|
||||
void ioconfig_add_code(input_field_config &field, int which, input_code code);
|
||||
|
||||
#endif /* __INPTPORT_H__ */
|
||||
|
@ -279,7 +279,7 @@ void running_machine::start()
|
||||
// initialize the input system and input ports for the game
|
||||
// this must be done before memory_init in order to allow specifying
|
||||
// callbacks based on input port tags
|
||||
time_t newbase = input_port_init(*this, devicelist());
|
||||
time_t newbase = input_port_init(*this);
|
||||
if (newbase != 0)
|
||||
m_base_time = newbase;
|
||||
|
||||
@ -1145,7 +1145,7 @@ const rom_entry *driver_device::device_rom_region() const
|
||||
// game's input ports
|
||||
//-------------------------------------------------
|
||||
|
||||
const input_port_token *driver_device::device_input_ports() const
|
||||
ioport_constructor driver_device::device_input_ports() const
|
||||
{
|
||||
return m_system->ipt;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ protected:
|
||||
|
||||
// device-level overrides
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
virtual const input_port_token *device_input_ports() const;
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
|
@ -748,5 +748,5 @@ READ32_HANDLER( watchdog_reset32_r ) { watchdog_reset(space->machine()); return
|
||||
CUSTOM_INPUT( custom_port_read )
|
||||
{
|
||||
const char *tag = (const char *)param;
|
||||
return input_port_read(field->port->machine(), tag);
|
||||
return input_port_read(field->machine(), tag);
|
||||
}
|
||||
|
@ -4592,13 +4592,13 @@ void handler_entry_read::set_ioport(const input_port_config &ioport)
|
||||
{
|
||||
m_ioport = &ioport;
|
||||
if (m_datawidth == 8)
|
||||
set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport<UINT8>, ioport.tag, this));
|
||||
set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport<UINT8>, ioport.tag(), this));
|
||||
else if (m_datawidth == 16)
|
||||
set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport<UINT16>, ioport.tag, this));
|
||||
set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport<UINT16>, ioport.tag(), this));
|
||||
else if (m_datawidth == 32)
|
||||
set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport<UINT32>, ioport.tag, this));
|
||||
set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport<UINT32>, ioport.tag(), this));
|
||||
else if (m_datawidth == 64)
|
||||
set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport<UINT64>, ioport.tag, this));
|
||||
set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport<UINT64>, ioport.tag(), this));
|
||||
}
|
||||
|
||||
|
||||
@ -4919,13 +4919,13 @@ void handler_entry_write::set_ioport(const input_port_config &ioport)
|
||||
{
|
||||
m_ioport = &ioport;
|
||||
if (m_datawidth == 8)
|
||||
set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport<UINT8>, ioport.tag, this));
|
||||
set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport<UINT8>, ioport.tag(), this));
|
||||
else if (m_datawidth == 16)
|
||||
set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport<UINT16>, ioport.tag, this));
|
||||
set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport<UINT16>, ioport.tag(), this));
|
||||
else if (m_datawidth == 32)
|
||||
set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport<UINT32>, ioport.tag, this));
|
||||
set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport<UINT32>, ioport.tag(), this));
|
||||
else if (m_datawidth == 64)
|
||||
set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport<UINT64>, ioport.tag, this));
|
||||
set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport<UINT64>, ioport.tag(), this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,258 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
tokenize.h
|
||||
|
||||
Common definitions and macros for tokenizing definitions.
|
||||
|
||||
Copyright Nicola Salmoria and the MAME Team.
|
||||
Visit http://mamedev.org for licensing and usage restrictions.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __TOKENIZE_H__
|
||||
#define __TOKENIZE_H__
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
/* tokens per item */
|
||||
#define TOKENS_PER_PTR (1)
|
||||
#define TOKENS_PER_UINT32 (1)
|
||||
#define TOKENS_PER_UINT64 (8 / sizeof(FPTR))
|
||||
#define TOKENS_PER_ATTOTIME (TOKENS_PER_UINT32 + TOKENS_PER_UINT64)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
/* include this at the top of your union to get the standard fields */
|
||||
#define TOKEN_COMMON_FIELDS \
|
||||
FPTR i; \
|
||||
const char * stringptr; \
|
||||
const void * voidptr; \
|
||||
const UINT8 * ui8ptr; \
|
||||
const INT8 * i8ptr; \
|
||||
const UINT16 * ui16ptr; \
|
||||
const INT16 * i16ptr; \
|
||||
const UINT32 * ui32ptr; \
|
||||
const INT32 * i32ptr; \
|
||||
const UINT64 * ui64ptr; \
|
||||
const INT64 * i64ptr; \
|
||||
|
||||
|
||||
/* generic_token can be used when there are no particularly special types */
|
||||
typedef struct _generic_token generic_token;
|
||||
struct _generic_token
|
||||
{
|
||||
TOKEN_COMMON_FIELDS
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
MACROS
|
||||
***************************************************************************/
|
||||
|
||||
/* ----- compile-time token generation macros ----- */
|
||||
|
||||
/* GCC and C99 compilers can use designated initializers for type safety */
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 3) && !defined(__cplusplus)) || (defined(_STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define TOKEN_VALUE(field,a) { .field = (a) }
|
||||
#else
|
||||
#define TOKEN_VALUE(field,a) { (FPTR)(a) }
|
||||
#endif
|
||||
|
||||
/* token output primitives */
|
||||
/* note that regardless of the endianness, UINT64s are packed LSW first */
|
||||
#define TOKEN_PTR(field,p) TOKEN_VALUE(field, p)
|
||||
#define TOKEN_STRING(p) TOKEN_VALUE(stringptr, p)
|
||||
#define TOKEN_UINT32(a) TOKEN_VALUE(i, a)
|
||||
#ifdef PTR64
|
||||
#define TOKEN_UINT64(a) TOKEN_VALUE(i, a)
|
||||
#else
|
||||
#define TOKEN_UINT64(a) TOKEN_VALUE(i, (UINT32)(a)), TOKEN_VALUE(i, (UINT32)((a) >> 32))
|
||||
#endif
|
||||
|
||||
/* mask a value to a fixed number of bits and then shift it */
|
||||
#define SHIFT_AND_MASK32(val, bits, shift) (((UINT32)(val) & ((1 << (bits)) - 1)) << (shift))
|
||||
#define SHIFT_AND_MASK64(val, bits, shift) (((UINT64)(val) & (((UINT64)1 << (bits)) - 1)) << (shift))
|
||||
|
||||
/* 32-bit integer packing */
|
||||
#define TOKEN_UINT32_PACK1(val1, bits1) \
|
||||
TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0))
|
||||
|
||||
#define TOKEN_UINT32_PACK2(val1, bits1, val2, bits2) \
|
||||
TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK32((val2), (bits2), (bits1)))
|
||||
|
||||
#define TOKEN_UINT32_PACK3(val1, bits1, val2, bits2, val3, bits3) \
|
||||
TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK32((val2), (bits2), (bits1)) | \
|
||||
SHIFT_AND_MASK32((val3), (bits3), (bits1)+(bits2)))
|
||||
|
||||
#define TOKEN_UINT32_PACK4(val1, bits1, val2, bits2, val3, bits3, val4, bits4) \
|
||||
TOKEN_UINT32(SHIFT_AND_MASK32((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK32((val2), (bits2), (bits1)) | \
|
||||
SHIFT_AND_MASK32((val3), (bits3), (bits1)+(bits2)) | \
|
||||
SHIFT_AND_MASK32((val4), (bits4), (bits1)+(bits2)+(bits3)))
|
||||
|
||||
/* 64-bit integer packing */
|
||||
#define TOKEN_UINT64_PACK1(val1, bits1) \
|
||||
TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0))
|
||||
|
||||
#define TOKEN_UINT64_PACK2(val1, bits1, val2, bits2) \
|
||||
TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK64((val2), (bits2), (bits1)))
|
||||
|
||||
#define TOKEN_UINT64_PACK3(val1, bits1, val2, bits2, val3, bits3) \
|
||||
TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK64((val2), (bits2), (bits1)) | \
|
||||
SHIFT_AND_MASK64((val3), (bits3), (bits1)+(bits2)))
|
||||
|
||||
#define TOKEN_UINT64_PACK4(val1, bits1, val2, bits2, val3, bits3, val4, bits4) \
|
||||
TOKEN_UINT64(SHIFT_AND_MASK64((val1), (bits1), 0) | \
|
||||
SHIFT_AND_MASK64((val2), (bits2), (bits1)) | \
|
||||
SHIFT_AND_MASK64((val3), (bits3), (bits1)+(bits2)) | \
|
||||
SHIFT_AND_MASK64((val4), (bits4), (bits1)+(bits2)+(bits3)))
|
||||
|
||||
|
||||
|
||||
/* ----- run-time token extraction macros ----- */
|
||||
|
||||
/* token fetch and advance primitives */
|
||||
#define TOKEN_GET_PTR(tp,field) (((tp)++)->field)
|
||||
#define TOKEN_GET_STRING(tp) (((tp)++)->stringptr)
|
||||
#define TOKEN_GET_UINT32(tp) (((tp)++)->i)
|
||||
#ifdef PTR64
|
||||
#define TOKEN_EXTRACT_UINT64(tp,a) do { (a) = (tp)->i; (tp)++; } while (0)
|
||||
#else
|
||||
#define TOKEN_EXTRACT_UINT64(tp,a) do { (a) = (tp)[0].i | ((UINT64)(tp)[1].i << 32); (tp) += 2; } while (0)
|
||||
#endif
|
||||
|
||||
/* token unfetch primitives */
|
||||
#define TOKEN_UNGET_PTR(tp) ((tp)--)
|
||||
#define TOKEN_UNGET_STRING(tp) ((tp)--)
|
||||
#define TOKEN_UNGET_UINT32(tp) ((tp)--)
|
||||
#define TOKEN_UNGET_UINT64(tp) ((tp) -= 8 / sizeof(FPTR))
|
||||
|
||||
/* token skip primitives */
|
||||
#define TOKEN_SKIP_PTR(tp) ((tp)++)
|
||||
#define TOKEN_SKIP_STRING(tp) ((tp)++)
|
||||
#define TOKEN_SKIP_UINT32(tp) ((tp)++)
|
||||
#define TOKEN_SKIP_UINT64(tp) ((tp) += 8 / sizeof(FPTR))
|
||||
|
||||
/* extract a value from a fixed number of bits; if bits is negative, treat it as a signed value */
|
||||
#define UNSHIFT_AND_MASK32(src, val, bits, shift) do { \
|
||||
if ((bits) < 0) \
|
||||
(val) = token_sign_extend32((src) >> (shift), (UINT8)-(bits)); \
|
||||
else \
|
||||
(val) = token_zero_extend32((src) >> (shift), (UINT8)(bits)); \
|
||||
} while (0)
|
||||
|
||||
#define UNSHIFT_AND_MASK64(src, val, bits, shift) do { \
|
||||
if ((bits) < 0) \
|
||||
(val) = token_sign_extend64((src) >> (shift), (UINT8)-(bits)); \
|
||||
else \
|
||||
(val) = token_zero_extend64((src) >> (shift), (UINT8)(bits)); \
|
||||
} while (0)
|
||||
|
||||
/* cheesy inline absolute value */
|
||||
#define TOKENABS(v) (((v) < 0) ? -(v) : (v))
|
||||
|
||||
/* 32-bit integer unpacking */
|
||||
#define TOKEN_GET_UINT32_UNPACK1(tp, val1, bits1) do { \
|
||||
UINT32 token32 = TOKEN_GET_UINT32(tp); \
|
||||
UNSHIFT_AND_MASK32(token32, val1, (bits1), 0); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT32_UNPACK2(tp, val1, bits1, val2, bits2) do { \
|
||||
UINT32 token32 = TOKEN_GET_UINT32(tp); \
|
||||
UINT8 shift = 0; \
|
||||
UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT32_UNPACK3(tp, val1, bits1, val2, bits2, val3, bits3) do { \
|
||||
UINT32 token32 = TOKEN_GET_UINT32(tp); \
|
||||
UINT8 shift = 0; \
|
||||
UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); shift += TOKENABS(bits2); \
|
||||
UNSHIFT_AND_MASK32(token32, val3, (bits3), shift); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT32_UNPACK4(tp, val1, bits1, val2, bits2, val3, bits3, val4, bits4) do { \
|
||||
UINT32 token32 = TOKEN_GET_UINT32(tp); \
|
||||
UINT8 shift = 0; \
|
||||
UNSHIFT_AND_MASK32(token32, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK32(token32, val2, (bits2), shift); shift += TOKENABS(bits2); \
|
||||
UNSHIFT_AND_MASK32(token32, val3, (bits3), shift); shift += TOKENABS(bits3); \
|
||||
UNSHIFT_AND_MASK32(token32, val4, (bits4), shift); \
|
||||
} while (0)
|
||||
|
||||
/* 64-bit integer unpacking */
|
||||
#define TOKEN_GET_UINT64_UNPACK1(tp, val1, bits1) do { \
|
||||
UINT64 token64; \
|
||||
TOKEN_EXTRACT_UINT64(tp, token64); \
|
||||
UNSHIFT_AND_MASK64(token64, val1, (bits1), 0); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT64_UNPACK2(tp, val1, bits1, val2, bits2) do { \
|
||||
UINT64 token64; \
|
||||
UINT8 shift = 0; \
|
||||
TOKEN_EXTRACT_UINT64(tp, token64); \
|
||||
UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT64_UNPACK3(tp, val1, bits1, val2, bits2, val3, bits3) do { \
|
||||
UINT64 token64; \
|
||||
UINT8 shift = 0; \
|
||||
TOKEN_EXTRACT_UINT64(tp, token64); \
|
||||
UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); shift += TOKENABS(bits2); \
|
||||
UNSHIFT_AND_MASK64(token64, val3, (bits3), shift); \
|
||||
} while (0)
|
||||
|
||||
#define TOKEN_GET_UINT64_UNPACK4(tp, val1, bits1, val2, bits2, val3, bits3, val4, bits4) do { \
|
||||
UINT64 token64; \
|
||||
UINT8 shift = 0; \
|
||||
TOKEN_EXTRACT_UINT64(tp, token64); \
|
||||
UNSHIFT_AND_MASK64(token64, val1, (bits1), shift); shift += TOKENABS(bits1); \
|
||||
UNSHIFT_AND_MASK64(token64, val2, (bits2), shift); shift += TOKENABS(bits2); \
|
||||
UNSHIFT_AND_MASK64(token64, val3, (bits3), shift); shift += TOKENABS(bits3); \
|
||||
UNSHIFT_AND_MASK64(token64, val4, (bits4), shift); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
INLINE UINT32 token_zero_extend32(UINT32 val, UINT8 bits)
|
||||
{
|
||||
return val & (((UINT32)1 << bits) - 1);
|
||||
}
|
||||
|
||||
INLINE INT32 token_sign_extend32(UINT32 val, UINT8 bits)
|
||||
{
|
||||
return (INT32)(val << (32 - bits)) >> (32 - bits);
|
||||
}
|
||||
|
||||
INLINE UINT64 token_zero_extend64(UINT64 val, UINT8 bits)
|
||||
{
|
||||
return val & (((UINT64)1 << bits) - 1);
|
||||
}
|
||||
|
||||
INLINE INT64 token_sign_extend64(UINT64 val, UINT8 bits)
|
||||
{
|
||||
return (INT64)(val << (64 - bits)) >> (64 - bits);
|
||||
}
|
||||
|
||||
#endif
|
@ -1595,8 +1595,8 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
|
||||
|
||||
static slider_state *slider_init(running_machine &machine)
|
||||
{
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
input_field_config *field;
|
||||
input_port_config *port;
|
||||
device_t *device;
|
||||
slider_state *listhead = NULL;
|
||||
slider_state **tailptr = &listhead;
|
||||
@ -1625,7 +1625,7 @@ static slider_state *slider_init(running_machine &machine)
|
||||
|
||||
/* add analog adjusters */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->type == IPT_ADJUSTER)
|
||||
{
|
||||
void *param = (void *)field;
|
||||
@ -1730,7 +1730,7 @@ static slider_state *slider_init(running_machine &machine)
|
||||
#ifdef MAME_DEBUG
|
||||
/* add crosshair adjusters */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->crossaxis != CROSSHAIR_AXIS_NONE && field->player == 0)
|
||||
{
|
||||
void *param = (void *)field;
|
||||
|
@ -168,7 +168,7 @@ struct _input_item_data
|
||||
typedef struct _analog_item_data analog_item_data;
|
||||
struct _analog_item_data
|
||||
{
|
||||
const input_field_config *field;
|
||||
input_field_config *field;
|
||||
int type;
|
||||
int min, max;
|
||||
int cur;
|
||||
@ -327,10 +327,10 @@ static void menu_settings_custom_render(running_machine &machine, ui_menu *menu,
|
||||
to the default sequence for the given field
|
||||
-------------------------------------------------*/
|
||||
|
||||
INLINE const input_seq *get_field_default_seq(const input_field_config *field, input_seq_type seqtype)
|
||||
INLINE const input_seq *get_field_default_seq(input_field_config *field, input_seq_type seqtype)
|
||||
{
|
||||
if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT)
|
||||
return input_type_seq(field->port->machine(), field->type, field->player, seqtype);
|
||||
return input_type_seq(field->machine(), field->type, field->player, seqtype);
|
||||
else
|
||||
return &field->seq[seqtype];
|
||||
}
|
||||
@ -1625,8 +1625,8 @@ static void ui_menu_slot_devices(running_machine &machine, ui_menu *menu, void *
|
||||
|
||||
static void menu_main_populate(running_machine &machine, ui_menu *menu, void *state)
|
||||
{
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
input_field_config *field;
|
||||
input_port_config *port;
|
||||
int has_categories = FALSE;
|
||||
int has_configs = FALSE;
|
||||
int has_analog = FALSE;
|
||||
@ -1634,7 +1634,7 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
|
||||
|
||||
/* scan the input port array to see what options we need to enable */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
{
|
||||
if (field->type == IPT_DIPSWITCH)
|
||||
has_dips = TRUE;
|
||||
@ -1844,8 +1844,8 @@ static void menu_input_specific(running_machine &machine, ui_menu *menu, void *p
|
||||
static void menu_input_specific_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate)
|
||||
{
|
||||
input_item_data *itemlist = NULL;
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
input_field_config *field;
|
||||
input_port_config *port;
|
||||
int suborder[SEQ_TYPE_TOTAL];
|
||||
astring tempstring;
|
||||
|
||||
@ -1856,7 +1856,7 @@ static void menu_input_specific_populate(running_machine &machine, ui_menu *menu
|
||||
|
||||
/* iterate over the input ports and add menu items */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
{
|
||||
const char *name = input_field_name(field);
|
||||
|
||||
@ -1999,9 +1999,9 @@ static void menu_input_common(running_machine &machine, ui_menu *menu, void *par
|
||||
{
|
||||
input_field_user_settings settings;
|
||||
|
||||
input_field_get_user_settings((const input_field_config *)seqchangeditem->ref, &settings);
|
||||
input_field_get_user_settings((input_field_config *)seqchangeditem->ref, &settings);
|
||||
settings.seq[seqchangeditem->seqtype] = seqchangeditem->seq;
|
||||
input_field_set_user_settings((const input_field_config *)seqchangeditem->ref, &settings);
|
||||
input_field_set_user_settings((input_field_config *)seqchangeditem->ref, &settings);
|
||||
}
|
||||
|
||||
/* invalidate the menu to force an update */
|
||||
@ -2156,7 +2156,7 @@ static void menu_settings_common(running_machine &machine, ui_menu *menu, void *
|
||||
/* handle events */
|
||||
if (menu_event != NULL && menu_event->itemref != NULL)
|
||||
{
|
||||
const input_field_config *field = (const input_field_config *)menu_event->itemref;
|
||||
input_field_config *field = (input_field_config *)menu_event->itemref;
|
||||
input_field_user_settings settings;
|
||||
int changed = FALSE;
|
||||
|
||||
@ -2197,8 +2197,8 @@ static void menu_settings_common(running_machine &machine, ui_menu *menu, void *
|
||||
|
||||
static void menu_settings_populate(running_machine &machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type)
|
||||
{
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
input_field_config *field;
|
||||
input_port_config *port;
|
||||
dip_descriptor **diplist_tailptr;
|
||||
int dipcount = 0;
|
||||
|
||||
@ -2208,7 +2208,7 @@ static void menu_settings_populate(running_machine &machine, ui_menu *menu, sett
|
||||
|
||||
/* loop over input ports and set up the current values */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (field->type == type && input_condition_true(machine, &field->condition))
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
@ -2223,7 +2223,7 @@ static void menu_settings_populate(running_machine &machine, ui_menu *menu, sett
|
||||
ui_menu_item_append(menu, input_field_name(field), input_field_setting_name(field), flags, (void *)field);
|
||||
|
||||
/* for DIP switches, build up the model */
|
||||
if (type == IPT_DIPSWITCH && field->diploclist != NULL)
|
||||
if (type == IPT_DIPSWITCH && field->diploclist().count() != 0)
|
||||
{
|
||||
const input_field_diplocation *diploc;
|
||||
input_field_user_settings settings;
|
||||
@ -2233,7 +2233,7 @@ static void menu_settings_populate(running_machine &machine, ui_menu *menu, sett
|
||||
input_field_get_user_settings(field, &settings);
|
||||
|
||||
/* iterate over each bit in the field */
|
||||
for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next)
|
||||
for (diploc = field->diploclist().first(); diploc != NULL; diploc = diploc->next())
|
||||
{
|
||||
UINT32 mask = accummask & ~(accummask - 1);
|
||||
dip_descriptor *dip;
|
||||
@ -2279,7 +2279,7 @@ static void menu_settings_populate(running_machine &machine, ui_menu *menu, sett
|
||||
|
||||
static void menu_settings_custom_render(running_machine &machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
const input_field_config *field = (const input_field_config *)selectedref;
|
||||
input_field_config *field = (input_field_config *)selectedref;
|
||||
settings_menu_state *menustate = (settings_menu_state *)state;
|
||||
dip_descriptor *dip;
|
||||
|
||||
@ -2299,7 +2299,7 @@ static void menu_settings_custom_render(running_machine &machine, ui_menu *menu,
|
||||
|
||||
/* determine the mask of selected bits */
|
||||
if (field != NULL)
|
||||
for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next)
|
||||
for (diploc = field->diploclist().first(); diploc != NULL; diploc = diploc->next())
|
||||
if (strcmp(dip->name, diploc->swname) == 0)
|
||||
selectedmask |= 1 << (diploc->swnum - 1);
|
||||
|
||||
@ -2455,14 +2455,14 @@ static void menu_analog(running_machine &machine, ui_menu *menu, void *parameter
|
||||
|
||||
static void menu_analog_populate(running_machine &machine, ui_menu *menu)
|
||||
{
|
||||
const input_field_config *field;
|
||||
const input_port_config *port;
|
||||
input_field_config *field;
|
||||
input_port_config *port;
|
||||
astring subtext;
|
||||
astring text;
|
||||
|
||||
/* loop over input ports and add the items */
|
||||
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
if (input_type_is_analog(field->type) && input_condition_true(machine, &field->condition))
|
||||
{
|
||||
input_field_user_settings settings;
|
||||
|
@ -75,9 +75,7 @@ public:
|
||||
|
||||
INLINE const char *input_port_string_from_index(UINT32 index)
|
||||
{
|
||||
input_port_token token;
|
||||
token.i = index;
|
||||
return input_port_string_from_token(token);
|
||||
return input_port_string_from_token((const char *)index);
|
||||
}
|
||||
|
||||
|
||||
@ -741,7 +739,7 @@ static int get_defstr_index(int_map &defstr_map, const char *name, const game_dr
|
||||
analog input field
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void validate_analog_input_field(const input_field_config *field, const game_driver &driver, bool *error)
|
||||
static void validate_analog_input_field(input_field_config *field, const game_driver &driver, bool *error)
|
||||
{
|
||||
INT32 analog_max = field->max;
|
||||
INT32 analog_min = field->min;
|
||||
@ -850,7 +848,7 @@ static void validate_analog_input_field(const input_field_config *field, const g
|
||||
setting
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void validate_dip_settings(const input_field_config *field, const game_driver &driver, int_map &defstr_map, bool *error)
|
||||
static void validate_dip_settings(input_field_config *field, const game_driver &driver, int_map &defstr_map, bool *error)
|
||||
{
|
||||
const char *demo_sounds = input_port_string_from_index(INPUT_STRING_Demo_Sounds);
|
||||
const char *flipscreen = input_port_string_from_index(INPUT_STRING_Flip_Screen);
|
||||
@ -859,7 +857,7 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
||||
int coin_error = FALSE;
|
||||
|
||||
/* iterate through the settings */
|
||||
for (setting = field->settinglist; setting != NULL; setting = setting->next)
|
||||
for (setting = field->settinglist().first(); setting != NULL; setting = setting->next())
|
||||
{
|
||||
int strindex = get_defstr_index(defstr_map, setting->name, driver, error);
|
||||
|
||||
@ -889,9 +887,9 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
||||
}
|
||||
|
||||
/* if we have a neighbor, compare ourselves to him */
|
||||
if (setting->next != NULL)
|
||||
if (setting->next() != NULL)
|
||||
{
|
||||
int next_strindex = get_defstr_index(defstr_map, setting->next->name, driver, error);
|
||||
int next_strindex = get_defstr_index(defstr_map, setting->next()->name, driver, error);
|
||||
|
||||
/* check for inverted off/on dispswitch order */
|
||||
if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off)
|
||||
@ -916,9 +914,9 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
||||
|
||||
/* check for proper coin ordering */
|
||||
else if (strindex >= INPUT_STRING_9C_1C && strindex <= INPUT_STRING_1C_9C && next_strindex >= INPUT_STRING_9C_1C && next_strindex <= INPUT_STRING_1C_9C &&
|
||||
strindex >= next_strindex && memcmp(&setting->condition, &setting->next->condition, sizeof(setting->condition)) == 0)
|
||||
strindex >= next_strindex && memcmp(&setting->condition, &setting->next()->condition, sizeof(setting->condition)) == 0)
|
||||
{
|
||||
mame_printf_error("%s: %s has unsorted coinage %s > %s\n", driver.source_file, driver.name, setting->name, setting->next->name);
|
||||
mame_printf_error("%s: %s has unsorted coinage %s > %s\n", driver.source_file, driver.name, setting->name, setting->next()->name);
|
||||
coin_error = *error = true;
|
||||
}
|
||||
}
|
||||
@ -943,14 +941,14 @@ static void validate_dip_settings(const input_field_config *field, const game_dr
|
||||
|
||||
static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, ioport_list &portlist)
|
||||
{
|
||||
const input_port_config *scanport;
|
||||
const input_port_config *port;
|
||||
const input_field_config *field;
|
||||
input_port_config *scanport;
|
||||
input_port_config *port;
|
||||
input_field_config *field;
|
||||
const game_driver &driver = drivlist.driver();
|
||||
const machine_config &config = drivlist.config();
|
||||
int empty_string_found = FALSE;
|
||||
char errorbuf[1024];
|
||||
bool error = false;
|
||||
astring errorbuf;
|
||||
|
||||
/* skip if no ports */
|
||||
if (driver.ipt == NULL)
|
||||
@ -958,31 +956,29 @@ static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, io
|
||||
|
||||
/* allocate the input ports */
|
||||
for (device_t *cfg = config.devicelist().first(); cfg != NULL; cfg = cfg->next())
|
||||
if (cfg->input_ports() != NULL)
|
||||
{
|
||||
input_port_list_init(*cfg, portlist, errorbuf);
|
||||
if (errorbuf)
|
||||
{
|
||||
input_port_list_init(portlist, cfg->input_ports(), errorbuf, sizeof(errorbuf), FALSE, cfg);
|
||||
if (errorbuf[0] != 0)
|
||||
{
|
||||
mame_printf_error("%s: %s has input port errors:\n%s\n", driver.source_file, driver.name, errorbuf);
|
||||
error = true;
|
||||
}
|
||||
mame_printf_error("%s: %s has input port errors:\n%s\n", driver.source_file, driver.name, errorbuf.cstr());
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for duplicate tags */
|
||||
for (port = portlist.first(); port != NULL; port = port->next())
|
||||
if (port->tag != NULL)
|
||||
for (scanport = port->next(); scanport != NULL; scanport = scanport->next())
|
||||
if (scanport->tag != NULL && strcmp(port->tag, scanport->tag) == 0)
|
||||
{
|
||||
mame_printf_error("%s: %s has a duplicate input port tag '%s'\n", driver.source_file, driver.name, port->tag);
|
||||
error = true;
|
||||
}
|
||||
for (scanport = port->next(); scanport != NULL; scanport = scanport->next())
|
||||
if (strcmp(port->tag(), scanport->tag()) == 0)
|
||||
{
|
||||
mame_printf_error("%s: %s has a duplicate input port tag '%s'\n", driver.source_file, driver.name, port->tag());
|
||||
error = true;
|
||||
}
|
||||
|
||||
/* iterate over the results */
|
||||
for (port = portlist.first(); port != NULL; port = port->next())
|
||||
for (field = port->fieldlist; field != NULL; field = field->next)
|
||||
for (field = port->fieldlist().first(); field != NULL; field = field->next())
|
||||
{
|
||||
const input_setting_config *setting;
|
||||
input_setting_config *setting;
|
||||
//int strindex = 0;
|
||||
|
||||
/* verify analog inputs */
|
||||
@ -1043,7 +1039,7 @@ static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, io
|
||||
{
|
||||
/* find a matching port */
|
||||
for (scanport = portlist.first(); scanport != NULL; scanport = scanport->next())
|
||||
if (scanport->tag != NULL && strcmp(field->condition.tag, scanport->tag) == 0)
|
||||
if (strcmp(field->condition.tag, scanport->tag()) == 0)
|
||||
break;
|
||||
|
||||
/* if none, error */
|
||||
@ -1055,12 +1051,12 @@ static bool validate_inputs(driver_enumerator &drivlist, int_map &defstr_map, io
|
||||
}
|
||||
|
||||
/* verify conditions on the settings */
|
||||
for (setting = field->settinglist; setting != NULL; setting = setting->next)
|
||||
for (setting = field->settinglist().first(); setting != NULL; setting = setting->next())
|
||||
if (setting->condition.tag != NULL)
|
||||
{
|
||||
/* find a matching port */
|
||||
for (scanport = portlist.first(); scanport != NULL; scanport = scanport->next())
|
||||
if (scanport->tag != NULL && strcmp(setting->condition.tag, scanport->tag) == 0)
|
||||
if (strcmp(setting->condition.tag, scanport->tag()) == 0)
|
||||
break;
|
||||
|
||||
/* if none, error */
|
||||
|
@ -24,7 +24,7 @@ WRITE8_HANDLER( cchasm_reset_coin_flag_w )
|
||||
|
||||
INPUT_CHANGED( cchasm_set_coin_flag )
|
||||
{
|
||||
cchasm_state *state = field->port->machine().driver_data<cchasm_state>();
|
||||
cchasm_state *state = field->machine().driver_data<cchasm_state>();
|
||||
if (!newval && !state->m_coin_flag)
|
||||
{
|
||||
state->m_coin_flag = 1;
|
||||
|
@ -177,6 +177,6 @@ READ8_HANDLER( gorf_speech_r )
|
||||
|
||||
CUSTOM_INPUT( gorf_speech_status_r )
|
||||
{
|
||||
device_t *samples = field->port->machine().device("samples");
|
||||
device_t *samples = field->machine().device("samples");
|
||||
return !sample_playing(samples, 0);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ static WRITE8_HANDLER( nmi_rate_w )
|
||||
|
||||
static CUSTOM_INPUT( speech_drq_custom_r )
|
||||
{
|
||||
return sp0250_drq_r(field->port->machine().device("spsnd"));
|
||||
return sp0250_drq_r(field->machine().device("spsnd"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ static READ8_HANDLER( audio_latch_r )
|
||||
|
||||
CUSTOM_INPUT( jedi_audio_comm_stat_r )
|
||||
{
|
||||
jedi_state *state = field->port->machine().driver_data<jedi_state>();
|
||||
jedi_state *state = field->machine().driver_data<jedi_state>();
|
||||
return *state->m_audio_comm_stat >> 6;
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,6 @@ READ8_HANDLER( wow_speech_r )
|
||||
|
||||
CUSTOM_INPUT( wow_speech_status_r )
|
||||
{
|
||||
device_t *samples = field->port->machine().device("samples");
|
||||
device_t *samples = field->machine().device("samples");
|
||||
return !sample_playing(samples, 0);
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ MACHINE_CONFIG_END
|
||||
|
||||
static CUSTOM_INPUT( sflush_80_r )
|
||||
{
|
||||
return (field->port->machine().primary_screen->vpos() & 0x80) ? 1 : 0;
|
||||
return (field->machine().primary_screen->vpos() & 0x80) ? 1 : 0;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( sflush_map, AS_PROGRAM, 8 )
|
||||
|
@ -168,9 +168,9 @@ static CUSTOM_INPUT( sidewndr_payout_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0x01:
|
||||
return ((input_port_read(field->port->machine(), "PAYOUT") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "PAYOUT") & bit_mask) >> 0);
|
||||
case 0x02:
|
||||
return ((input_port_read(field->port->machine(), "PAYOUT") & bit_mask) >> 1);
|
||||
return ((input_port_read(field->machine(), "PAYOUT") & bit_mask) >> 1);
|
||||
default:
|
||||
logerror("sidewndr_payout_r : invalid %02X bit_mask\n",bit_mask);
|
||||
return 0;
|
||||
@ -184,13 +184,13 @@ static CUSTOM_INPUT( starspnr_coinage_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0x01:
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
case 0x02:
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 1);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 1);
|
||||
case 0x04:
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 2);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 2);
|
||||
case 0x08:
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 3);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 3);
|
||||
default:
|
||||
logerror("starspnr_coinage_r : invalid %02X bit_mask\n",bit_mask);
|
||||
return 0;
|
||||
@ -204,11 +204,11 @@ static CUSTOM_INPUT( starspnr_payout_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0x01:
|
||||
return ((input_port_read(field->port->machine(), "PAYOUT") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "PAYOUT") & bit_mask) >> 0);
|
||||
case 0x02:
|
||||
return ((input_port_read(field->port->machine(), "PAYOUT") & bit_mask) >> 1);
|
||||
return ((input_port_read(field->machine(), "PAYOUT") & bit_mask) >> 1);
|
||||
case 0x04:
|
||||
return ((input_port_read(field->port->machine(), "PAYOUT") & bit_mask) >> 2);
|
||||
return ((input_port_read(field->machine(), "PAYOUT") & bit_mask) >> 2);
|
||||
default:
|
||||
logerror("starspnr_payout_r : invalid %02X bit_mask\n",bit_mask);
|
||||
return 0;
|
||||
|
@ -185,30 +185,30 @@ static void alg_potgo_w(running_machine &machine, UINT16 data)
|
||||
|
||||
static CUSTOM_INPUT( lightgun_pos_r )
|
||||
{
|
||||
alg_state *state = field->port->machine().driver_data<alg_state>();
|
||||
alg_state *state = field->machine().driver_data<alg_state>();
|
||||
int x = 0, y = 0;
|
||||
|
||||
/* get the position based on the input select */
|
||||
get_lightgun_pos(*field->port->machine().primary_screen, state->m_input_select, &x, &y);
|
||||
get_lightgun_pos(*field->machine().primary_screen, state->m_input_select, &x, &y);
|
||||
return (y << 8) | (x >> 2);
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( lightgun_trigger_r )
|
||||
{
|
||||
alg_state *state = field->port->machine().driver_data<alg_state>();
|
||||
alg_state *state = field->machine().driver_data<alg_state>();
|
||||
|
||||
/* read the trigger control based on the input select */
|
||||
return (input_port_read(field->port->machine(), "TRIGGERS") >> state->m_input_select) & 1;
|
||||
return (input_port_read(field->machine(), "TRIGGERS") >> state->m_input_select) & 1;
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( lightgun_holster_r )
|
||||
{
|
||||
alg_state *state = field->port->machine().driver_data<alg_state>();
|
||||
alg_state *state = field->machine().driver_data<alg_state>();
|
||||
|
||||
/* read the holster control based on the input select */
|
||||
return (input_port_read(field->port->machine(), "TRIGGERS") >> (2 + state->m_input_select)) & 1;
|
||||
return (input_port_read(field->machine(), "TRIGGERS") >> (2 + state->m_input_select)) & 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,7 +157,7 @@ static WRITE8_DEVICE_HANDLER( arcadia_cia_0_portb_w )
|
||||
static CUSTOM_INPUT( coin_counter_r )
|
||||
{
|
||||
int coin = (FPTR)param;
|
||||
UINT8 *coin_counter = field->port->machine().driver_data<arcadia_state>()->coin_counter;
|
||||
UINT8 *coin_counter = field->machine().driver_data<arcadia_state>()->coin_counter;
|
||||
|
||||
/* return coin counter values */
|
||||
return coin_counter[coin] & 3;
|
||||
@ -167,7 +167,7 @@ static CUSTOM_INPUT( coin_counter_r )
|
||||
static INPUT_CHANGED( coin_changed_callback )
|
||||
{
|
||||
int coin = (FPTR)param;
|
||||
UINT8 *coin_counter = field->port->machine().driver_data<arcadia_state>()->coin_counter;
|
||||
UINT8 *coin_counter = field->machine().driver_data<arcadia_state>()->coin_counter;
|
||||
|
||||
/* check for a 0 -> 1 transition */
|
||||
if (!oldval && newval && coin_counter[coin] < 3)
|
||||
|
@ -387,7 +387,7 @@ static void stonebal_protection(running_machine &machine)
|
||||
|
||||
static CUSTOM_INPUT( prot_r )
|
||||
{
|
||||
artmagic_state *state = field->port->machine().driver_data<artmagic_state>();
|
||||
artmagic_state *state = field->machine().driver_data<artmagic_state>();
|
||||
return state->m_prot_output_bit;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( clock_r )
|
||||
{
|
||||
return (field->port->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
return (field->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( asteroid )
|
||||
|
@ -275,7 +275,7 @@ static MACHINE_RESET( spaceint )
|
||||
|
||||
static INPUT_CHANGED( spaceint_coin_inserted )
|
||||
{
|
||||
astinvad_state *state = field->port->machine().driver_data<astinvad_state>();
|
||||
astinvad_state *state = field->machine().driver_data<astinvad_state>();
|
||||
/* coin insertion causes an NMI */
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
@ -259,9 +259,9 @@ static WRITE8_HANDLER( seawolf2_sound_2_w ) // Port 41
|
||||
|
||||
static CUSTOM_INPUT( ebases_trackball_r )
|
||||
{
|
||||
astrocde_state *state = field->port->machine().driver_data<astrocde_state>();
|
||||
astrocde_state *state = field->machine().driver_data<astrocde_state>();
|
||||
static const char *const names[] = { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" };
|
||||
return input_port_read(field->port->machine(), names[state->m_input_select]);
|
||||
return input_port_read(field->machine(), names[state->m_input_select]);
|
||||
}
|
||||
|
||||
|
||||
@ -487,9 +487,9 @@ static READ8_HANDLER( demndrgn_io_r )
|
||||
|
||||
static CUSTOM_INPUT( demndragn_joystick_r )
|
||||
{
|
||||
astrocde_state *state = field->port->machine().driver_data<astrocde_state>();
|
||||
astrocde_state *state = field->machine().driver_data<astrocde_state>();
|
||||
static const char *const names[] = { "MOVEX", "MOVEY" };
|
||||
return input_port_read(field->port->machine(), names[state->m_input_select]);
|
||||
return input_port_read(field->machine(), names[state->m_input_select]);
|
||||
}
|
||||
|
||||
|
||||
@ -841,7 +841,7 @@ INPUT_PORTS_END
|
||||
|
||||
static INPUT_CHANGED( spacezap_monitor )
|
||||
{
|
||||
astrocde_state *state = field->port->machine().driver_data<astrocde_state>();
|
||||
astrocde_state *state = field->machine().driver_data<astrocde_state>();
|
||||
if (newval)
|
||||
state->m_video_config &= ~AC_MONITOR_BW;
|
||||
else
|
||||
|
@ -90,8 +90,8 @@ ADDRESS_MAP_END
|
||||
static INPUT_CHANGED( set_write_protect ) // run when RAM expansion write protect switch is changed
|
||||
{
|
||||
int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
|
||||
address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *expram = ram_get_ptr(field->port->machine().device("ram_tag"));
|
||||
address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *expram = ram_get_ptr(field->machine().device("ram_tag"));
|
||||
|
||||
get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference
|
||||
|
||||
|
@ -104,17 +104,17 @@ static TIMER_DEVICE_CALLBACK( irq_callback )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
astrof_state *state = field->port->machine().driver_data<astrof_state>();
|
||||
astrof_state *state = field->machine().driver_data<astrof_state>();
|
||||
|
||||
/* coin insertion causes an NMI */
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
coin_counter_w(field->port->machine(), 0, newval);
|
||||
coin_counter_w(field->machine(), 0, newval);
|
||||
}
|
||||
|
||||
|
||||
static INPUT_CHANGED( service_coin_inserted )
|
||||
{
|
||||
astrof_state *state = field->port->machine().driver_data<astrof_state>();
|
||||
astrof_state *state = field->machine().driver_data<astrof_state>();
|
||||
|
||||
/* service coin insertion causes an NMI */
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
@ -123,7 +123,7 @@ static INPUT_CHANGED( service_coin_inserted )
|
||||
|
||||
static CUSTOM_INPUT( astrof_p1_controls_r )
|
||||
{
|
||||
return input_port_read(field->port->machine(), "P1");
|
||||
return input_port_read(field->machine(), "P1");
|
||||
}
|
||||
|
||||
|
||||
@ -134,10 +134,10 @@ static CUSTOM_INPUT( astrof_p2_controls_r )
|
||||
/* on an upright cabinet, a single set of controls
|
||||
is connected to both sets of pins on the edge
|
||||
connector */
|
||||
if (input_port_read(field->port->machine(), "CAB"))
|
||||
ret = input_port_read(field->port->machine(), "P2");
|
||||
if (input_port_read(field->machine(), "CAB"))
|
||||
ret = input_port_read(field->machine(), "P2");
|
||||
else
|
||||
ret = input_port_read(field->port->machine(), "P1");
|
||||
ret = input_port_read(field->machine(), "P1");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -146,16 +146,16 @@ static CUSTOM_INPUT( astrof_p2_controls_r )
|
||||
static CUSTOM_INPUT( tomahawk_controls_r )
|
||||
{
|
||||
UINT32 ret;
|
||||
astrof_state *state = field->port->machine().driver_data<astrof_state>();
|
||||
astrof_state *state = field->machine().driver_data<astrof_state>();
|
||||
|
||||
/* on a cocktail cabinet, two sets of controls are
|
||||
multiplexed on a single set of inputs
|
||||
(not verified on pcb) */
|
||||
|
||||
if (state->m_flipscreen)
|
||||
ret = input_port_read(field->port->machine(), "P2");
|
||||
ret = input_port_read(field->machine(), "P2");
|
||||
else
|
||||
ret = input_port_read(field->port->machine(), "P1");
|
||||
ret = input_port_read(field->machine(), "P1");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@ static INTERRUPT_GEN( battlex_interrupt )
|
||||
|
||||
static CUSTOM_INPUT( battlex_in0_b4_r )
|
||||
{
|
||||
battlex_state *state = field->port->machine().driver_data<battlex_state>();
|
||||
battlex_state *state = field->machine().driver_data<battlex_state>();
|
||||
UINT32 ret = state->m_in0_b4;
|
||||
if (state->m_in0_b4)
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", 0, CLEAR_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", 0, CLEAR_LINE);
|
||||
state->m_in0_b4 = 0;
|
||||
}
|
||||
|
||||
|
@ -2864,7 +2864,7 @@ static ADDRESS_MAP_START( memmap_sc2_dm01, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x8000, 0xFFFF) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
#ifdef UNREFERENCED_CODE
|
||||
static INPUT_PORTS_START( scorpion2 )
|
||||
PORT_START("COINS")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(3)
|
||||
@ -3008,6 +3008,7 @@ static INPUT_PORTS_START( scorpion2 )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
|
||||
INPUT_PORTS_END
|
||||
#endif
|
||||
|
||||
static INPUT_PORTS_START( bbrkfst )
|
||||
PORT_START("COINS")
|
||||
|
@ -92,7 +92,7 @@ static WRITE8_HANDLER( brkthru_soundlatch_w )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
brkthru_state *state = field->port->machine().driver_data<brkthru_state>();
|
||||
brkthru_state *state = field->machine().driver_data<brkthru_state>();
|
||||
/* coin insertion causes an IRQ */
|
||||
device_set_input_line(state->m_maincpu, 0, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_irq_hi )
|
||||
{
|
||||
btime_state *state = field->port->machine().driver_data<btime_state>();
|
||||
btime_state *state = field->machine().driver_data<btime_state>();
|
||||
|
||||
if (newval)
|
||||
device_set_input_line(state->m_maincpu, 0, HOLD_LINE);
|
||||
@ -533,7 +533,7 @@ static INPUT_CHANGED( coin_inserted_irq_hi )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_irq_lo )
|
||||
{
|
||||
btime_state *state = field->port->machine().driver_data<btime_state>();
|
||||
btime_state *state = field->machine().driver_data<btime_state>();
|
||||
|
||||
if (!newval)
|
||||
device_set_input_line(state->m_maincpu, 0, HOLD_LINE);
|
||||
@ -541,7 +541,7 @@ static INPUT_CHANGED( coin_inserted_irq_lo )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_nmi_lo )
|
||||
{
|
||||
btime_state *state = field->port->machine().driver_data<btime_state>();
|
||||
btime_state *state = field->machine().driver_data<btime_state>();
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,13 @@ READ16_MEMBER( btoads_state::main_sound_r )
|
||||
|
||||
CUSTOM_INPUT( btoads_state::static_main_to_sound_r )
|
||||
{
|
||||
return field->port->machine().driver_data<btoads_state>()->m_main_to_sound_ready;
|
||||
return field->machine().driver_data<btoads_state>()->m_main_to_sound_ready;
|
||||
}
|
||||
|
||||
|
||||
CUSTOM_INPUT( btoads_state::static_sound_to_main_r )
|
||||
{
|
||||
return field->port->machine().driver_data<btoads_state>()->m_sound_to_main_ready;
|
||||
return field->machine().driver_data<btoads_state>()->m_sound_to_main_ready;
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,7 +316,7 @@ static READ8_HANDLER( spacduel_IN3_r )
|
||||
|
||||
static CUSTOM_INPUT( clock_r )
|
||||
{
|
||||
return (field->port->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
return (field->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,12 +200,12 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( tilt_pressed )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", M6809_FIRQ_LINE, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", M6809_FIRQ_LINE, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( bwing )
|
||||
|
@ -258,7 +258,7 @@ static INTERRUPT_GEN( bzone_interrupt )
|
||||
|
||||
static CUSTOM_INPUT( clock_r )
|
||||
{
|
||||
return (field->port->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
return (field->machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1024,6 +1024,7 @@ static INPUT_PORTS_START( stand903 )
|
||||
PORT_DIPSETTING( 0x00, "50Hz." )
|
||||
INPUT_PORTS_END
|
||||
|
||||
#ifdef UNREFERENCED_CODE
|
||||
static INPUT_PORTS_START( stand904 )
|
||||
PORT_START("IN0-0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("0-1") PORT_CODE(KEYCODE_1)
|
||||
@ -1128,6 +1129,7 @@ static INPUT_PORTS_START( stand904 )
|
||||
PORT_DIPSETTING( 0x80, "60Hz." )
|
||||
PORT_DIPSETTING( 0x00, "50Hz." )
|
||||
INPUT_PORTS_END
|
||||
#endif
|
||||
|
||||
static INPUT_PORTS_START( stand905 )
|
||||
PORT_START("IN0-0")
|
||||
|
@ -692,7 +692,7 @@ static WRITE16_DEVICE_HANDLER( korokoro_eeprom_msb_w )
|
||||
|
||||
static CUSTOM_INPUT( korokoro_hopper_r )
|
||||
{
|
||||
cave_state *state = field->port->machine().driver_data<cave_state>();
|
||||
cave_state *state = field->machine().driver_data<cave_state>();
|
||||
return state->m_hopper ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -928,8 +928,8 @@ static WRITE16_HANDLER( tjumpman_leds_w )
|
||||
|
||||
static CUSTOM_INPUT( tjumpman_hopper_r )
|
||||
{
|
||||
cave_state *state = field->port->machine().driver_data<cave_state>();
|
||||
return (state->m_hopper && !(field->port->machine().primary_screen->frame_number() % 10)) ? 0 : 1;
|
||||
cave_state *state = field->machine().driver_data<cave_state>();
|
||||
return (state->m_hopper && !(field->machine().primary_screen->frame_number() % 10)) ? 0 : 1;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( tjumpman_map, AS_PROGRAM, 16 )
|
||||
|
@ -173,8 +173,8 @@ static TIMER_CALLBACK( clock_irq )
|
||||
|
||||
static CUSTOM_INPUT( get_vblank )
|
||||
{
|
||||
ccastles_state *state = field->port->machine().driver_data<ccastles_state>();
|
||||
int scanline = field->port->machine().primary_screen->vpos();
|
||||
ccastles_state *state = field->machine().driver_data<ccastles_state>();
|
||||
int scanline = field->machine().primary_screen->vpos();
|
||||
return state->m_syncprom[scanline & 0xff] & 1;
|
||||
}
|
||||
|
||||
|
@ -230,8 +230,8 @@ static UINT16 handle_joystick_potgor(running_machine &machine, UINT16 potgor)
|
||||
|
||||
static CUSTOM_INPUT(cubo_input)
|
||||
{
|
||||
cd32_state *state = field->port->machine().driver_data<cd32_state>();
|
||||
return handle_joystick_potgor(field->port->machine(), state->m_potgo_value) >> 10;
|
||||
cd32_state *state = field->machine().driver_data<cd32_state>();
|
||||
return handle_joystick_potgor(field->machine(), state->m_potgo_value) >> 10;
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( cd32 )
|
||||
|
@ -81,49 +81,49 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( mcu_input )
|
||||
{
|
||||
cdi_state *state = field->port->machine().driver_data<cdi_state>();
|
||||
cdi_state *state = field->machine().driver_data<cdi_state>();
|
||||
scc68070_regs_t *scc68070 = &state->m_scc68070_regs;
|
||||
bool send = false;
|
||||
|
||||
switch((FPTR)param)
|
||||
{
|
||||
case 0x39:
|
||||
if(input_port_read(field->port->machine(), "INPUT1") & 0x01) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT1") & 0x01) send = true;
|
||||
break;
|
||||
case 0x37:
|
||||
if(input_port_read(field->port->machine(), "INPUT1") & 0x02) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT1") & 0x02) send = true;
|
||||
break;
|
||||
case 0x31:
|
||||
if(input_port_read(field->port->machine(), "INPUT1") & 0x04) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT1") & 0x04) send = true;
|
||||
break;
|
||||
case 0x32:
|
||||
if(input_port_read(field->port->machine(), "INPUT1") & 0x08) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT1") & 0x08) send = true;
|
||||
break;
|
||||
case 0x33:
|
||||
if(input_port_read(field->port->machine(), "INPUT1") & 0x10) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT1") & 0x10) send = true;
|
||||
break;
|
||||
|
||||
case 0x30:
|
||||
if(input_port_read(field->port->machine(), "INPUT2") & 0x01) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT2") & 0x01) send = true;
|
||||
break;
|
||||
case 0x38:
|
||||
if(input_port_read(field->port->machine(), "INPUT2") & 0x02) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT2") & 0x02) send = true;
|
||||
break;
|
||||
case 0x34:
|
||||
if(input_port_read(field->port->machine(), "INPUT2") & 0x04) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT2") & 0x04) send = true;
|
||||
break;
|
||||
case 0x35:
|
||||
if(input_port_read(field->port->machine(), "INPUT2") & 0x08) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT2") & 0x08) send = true;
|
||||
break;
|
||||
case 0x36:
|
||||
if(input_port_read(field->port->machine(), "INPUT2") & 0x10) send = true;
|
||||
if(input_port_read(field->machine(), "INPUT2") & 0x10) send = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(send)
|
||||
{
|
||||
UINT8 data = (UINT8)((FPTR)param & 0x000000ff);
|
||||
scc68070_quizard_rx(field->port->machine(), scc68070, data);
|
||||
scc68070_quizard_rx(field->machine(), scc68070, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ static WRITE8_HANDLER( champbas_watchdog_reset_w )
|
||||
|
||||
static CUSTOM_INPUT( champbas_watchdog_bit2 )
|
||||
{
|
||||
champbas_state *state = field->port->machine().driver_data<champbas_state>();
|
||||
champbas_state *state = field->machine().driver_data<champbas_state>();
|
||||
return BIT(state->m_watchdog_count, 2);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
cheekyms_state *state = field->port->machine().driver_data<cheekyms_state>();
|
||||
cheekyms_state *state = field->machine().driver_data<cheekyms_state>();
|
||||
|
||||
/* this starts a 556 one-shot timer (and triggers a sound effect) */
|
||||
if (newval)
|
||||
|
@ -272,14 +272,14 @@ ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( cdp1869_pcb_r )
|
||||
{
|
||||
cidelsa_state *state = field->port->machine().driver_data<cidelsa_state>();
|
||||
cidelsa_state *state = field->machine().driver_data<cidelsa_state>();
|
||||
|
||||
return state->m_cdp1869_pcb;
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( ef_w )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), CDP1802_TAG, (int)(FPTR)param, newval);
|
||||
cputag_set_input_line(field->machine(), CDP1802_TAG, (int)(FPTR)param, newval);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( destryer )
|
||||
|
@ -99,7 +99,7 @@ static READ8_HANDLER( switches_r )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
cinemat_state *state = field->port->machine().driver_data<cinemat_state>();
|
||||
cinemat_state *state = field->machine().driver_data<cinemat_state>();
|
||||
/* on the falling edge of a new coin, set the coin_detected flag */
|
||||
if (newval == 0)
|
||||
state->m_coin_detected = 1;
|
||||
|
@ -142,8 +142,8 @@ static TIMER_CALLBACK( clock_irq )
|
||||
|
||||
static CUSTOM_INPUT( get_vblank )
|
||||
{
|
||||
cloud9_state *state = field->port->machine().driver_data<cloud9_state>();
|
||||
int scanline = field->port->machine().primary_screen->vpos();
|
||||
cloud9_state *state = field->machine().driver_data<cloud9_state>();
|
||||
int scanline = field->machine().primary_screen->vpos();
|
||||
return (~state->m_syncprom[scanline & 0xff] >> 1) & 1;
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ INPUT_PORTS_END
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
cntsteer_state *state = field->port->machine().driver_data<cntsteer_state>();
|
||||
cntsteer_state *state = field->machine().driver_data<cntsteer_state>();
|
||||
device_set_input_line(state->m_subcpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ static READ8_HANDLER( cop01_sound_command_r )
|
||||
static CUSTOM_INPUT( mightguy_area_r )
|
||||
{
|
||||
int bit_mask = (FPTR)param;
|
||||
return (input_port_read(field->port->machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
|
||||
return (input_port_read(field->machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( cop01_irq_ack_w )
|
||||
|
@ -134,7 +134,7 @@ ADDRESS_MAP_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const int gun_table[] = {0x3f, 0x5f, 0x6f, 0x77, 0x7b, 0x7d, 0x7e};
|
||||
static const input_port_value gun_table[] = {0x3f, 0x5f, 0x6f, 0x77, 0x7b, 0x7d, 0x7e};
|
||||
|
||||
static INPUT_PORTS_START( copsnrob )
|
||||
PORT_START("IN0")
|
||||
|
@ -414,7 +414,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( panic_coin_inserted )
|
||||
{
|
||||
panic_sound_output_w(field->port->machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0);
|
||||
panic_sound_output_w(field->machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( panic )
|
||||
@ -475,7 +475,7 @@ INPUT_PORTS_END
|
||||
|
||||
static INPUT_CHANGED( cosmica_coin_inserted )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( cosmica )
|
||||
@ -530,7 +530,7 @@ INPUT_PORTS_END
|
||||
|
||||
static INPUT_CHANGED( cosmicg_coin_inserted )
|
||||
{
|
||||
cputag_set_input_line_and_vector(field->port->machine(), "maincpu", 0, newval ? ASSERT_LINE : CLEAR_LINE, 6);
|
||||
cputag_set_input_line_and_vector(field->machine(), "maincpu", 0, newval ? ASSERT_LINE : CLEAR_LINE, 6);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( cosmicg )
|
||||
@ -577,12 +577,12 @@ INPUT_PORTS_END
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_irq0 )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", 0, newval ? HOLD_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", 0, newval ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_nmi )
|
||||
{
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( magspot )
|
||||
|
@ -70,16 +70,16 @@ static WRITE8_HANDLER( pc3092_w )
|
||||
|
||||
static CUSTOM_INPUT( pc3092_r )
|
||||
{
|
||||
crbaloon_state *state = field->port->machine().driver_data<crbaloon_state>();
|
||||
crbaloon_state *state = field->machine().driver_data<crbaloon_state>();
|
||||
UINT32 ret;
|
||||
|
||||
/* enable coin & start input? Wild guess!!! */
|
||||
if (state->m_pc3092_data[1] & 0x02)
|
||||
ret = input_port_read(field->port->machine(), "PC3092");
|
||||
ret = input_port_read(field->machine(), "PC3092");
|
||||
else
|
||||
ret = 0x00;
|
||||
|
||||
if (LOG_PC3092) logerror("%s: read PC3092 = 0x%02x\n", field->port->machine().describe_context(), ret);
|
||||
if (LOG_PC3092) logerror("%s: read PC3092 = 0x%02x\n", field->machine().describe_context(), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ static WRITE16_HANDLER( sound_command_w )
|
||||
|
||||
static CUSTOM_INPUT( country_sndpending_r )
|
||||
{
|
||||
crshrace_state *state = field->port->machine().driver_data<crshrace_state>();
|
||||
crshrace_state *state = field->machine().driver_data<crshrace_state>();
|
||||
return state->m_pending_command;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ static WRITE8_HANDLER( snd_ack_w )
|
||||
|
||||
static CUSTOM_INPUT( snd_ack_r )
|
||||
{
|
||||
dacholer_state *state = field->port->machine().driver_data<dacholer_state>();
|
||||
dacholer_state *state = field->machine().driver_data<dacholer_state>();
|
||||
return state->m_snd_ack; //guess ...
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ static MACHINE_START( dcheese )
|
||||
|
||||
static CUSTOM_INPUT( sound_latch_state_r )
|
||||
{
|
||||
dcheese_state *state = field->port->machine().driver_data<dcheese_state>();
|
||||
dcheese_state *state = field->machine().driver_data<dcheese_state>();
|
||||
return state->m_soundlatch_full;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ static const UINT8 prot_data[0x10] =
|
||||
|
||||
static CUSTOM_INPUT( prot_r )
|
||||
{
|
||||
ddayjlc_state *state = field->port->machine().driver_data<ddayjlc_state>();
|
||||
ddayjlc_state *state = field->machine().driver_data<ddayjlc_state>();
|
||||
return prot_data[state->m_prot_addr];
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ SCREEN_UPDATE(ddenlovr)
|
||||
|
||||
static CUSTOM_INPUT( ddenlovr_special_r )
|
||||
{
|
||||
dynax_state *state = field->port->machine().driver_data<dynax_state>();
|
||||
dynax_state *state = field->machine().driver_data<dynax_state>();
|
||||
return state->m_ddenlovr_blitter_irq_flag;
|
||||
}
|
||||
|
||||
@ -1781,7 +1781,7 @@ static WRITE16_HANDLER( ddenlovj_coincounter_w )
|
||||
|
||||
static CUSTOM_INPUT( ddenlovj_blitter_r )
|
||||
{
|
||||
dynax_state *state = field->port->machine().driver_data<dynax_state>();
|
||||
dynax_state *state = field->machine().driver_data<dynax_state>();
|
||||
return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00; // bit 4 = 1 -> blitter busy
|
||||
}
|
||||
|
||||
@ -1921,7 +1921,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( nettoqc_special_r )
|
||||
{
|
||||
dynax_state *state = field->port->machine().driver_data<dynax_state>();
|
||||
dynax_state *state = field->machine().driver_data<dynax_state>();
|
||||
return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00;
|
||||
}
|
||||
|
||||
@ -3446,7 +3446,7 @@ static READ8_HANDLER( mjflove_keyb_r )
|
||||
|
||||
static CUSTOM_INPUT( mjflove_blitter_r )
|
||||
{
|
||||
dynax_state *state = field->port->machine().driver_data<dynax_state>();
|
||||
dynax_state *state = field->machine().driver_data<dynax_state>();
|
||||
|
||||
// bit 7 = 1 -> blitter busy
|
||||
// bit 6 = 0 -> VBLANK?
|
||||
|
@ -357,7 +357,7 @@ static void irq_handler( device_t *device, int irq )
|
||||
|
||||
static CUSTOM_INPUT( sub_cpu_busy )
|
||||
{
|
||||
ddragon_state *state = field->port->machine().driver_data<ddragon_state>();
|
||||
ddragon_state *state = field->machine().driver_data<ddragon_state>();
|
||||
return state->m_dd_sub_cpu_busy;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ static WRITE8_HANDLER( led_den2_w )
|
||||
|
||||
static CUSTOM_INPUT( laserdisc_status_r )
|
||||
{
|
||||
dlair_state *state = field->port->machine().driver_data<dlair_state>();
|
||||
dlair_state *state = field->machine().driver_data<dlair_state>();
|
||||
switch (laserdisc_get_type(state->m_laserdisc))
|
||||
{
|
||||
case LASERDISC_TYPE_PIONEER_PR7820:
|
||||
@ -334,7 +334,7 @@ static CUSTOM_INPUT( laserdisc_status_r )
|
||||
|
||||
static CUSTOM_INPUT( laserdisc_command_r )
|
||||
{
|
||||
dlair_state *state = field->port->machine().driver_data<dlair_state>();
|
||||
dlair_state *state = field->machine().driver_data<dlair_state>();
|
||||
switch (laserdisc_get_type(state->m_laserdisc))
|
||||
{
|
||||
case LASERDISC_TYPE_PIONEER_PR7820:
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
|
||||
static CUSTOM_INPUT( dorachan_protection_r )
|
||||
{
|
||||
dorachan_state *state = field->port->machine().driver_data<dorachan_state>();
|
||||
dorachan_state *state = field->machine().driver_data<dorachan_state>();
|
||||
UINT8 ret = 0;
|
||||
|
||||
switch (cpu_get_previouspc(state->m_main_cpu))
|
||||
@ -129,10 +129,10 @@ static WRITE8_HANDLER(dorachan_ctrl_w)
|
||||
|
||||
static CUSTOM_INPUT( dorachan_v128_r )
|
||||
{
|
||||
dorachan_state *state = field->port->machine().driver_data<dorachan_state>();
|
||||
dorachan_state *state = field->machine().driver_data<dorachan_state>();
|
||||
|
||||
/* to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped */
|
||||
return ((field->port->machine().primary_screen->vpos() >> 7) & 0x01) ^ state->m_flip_screen;
|
||||
return ((field->machine().primary_screen->vpos() >> 7) & 0x01) ^ state->m_flip_screen;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2047,6 +2047,7 @@ static INPUT_PORTS_START( HANAFUDA_KEYS_BET )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2) // "s"
|
||||
INPUT_PORTS_END
|
||||
|
||||
#ifdef UNREFERENCED_CODE
|
||||
static INPUT_PORTS_START( HANAFUDA_KEYS_BET_ALT )
|
||||
PORT_START("KEY0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_A ) PORT_PLAYER(1)
|
||||
@ -2132,7 +2133,7 @@ static INPUT_PORTS_START( HANAFUDA_KEYS_BET_ALT )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
INPUT_PORTS_END
|
||||
|
||||
#endif
|
||||
|
||||
static INPUT_PORTS_START( hanamai )
|
||||
PORT_START("DSW0")
|
||||
|
@ -416,17 +416,17 @@ static WRITE8_HANDLER( enigma2_flip_screen_w )
|
||||
|
||||
static CUSTOM_INPUT( p1_controls_r )
|
||||
{
|
||||
return input_port_read(field->port->machine(), "P1CONTROLS");
|
||||
return input_port_read(field->machine(), "P1CONTROLS");
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( p2_controls_r )
|
||||
{
|
||||
enigma2_state *state = field->port->machine().driver_data<enigma2_state>();
|
||||
enigma2_state *state = field->machine().driver_data<enigma2_state>();
|
||||
if (state->m_flip_screen)
|
||||
return input_port_read(field->port->machine(), "P2CONTROLS");
|
||||
return input_port_read(field->machine(), "P2CONTROLS");
|
||||
else
|
||||
return input_port_read(field->port->machine(), "P1CONTROLS");
|
||||
return input_port_read(field->machine(), "P1CONTROLS");
|
||||
}
|
||||
|
||||
|
||||
|
@ -657,7 +657,7 @@ static READ16_HANDLER(hvoltage_debug_r)
|
||||
|
||||
static CUSTOM_INPUT( gekisou_unknown_status )
|
||||
{
|
||||
equites_state *state = field->port->machine().driver_data<equites_state>();
|
||||
equites_state *state = field->machine().driver_data<equites_state>();
|
||||
return state->m_unknown_bit;
|
||||
}
|
||||
|
||||
|
@ -414,23 +414,23 @@ static WRITE8_HANDLER( g_ioadd_w )
|
||||
|
||||
static INPUT_CHANGED( keypad_interrupt )
|
||||
{
|
||||
esripsys_state *state = field->port->machine().driver_data<esripsys_state>();
|
||||
esripsys_state *state = field->machine().driver_data<esripsys_state>();
|
||||
if (newval == 0)
|
||||
{
|
||||
state->m_io_firq_status |= 2;
|
||||
state->m_keypad_status |= 0x20;
|
||||
cputag_set_input_line(field->port->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||
cputag_set_input_line(field->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( coin_interrupt )
|
||||
{
|
||||
esripsys_state *state = field->port->machine().driver_data<esripsys_state>();
|
||||
esripsys_state *state = field->machine().driver_data<esripsys_state>();
|
||||
if (newval == 1)
|
||||
{
|
||||
state->m_io_firq_status |= 2;
|
||||
state->m_coin_latch = input_port_read(field->port->machine(), "COINS") << 2;
|
||||
cputag_set_input_line(field->port->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||
state->m_coin_latch = input_port_read(field->machine(), "COINS") << 2;
|
||||
cputag_set_input_line(field->machine(), "game_cpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,14 +133,14 @@ Stephh's notes (based on the games Z80 code and some tests) :
|
||||
static CUSTOM_INPUT( exerion_controls_r )
|
||||
{
|
||||
static const char *const inname[2] = { "P1", "P2" };
|
||||
exerion_state *state = field->port->machine().driver_data<exerion_state>();
|
||||
return input_port_read(field->port->machine(), inname[state->m_cocktail_flip]) & 0x3f;
|
||||
exerion_state *state = field->machine().driver_data<exerion_state>();
|
||||
return input_port_read(field->machine(), inname[state->m_cocktail_flip]) & 0x3f;
|
||||
}
|
||||
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
exerion_state *state = field->port->machine().driver_data<exerion_state>();
|
||||
exerion_state *state = field->machine().driver_data<exerion_state>();
|
||||
/* coin insertion causes an NMI */
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ Fax 1982 6502 FXL, FLA
|
||||
|
||||
static CUSTOM_INPUT( teetert_input_r )
|
||||
{
|
||||
exidy_state *state = field->port->machine().driver_data<exidy_state>();
|
||||
UINT8 dial = input_port_read(field->port->machine(), "DIAL");
|
||||
exidy_state *state = field->machine().driver_data<exidy_state>();
|
||||
UINT8 dial = input_port_read(field->machine(), "DIAL");
|
||||
int result = 0;
|
||||
|
||||
result = (dial != state->m_last_dial) << 4;
|
||||
|
@ -256,7 +256,7 @@ static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
/* if we got a coin, set the IRQ on the main CPU */
|
||||
if (newval == 0)
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", 0, ASSERT_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -269,14 +269,14 @@ static INPUT_CHANGED( coin_inserted )
|
||||
|
||||
static CUSTOM_INPUT( firq_beam_r )
|
||||
{
|
||||
exidy440_state *state = field->port->machine().driver_data<exidy440_state>();
|
||||
exidy440_state *state = field->machine().driver_data<exidy440_state>();
|
||||
return state->m_firq_beam;
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( firq_vblank_r )
|
||||
{
|
||||
exidy440_state *state = field->port->machine().driver_data<exidy440_state>();
|
||||
exidy440_state *state = field->machine().driver_data<exidy440_state>();
|
||||
return state->m_firq_vblank;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ static CUSTOM_INPUT( firq_vblank_r )
|
||||
static CUSTOM_INPUT( hitnmiss_button1_r )
|
||||
{
|
||||
/* button 1 shows up in two bits */
|
||||
UINT32 button1 = input_port_read(field->port->machine(), "HITNMISS_BUTTON1");
|
||||
UINT32 button1 = input_port_read(field->machine(), "HITNMISS_BUTTON1");
|
||||
return (button1 << 1) | button1;
|
||||
}
|
||||
|
||||
|
@ -280,13 +280,13 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_deco16 )
|
||||
{
|
||||
exprraid_state *state = field->port->machine().driver_data<exprraid_state>();
|
||||
exprraid_state *state = field->machine().driver_data<exprraid_state>();
|
||||
device_set_input_line(state->m_maincpu, DECO16_IRQ_LINE, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static INPUT_CHANGED( coin_inserted_nmi )
|
||||
{
|
||||
exprraid_state *state = field->port->machine().driver_data<exprraid_state>();
|
||||
exprraid_state *state = field->machine().driver_data<exprraid_state>();
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
@ -730,7 +730,7 @@ INPUT_PORTS_END
|
||||
static CUSTOM_INPUT( wheelrun_wheel_r )
|
||||
{
|
||||
int player = (FPTR)param;
|
||||
int delta = input_port_read(field->port->machine(), player ? "WHEEL1" : "WHEEL0");
|
||||
int delta = input_port_read(field->machine(), player ? "WHEEL1" : "WHEEL0");
|
||||
delta = (delta & 0x7f) - (delta & 0x80) + 4;
|
||||
|
||||
if (delta > 7) delta = 7;
|
||||
|
@ -36,7 +36,7 @@ inputs + notes by stephh
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
fcombat_state *state = field->port->machine().driver_data<fcombat_state>();
|
||||
fcombat_state *state = field->machine().driver_data<fcombat_state>();
|
||||
|
||||
/* coin insertion causes an NMI */
|
||||
device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
|
||||
|
@ -106,7 +106,7 @@ static READ8_HANDLER( fgoal_analog_r )
|
||||
|
||||
static CUSTOM_INPUT( fgoal_80_r )
|
||||
{
|
||||
UINT8 ret = (field->port->machine().primary_screen->vpos() & 0x80) ? 1 : 0;
|
||||
UINT8 ret = (field->machine().primary_screen->vpos() & 0x80) ? 1 : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -265,13 +265,13 @@ static WRITE8_HANDLER( firefox_objram_bank_w )
|
||||
|
||||
static CUSTOM_INPUT( mainflag_r )
|
||||
{
|
||||
firefox_state *state = field->port->machine().driver_data<firefox_state>();
|
||||
firefox_state *state = field->machine().driver_data<firefox_state>();
|
||||
return state->m_main_to_sound_flag;
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( soundflag_r )
|
||||
{
|
||||
firefox_state *state = field->port->machine().driver_data<firefox_state>();
|
||||
firefox_state *state = field->machine().driver_data<firefox_state>();
|
||||
return state->m_sound_to_main_flag;
|
||||
}
|
||||
|
||||
|
@ -29,20 +29,20 @@ static void set_service_mode(running_machine &machine, int enable)
|
||||
|
||||
static INPUT_CHANGED( service_mode_switch_changed )
|
||||
{
|
||||
set_service_mode(field->port->machine(), newval);
|
||||
set_service_mode(field->machine(), newval);
|
||||
}
|
||||
|
||||
|
||||
static INPUT_CHANGED( firetrk_horn_changed )
|
||||
{
|
||||
device_t *discrete = field->port->machine().device("discrete");
|
||||
device_t *discrete = field->machine().device("discrete");
|
||||
discrete_sound_w(discrete, FIRETRUCK_HORN_EN, newval);
|
||||
}
|
||||
|
||||
|
||||
static INPUT_CHANGED( gear_changed )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
if (newval)
|
||||
state->m_gear = (FPTR)param;
|
||||
}
|
||||
@ -200,21 +200,21 @@ static READ8_HANDLER( montecar_dip_r )
|
||||
|
||||
static CUSTOM_INPUT( steer_dir_r )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
return state->m_steer_dir[(FPTR)param];
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( steer_flag_r )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
return state->m_steer_flag[(FPTR)param];
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( skid_r )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
UINT32 ret;
|
||||
int which = (FPTR)param;
|
||||
|
||||
@ -229,7 +229,7 @@ static CUSTOM_INPUT( skid_r )
|
||||
|
||||
static CUSTOM_INPUT( crash_r )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
UINT32 ret;
|
||||
int which = (FPTR)param;
|
||||
|
||||
@ -244,7 +244,7 @@ static CUSTOM_INPUT( crash_r )
|
||||
|
||||
static CUSTOM_INPUT( gear_r )
|
||||
{
|
||||
firetrk_state *state = field->port->machine().driver_data<firetrk_state>();
|
||||
firetrk_state *state = field->machine().driver_data<firetrk_state>();
|
||||
return (state->m_gear == (FPTR)param) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( victnine_mcu_status_bit01_r )
|
||||
{
|
||||
flstory_state *state = field->port->machine().driver_data<flstory_state>();
|
||||
flstory_state *state = field->machine().driver_data<flstory_state>();
|
||||
address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
|
||||
|
||||
return (victnine_mcu_status_r(space, 0) & 3);
|
||||
|
@ -75,19 +75,19 @@ static READ16_HANDLER( fromanc2_keymatrix_r )
|
||||
|
||||
static CUSTOM_INPUT( subcpu_int_r )
|
||||
{
|
||||
fromanc2_state *state = field->port->machine().driver_data<fromanc2_state>();
|
||||
fromanc2_state *state = field->machine().driver_data<fromanc2_state>();
|
||||
return state->m_subcpu_int_flag & 0x01;
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( sndcpu_nmi_r )
|
||||
{
|
||||
fromanc2_state *state = field->port->machine().driver_data<fromanc2_state>();
|
||||
fromanc2_state *state = field->machine().driver_data<fromanc2_state>();
|
||||
return state->m_sndcpu_nmi_flag & 0x01;
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( subcpu_nmi_r )
|
||||
{
|
||||
fromanc2_state *state = field->port->machine().driver_data<fromanc2_state>();
|
||||
fromanc2_state *state = field->machine().driver_data<fromanc2_state>();
|
||||
return state->m_subcpu_nmi_flag & 0x01;
|
||||
}
|
||||
|
||||
@ -416,6 +416,7 @@ static INPUT_PORTS_START( fromanc2 )
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_cs_line)
|
||||
INPUT_PORTS_END
|
||||
|
||||
#ifdef UNREFERENCED_CODE
|
||||
static INPUT_PORTS_START( fromancr )
|
||||
PORT_INCLUDE( fromanc2 )
|
||||
|
||||
@ -424,6 +425,7 @@ static INPUT_PORTS_START( fromancr )
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_clock_line)
|
||||
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eeprom_set_cs_line)
|
||||
INPUT_PORTS_END
|
||||
#endif
|
||||
|
||||
static INPUT_PORTS_START( fromanc4 )
|
||||
PORT_INCLUDE( fromanc2 )
|
||||
|
@ -409,7 +409,7 @@ static WRITE16_HANDLER( sound_status_w )
|
||||
|
||||
static CUSTOM_INPUT( analog_bit_r )
|
||||
{
|
||||
gaelco3d_state *state = field->port->machine().driver_data<gaelco3d_state>();
|
||||
gaelco3d_state *state = field->machine().driver_data<gaelco3d_state>();
|
||||
int which = (FPTR)param;
|
||||
return (state->m_analog_ports[which] >> 7) & 0x01;
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ static WRITE8_HANDLER( bosco_latch_w )
|
||||
}
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field->port->machine(), (const char *)param) >> 4; }
|
||||
static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field->machine(), (const char *)param) >> 4; }
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( out_0 )
|
||||
{
|
||||
|
@ -92,13 +92,13 @@ static WRITE32_HANDLER( galastrm_tc0610_1_w )
|
||||
|
||||
static CUSTOM_INPUT( frame_counter_r )
|
||||
{
|
||||
galastrm_state *state = field->port->machine().driver_data<galastrm_state>();
|
||||
galastrm_state *state = field->machine().driver_data<galastrm_state>();
|
||||
return state->m_frame_counter;
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( coin_word_r )
|
||||
{
|
||||
galastrm_state *state = field->port->machine().driver_data<galastrm_state>();
|
||||
galastrm_state *state = field->machine().driver_data<galastrm_state>();
|
||||
return state->m_coin_word;
|
||||
}
|
||||
|
||||
|
@ -261,14 +261,14 @@ static WRITE16_HANDLER( galaxi_500004_w )
|
||||
|
||||
static CUSTOM_INPUT( ticket_r )
|
||||
{
|
||||
galaxi_state *state = field->port->machine().driver_data<galaxi_state>();
|
||||
return state->m_ticket && !(field->port->machine().primary_screen->frame_number() % 10);
|
||||
galaxi_state *state = field->machine().driver_data<galaxi_state>();
|
||||
return state->m_ticket && !(field->machine().primary_screen->frame_number() % 10);
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( hopper_r )
|
||||
{
|
||||
galaxi_state *state = field->port->machine().driver_data<galaxi_state>();
|
||||
return state->m_hopper && !(field->port->machine().primary_screen->frame_number() % 10);
|
||||
galaxi_state *state = field->machine().driver_data<galaxi_state>();
|
||||
return state->m_hopper && !(field->machine().primary_screen->frame_number() % 10);
|
||||
}
|
||||
|
||||
|
||||
|
@ -728,7 +728,7 @@ static READ8_DEVICE_HANDLER( scramble_protection_r )
|
||||
|
||||
static CUSTOM_INPUT( scramble_protection_alt_r )
|
||||
{
|
||||
galaxian_state *state = field->port->machine().driver_data<galaxian_state>();
|
||||
galaxian_state *state = field->machine().driver_data<galaxian_state>();
|
||||
/*
|
||||
There are two additional bits that are derived from bit 7 of
|
||||
the protection result. This is just a guess but works well enough
|
||||
@ -1008,31 +1008,31 @@ static const ppi8255_interface scorpion_ppi8255_1_intf =
|
||||
|
||||
static INPUT_CHANGED( gmgalax_game_changed )
|
||||
{
|
||||
galaxian_state *state = field->port->machine().driver_data<galaxian_state>();
|
||||
address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
galaxian_state *state = field->machine().driver_data<galaxian_state>();
|
||||
address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
/* new value is the selected game */
|
||||
state->m_gmgalax_selected_game = newval;
|
||||
|
||||
/* select the bank and graphics bank based on it */
|
||||
memory_set_bank(field->port->machine(), "bank1", state->m_gmgalax_selected_game);
|
||||
memory_set_bank(field->machine(), "bank1", state->m_gmgalax_selected_game);
|
||||
galaxian_gfxbank_w(space, 0, state->m_gmgalax_selected_game);
|
||||
|
||||
/* reset the stars */
|
||||
galaxian_stars_enable_w(space, 0, 0);
|
||||
|
||||
/* reset the CPU */
|
||||
cputag_set_input_line(field->port->machine(), "maincpu", INPUT_LINE_RESET, PULSE_LINE);
|
||||
cputag_set_input_line(field->machine(), "maincpu", INPUT_LINE_RESET, PULSE_LINE);
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( gmgalax_port_r )
|
||||
{
|
||||
galaxian_state *state = field->port->machine().driver_data<galaxian_state>();
|
||||
galaxian_state *state = field->machine().driver_data<galaxian_state>();
|
||||
const char *portname = (const char *)param;
|
||||
if (state->m_gmgalax_selected_game != 0)
|
||||
portname += strlen(portname) + 1;
|
||||
return input_port_read(field->port->machine(), portname);
|
||||
return input_port_read(field->machine(), portname);
|
||||
}
|
||||
|
||||
|
||||
@ -1084,7 +1084,7 @@ static WRITE8_HANDLER( zigzag_ay8910_w )
|
||||
|
||||
static CUSTOM_INPUT( azurian_port_r )
|
||||
{
|
||||
return (input_port_read(field->port->machine(), "FAKE") >> (FPTR)param) & 1;
|
||||
return (input_port_read(field->machine(), "FAKE") >> (FPTR)param) & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1097,9 +1097,9 @@ static CUSTOM_INPUT( azurian_port_r )
|
||||
|
||||
static CUSTOM_INPUT( kingball_muxbit_r )
|
||||
{
|
||||
galaxian_state *state = field->port->machine().driver_data<galaxian_state>();
|
||||
galaxian_state *state = field->machine().driver_data<galaxian_state>();
|
||||
/* multiplex the service mode switch with a speech DIP switch */
|
||||
return (input_port_read(field->port->machine(), "FAKE") >> state->m_kingball_speech_dip) & 1;
|
||||
return (input_port_read(field->machine(), "FAKE") >> state->m_kingball_speech_dip) & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1108,7 +1108,7 @@ static CUSTOM_INPUT( kingball_noise_r )
|
||||
/* bit 5 is the NOISE line from the sound circuit. The code just verifies
|
||||
that it's working, doesn't actually use return value, so we can just use
|
||||
rand() */
|
||||
return field->port->machine().rand() & 1;
|
||||
return field->machine().rand() & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -2689,7 +2689,7 @@ static DRIVER_INIT( gmgalax )
|
||||
memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
|
||||
|
||||
/* callback when the game select is toggled */
|
||||
gmgalax_game_changed(machine.m_portlist.first()->fieldlist, NULL, 0, 0);
|
||||
gmgalax_game_changed(*state, machine.m_portlist.first()->fieldlist().first(), NULL, 0, 0);
|
||||
state_save_register_global(machine, state->m_gmgalax_selected_game);
|
||||
}
|
||||
|
||||
|
@ -917,9 +917,9 @@ static CUSTOM_INPUT( vpool_lives_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0x40: /* vpool : IN1 (0xa800) bit 6 */
|
||||
return ((input_port_read(field->port->machine(), "LIVES") & bit_mask) >> 6);
|
||||
return ((input_port_read(field->machine(), "LIVES") & bit_mask) >> 6);
|
||||
case 0x01: /* vpool : DSW (0xb000) bit 0 */
|
||||
return ((input_port_read(field->port->machine(), "LIVES") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "LIVES") & bit_mask) >> 0);
|
||||
|
||||
default:
|
||||
logerror("vpool_lives_r : invalid %02X bit_mask\n",bit_mask);
|
||||
@ -1064,14 +1064,14 @@ static CUSTOM_INPUT( ckongg_coinage_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0x0c: /* ckongg : DSW (0xc800) bits 2 and 3 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 2);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 2);
|
||||
case 0x40: /* ckongg : IN1 (0xc400) bit 6 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
|
||||
case 0xc0: /* ckongmc : IN1 (0xa800) bits 6 and 7 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
case 0x01: /* ckongmc : DSW (0xb000) bit 0 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
|
||||
default:
|
||||
logerror("ckongg_coinage_r : invalid %02X bit_mask\n",bit_mask);
|
||||
@ -1432,9 +1432,9 @@ static CUSTOM_INPUT( dkongjrm_coinage_r )
|
||||
switch (bit_mask)
|
||||
{
|
||||
case 0xc0: /* dkongjrm : IN1 (0xa8??) bits 6 and 7 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 6);
|
||||
case 0x01: /* dkongjrm : DSW (0xb0??) bit 0 */
|
||||
return ((input_port_read(field->port->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
return ((input_port_read(field->machine(), "COINAGE") & bit_mask) >> 0);
|
||||
|
||||
default:
|
||||
logerror("dkongjrm_coinage_r : invalid %02X bit_mask\n",bit_mask);
|
||||
|
@ -2354,14 +2354,14 @@ INPUT_PORTS_END
|
||||
|
||||
static CUSTOM_INPUT( moonwar_dial_r )
|
||||
{
|
||||
galaxian_state *state = field->port->machine().driver_data<galaxian_state>();
|
||||
galaxian_state *state = field->machine().driver_data<galaxian_state>();
|
||||
static const char *const dialname[2] = { "P1_DIAL", "P2_DIAL" };
|
||||
int p = (~state->m_moonwar_port_select >> 4) & 1;
|
||||
|
||||
// see http://www.cityofberwyn.com/schematics/stern/MoonWar_opto.tiff for schematic
|
||||
// I.e. a 74ls161 counts from 0 to 15 which is the absolute number of bars passed on the quadrature
|
||||
|
||||
signed char dialread = input_port_read(field->port->machine(), dialname[p]);
|
||||
signed char dialread = input_port_read(field->machine(), dialname[p]);
|
||||
|
||||
UINT8 ret;
|
||||
|
||||
|
@ -295,11 +295,11 @@ static MACHINE_RESET( gottlieb )
|
||||
|
||||
static CUSTOM_INPUT( analog_delta_r )
|
||||
{
|
||||
gottlieb_state *state = field->port->machine().driver_data<gottlieb_state>();
|
||||
gottlieb_state *state = field->machine().driver_data<gottlieb_state>();
|
||||
const char *string = (const char *)param;
|
||||
int which = string[0] - '0';
|
||||
|
||||
return input_port_read(field->port->machine(), &string[1]) - state->m_track[which];
|
||||
return input_port_read(field->machine(), &string[1]) - state->m_track[which];
|
||||
}
|
||||
|
||||
|
||||
@ -314,9 +314,9 @@ static WRITE8_HANDLER( gottlieb_analog_reset_w )
|
||||
|
||||
static CUSTOM_INPUT( stooges_joystick_r )
|
||||
{
|
||||
gottlieb_state *state = field->port->machine().driver_data<gottlieb_state>();
|
||||
gottlieb_state *state = field->machine().driver_data<gottlieb_state>();
|
||||
static const char *const joyport[] = { "P2JOY", "P3JOY", "P1JOY", NULL };
|
||||
return (joyport[state->m_joystick_select & 3] != NULL) ? input_port_read(field->port->machine(), joyport[state->m_joystick_select & 3]) : 0xff;
|
||||
return (joyport[state->m_joystick_select & 3] != NULL) ? input_port_read(field->machine(), joyport[state->m_joystick_select & 3]) : 0xff;
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,13 +126,13 @@ static const eeprom_interface groundfx_eeprom_interface =
|
||||
|
||||
static CUSTOM_INPUT( frame_counter_r )
|
||||
{
|
||||
groundfx_state *state = field->port->machine().driver_data<groundfx_state>();
|
||||
groundfx_state *state = field->machine().driver_data<groundfx_state>();
|
||||
return state->m_frame_counter;
|
||||
}
|
||||
|
||||
static CUSTOM_INPUT( coin_word_r )
|
||||
{
|
||||
groundfx_state *state = field->port->machine().driver_data<groundfx_state>();
|
||||
groundfx_state *state = field->machine().driver_data<groundfx_state>();
|
||||
return state->m_coin_word;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ static CUSTOM_INPUT( gstream_mirror_service_r )
|
||||
int result;
|
||||
|
||||
/* PORT_SERVICE_NO_TOGGLE */
|
||||
result = (input_port_read(field->port->machine(), "IN0") & 0x8000) >> 15;
|
||||
result = (input_port_read(field->machine(), "IN0") & 0x8000) >> 15;
|
||||
|
||||
return ~result;
|
||||
}
|
||||
@ -178,15 +178,15 @@ static CUSTOM_INPUT( gstream_mirror_r )
|
||||
int result;
|
||||
|
||||
/* IPT_COIN1 */
|
||||
result = ((input_port_read(field->port->machine(), "IN0") & 0x200) >> 9) << 0;
|
||||
result = ((input_port_read(field->machine(), "IN0") & 0x200) >> 9) << 0;
|
||||
/* IPT_COIN2 */
|
||||
result |= ((input_port_read(field->port->machine(), "IN1") & 0x200) >> 9) << 1;
|
||||
result |= ((input_port_read(field->machine(), "IN1") & 0x200) >> 9) << 1;
|
||||
/* IPT_START1 */
|
||||
result |= ((input_port_read(field->port->machine(), "IN0") & 0x400) >> 10) << 2;
|
||||
result |= ((input_port_read(field->machine(), "IN0") & 0x400) >> 10) << 2;
|
||||
/* IPT_START2 */
|
||||
result |= ((input_port_read(field->port->machine(), "IN1") & 0x400) >> 10) << 3;
|
||||
result |= ((input_port_read(field->machine(), "IN1") & 0x400) >> 10) << 3;
|
||||
/* PORT_SERVICE_NO_TOGGLE */
|
||||
result |= ((input_port_read(field->port->machine(), "IN0") & 0x8000) >> 15) << 6;
|
||||
result |= ((input_port_read(field->machine(), "IN0") & 0x8000) >> 15) << 6;
|
||||
|
||||
return ~result;
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ static INPUT_CHANGED( coin_inserted )
|
||||
if (newval == 0)
|
||||
{
|
||||
UINT32 credit;
|
||||
address_space *space = field->port->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
address_space *space = field->machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
|
||||
/* Get the current credit value and add the new coin value */
|
||||
credit = space->read_dword(0x8002c) + (UINT32)(FPTR)param;
|
||||
|
@ -80,7 +80,7 @@ static WRITE32_HANDLER( gunbustr_palette_w )
|
||||
|
||||
static CUSTOM_INPUT( coin_word_r )
|
||||
{
|
||||
gunbustr_state *state = field->port->machine().driver_data<gunbustr_state>();
|
||||
gunbustr_state *state = field->machine().driver_data<gunbustr_state>();
|
||||
return state->m_coin_word;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( homerun_40_r )
|
||||
{
|
||||
UINT8 ret = (field->port->machine().primary_screen->vpos() > 116) ? 1 : 0;
|
||||
UINT8 ret = (field->machine().primary_screen->vpos() > 116) ? 1 : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -342,8 +342,8 @@ static SCREEN_UPDATE(jingbell)
|
||||
|
||||
static CUSTOM_INPUT( hopper_r )
|
||||
{
|
||||
igs009_state *state = field->port->machine().driver_data<igs009_state>();
|
||||
return state->m_hopper && !(field->port->machine().primary_screen->frame_number()%10);
|
||||
igs009_state *state = field->machine().driver_data<igs009_state>();
|
||||
return state->m_hopper && !(field->machine().primary_screen->frame_number()%10);
|
||||
}
|
||||
|
||||
|
||||
|
@ -466,8 +466,8 @@ static WRITE16_HANDLER( igs011_blit_flags_w )
|
||||
|
||||
static CUSTOM_INPUT( igs_hopper_r )
|
||||
{
|
||||
igs011_state *state = field->port->machine().driver_data<igs011_state>();
|
||||
return (state->m_igs_hopper && ((field->port->machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001;
|
||||
igs011_state *state = field->machine().driver_data<igs011_state>();
|
||||
return (state->m_igs_hopper && ((field->machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs_dips_w )
|
||||
|
@ -320,9 +320,9 @@ static WRITE8_HANDLER( custom_io_w )
|
||||
|
||||
static CUSTOM_INPUT( hopper_r )
|
||||
{
|
||||
igspoker_state *state = field->port->machine().driver_data<igspoker_state>();
|
||||
if (state->m_hopper) return !(field->port->machine().primary_screen->frame_number()%10);
|
||||
return input_code_pressed(field->port->machine(), KEYCODE_H);
|
||||
igspoker_state *state = field->machine().driver_data<igspoker_state>();
|
||||
if (state->m_hopper) return !(field->machine().primary_screen->frame_number()%10);
|
||||
return input_code_pressed(field->machine(), KEYCODE_H);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( exp_rom_r )
|
||||
|
@ -115,7 +115,7 @@ static WRITE8_HANDLER( inufuku_soundrombank_w )
|
||||
|
||||
static CUSTOM_INPUT( soundflag_r )
|
||||
{
|
||||
inufuku_state *state = field->port->machine().driver_data<inufuku_state>();
|
||||
inufuku_state *state = field->machine().driver_data<inufuku_state>();
|
||||
UINT16 soundflag = state->m_pending_command ? 0 : 1;
|
||||
|
||||
return soundflag;
|
||||
|
@ -466,7 +466,7 @@ static MACHINE_RESET( drivedge )
|
||||
|
||||
static CUSTOM_INPUT( special_port_r )
|
||||
{
|
||||
itech32_state *state = field->port->machine().driver_data<itech32_state>();
|
||||
itech32_state *state = field->machine().driver_data<itech32_state>();
|
||||
if (state->m_sound_int_state)
|
||||
state->m_special_result ^= 1;
|
||||
|
||||
|
@ -728,7 +728,7 @@ static WRITE8_HANDLER( rimrockn_bank_w )
|
||||
|
||||
static CUSTOM_INPUT( special_r )
|
||||
{
|
||||
itech8_state *state = field->port->machine().driver_data<itech8_state>();
|
||||
itech8_state *state = field->machine().driver_data<itech8_state>();
|
||||
return state->m_pia_portb_data & 0x01;
|
||||
}
|
||||
|
||||
@ -1102,7 +1102,7 @@ static CUSTOM_INPUT( gtg_mux )
|
||||
{
|
||||
const char *tag1 = (const char *)param;
|
||||
const char *tag2 = tag1 + strlen(tag1) + 1;
|
||||
return input_port_read(field->port->machine(), tag1) & input_port_read(field->port->machine(), tag2);
|
||||
return input_port_read(field->machine(), tag1) & input_port_read(field->machine(), tag2);
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( gtg )
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user