(Finally found the time to finish this....)

Low-level input upgrade. Classes now exist for input_codes, input_items,
input_devices, and input_seqs. Also created an input_manager class to
hold machine-global state and made it accessible via machine.input().
Expanded the device index range (0-255, up from 0-16), and the OSD can
now specify the device index explicitly if they can better keep the 
indexes from varying run-to-run. [Aaron Giles]

Note that I've built and run SDL on Windows, but not all the code paths
were exercised. If you use mice/joysticks extensively double-check them
to be sure it all still works as expected.

This is mainly an OSD and core change. The only thing impacting drivers
is if they query for specific keys for debugging. The following S&Rs
took care of most of that:

S: input_code_pressed( *)\(( *)([^, ]+) *, *
R: \3\.input\(\)\.code_pressed\1\(\2

S: input_code_pressed_once( *)\(( *)([^, ]+) *, *
R: \3\.input\(\)\.code_pressed_once\1\(\2
This commit is contained in:
Aaron Giles 2011-05-30 19:07:19 +00:00
parent 8f7d456e70
commit 665d213ee4
151 changed files with 4499 additions and 4382 deletions

2
.gitattributes vendored
View File

@ -717,8 +717,6 @@ src/emu/inptport.h svneol=native#text/plain
src/emu/inpttype.h svneol=native#text/plain
src/emu/input.c svneol=native#text/plain
src/emu/input.h svneol=native#text/plain
src/emu/inputseq.c svneol=native#text/plain
src/emu/inputseq.h svneol=native#text/plain
src/emu/layout/dualhovu.lay svneol=native#text/plain
src/emu/layout/dualhsxs.lay svneol=native#text/plain
src/emu/layout/dualhuov.lay svneol=native#text/plain

View File

@ -61,6 +61,12 @@ int sort_callback(const void *elem1, const void *elem2)
return strcmp(*item1, *item2);
}
//-------------------------------------------------
// parse_file - parse a single file, may be
// called recursively
//-------------------------------------------------
int parse_file(const char *srcfile)
{
// read source file
@ -78,7 +84,6 @@ int parse_file(const char *srcfile)
char *endptr = srcptr + length;
int linenum = 1;
bool in_comment = false;
bool in_import = false;
while (srcptr < endptr)
{
char c = *srcptr++;
@ -116,13 +121,6 @@ int parse_file(const char *srcfile)
continue;
}
// look for start of import directive start
if (c == '#')
{
in_import = true;
continue;
}
// if we hit a C++ comment, scan to the end of line
if (c == '/' && *srcptr == '/')
{
@ -131,11 +129,11 @@ int parse_file(const char *srcfile)
continue;
}
if (in_import) {
in_import = false;
// look for an import directive
if (c == '#')
{
char filename[256];
filename[0] = 0;
srcptr--;
for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(filename) - 1 && !isspace(*srcptr); pos++)
{
filename[pos] = *srcptr++;
@ -143,34 +141,37 @@ int parse_file(const char *srcfile)
}
fprintf(stderr, "Importing drivers from '%s'\n", filename);
parse_file(filename);
} else {
// extract the driver name
char drivname[32];
drivname[0] = 0;
srcptr--;
for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++)
{
drivname[pos] = *srcptr++;
drivname[pos+1] = 0;
}
// verify the name as valid
for (char *drivch = drivname; *drivch != 0; drivch++)
{
if ((*drivch >= 'a' && *drivch <= 'z') || (*drivch >= '0' && *drivch <= '9') || *drivch == '_')
continue;
fprintf(stderr, "%s:%d - Invalid character '%c' in driver \"%s\"\n", srcfile, linenum, *drivch, drivname);
return 1;
}
// add it to the list
char *name = (char *)malloc(strlen(drivname) + 1);
strcpy(name, drivname);
drivlist[drivcount++] = name;
continue;
}
// otherwise treat as a driver name
char drivname[32];
drivname[0] = 0;
srcptr--;
for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++)
{
drivname[pos] = *srcptr++;
drivname[pos+1] = 0;
}
// verify the name as valid
for (char *drivch = drivname; *drivch != 0; drivch++)
{
if ((*drivch >= 'a' && *drivch <= 'z') || (*drivch >= '0' && *drivch <= '9') || *drivch == '_')
continue;
fprintf(stderr, "%s:%d - Invalid character '%c' in driver \"%s\"\n", srcfile, linenum, *drivch, drivname);
return 1;
}
// add it to the list
char *name = (char *)malloc(strlen(drivname) + 1);
strcpy(name, drivname);
drivlist[drivcount++] = name;
}
return 0;
}
//-------------------------------------------------
// main - primary entry point
//-------------------------------------------------
@ -190,10 +191,10 @@ int main(int argc, char *argv[])
// extract arguments
const char *srcfile = argv[1];
// parse the root file, exit early upon failure
drivcount = 0;
if (parse_file(srcfile)) {
if (parse_file(srcfile))
return 1;
}
// add a reference to the ___empty driver
drivlist[drivcount++] = "___empty";

View File

@ -11,7 +11,7 @@
#define LOG_GFX_OPS 0
#define LOGGFX(x) do { if (LOG_GFX_OPS && input_code_pressed(tms->device->machine(), KEYCODE_L)) logerror x; } while (0)
#define LOGGFX(x) do { if (LOG_GFX_OPS && tms->device->machine().input().code_pressed(KEYCODE_L)) logerror x; } while (0)
/* Graphics Instructions */

View File

@ -81,7 +81,6 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
// I/O
#include "input.h"
#include "inputseq.h"
#include "inptport.h"
#include "output.h"

View File

@ -79,7 +79,6 @@ EMUOBJS = \
$(EMUOBJ)/image.o \
$(EMUOBJ)/info.o \
$(EMUOBJ)/input.o \
$(EMUOBJ)/inputseq.o \
$(EMUOBJ)/inptport.o \
$(EMUOBJ)/mame.o \
$(EMUOBJ)/machine.o \

View File

@ -235,16 +235,6 @@ struct _input_port_state
};
/* internal live state of an input type */
typedef struct _input_type_state input_type_state;
struct _input_type_state
{
input_type_state * next; /* pointer to the next live state in the list */
input_type_desc typedesc; /* copy of the original description, modified by the OSD */
input_seq seq[SEQ_TYPE_TOTAL];/* currently configured sequences */
};
typedef struct _inputx_code inputx_code;
struct _inputx_code
{
@ -277,8 +267,8 @@ struct _input_port_private
UINT8 safe_to_read; /* clear at start; set after state is loaded */
/* types */
input_type_state * typestatelist; /* list of live type states */
input_type_state * type_to_typestate[__ipt_max][MAX_PLAYERS]; /* map from type/player to type state */
simple_list<input_type_entry> typelist; /* list of live type states */
input_type_entry * type_to_entry[__ipt_max][MAX_PLAYERS]; /* map from type/player to type state */
/* specific special global input states */
digital_joystick_state joystick_info[MAX_PLAYERS][DIGITAL_JOYSTICKS_PER_PLAYER]; /* joystick states */
@ -800,7 +790,7 @@ static int load_game_config(running_machine &machine, xml_data_node *portnode, i
/* settings save */
static void save_config_callback(running_machine &machine, int config_type, xml_data_node *parentnode);
static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq);
static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq &seq);
static int save_this_input_field_type(int type);
static void save_default_inputs(running_machine &machine, xml_data_node *parentnode);
static void save_game_inputs(running_machine &machine, xml_data_node *parentnode);
@ -1028,20 +1018,17 @@ const char *input_field_name(const input_field_config *field)
for the given input field
-------------------------------------------------*/
const input_seq *input_field_seq(const input_field_config *field, input_seq_type seqtype)
const input_seq &input_field_seq(const input_field_config *field, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
const input_seq *portseq = &ip_none;
/* if the field is disabled, return no key */
if (field->flags & FIELD_FLAG_UNUSED)
return portseq;
return input_seq::empty_seq;
/* select either the live or config state depending on whether we have live state */
portseq = (field->state == NULL) ? &field->seq[seqtype] : &field->state->seq[seqtype];
const input_seq &portseq = (field->state == NULL) ? field->seq[seqtype] : field->state->seq[seqtype];
/* if the portseq is the special default code, return the expanded default value */
if (input_seq_get_1(portseq) == SEQCODE_DEFAULT)
if (portseq.is_default())
return input_type_seq(field->machine(), field->type, field->player, seqtype);
/* otherwise, return the sequence as-is */
@ -1087,15 +1074,14 @@ void input_field_get_user_settings(const input_field_config *field, input_field_
void input_field_set_user_settings(const input_field_config *field, const input_field_user_settings *settings)
{
static const input_seq default_seq = SEQ_DEF_1(SEQCODE_DEFAULT);
int seqtype;
/* copy the basics */
for (seqtype = 0; seqtype < ARRAY_LENGTH(settings->seq); seqtype++)
{
const input_seq *defseq = input_type_seq(field->machine(), field->type, field->player, (input_seq_type)seqtype);
if (input_seq_cmp(defseq, &settings->seq[seqtype]) == 0)
field->state->seq[seqtype] = default_seq;
const input_seq &defseq = input_type_seq(field->machine(), field->type, field->player, (input_seq_type)seqtype);
if (defseq == settings->seq[seqtype])
field->state->seq[seqtype] = input_seq::default_seq;
else
field->state->seq[seqtype] = settings->seq[seqtype];
}
@ -1289,22 +1275,10 @@ int input_type_is_analog(int type)
const char *input_type_name(running_machine &machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
if (1)//machine != NULL)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.name;
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].name;
}
input_port_private *portdata = machine.input_port_data;
input_type_entry *entry = portdata->type_to_entry[type][player];
if (entry != NULL)
return entry->name;
/* if we find nothing, return an invalid group */
return "???";
@ -1318,23 +1292,10 @@ const char *input_type_name(running_machine &machine, int type, int player)
int input_type_group(running_machine &machine, int type, int player)
{
/* if we have a machine, use the live state and quick lookup */
if (1)//machine != NULL)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.group;
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return core_types[typenum].group;
}
input_port_private *portdata = machine.input_port_data;
input_type_entry *entry = portdata->type_to_entry[type][player];
if (entry != NULL)
return entry->group;
/* if we find nothing, return an invalid group */
return IPG_INVALID;
@ -1346,33 +1307,19 @@ int input_type_group(running_machine &machine, int type, int player)
sequence for the given type/player
-------------------------------------------------*/
const input_seq *input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype)
const input_seq &input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype)
{
static const input_seq ip_none = SEQ_DEF_0;
assert((type >= 0) && (type < __ipt_max));
assert((player >= 0) && (player < MAX_PLAYERS));
assert(type >= 0 && type < __ipt_max);
assert(player >= 0 && player < MAX_PLAYERS);
/* if we have a machine, use the live state and quick lookup */
if (1)//machine != NULL)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return &typestate->seq[seqtype];
}
/* if no machine, fall back to brute force searching */
else
{
int typenum;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
if (core_types[typenum].type == type && core_types[typenum].player == player)
return &core_types[typenum].seq[seqtype];
}
input_port_private *portdata = machine.input_port_data;
input_type_entry *entry = portdata->type_to_entry[type][player];
if (entry != NULL)
return entry->seq[seqtype];
/* if we find nothing, return an empty sequence */
return &ip_none;
return input_seq::empty_seq;
}
@ -1384,9 +1331,9 @@ const input_seq *input_type_seq(running_machine &machine, int type, int player,
void input_type_set_seq(running_machine &machine, int type, int player, input_seq_type seqtype, const input_seq *newseq)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
typestate->seq[seqtype] = *newseq;
input_type_entry *entry = portdata->type_to_entry[type][player];
if (entry != NULL)
entry->seq[seqtype] = *newseq;
}
@ -1398,7 +1345,7 @@ void input_type_set_seq(running_machine &machine, int type, int player, input_se
int input_type_pressed(running_machine &machine, int type, int player)
{
return input_seq_pressed(machine, input_type_seq(machine, type, player, SEQ_TYPE_STANDARD));
return machine.input().seq_pressed(input_type_seq(machine, type, player, SEQ_TYPE_STANDARD));
}
@ -1406,10 +1353,10 @@ int input_type_pressed(running_machine &machine, int type, int player)
input_type_list - return the list of types
-------------------------------------------------*/
const input_type_desc *input_type_list(running_machine &machine)
const simple_list<input_type_entry> &input_type_list(running_machine &machine)
{
input_port_private *portdata = machine.input_port_data;
return &portdata->typestatelist->typedesc;
return portdata->typelist;
}
@ -1851,44 +1798,26 @@ const char *input_port_string_from_token(const char *string)
static void init_port_types(running_machine &machine)
{
input_port_private *portdata = machine.input_port_data;
input_type_state **stateptr;
input_type_state *curtype;
input_type_desc *lasttype = NULL;
int seqtype, typenum;
/* convert the array into a list of type states that can be modified */
portdata->typestatelist = NULL;
stateptr = &portdata->typestatelist;
for (typenum = 0; typenum < ARRAY_LENGTH(core_types); typenum++)
{
/* allocate memory for the state and link it to the end of the list */
*stateptr = auto_alloc_clear(machine, input_type_state);
/* copy the type description and link the previous description to it */
(*stateptr)->typedesc = core_types[typenum];
if (lasttype != NULL)
lasttype->next = &(*stateptr)->typedesc;
lasttype = &(*stateptr)->typedesc;
/* advance */
stateptr = &(*stateptr)->next;
}
construct_core_types(portdata->typelist);
/* ask the OSD to customize the list */
machine.osd().customize_input_type_list(&portdata->typestatelist->typedesc);
machine.osd().customize_input_type_list(portdata->typelist);
/* now iterate over the OSD-modified types */
for (curtype = portdata->typestatelist; curtype != NULL; curtype = curtype->next)
for (input_type_entry *curtype = portdata->typelist.first(); curtype != NULL; curtype = curtype->next())
{
/* first copy all the OSD-updated sequences into our current state */
for (seqtype = 0; seqtype < ARRAY_LENGTH(curtype->seq); seqtype++)
curtype->seq[seqtype] = curtype->typedesc.seq[seqtype];
for (int seqtype = 0; seqtype < ARRAY_LENGTH(curtype->seq); seqtype++)
curtype->seq[seqtype] = curtype->defseq[seqtype];
/* also make a lookup table mapping type/player to the appropriate type list entry */
portdata->type_to_typestate[curtype->typedesc.type][curtype->typedesc.player] = curtype;
portdata->type_to_entry[curtype->type][curtype->player] = curtype;
}
}
/*-------------------------------------------------
get_keyboard_code - accesses a particular
keyboard code
@ -1904,6 +1833,7 @@ static unicode_char get_keyboard_code(const input_field_config *field, int i)
return ch;
}
/***************************************************************************
MISCELLANEOUS
***************************************************************************/
@ -2124,7 +2054,7 @@ static void init_port_state(running_machine &machine)
for (field = port->first_field(); field != NULL; field = field->next())
if (field->state->joystick != NULL && field->way == 4)
{
input_device_set_joystick_map(machine, -1, (field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
machine.input().set_global_joystick_map((field->flags & FIELD_FLAG_ROTATED) ? joystick_map_4way_diagonal : joystick_map_4way_sticky);
break;
}
}
@ -2174,7 +2104,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ
mame_printf_error("Invalid %s value %s; reverting to keyboard\n", option, stemp);
/* only scan the list if we haven't already enabled this class of control */
if (portlist.first() != NULL && !input_device_class_enabled(portlist.first()->machine(), autoenable))
if (portlist.first() != NULL && !machine.input().device_class(autoenable).enabled())
for (port = portlist.first(); port != NULL; port = port->next())
for (field = port->first_field(); field != NULL; field = field->next())
@ -2184,7 +2114,7 @@ static void init_autoselect_devices(running_machine &machine, int type1, int typ
(type3 != 0 && field->type == type3))
{
mame_printf_verbose("Input: Autoenabling %s due to presence of a %s\n", autostring, ananame);
input_device_class_enable(port->machine(), autoenable, TRUE);
machine.input().device_class(autoenable).enable();
break;
}
}
@ -2590,13 +2520,13 @@ static void frame_update_digital_joysticks(running_machine &machine)
joystick->current = 0;
/* read all the associated ports */
if (joystick->field[JOYDIR_UP] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
if (joystick->field[JOYDIR_UP] != NULL && machine.input().seq_pressed(input_field_seq(joystick->field[JOYDIR_UP], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_UP_BIT;
if (joystick->field[JOYDIR_DOWN] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
if (joystick->field[JOYDIR_DOWN] != NULL && machine.input().seq_pressed(input_field_seq(joystick->field[JOYDIR_DOWN], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_DOWN_BIT;
if (joystick->field[JOYDIR_LEFT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
if (joystick->field[JOYDIR_LEFT] != NULL && machine.input().seq_pressed(input_field_seq(joystick->field[JOYDIR_LEFT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_LEFT_BIT;
if (joystick->field[JOYDIR_RIGHT] != NULL && input_seq_pressed(machine, input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
if (joystick->field[JOYDIR_RIGHT] != NULL && machine.input().seq_pressed(input_field_seq(joystick->field[JOYDIR_RIGHT], SEQ_TYPE_STANDARD)))
joystick->current |= JOYDIR_RIGHT_BIT;
/* lock out opposing directions (left + right or up + down) */
@ -2669,7 +2599,7 @@ static void frame_update_analog_field(running_machine &machine, analog_field_sta
analog->previous = analog->accum = apply_analog_min_max(analog, analog->accum);
/* get the new raw analog value and its type */
rawvalue = input_seq_axis_value(machine, input_field_seq(analog->field, SEQ_TYPE_STANDARD), &itemclass);
rawvalue = machine.input().seq_axis_value(input_field_seq(analog->field, SEQ_TYPE_STANDARD), itemclass);
/* if we got an absolute input, it overrides everything else */
if (itemclass == ITEM_CLASS_ABSOLUTE)
@ -2727,7 +2657,7 @@ static void frame_update_analog_field(running_machine &machine, analog_field_sta
/* if the decrement code sequence is pressed, add the key delta to */
/* the accumulated delta; also note that the last input was a digital one */
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
if (machine.input().seq_pressed(input_field_seq(analog->field, SEQ_TYPE_DECREMENT)))
{
keypressed = TRUE;
if (analog->delta != 0)
@ -2739,7 +2669,7 @@ static void frame_update_analog_field(running_machine &machine, analog_field_sta
}
/* same for the increment code sequence */
if (input_seq_pressed(machine, input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
if (machine.input().seq_pressed(input_field_seq(analog->field, SEQ_TYPE_INCREMENT)))
{
keypressed = TRUE;
if (analog->delta)
@ -2803,7 +2733,7 @@ static void frame_update_analog_field(running_machine &machine, analog_field_sta
static int frame_get_digital_field_state(const input_field_config *field, int mouse_down)
{
int curstate = mouse_down || input_seq_pressed(field->machine(), input_field_seq(field, SEQ_TYPE_STANDARD));
int curstate = mouse_down || field->machine().input().seq_pressed(input_field_seq(field, SEQ_TYPE_STANDARD));
int changed = FALSE;
/* if the state changed, look for switch down/switch up */
@ -2955,7 +2885,7 @@ input_field_config::input_field_config(input_port_config &port, int _type, input
{
memset(&condition, 0, sizeof(condition));
for (int seqtype = 0; seqtype < ARRAY_LENGTH(seq); seqtype++)
input_seq_set_1(&seq[seqtype], SEQCODE_DEFAULT);
seq[seqtype].set_default();
chars[0] = chars[1] = chars[2] = (unicode_char) 0;
}
@ -3144,7 +3074,6 @@ void diplocation_list_alloc(input_field_config &field, const char *location, ast
static int token_to_input_field_type(running_machine &machine, const char *string, int *player)
{
input_port_private *portdata = machine.input_port_data;
const input_type_desc *typedesc;
int ipnum;
/* check for our failsafe case first */
@ -3152,11 +3081,11 @@ static int token_to_input_field_type(running_machine &machine, const char *strin
return ipnum;
/* find the token in the list */
for (typedesc = &portdata->typestatelist->typedesc; typedesc != NULL; typedesc = typedesc->next)
if (typedesc->token != NULL && !strcmp(typedesc->token, string))
for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
if (entry->token != NULL && !strcmp(entry->token, string))
{
*player = typedesc->player;
return typedesc->type;
*player = entry->player;
return entry->type;
}
/* if we fail, return IPT_UNKNOWN */
@ -3173,13 +3102,12 @@ static int token_to_input_field_type(running_machine &machine, const char *strin
static const char *input_field_type_to_token(running_machine &machine, int type, int player)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
static char tempbuf[32];
/* look up the port and return the token */
typestate = portdata->type_to_typestate[type][player];
if (typestate != NULL)
return typestate->typedesc.token;
input_type_entry *entry = portdata->type_to_entry[type][player];
if (entry != NULL)
return entry->token;
/* if that fails, carry on */
sprintf(tempbuf, "TYPE_OTHER(%d,%d)", type, player);
@ -3248,7 +3176,7 @@ static void load_config_callback(running_machine &machine, int config_type, xml_
/* initialize sequences to invalid defaults */
for (seqtype = 0; seqtype < ARRAY_LENGTH(newseq); seqtype++)
input_seq_set_1(&newseq[seqtype], INPUT_CODE_INVALID);
newseq[seqtype].set(INPUT_CODE_INVALID);
/* loop over new sequences */
for (seqnode = xml_get_sibling(portnode->child, "newseq"); seqnode; seqnode = xml_get_sibling(seqnode->next, "newseq"))
@ -3258,9 +3186,9 @@ static void load_config_callback(running_machine &machine, int config_type, xml_
if (seqtype != -1 && seqnode->value != NULL)
{
if (strcmp(seqnode->value, "NONE") == 0)
input_seq_set_0(&newseq[seqtype]);
else if (input_seq_from_tokens(machine, seqnode->value, &tempseq) != 0)
newseq[seqtype] = tempseq;
newseq[seqtype].set();
else
machine.input().seq_from_tokens(newseq[seqtype], seqnode->value);
}
}
@ -3274,14 +3202,9 @@ static void load_config_callback(running_machine &machine, int config_type, xml_
/* after applying the controller config, push that back into the backup, since that is */
/* what we will diff against */
if (config_type == CONFIG_TYPE_CONTROLLER)
{
input_type_state *typestate;
int seqtype;
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->typedesc.seq); seqtype++)
typestate->typedesc.seq[seqtype] = typestate->seq[seqtype];
}
for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
entry->defseq[seqtype] = entry->seq[seqtype];
}
@ -3315,8 +3238,8 @@ static void load_remap_table(running_machine &machine, xml_data_node *parentnode
count = 0;
for (remapnode = xml_get_sibling(parentnode->child, "remap"); remapnode != NULL; remapnode = xml_get_sibling(remapnode->next, "remap"))
{
input_code origcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "origcode", ""));
input_code newcode = input_code_from_token(machine, xml_get_attribute_string(remapnode, "newcode", ""));
input_code origcode = machine.input().code_from_token(xml_get_attribute_string(remapnode, "origcode", ""));
input_code newcode = machine.input().code_from_token(xml_get_attribute_string(remapnode, "newcode", ""));
if (origcode != INPUT_CODE_INVALID && newcode != INPUT_CODE_INVALID)
{
oldtable[count] = origcode;
@ -3330,18 +3253,13 @@ static void load_remap_table(running_machine &machine, xml_data_node *parentnode
{
input_code oldcode = oldtable[remapnum];
input_code newcode = newtable[remapnum];
input_type_state *typestate;
/* loop over all default ports, remapping the requested keys */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
{
int seqtype, codenum;
/* remap anything in the default sequences */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
for (codenum = 0; codenum < ARRAY_LENGTH(typestate->seq[0].code); codenum++)
if (typestate->seq[seqtype].code[codenum] == oldcode)
typestate->seq[seqtype].code[codenum] = newcode;
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
entry->seq[seqtype].replace(oldcode, newcode);
}
}
@ -3360,16 +3278,14 @@ static void load_remap_table(running_machine &machine, xml_data_node *parentnode
static int load_default_config(running_machine &machine, xml_data_node *portnode, int type, int player, const input_seq *newseq)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
int seqtype;
/* find a matching port in the list */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
if (typestate->typedesc.type == type && typestate->typedesc.player == player)
for (input_type_entry *entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
if (entry->type == type && entry->player == player)
{
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
typestate->seq[seqtype] = newseq[seqtype];
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
if (newseq[seqtype][0] != INPUT_CODE_INVALID)
entry->seq[seqtype] = newseq[seqtype];
return TRUE;
}
@ -3409,7 +3325,7 @@ static int load_game_config(running_machine &machine, xml_data_node *portnode, i
/* if a sequence was specified, copy it in */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_get_1(&newseq[seqtype]) != INPUT_CODE_INVALID)
if (newseq[seqtype][0] != INPUT_CODE_INVALID)
field->state->seq[seqtype] = newseq[seqtype];
/* for non-analog fields, fetch the value */
@ -3465,16 +3381,16 @@ static void save_config_callback(running_machine &machine, int config_type, xml_
sequence
-------------------------------------------------*/
static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq *seq)
static void save_sequence(running_machine &machine, xml_data_node *parentnode, int type, int porttype, const input_seq &seq)
{
astring seqstring;
xml_data_node *seqnode;
/* get the string for the sequence */
if (input_seq_get_1(seq) == SEQCODE_END)
if (seq.length() == 0)
seqstring.cpy("NONE");
else
input_seq_to_tokens(machine, seqstring, seq);
machine.input().seq_to_tokens(seqstring, seq);
/* add the new node */
seqnode = xml_add_child(parentnode, "newseq", seqstring);
@ -3511,35 +3427,35 @@ static int save_this_input_field_type(int type)
static void save_default_inputs(running_machine &machine, xml_data_node *parentnode)
{
input_port_private *portdata = machine.input_port_data;
input_type_state *typestate;
input_type_entry *entry;
/* iterate over ports */
for (typestate = portdata->typestatelist; typestate != NULL; typestate = typestate->next)
for (entry = portdata->typelist.first(); entry != NULL; entry = entry->next())
{
/* only save if this port is a type we save */
if (save_this_input_field_type(typestate->typedesc.type))
if (save_this_input_field_type(entry->type))
{
int seqtype;
/* see if any of the sequences have changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
for (seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
if (entry->seq[seqtype] != entry->defseq[seqtype])
break;
/* if so, we need to add a node */
if (seqtype < ARRAY_LENGTH(typestate->seq))
if (seqtype < ARRAY_LENGTH(entry->seq))
{
/* add a new port node */
xml_data_node *portnode = xml_add_child(parentnode, "port", NULL);
if (portnode != NULL)
{
/* add the port information and attributes */
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, typestate->typedesc.type, typestate->typedesc.player));
xml_set_attribute(portnode, "type", input_field_type_to_token(machine, entry->type, entry->player));
/* add only the sequences that have changed from the defaults */
for (seqtype = 0; seqtype < ARRAY_LENGTH(typestate->seq); seqtype++)
if (input_seq_cmp(&typestate->seq[seqtype], &typestate->typedesc.seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, typestate->typedesc.type, &typestate->seq[seqtype]);
for (int seqtype = 0; seqtype < ARRAY_LENGTH(entry->seq); seqtype++)
if (entry->seq[seqtype] != entry->defseq[seqtype])
save_sequence(machine, portnode, seqtype, entry->type, entry->seq[seqtype]);
}
}
}
@ -3567,7 +3483,7 @@ static void save_game_inputs(running_machine &machine, xml_data_node *parentnode
/* determine if we changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
changed |= (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0);
changed |= (field->state->seq[seqtype] != field->seq[seqtype]);
/* non-analog changes */
if (field->state->analog == NULL)
@ -3599,8 +3515,8 @@ static void save_game_inputs(running_machine &machine, xml_data_node *parentnode
/* add sequences if changed */
for (seqtype = 0; seqtype < ARRAY_LENGTH(field->state->seq); seqtype++)
if (input_seq_cmp(&field->state->seq[seqtype], &field->seq[seqtype]) != 0)
save_sequence(machine, portnode, seqtype, field->type, &field->state->seq[seqtype]);
if (field->state->seq[seqtype] != field->seq[seqtype])
save_sequence(machine, portnode, seqtype, field->type, field->state->seq[seqtype]);
/* write out non-analog changes */
if (field->state->analog == NULL)
@ -4080,10 +3996,10 @@ static const char *code_point_string(running_machine &machine, unicode_char ch)
}
else if (ch >= UCHAR_MAMEKEY_BEGIN)
{
/* try to obtain a codename with input_code_name(); this can result in an empty string */
astring astr;
input_code_name(machine, astr, (input_code) ch - UCHAR_MAMEKEY_BEGIN);
snprintf(buf, ARRAY_LENGTH(buf), "%s", astr.cstr());
/* try to obtain a codename with code_name(); this can result in an empty string */
input_code code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(ch - UCHAR_MAMEKEY_BEGIN));
astring tempstr;
snprintf(buf, ARRAY_LENGTH(buf), "%s", machine.input().code_name(tempstr, code));
}
else
{
@ -4949,7 +4865,7 @@ input_field_config *ioconfig_alloc_onoff(input_port_config &port, const char *na
if (name == DEF_STR(Service_Mode))
{
curfield->flags |= FIELD_FLAG_TOGGLE;
curfield->seq[SEQ_TYPE_STANDARD].code[0] = KEYCODE_F2;
curfield->seq[SEQ_TYPE_STANDARD].set(KEYCODE_F2);
}
if (diplocation != NULL)
diplocation_list_alloc(*curfield, diplocation, errorbuf);
@ -4975,6 +4891,33 @@ void ioconfig_field_add_char(input_field_config &field, unicode_char ch, astring
void ioconfig_add_code(input_field_config &field, int which, input_code code)
{
input_seq_append_or(&field.seq[which], code);
field.seq[which] |= code;
}
input_type_entry::input_type_entry(UINT32 _type, ioport_group _group, int _player, const char *_token, const char *_name, input_seq standard)
: type(_type),
group(_group),
player(_player),
token(_token),
name(_name),
m_next(NULL)
{
defseq[SEQ_TYPE_STANDARD] = seq[SEQ_TYPE_STANDARD] = standard;
defseq[SEQ_TYPE_INCREMENT] = seq[SEQ_TYPE_INCREMENT] = input_seq::empty_seq;
defseq[SEQ_TYPE_DECREMENT] = seq[SEQ_TYPE_DECREMENT] = input_seq::empty_seq;
}
input_type_entry::input_type_entry(UINT32 _type, ioport_group _group, int _player, const char *_token, const char *_name, input_seq standard, input_seq decrement, input_seq increment)
: type(_type),
group(_group),
player(_player),
token(_token),
name(_name),
m_next(NULL)
{
defseq[SEQ_TYPE_STANDARD] = seq[SEQ_TYPE_STANDARD] = standard;
defseq[SEQ_TYPE_INCREMENT] = seq[SEQ_TYPE_INCREMENT] = increment;
defseq[SEQ_TYPE_DECREMENT] = seq[SEQ_TYPE_DECREMENT] = decrement;
}

View File

@ -84,7 +84,7 @@ enum
/* groups for input ports */
enum
enum ioport_group
{
IPG_UI = 0,
IPG_PLAYER1,
@ -512,8 +512,7 @@ enum
#define UCHAR_SHIFT_1 (UCHAR_PRIVATE + 0)
#define UCHAR_SHIFT_2 (UCHAR_PRIVATE + 1)
#define UCHAR_MAMEKEY_BEGIN (UCHAR_PRIVATE + 2)
#define UCHAR_MAMEKEY_END (UCHAR_MAMEKEY_BEGIN + __code_key_last)
#define UCHAR_MAMEKEY(code) (UCHAR_MAMEKEY_BEGIN + KEYCODE_##code)
#define UCHAR_MAMEKEY(code) (UCHAR_MAMEKEY_BEGIN + ITEM_ID_##code)
#define UCHAR_SHIFT_BEGIN (UCHAR_SHIFT_1)
#define UCHAR_SHIFT_END (UCHAR_SHIFT_2)
@ -725,16 +724,26 @@ private:
/* describes a fundamental input type, including default input sequences */
class input_type_desc
class input_type_entry
{
friend class simple_list<input_type_entry>;
public:
input_type_desc * next; /* next description in the list */
input_type_entry(UINT32 type, ioport_group group, int player, const char *token, const char *name, input_seq standard);
input_type_entry(UINT32 type, ioport_group group, int player, const char *token, const char *name, input_seq standard, input_seq decrement, input_seq increment);
input_type_entry *next() const { return m_next; }
UINT32 type; /* IPT_* for this entry */
UINT8 group; /* which group the port belongs to */
ioport_group group; /* which group the port belongs to */
UINT8 player; /* player number (0 is player 1) */
const char * token; /* token used to store settings */
const char * name; /* user-friendly name */
input_seq seq[SEQ_TYPE_TOTAL];/* default input sequence */
input_seq defseq[SEQ_TYPE_TOTAL];/* default input sequence */
input_seq seq[SEQ_TYPE_TOTAL];/* currently configured sequences */
private:
input_type_entry * m_next; /* next description in the list */
};
@ -1140,7 +1149,7 @@ const char *input_type_name(running_machine &machine, int type, int player);
int input_type_group(running_machine &machine, int type, int player);
/* return the global input mapping sequence for the given type/player */
const input_seq *input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype);
const input_seq &input_type_seq(running_machine &machine, int type, int player, input_seq_type seqtype);
/* change the global input sequence for the given type/player */
void input_type_set_seq(running_machine &machine, int type, int player, input_seq_type seqtype, const input_seq *newseq);
@ -1149,7 +1158,7 @@ void input_type_set_seq(running_machine &machine, int type, int player, input_se
int input_type_pressed(running_machine &machine, int type, int player);
/* return the list of default mappings */
const input_type_desc *input_type_list(running_machine &machine);
const simple_list<input_type_entry> &input_type_list(running_machine &machine);
@ -1159,7 +1168,7 @@ const input_type_desc *input_type_list(running_machine &machine);
const char *input_field_name(const input_field_config *field);
/* return the input sequence for the given input field */
const input_seq *input_field_seq(const input_field_config *field, input_seq_type seqtype);
const input_seq &input_field_seq(const input_field_config *field, input_seq_type seqtype);
/* return the current settings for the given input field */
void input_field_get_user_settings(const input_field_config *field, input_field_user_settings *settings);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,645 +0,0 @@
/***************************************************************************
inputseq.c
Input sequence abstractions.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#include "emu.h"
#include <ctype.h>
/***************************************************************************
CONSTANTS
***************************************************************************/
/* max time between key presses */
#define RECORD_TIME (osd_ticks_per_second() * 2 / 3)
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
/* information about the current sequence being recorded */
static input_seq record_seq;
static osd_ticks_t record_last;
static input_item_class record_class;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* internal functions */
static int input_seq_is_valid(const input_seq *seq);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
input_seq_length - return the length of the
sequence
-------------------------------------------------*/
INLINE int input_seq_length(const input_seq *seq)
{
int seqnum;
/* find the end token; error if none found */
for (seqnum = 0; seqnum < ARRAY_LENGTH(seq->code); seqnum++)
if (seq->code[seqnum] == SEQCODE_END)
return seqnum;
return ARRAY_LENGTH(seq->code);
}
/*-------------------------------------------------
input_seq_append - append a code to the end
of an input sequence
-------------------------------------------------*/
INLINE int input_seq_append(input_seq *seq, input_code code)
{
int length = input_seq_length(seq);
/* if not enough room, return FALSE */
if (length >= ARRAY_LENGTH(seq->code) - 1)
return FALSE;
/* otherwise, append the code and add a new end */
seq->code[length++] = code;
seq->code[length] = SEQCODE_END;
return TRUE;
}
/*-------------------------------------------------
input_seq_get_last - return the last code
in a sequence
-------------------------------------------------*/
INLINE input_code input_seq_get_last(const input_seq *seq)
{
int length = input_seq_length(seq);
return (length == 0) ? SEQCODE_END : seq->code[length - 1];
}
/*-------------------------------------------------
input_seq_get_last_but_one - return the
last_but_one code in a sequence
-------------------------------------------------*/
INLINE input_code input_seq_get_last_but_one(const input_seq *seq)
{
int length = input_seq_length(seq);
return (length < 2) ? SEQCODE_END : seq->code[length - 2];
}
/*-------------------------------------------------
input_seq_backspace - "backspace" over the
last entry in a sequence
-------------------------------------------------*/
INLINE void input_seq_backspace(input_seq *seq)
{
int length = input_seq_length(seq);
/* if we have at least one entry, remove it */
if (length > 0)
seq->code[length - 1] = SEQCODE_END;
}
/***************************************************************************
STATE QUERIES
***************************************************************************/
/*-------------------------------------------------
input_seq_pressed - return true if the given
sequence of switch inputs is "pressed"
-------------------------------------------------*/
int input_seq_pressed(running_machine &machine, const input_seq *seq)
{
int result = FALSE;
int invert = FALSE;
int first = TRUE;
int codenum;
/* iterate over all of the codes */
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
/* handle NOT */
if (code == SEQCODE_NOT)
invert = TRUE;
/* handle OR and END */
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* if we have a positive result from the previous set, we're done */
if (result || code == SEQCODE_END)
break;
/* otherwise, reset our state */
result = FALSE;
invert = FALSE;
first = TRUE;
}
/* handle everything else as a series of ANDs */
else
{
/* if this is the first in the sequence, result is set equal */
if (first)
result = input_code_pressed(machine, code) ^ invert;
/* further values are ANDed */
else if (result)
result &= input_code_pressed(machine, code) ^ invert;
/* no longer first, and clear the invert flag */
first = invert = FALSE;
}
}
/* return the result if we queried at least one switch */
return result;
}
/*-------------------------------------------------
input_seq_axis_value - return the value of an
axis defined in an input sequence
-------------------------------------------------*/
INT32 input_seq_axis_value(running_machine &machine, const input_seq *seq, input_item_class *itemclass_ptr)
{
input_item_class itemclasszero = ITEM_CLASS_ABSOLUTE;
input_item_class itemclass = ITEM_CLASS_INVALID;
int result = 0;
int invert = FALSE;
int enable = TRUE;
int codenum;
/* iterate over all of the codes */
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
/* handle NOT */
if (code == SEQCODE_NOT)
invert = TRUE;
/* handle OR and END */
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* if we have a positive result from the previous set, we're done */
if (itemclass != ITEM_CLASS_INVALID || code == SEQCODE_END)
break;
/* otherwise, reset our state */
result = 0;
invert = FALSE;
enable = TRUE;
}
/* handle everything else only if we're still enabled */
else if (enable)
{
/* switch codes serve as enables */
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
/* AND against previous digital codes */
if (enable)
enable &= input_code_pressed(machine, code) ^ invert;
}
/* non-switch codes are analog values */
else
{
INT32 value = input_code_value(machine, code);
/* if we got a 0 value, don't do anything except remember the first type */
if (value == 0)
{
if (itemclasszero == ITEM_CLASS_INVALID)
itemclasszero = INPUT_CODE_ITEMCLASS(code);
}
/* non-zero absolute values stick */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
{
itemclass = ITEM_CLASS_ABSOLUTE;
result = value;
}
/* non-zero relative values accumulate */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
{
itemclass = ITEM_CLASS_RELATIVE;
result += value;
}
}
/* clear the invert flag */
invert = FALSE;
}
}
/* if the caller wants to know the type, provide it */
if (itemclass_ptr != NULL)
*itemclass_ptr = (result == 0) ? itemclasszero : itemclass;
return result;
}
/***************************************************************************
SEQUENCE POLLING
***************************************************************************/
/*-------------------------------------------------
input_seq_poll_start - begin polling for a
new sequence of the given itemclass
-------------------------------------------------*/
void input_seq_poll_start(running_machine &machine, input_item_class itemclass, const input_seq *startseq)
{
input_code dummycode;
assert(itemclass == ITEM_CLASS_SWITCH || itemclass == ITEM_CLASS_ABSOLUTE || itemclass == ITEM_CLASS_RELATIVE);
/* reset the recording count and the clock */
record_last = 0;
record_class = itemclass;
/* grab the starting sequence to append to */
if (startseq != NULL)
record_seq = *startseq;
else
input_seq_set_0(&record_seq);
/* append an OR if this is not a NULL sequence */
if (input_seq_length(&record_seq) > 0)
input_seq_append(&record_seq, SEQCODE_OR);
/* flush out any goobers */
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, TRUE) : input_code_poll_axes(machine, TRUE);
while (dummycode != INPUT_CODE_INVALID)
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, FALSE) : input_code_poll_axes(machine, FALSE);
}
/*-------------------------------------------------
input_seq_poll - continue polling
-------------------------------------------------*/
int input_seq_poll(running_machine &machine, input_seq *finalseq)
{
input_code lastcode = input_seq_get_last(&record_seq);
int has_or = FALSE;
input_code newcode;
/* switch case: see if we have a new code to process */
if (record_class == ITEM_CLASS_SWITCH)
{
newcode = input_code_poll_switches(machine, FALSE);
if (newcode != INPUT_CODE_INVALID)
{
/* if code is duplicate, toggle the NOT state on the code */
if (input_seq_length(&record_seq) > 0 && newcode == lastcode)
{
/* back up over the code */
input_seq_backspace(&record_seq);
/* if there was a NOT preceding it, just delete it, otherwise append one */
if (input_seq_get_last(&record_seq) == SEQCODE_NOT)
input_seq_backspace(&record_seq);
else
input_seq_append(&record_seq, SEQCODE_NOT);
}
}
}
/* absolute/relative case: see if we have an analog change of sufficient amount */
else
{
if (lastcode == SEQCODE_OR)
{
lastcode = input_seq_get_last_but_one(&record_seq);
has_or = TRUE;
}
newcode = input_code_poll_axes(machine, FALSE);
/* if the last code doesn't match absolute/relative of this code, ignore the new one */
if ((INPUT_CODE_ITEMCLASS(lastcode) == ITEM_CLASS_ABSOLUTE && INPUT_CODE_ITEMCLASS(newcode) != ITEM_CLASS_ABSOLUTE) ||
(INPUT_CODE_ITEMCLASS(lastcode) == ITEM_CLASS_RELATIVE && INPUT_CODE_ITEMCLASS(newcode) != ITEM_CLASS_RELATIVE))
newcode = INPUT_CODE_INVALID;
if (newcode != INPUT_CODE_INVALID)
{
/* if code is duplicate and an absolute control, toggle to half axis */
if (input_seq_length(&record_seq) > 0 && INPUT_CODE_ITEMCLASS(newcode) == ITEM_CLASS_ABSOLUTE)
{
if (newcode == INPUT_CODE_SET_MODIFIER(lastcode, ITEM_MODIFIER_NONE))
{
/* increment the modifier, wrapping back to none */
input_item_modifier oldmod = INPUT_CODE_MODIFIER(lastcode);
input_item_modifier newmod = (oldmod < ITEM_MODIFIER_NEG) ? (input_item_modifier)(oldmod + 1) : ITEM_MODIFIER_NONE;
newcode = INPUT_CODE_SET_MODIFIER(newcode, newmod);
/* back up over the previous code so we can re-append */
if (has_or)
input_seq_backspace(&record_seq);
input_seq_backspace(&record_seq);
}
}
}
}
/* if we got a new code to append it, append it and reset the timer */
if (newcode != INPUT_CODE_INVALID)
{
input_seq_append(&record_seq, newcode);
record_last = osd_ticks();
}
/* if we're recorded at least one item and the RECORD_TIME has passed, we're done */
if (record_last != 0 && (osd_ticks() > record_last + RECORD_TIME))
{
/* if the final result is invalid, reset to nothing */
if (!input_seq_is_valid(&record_seq))
input_seq_set_0(&record_seq);
/* return TRUE to indicate that we are finished */
*finalseq = record_seq;
return TRUE;
}
/* return FALSE to indicate we are still polling */
return FALSE;
}
/***************************************************************************
STRINGS AND TOKENIZATION
***************************************************************************/
/*-------------------------------------------------
input_seq_name - generate the friendly name
of a sequence
-------------------------------------------------*/
astring &input_seq_name(running_machine &machine, astring &string, const input_seq *seq)
{
astring codestr;
int codenum, copycodenum;
input_seq seqcopy;
/* walk the sequence first, removing any pieces that are invalid */
for (codenum = copycodenum = 0; codenum < ARRAY_LENGTH(seq->code) && seq->code[codenum] != SEQCODE_END; codenum++)
{
input_code code = seq->code[codenum];
/* if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs */
if (!INPUT_CODE_IS_INTERNAL(code) && !input_code_name(machine, codestr, code))
{
while (copycodenum > 0 && INPUT_CODE_IS_INTERNAL(seqcopy.code[copycodenum - 1]))
copycodenum--;
}
else if (copycodenum > 0 || !INPUT_CODE_IS_INTERNAL(code))
seqcopy.code[copycodenum++] = code;
}
seqcopy.code[copycodenum] = SEQCODE_END;
/* special case: empty */
if (copycodenum == 0)
return string.cpy((seq->code[0] == SEQCODE_END) ? "None" : "n/a");
/* start with an empty buffer */
string.reset();
/* loop until we hit the end */
for (codenum = 0; codenum < ARRAY_LENGTH(seqcopy.code) && seqcopy.code[codenum] != SEQCODE_END; codenum++)
{
input_code code = seqcopy.code[codenum];
/* append a space if not the first code */
if (codenum != 0)
string.cat(" ");
/* handle OR/NOT codes here */
if (code == SEQCODE_OR)
string.cat("or");
else if (code == SEQCODE_NOT)
string.cat("not");
/* otherwise, assume it is an input code and ask the input system to generate it */
else
string.cat(input_code_name(machine, codestr, code));
}
return string;
}
/*-------------------------------------------------
input_seq_to_tokens - generate the tokenized
form of a sequence
-------------------------------------------------*/
astring &input_seq_to_tokens(running_machine &machine, astring &string, const input_seq *seq)
{
astring codestr;
int codenum;
/* start with an empty buffer */
string.reset();
/* loop until we hit the end */
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code) && seq->code[codenum] != SEQCODE_END; codenum++)
{
input_code code = seq->code[codenum];
/* append a space if not the first code */
if (codenum != 0)
string.cat(" ");
/* handle OR/NOT codes here */
if (code == SEQCODE_OR)
string.cat("OR");
else if (code == SEQCODE_NOT)
string.cat("NOT");
else if (code == SEQCODE_DEFAULT)
string.cat("DEFAULT");
/* otherwise, assume it is an input code and ask the input system to generate it */
else
string.cat(input_code_to_token(machine, codestr, code));
}
return string;
}
/*-------------------------------------------------
input_seq_from_tokens - generate the tokenized
form of a sequence
-------------------------------------------------*/
int input_seq_from_tokens(running_machine &machine, const char *string, input_seq *seq)
{
char *strcopy = auto_alloc_array(machine, char, strlen(string) + 1);
char *str = strcopy;
int result = FALSE;
/* start with a blank sequence */
input_seq_set_0(seq);
/* loop until we're done */
strcpy(strcopy, string);
while (1)
{
input_code code;
char origspace;
char *strtemp;
/* trim any leading spaces */
while (*str != 0 && isspace((UINT8)*str))
str++;
/* bail if we're done */
if (*str == 0)
{
result = TRUE;
break;
}
/* find the end of the token and make it upper-case along the way */
for (strtemp = str; *strtemp != 0 && !isspace((UINT8)*strtemp); strtemp++)
*strtemp = toupper((UINT8)*strtemp);
origspace = *strtemp;
*strtemp = 0;
/* look for common stuff */
if (strcmp(str, "OR") == 0)
code = SEQCODE_OR;
else if (strcmp(str, "NOT") == 0)
code = SEQCODE_NOT;
else if (strcmp(str, "DEFAULT") == 0)
code = SEQCODE_DEFAULT;
else
code = input_code_from_token(machine, str);
/* translate and add to the sequence */
input_seq_append(seq, code);
/* advance */
if (origspace == 0)
{
result = TRUE;
break;
}
str = strtemp + 1;
}
auto_free(machine, strcopy);
return result;
}
/***************************************************************************
INTERNAL FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
input_seq_is_valid - return TRUE if a given
sequence is valid
-------------------------------------------------*/
static int input_seq_is_valid(const input_seq *seq)
{
input_item_class lastclass = ITEM_CLASS_INVALID;
input_code lastcode = INPUT_CODE_INVALID;
int positive_code_count = 0;
int seqnum;
/* scan the sequence for valid codes */
for (seqnum = 0; seqnum < ARRAY_LENGTH(seq->code); seqnum++)
{
input_code code = seq->code[seqnum];
/* invalid codes are invalid */
if (code == INPUT_CODE_INVALID)
return FALSE;
/* if we hit an OR or the end, validate the previous chunk */
if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* must be at least one positive code */
if (positive_code_count == 0)
return FALSE;
/* last code must not have been an internal code */
if (INPUT_CODE_IS_INTERNAL(lastcode))
return FALSE;
/* if this is the end, we're ok */
if (code == SEQCODE_END)
return TRUE;
/* reset the state for the next chunk */
positive_code_count = 0;
lastclass = ITEM_CLASS_INVALID;
}
/* if we hit a NOT, make sure we don't have a double */
else if (code == SEQCODE_NOT)
{
if (lastcode == SEQCODE_NOT)
return FALSE;
}
/* anything else */
else
{
input_item_class itemclass = INPUT_CODE_ITEMCLASS(code);
/* count positive codes */
if (lastcode != SEQCODE_NOT)
positive_code_count++;
/* non-switch items can't have a NOT */
if (itemclass != ITEM_CLASS_SWITCH && lastcode == SEQCODE_NOT)
return FALSE;
/* absolute/relative items must all be the same class */
if ((lastclass == ITEM_CLASS_ABSOLUTE && itemclass != ITEM_CLASS_ABSOLUTE) ||
(lastclass == ITEM_CLASS_RELATIVE && itemclass != ITEM_CLASS_RELATIVE))
return FALSE;
}
/* remember the last code */
lastcode = code;
}
/* if we got here, we were missing an END token; fail */
return FALSE;
}

View File

@ -1,207 +0,0 @@
/***************************************************************************
inputseq.h
Input sequence abstractions.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef __INPUTSEQ_H__
#define __INPUTSEQ_H__
/***************************************************************************
CONSTANTS
***************************************************************************/
/* additional expanded input codes for sequences */
enum
{
/* special codes */
SEQCODE_END = INTERNAL_CODE(0),
SEQCODE_DEFAULT = INTERNAL_CODE(1),
SEQCODE_NOT = INTERNAL_CODE(2),
SEQCODE_OR = INTERNAL_CODE(3)
};
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
/* a sequence of inputs */
typedef struct _input_seq input_seq;
struct _input_seq
{
input_code code[16];
};
/***************************************************************************
MACROS
***************************************************************************/
#define SEQ_DEF_7(a,b,c,d,e,f,g) {{ a, b, c, d, e, f, g, SEQCODE_END }}
#define SEQ_DEF_6(a,b,c,d,e,f) {{ a, b, c, d, e, f, SEQCODE_END }}
#define SEQ_DEF_5(a,b,c,d,e) {{ a, b, c, d, e, SEQCODE_END }}
#define SEQ_DEF_4(a,b,c,d) {{ a, b, c, d, SEQCODE_END }}
#define SEQ_DEF_3(a,b,c) {{ a, b, c, SEQCODE_END }}
#define SEQ_DEF_2(a,b) {{ a, b, SEQCODE_END }}
#define SEQ_DEF_1(a) {{ a, SEQCODE_END }}
#define SEQ_DEF_0 {{ SEQCODE_END }}
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* ----- state queries ----- */
/* return TRUE if the given switch sequence has been pressed */
int input_seq_pressed(running_machine &machine, const input_seq *seq);
/* return the value of an axis sequence */
INT32 input_seq_axis_value(running_machine &machine, const input_seq *seq, input_item_class *itemclass_ptr);
/* ----- sequence polling ----- */
/* begin polling for a new sequence of the given itemclass */
void input_seq_poll_start(running_machine &machine, input_item_class itemclass, const input_seq *startseq);
/* continue polling for a sequence */
int input_seq_poll(running_machine &machine, input_seq *finalseq);
/* ----- strings and tokenization ----- */
/* generate the friendly name of an input sequence */
astring &input_seq_name(running_machine &machine, astring &string, const input_seq *seq);
/* convert an input sequence to tokens, returning the length */
astring &input_seq_to_tokens(running_machine &machine, astring &string, const input_seq *seq);
/* convert a set of tokens back to an input sequence */
int input_seq_from_tokens(running_machine &machine, const char *string, input_seq *seq);
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
input_seq_get_1 - fetch the first item of an
input sequence
-------------------------------------------------*/
INLINE input_code input_seq_get_1(const input_seq *seq)
{
return seq->code[0];
}
/*-------------------------------------------------
input_seq_set_n - set a sequence of n codes
as an input sequence
-------------------------------------------------*/
INLINE void input_seq_set_5(input_seq *seq, input_code code0, input_code code1, input_code code2, input_code code3, input_code code4)
{
int codenum;
seq->code[0] = code0;
seq->code[1] = code1;
seq->code[2] = code2;
seq->code[3] = code3;
seq->code[4] = code4;
for (codenum = 5; codenum < ARRAY_LENGTH(seq->code); codenum++)
seq->code[codenum] = SEQCODE_END;
}
INLINE void input_seq_set_4(input_seq *seq, input_code code0, input_code code1, input_code code2, input_code code3)
{
input_seq_set_5(seq, code0, code1, code2, code3, SEQCODE_END);
}
INLINE void input_seq_set_3(input_seq *seq, input_code code0, input_code code1, input_code code2)
{
input_seq_set_5(seq, code0, code1, code2, SEQCODE_END, SEQCODE_END);
}
INLINE void input_seq_set_2(input_seq *seq, input_code code0, input_code code1)
{
input_seq_set_5(seq, code0, code1, SEQCODE_END, SEQCODE_END, SEQCODE_END);
}
INLINE void input_seq_set_1(input_seq *seq, input_code code0)
{
input_seq_set_5(seq, code0, SEQCODE_END, SEQCODE_END, SEQCODE_END, SEQCODE_END);
}
INLINE void input_seq_set_0(input_seq *seq)
{
input_seq_set_5(seq, SEQCODE_END, SEQCODE_END, SEQCODE_END, SEQCODE_END, SEQCODE_END);
}
/*-------------------------------------------------
input_seq_cmp - compare two input sequences
-------------------------------------------------*/
INLINE int input_seq_cmp(const input_seq *seqa, const input_seq *seqb)
{
int codenum;
for (codenum = 0; codenum < ARRAY_LENGTH(seqa->code); codenum++)
{
if (seqa->code[codenum] != seqb->code[codenum])
return -1;
if (seqa->code[codenum] == SEQCODE_END)
break;
}
return 0;
}
/*-------------------------------------------------
input_seq_append_or - append a code to a
sequence; if the sequence is non-empty, insert
an OR before the new code
-------------------------------------------------*/
INLINE void input_seq_append_or(input_seq *seq, input_code code)
{
int codenum;
if (seq->code[0] == SEQCODE_END || seq->code[0] == SEQCODE_DEFAULT)
{
seq->code[0] = code;
seq->code[1] = SEQCODE_END;
}
else
{
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code) - 2; codenum++)
if (seq->code[codenum] == SEQCODE_END)
{
seq->code[codenum++] = SEQCODE_OR;
seq->code[codenum++] = code;
seq->code[codenum++] = SEQCODE_END;
}
}
}
#endif /* __INPUTSEQ_H__ */

View File

@ -167,6 +167,7 @@ running_machine::running_machine(const machine_config &_config, osd_interface &o
m_scheduler(*this),
m_cheat(NULL),
m_render(NULL),
m_input(NULL),
m_sound(NULL),
m_video(NULL),
m_debug_view(NULL),
@ -256,7 +257,7 @@ void running_machine::start()
{
// initialize basic can't-fail systems here
config_init(*this);
input_init(*this);
m_input = auto_alloc(*this, input_manager(*this));
output_init(*this);
palette_init(*this);
m_render = auto_alloc(*this, render_manager(*this));

View File

@ -336,6 +336,7 @@ public:
save_manager &save() { return m_save; }
cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; }
render_manager &render() const { assert(m_render != NULL); return *m_render; }
input_manager &input() const { assert(m_input != NULL); return *m_input; }
sound_manager &sound() const { assert(m_sound != NULL); return *m_sound; }
video_manager &video() const { assert(m_video != NULL); return *m_video; }
debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; }
@ -459,6 +460,7 @@ private:
// managers
cheat_manager * m_cheat; // internal data from cheat.c
render_manager * m_render; // internal data from render.c
input_manager * m_input; // internal data from input.c
sound_manager * m_sound; // internal data from sound.c
video_manager * m_video; // internal data from video.c
debug_view_manager * m_debug_view; // internal data from debugvw.c

View File

@ -541,14 +541,14 @@ READ8_DEVICE_HANDLER(duart68681_r)
{
r = 0xff;
#if 0
if (input_code_pressed(device->machine(), KEYCODE_1)) r ^= 0x0001;
if (input_code_pressed(device->machine(), KEYCODE_2)) r ^= 0x0002;
if (input_code_pressed(device->machine(), KEYCODE_3)) r ^= 0x0004;
if (input_code_pressed(device->machine(), KEYCODE_4)) r ^= 0x0008;
if (input_code_pressed(device->machine(), KEYCODE_5)) r ^= 0x0010;
if (input_code_pressed(device->machine(), KEYCODE_6)) r ^= 0x0020;
if (input_code_pressed(device->machine(), KEYCODE_7)) r ^= 0x0040;
if (input_code_pressed(device->machine(), KEYCODE_8)) r ^= 0x0080;
if (device->machine().input().code_pressed(KEYCODE_1)) r ^= 0x0001;
if (device->machine().input().code_pressed(KEYCODE_2)) r ^= 0x0002;
if (device->machine().input().code_pressed(KEYCODE_3)) r ^= 0x0004;
if (device->machine().input().code_pressed(KEYCODE_4)) r ^= 0x0008;
if (device->machine().input().code_pressed(KEYCODE_5)) r ^= 0x0010;
if (device->machine().input().code_pressed(KEYCODE_6)) r ^= 0x0020;
if (device->machine().input().code_pressed(KEYCODE_7)) r ^= 0x0040;
if (device->machine().input().code_pressed(KEYCODE_8)) r ^= 0x0080;
#endif
}
break;

View File

@ -71,19 +71,18 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
device_slot_interface *slot = NULL;
for (bool gotone = m_devicelist.first(slot); gotone; gotone = slot->next(slot))
{
device_t &owner = slot->device();
const slot_interface *intf = slot->get_slot_interfaces();
if (intf != NULL)
{
const char *selval = options.value(owner.tag());
if (options.seqid(owner.tag())==0) {
device_t &owner = slot->device();
const char *selval = options.value(owner.tag());
if (options.seqid(owner.tag()) == 0)
selval = slot->get_default_card();
}
if (selval) {
if (selval != NULL)
for (int i = 0; intf[i].name != NULL; i++)
if (strcmp(selval, intf[i].name) == 0)
device_add(&owner, intf[i].name, intf[i].devtype, 0);
}
}
}

View File

@ -384,7 +384,7 @@ else
double gc_f0;
int gc_i, gc_j, gc_k, gc_l;
if (input_code_pressed_once(device->machine(), KEYCODE_DEL_PAD))
if (device->machine().input().code_pressed_once(KEYCODE_DEL_PAD))
{
gc_active ^= 1;
if (!gc_active) popmessage(NULL);
@ -392,23 +392,23 @@ else
if (gc_active)
{
if (input_code_pressed_once(device->machine(), KEYCODE_0_PAD)) gc_chip ^= 1;
if (device->machine().input().code_pressed_once(KEYCODE_0_PAD)) gc_chip ^= 1;
gc_i = gc_pos[gc_chip];
gc_j = 0;
if (input_code_pressed_once(device->machine(), KEYCODE_4_PAD)) { gc_i--; gc_j = 1; }
if (input_code_pressed_once(device->machine(), KEYCODE_6_PAD)) { gc_i++; gc_j = 1; }
if (device->machine().input().code_pressed_once(KEYCODE_4_PAD)) { gc_i--; gc_j = 1; }
if (device->machine().input().code_pressed_once(KEYCODE_6_PAD)) { gc_i++; gc_j = 1; }
if (gc_j) { gc_i &= 7; gc_pos[gc_chip] = gc_i; }
if (input_code_pressed_once(device->machine(), KEYCODE_5_PAD))
if (device->machine().input().code_pressed_once(KEYCODE_5_PAD))
info->k054539_gain[gc_i] = 1.0;
else
{
gc_fptr = &info->k054539_gain[gc_i];
gc_f0 = *gc_fptr;
gc_j = 0;
if (input_code_pressed_once(device->machine(), KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; }
if (input_code_pressed_once(device->machine(), KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; }
if (device->machine().input().code_pressed_once(KEYCODE_2_PAD)) { gc_f0 -= 0.1; gc_j = 1; }
if (device->machine().input().code_pressed_once(KEYCODE_8_PAD)) { gc_f0 += 0.1; gc_j = 1; }
if (gc_j) { if (gc_f0 < 0) gc_f0 = 0; *gc_fptr = gc_f0; }
}

View File

@ -1988,7 +1988,7 @@ static STREAM_UPDATE( SN76477_update )
#if TEST_MODE
static int recursing = 0; /* we need to prevent recursion since enable_w calls input_code_pressed_once(device->machine(), KEYCODE_SPACE->update */
static int recursing = 0; /* we need to prevent recursion since enable_w calls device->machine().input().code_pressed_once(KEYCODE_SPACE->update */
if () && !recursing)
{

View File

@ -319,8 +319,8 @@ int ui_display_startup_screens(running_machine &machine, int first_time, int sho
}
/* clear the input memory */
input_code_poll_switches(machine, TRUE);
while (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID) ;
machine.input().reset_polling();
while (machine.input().poll_switches() != INPUT_CODE_INVALID) ;
/* loop while we have a handler */
while (ui_handler_callback != handler_ingame && !machine.scheduled_event_pending() && !ui_menu_is_force_game_select())
@ -1135,11 +1135,11 @@ static UINT32 handler_messagebox_ok(running_machine &machine, render_container *
ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
/* an 'O' or left joystick kicks us to the next state */
if (state == 0 && (input_code_pressed_once(machine, KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
if (state == 0 && (machine.input().code_pressed_once(KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
state++;
/* a 'K' or right joystick exits the state */
else if (state == 1 && (input_code_pressed_once(machine, KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
else if (state == 1 && (machine.input().code_pressed_once(KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
state = UI_HANDLER_CANCEL;
/* if the user cancels, exit out completely */
@ -1172,7 +1172,7 @@ static UINT32 handler_messagebox_anykey(running_machine &machine, render_contain
}
/* if any key is pressed, just exit */
else if (input_code_poll_switches(machine, FALSE) != INPUT_CODE_INVALID)
else if (machine.input().poll_switches() != INPUT_CODE_INVALID)
state = UI_HANDLER_CANCEL;
return state;
@ -1205,10 +1205,10 @@ static void process_natural_keyboard(running_machine &machine)
{
/* identify this keycode */
itemid = non_char_keys[i];
code = input_code_from_input_item_id(machine, itemid);
code = machine.input().code_from_itemid(itemid);
/* ...and determine if it is pressed */
pressed = input_code_pressed(machine, code);
pressed = machine.input().code_pressed(code);
/* figure out whey we are in the key_down map */
key_down_ptr = &non_char_keys_down[i / 8];
@ -1220,7 +1220,7 @@ static void process_natural_keyboard(running_machine &machine)
*key_down_ptr |= key_down_mask;
/* post the key */
inputx_postc(machine, UCHAR_MAMEKEY_BEGIN + code);
inputx_postc(machine, UCHAR_MAMEKEY_BEGIN + code.item_id());
}
else if (!pressed && (*key_down_ptr & key_down_mask))
{
@ -1402,7 +1402,7 @@ static UINT32 handler_ingame(running_machine &machine, render_container *contain
if (ui_input_pressed(machine, IPT_UI_PAUSE))
{
/* with a shift key, it is single step */
if (is_paused && (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT)))
if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT)))
{
single_step = TRUE;
machine.resume();
@ -1519,17 +1519,17 @@ static UINT32 handler_load_save(running_machine &machine, render_container *cont
}
/* check for A-Z or 0-9 */
for (code = KEYCODE_A; code <= (input_code)KEYCODE_Z; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_A + 'a';
for (input_item_id id = ITEM_ID_A; id <= ITEM_ID_Z; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_A + 'a';
if (file == 0)
for (code = KEYCODE_0; code <= (input_code)KEYCODE_9; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0 + '0';
for (input_item_id id = ITEM_ID_0; id <= ITEM_ID_9; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_0 + '0';
if (file == 0)
for (code = KEYCODE_0_PAD; code <= (input_code)KEYCODE_9_PAD; code++)
if (input_code_pressed_once(machine, code))
file = code - KEYCODE_0_PAD + '0';
for (input_item_id id = ITEM_ID_0_PAD; id <= ITEM_ID_9_PAD; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_0_PAD + '0';
if (file == 0)
return state;

View File

@ -992,8 +992,8 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state *state, i
/* handle navigation (up,down,left,right) */
step = 8;
if (input_code_pressed(machine, KEYCODE_LSHIFT)) step = 1;
if (input_code_pressed(machine, KEYCODE_LCONTROL)) step = 64;
if (machine.input().code_pressed(KEYCODE_LSHIFT)) step = 1;
if (machine.input().code_pressed(KEYCODE_LCONTROL)) step = 64;
if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
state->tilemap.yoffs -= step;
if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))

View File

@ -103,7 +103,7 @@ void ui_input_frame_update(running_machine &machine)
/* update the state of all the UI keys */
for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
{
int pressed = input_seq_pressed(machine, input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
int pressed = machine.input().seq_pressed(input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
uidata->seqpressed[code] = pressed;
}

View File

@ -329,12 +329,12 @@ 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(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)
if (field->seq[seqtype].is_default())
return input_type_seq(field->machine(), field->type, field->player, seqtype);
else
return &field->seq[seqtype];
return field->seq[seqtype];
}
@ -343,15 +343,15 @@ INLINE const input_seq *get_field_default_seq(input_field_config *field, input_s
and the default item
-------------------------------------------------*/
INLINE void toggle_none_default(input_seq *selected_seq, input_seq *original_seq, const input_seq *selected_defseq)
INLINE void toggle_none_default(input_seq &selected_seq, input_seq &original_seq, const input_seq &selected_defseq)
{
/* if we used to be "none", toggle to the default value */
if (input_seq_get_1(original_seq) == SEQCODE_END)
*selected_seq = *selected_defseq;
if (original_seq.length() == 0)
selected_seq = selected_defseq;
/* otherwise, toggle to "none" */
else
input_seq_set_1(selected_seq, SEQCODE_END);
selected_seq.reset();
}
@ -1787,7 +1787,6 @@ static void menu_input_general(running_machine &machine, ui_menu *menu, void *pa
static void menu_input_general_populate(running_machine &machine, ui_menu *menu, input_menu_state *menustate, int group)
{
input_item_data *itemlist = NULL;
const input_type_desc *typedesc;
int suborder[SEQ_TYPE_TOTAL];
astring tempstring;
int sortorder = 1;
@ -1798,10 +1797,10 @@ static void menu_input_general_populate(running_machine &machine, ui_menu *menu,
suborder[SEQ_TYPE_INCREMENT] = 2;
/* iterate over the input ports and add menu items */
for (typedesc = input_type_list(machine); typedesc != NULL; typedesc = typedesc->next)
for (input_type_entry *entry = input_type_list(machine).first(); entry != NULL; entry = entry->next())
/* add if we match the group and we have a valid name */
if (typedesc->group == group && typedesc->name != NULL && typedesc->name[0] != 0)
if (entry->group == group && entry->name != NULL && entry->name[0] != 0)
{
input_seq_type seqtype;
@ -1812,13 +1811,13 @@ static void menu_input_general_populate(running_machine &machine, ui_menu *menu,
/* build an entry for the standard sequence */
input_item_data *item = (input_item_data *)ui_menu_pool_alloc(menu, sizeof(*item));
memset(item, 0, sizeof(*item));
item->ref = typedesc;
item->ref = entry;
item->seqtype = seqtype;
item->seq = *input_type_seq(machine, typedesc->type, typedesc->player, seqtype);
item->defseq = &typedesc->seq[seqtype];
item->seq = input_type_seq(machine, entry->type, entry->player, seqtype);
item->defseq = &entry->defseq[seqtype];
item->sortorder = sortorder * 4 + suborder[seqtype];
item->type = input_type_is_analog(typedesc->type) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item->name = typedesc->name;
item->type = input_type_is_analog(entry->type) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item->name = entry->name;
item->next = itemlist;
itemlist = item;
@ -1890,8 +1889,8 @@ static void menu_input_specific_populate(running_machine &machine, ui_menu *menu
memset(item, 0, sizeof(*item));
item->ref = field;
item->seqtype = seqtype;
item->seq = *input_field_seq(field, seqtype);
item->defseq = get_field_default_seq(field, seqtype);
item->seq = input_field_seq(field, seqtype);
item->defseq = &get_field_default_seq(field, seqtype);
item->sortorder = sortorder + suborder[seqtype];
item->type = input_type_is_analog(field->type) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item->name = name;
@ -1949,16 +1948,16 @@ static void menu_input_common(running_machine &machine, ui_menu *menu, void *par
{
menustate->pollingitem = NULL;
menustate->record_next = FALSE;
toggle_none_default(&item->seq, &menustate->starting_seq, item->defseq);
toggle_none_default(item->seq, menustate->starting_seq, *item->defseq);
seqchangeditem = item;
}
/* poll again; if finished, update the sequence */
if (input_seq_poll(machine, &newseq))
if (machine.input().seq_poll())
{
menustate->pollingitem = NULL;
menustate->record_next = TRUE;
item->seq = newseq;
item->seq = machine.input().seq_poll_final();
seqchangeditem = item;
}
}
@ -1974,13 +1973,13 @@ static void menu_input_common(running_machine &machine, ui_menu *menu, void *par
menustate->pollingitem = item;
menustate->last_sortorder = item->sortorder;
menustate->starting_seq = item->seq;
input_seq_poll_start(machine, (item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
machine.input().seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
invalidate = TRUE;
break;
/* if the clear key was pressed, reset the selected item */
case IPT_UI_CLEAR:
toggle_none_default(&item->seq, &item->seq, item->defseq);
toggle_none_default(item->seq, item->seq, *item->defseq);
menustate->record_next = FALSE;
seqchangeditem = item;
break;
@ -1998,8 +1997,8 @@ static void menu_input_common(running_machine &machine, ui_menu *menu, void *par
/* update a general input */
if (parameter != NULL)
{
const input_type_desc *typedesc = (const input_type_desc *)seqchangeditem->ref;
input_type_set_seq(machine, typedesc->type, typedesc->player, seqchangeditem->seqtype, &seqchangeditem->seq);
const input_type_entry *entry = (const input_type_entry *)seqchangeditem->ref;
input_type_set_seq(machine, entry->type, entry->player, seqchangeditem->seqtype, &seqchangeditem->seq);
}
/* update a game-specific input */
@ -2096,8 +2095,8 @@ static void menu_input_populate_and_sort(running_machine &machine, ui_menu *menu
/* otherwise, generate the sequence name and invert it if different from the default */
else
{
input_seq_name(machine, subtext, &item->seq);
flags |= input_seq_cmp(&item->seq, item->defseq) ? MENU_FLAG_INVERT : 0;
machine.input().seq_name(subtext, item->seq);
flags |= (item->seq != *item->defseq) ? MENU_FLAG_INVERT : 0;
}
/* add the item */
@ -2418,12 +2417,12 @@ static void menu_analog(running_machine &machine, ui_menu *menu, void *parameter
/* left decrements */
case IPT_UI_LEFT:
newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
newval -= machine.input().code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
break;
/* right increments */
case IPT_UI_RIGHT:
newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
newval += machine.input().code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
break;
}
@ -2925,11 +2924,11 @@ static void menu_sliders(running_machine &machine, ui_menu *menu, void *paramete
/* decrease value */
case IPT_UI_LEFT:
if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
if (machine.input().code_pressed(KEYCODE_LALT) || machine.input().code_pressed(KEYCODE_RALT))
increment = -1;
else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
else if (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT))
increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
else if (machine.input().code_pressed(KEYCODE_LCONTROL) || machine.input().code_pressed(KEYCODE_RCONTROL))
increment = -slider->incval * 10;
else
increment = -slider->incval;
@ -2937,11 +2936,11 @@ static void menu_sliders(running_machine &machine, ui_menu *menu, void *paramete
/* increase value */
case IPT_UI_RIGHT:
if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
if (machine.input().code_pressed(KEYCODE_LALT) || machine.input().code_pressed(KEYCODE_RALT))
increment = 1;
else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
else if (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT))
increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
else if (machine.input().code_pressed(KEYCODE_LCONTROL) || machine.input().code_pressed(KEYCODE_RCONTROL))
increment = slider->incval * 10;
else
increment = slider->incval;
@ -3354,12 +3353,12 @@ static void menu_crosshair(running_machine &machine, ui_menu *menu, void *parame
/* left decrements */
case IPT_UI_LEFT:
newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
newval -= machine.input().code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
break;
/* right increments */
case IPT_UI_RIGHT:
newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
newval += machine.input().code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
break;
}

View File

@ -249,10 +249,10 @@ void psxgpu_device::DebugMeshEnd( void )
void psxgpu_device::DebugCheckKeys( void )
{
if( input_code_pressed_once( machine(), KEYCODE_M ) )
if( machine().input().code_pressed_once( KEYCODE_M ) )
m_debug.b_mesh = !m_debug.b_mesh;
if( input_code_pressed_once( machine(), KEYCODE_V ) )
if( machine().input().code_pressed_once( KEYCODE_V ) )
m_debug.b_texture = !m_debug.b_texture;
if( m_debug.b_mesh || m_debug.b_texture )
@ -265,7 +265,7 @@ void psxgpu_device::DebugCheckKeys( void )
else
machine().primary_screen->set_visible_area( 0, n_screenwidth - 1, 0, n_screenheight - 1 );
if( input_code_pressed_once( machine(), KEYCODE_I ) )
if( machine().input().code_pressed_once( KEYCODE_I ) )
{
if( m_debug.b_texture )
{
@ -293,7 +293,7 @@ void psxgpu_device::DebugCheckKeys( void )
}
#if 0
if( input_code_pressed_once( machine(), KEYCODE_D ) )
if( machine().input().code_pressed_once( KEYCODE_D ) )
{
FILE *f;
int n_x;
@ -303,7 +303,7 @@ void psxgpu_device::DebugCheckKeys( void )
fprintf( f, "%04u,%04u = %04x\n", n_y, n_x, p_p_vram[ n_y ][ n_x ] );
fclose( f );
}
if( input_code_pressed_once( machine(), KEYCODE_S ) )
if( machine().input().code_pressed_once( KEYCODE_S ) )
{
FILE *f;
popmessage( "saving..." );
@ -312,7 +312,7 @@ void psxgpu_device::DebugCheckKeys( void )
fwrite( p_p_vram[ n_y ], 1024 * 2, 1, f );
fclose( f );
}
if( input_code_pressed_once( machine(), KEYCODE_L ) )
if( machine().input().code_pressed_once( KEYCODE_L ) )
{
FILE *f;
popmessage( "loading..." );

View File

@ -1412,7 +1412,7 @@ have to test.
static void v9938_interrupt_start_vblank (running_machine &machine)
{
#if 0
if (input_code_pressed (machine, KEYCODE_D) )
if (machine.input().code_pressed (KEYCODE_D) )
{
FILE *fp;
int i;

View File

@ -416,7 +416,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect)
}
/* debugging! */
if (input_code_pressed(device->machine(), KEYCODE_L))
if (device->machine().input().code_pressed(KEYCODE_L))
drawbuf = v->fbi.backbuf;
/* copy from the current front buffer */
@ -430,7 +430,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect)
}
/* update stats display */
statskey = (input_code_pressed(device->machine(), KEYCODE_BACKSLASH) != 0);
statskey = (device->machine().input().code_pressed(KEYCODE_BACKSLASH) != 0);
if (statskey && statskey != v->stats.lastkey)
v->stats.display = !v->stats.display;
v->stats.lastkey = statskey;
@ -440,7 +440,7 @@ int voodoo_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect)
popmessage(v->stats.buffer, 0, 0);
/* update render override */
v->stats.render_override = input_code_pressed(device->machine(), KEYCODE_ENTER);
v->stats.render_override = device->machine().input().code_pressed(KEYCODE_ENTER);
if (DEBUG_DEPTH && v->stats.render_override)
{
for (y = cliprect->min_y; y <= cliprect->max_y; y++)

View File

@ -296,29 +296,29 @@ static SCREEN_UPDATE( adp )
b = ((hd63484_regs_r(state->m_hd63484, 0xcc/2, 0xffff) & 0x000f) << 16) + hd63484_regs_r(state->m_hd63484, 0xce/2, 0xffff);
#if 1
if (input_code_pressed(screen->machine(), KEYCODE_M)) b = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) b += 0x2000 * 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) b += 0x2000 * 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) b += 0x2000 * 3;
if (input_code_pressed(screen->machine(), KEYCODE_R)) b += 0x2000 * 4;
if (input_code_pressed(screen->machine(), KEYCODE_T)) b += 0x2000 * 5;
if (input_code_pressed(screen->machine(), KEYCODE_Y)) b += 0x2000 * 6;
if (input_code_pressed(screen->machine(), KEYCODE_U)) b += 0x2000 * 7;
if (input_code_pressed(screen->machine(), KEYCODE_I)) b += 0x2000 * 8;
if (input_code_pressed(screen->machine(), KEYCODE_A)) b += 0x2000 * 9;
if (input_code_pressed(screen->machine(), KEYCODE_S)) b += 0x2000 * 10;
if (input_code_pressed(screen->machine(), KEYCODE_D)) b += 0x2000 * 11;
if (input_code_pressed(screen->machine(), KEYCODE_F)) b += 0x2000 * 12;
if (input_code_pressed(screen->machine(), KEYCODE_G)) b += 0x2000 * 13;
if (input_code_pressed(screen->machine(), KEYCODE_H)) b += 0x2000 * 14;
if (input_code_pressed(screen->machine(), KEYCODE_J)) b += 0x2000 * 15;
if (input_code_pressed(screen->machine(), KEYCODE_K)) b += 0x2000 * 16;
if (input_code_pressed(screen->machine(), KEYCODE_Z)) b += 0x2000 * 17;
if (input_code_pressed(screen->machine(), KEYCODE_X)) b += 0x2000 * 18;
if (input_code_pressed(screen->machine(), KEYCODE_C)) b += 0x2000 * 19;
if (input_code_pressed(screen->machine(), KEYCODE_V)) b += 0x2000 * 20;
if (input_code_pressed(screen->machine(), KEYCODE_B)) b += 0x2000 * 21;
if (input_code_pressed(screen->machine(), KEYCODE_N)) b += 0x2000 * 22;
if (screen->machine().input().code_pressed(KEYCODE_M)) b = 0;
if (screen->machine().input().code_pressed(KEYCODE_Q)) b += 0x2000 * 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) b += 0x2000 * 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) b += 0x2000 * 3;
if (screen->machine().input().code_pressed(KEYCODE_R)) b += 0x2000 * 4;
if (screen->machine().input().code_pressed(KEYCODE_T)) b += 0x2000 * 5;
if (screen->machine().input().code_pressed(KEYCODE_Y)) b += 0x2000 * 6;
if (screen->machine().input().code_pressed(KEYCODE_U)) b += 0x2000 * 7;
if (screen->machine().input().code_pressed(KEYCODE_I)) b += 0x2000 * 8;
if (screen->machine().input().code_pressed(KEYCODE_A)) b += 0x2000 * 9;
if (screen->machine().input().code_pressed(KEYCODE_S)) b += 0x2000 * 10;
if (screen->machine().input().code_pressed(KEYCODE_D)) b += 0x2000 * 11;
if (screen->machine().input().code_pressed(KEYCODE_F)) b += 0x2000 * 12;
if (screen->machine().input().code_pressed(KEYCODE_G)) b += 0x2000 * 13;
if (screen->machine().input().code_pressed(KEYCODE_H)) b += 0x2000 * 14;
if (screen->machine().input().code_pressed(KEYCODE_J)) b += 0x2000 * 15;
if (screen->machine().input().code_pressed(KEYCODE_K)) b += 0x2000 * 16;
if (screen->machine().input().code_pressed(KEYCODE_Z)) b += 0x2000 * 17;
if (screen->machine().input().code_pressed(KEYCODE_X)) b += 0x2000 * 18;
if (screen->machine().input().code_pressed(KEYCODE_C)) b += 0x2000 * 19;
if (screen->machine().input().code_pressed(KEYCODE_V)) b += 0x2000 * 20;
if (screen->machine().input().code_pressed(KEYCODE_B)) b += 0x2000 * 21;
if (screen->machine().input().code_pressed(KEYCODE_N)) b += 0x2000 * 22;
#endif
for (y = 0;y < 280;y++)
{
@ -333,7 +333,7 @@ static SCREEN_UPDATE( adp )
b++;
}
}
if (!input_code_pressed(screen->machine(), KEYCODE_O)) // debug: toggle window
if (!screen->machine().input().code_pressed(KEYCODE_O)) // debug: toggle window
if ((hd63484_regs_r(state->m_hd63484, 0x06/2, 0xffff) & 0x0300) == 0x0300)
{
int sy = (hd63484_regs_r(state->m_hd63484, 0x94/2, 0xffff) & 0x0fff) - (hd63484_regs_r(state->m_hd63484, 0x88/2, 0xffff) >> 8);

View File

@ -72,13 +72,13 @@ static READ8_HANDLER( sound_test_r )
{
bingoc_state *state = space->machine().driver_data<bingoc_state>();
if(input_code_pressed_once(space->machine(), KEYCODE_Z))
if(space->machine().input().code_pressed_once(KEYCODE_Z))
state->m_x++;
if(input_code_pressed_once(space->machine(), KEYCODE_X))
if(space->machine().input().code_pressed_once(KEYCODE_X))
state->m_x--;
if(input_code_pressed_once(space->machine(), KEYCODE_A))
if(space->machine().input().code_pressed_once(KEYCODE_A))
return 0xff;
popmessage("%02x",state->m_x);

View File

@ -288,7 +288,7 @@ GFXDECODE_END
static INTERRUPT_GEN( cmmb_irq )
{
//if(input_code_pressed_once(device->machine(), KEYCODE_Z))
//if(device->machine().input().code_pressed_once(KEYCODE_Z))
// device_set_input_line(device, 0, HOLD_LINE);
}

View File

@ -301,28 +301,28 @@ static SCREEN_UPDATE(coolridr)
int y,x;
if(input_code_pressed(screen->machine(),KEYCODE_Z))
if(screen->machine().input().code_pressed(KEYCODE_Z))
state->m_test_offs+=4;
if(input_code_pressed(screen->machine(),KEYCODE_X))
if(screen->machine().input().code_pressed(KEYCODE_X))
state->m_test_offs-=4;
if(input_code_pressed(screen->machine(),KEYCODE_C))
if(screen->machine().input().code_pressed(KEYCODE_C))
state->m_test_offs+=0x40;
if(input_code_pressed(screen->machine(),KEYCODE_V))
if(screen->machine().input().code_pressed(KEYCODE_V))
state->m_test_offs-=0x40;
if(input_code_pressed(screen->machine(),KEYCODE_B))
if(screen->machine().input().code_pressed(KEYCODE_B))
state->m_test_offs+=0x400;
if(input_code_pressed(screen->machine(),KEYCODE_N))
if(screen->machine().input().code_pressed(KEYCODE_N))
state->m_test_offs-=0x400;
if(input_code_pressed_once(screen->machine(),KEYCODE_A))
if(screen->machine().input().code_pressed_once(KEYCODE_A))
state->m_color++;
if(input_code_pressed_once(screen->machine(),KEYCODE_S))
if(screen->machine().input().code_pressed_once(KEYCODE_S))
state->m_color--;
if(state->m_test_offs > 0x100000*4)

View File

@ -435,40 +435,40 @@ static SCREEN_UPDATE( cybertnk )
int x,y,count;
const UINT8 *blit_ram = screen->machine().region("spr_gfx")->base();
if(input_code_pressed(screen->machine(), KEYCODE_Z))
if(screen->machine().input().code_pressed(KEYCODE_Z))
state->m_test_x++;
if(input_code_pressed(screen->machine(), KEYCODE_X))
if(screen->machine().input().code_pressed(KEYCODE_X))
state->m_test_x--;
if(input_code_pressed(screen->machine(), KEYCODE_A))
if(screen->machine().input().code_pressed(KEYCODE_A))
state->m_test_y++;
if(input_code_pressed(screen->machine(), KEYCODE_S))
if(screen->machine().input().code_pressed(KEYCODE_S))
state->m_test_y--;
if(input_code_pressed(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed(KEYCODE_Q))
state->m_start_offs+=0x200;
if(input_code_pressed(screen->machine(), KEYCODE_W))
if(screen->machine().input().code_pressed(KEYCODE_W))
state->m_start_offs-=0x200;
if(input_code_pressed_once(screen->machine(), KEYCODE_T))
if(screen->machine().input().code_pressed_once(KEYCODE_T))
state->m_start_offs+=0x20000;
if(input_code_pressed_once(screen->machine(), KEYCODE_Y))
if(screen->machine().input().code_pressed_once(KEYCODE_Y))
state->m_start_offs-=0x20000;
if(input_code_pressed(screen->machine(), KEYCODE_E))
if(screen->machine().input().code_pressed(KEYCODE_E))
state->m_start_offs+=4;
if(input_code_pressed(screen->machine(), KEYCODE_R))
if(screen->machine().input().code_pressed(KEYCODE_R))
state->m_start_offs-=4;
if(input_code_pressed(screen->machine(), KEYCODE_D))
if(screen->machine().input().code_pressed(KEYCODE_D))
state->m_color_pen++;
if(input_code_pressed(screen->machine(), KEYCODE_F))
if(screen->machine().input().code_pressed(KEYCODE_F))
state->m_color_pen--;
popmessage("%02x %02x %04x %02x",state->m_test_x,state->m_test_y,state->m_start_offs,state->m_color_pen);

View File

@ -182,12 +182,12 @@ static SCREEN_UPDATE( darkhors )
int layers_ctrl = -1;
#if DARKHORS_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) mask |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) mask |= 4;
if (mask != 0) layers_ctrl &= mask;
}
#endif

View File

@ -1332,36 +1332,36 @@ SCREEN_UPDATE(ddenlovr)
state->m_ddenlovr_clip_ctrl = 0x0f;
next = blit_draw(screen->machine(), base, 0);
popmessage("GFX %06x", base);
if (input_code_pressed(screen->machine(), KEYCODE_S)) base = next;
if (input_code_pressed_once(screen->machine(), KEYCODE_X)) base = next;
if (input_code_pressed(screen->machine(), KEYCODE_C)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
if (input_code_pressed(screen->machine(), KEYCODE_V)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
if (input_code_pressed_once(screen->machine(), KEYCODE_D)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
if (input_code_pressed_once(screen->machine(), KEYCODE_F)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
if (screen->machine().input().code_pressed(KEYCODE_S)) base = next;
if (screen->machine().input().code_pressed_once(KEYCODE_X)) base = next;
if (screen->machine().input().code_pressed(KEYCODE_C)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
if (screen->machine().input().code_pressed(KEYCODE_V)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
if (screen->machine().input().code_pressed_once(KEYCODE_D)) { base--; while ((gfx[base] & 0xf0) != 0x30) base--; }
if (screen->machine().input().code_pressed_once(KEYCODE_F)) { base++; while ((gfx[base] & 0xf0) != 0x30) base++; }
#endif
bitmap_fill(bitmap, cliprect, state->m_ddenlovr_bgcolor);
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask, mask2;
mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) mask |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_R)) mask |= 8;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) mask |= 4;
if (screen->machine().input().code_pressed(KEYCODE_R)) mask |= 8;
mask2 = 0;
if (state->m_extra_layers)
{
if (input_code_pressed(screen->machine(), KEYCODE_A)) mask2 |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_S)) mask2 |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_D)) mask2 |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_F)) mask2 |= 8;
if (screen->machine().input().code_pressed(KEYCODE_A)) mask2 |= 1;
if (screen->machine().input().code_pressed(KEYCODE_S)) mask2 |= 2;
if (screen->machine().input().code_pressed(KEYCODE_D)) mask2 |= 4;
if (screen->machine().input().code_pressed(KEYCODE_F)) mask2 |= 8;
}
if (mask || mask2)

View File

@ -138,11 +138,11 @@ static SCREEN_UPDATE( dunhuang )
int layers_ctrl = -1;
#if DUNHUANG_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -555,7 +555,7 @@ static SCREEN_UPDATE(firebeat)
if (state->m_tick >= 5)
{
state->m_tick = 0;
if (input_code_pressed(screen->machine(), KEYCODE_0))
if (screen->machine().input().code_pressed(KEYCODE_0))
{
state->m_layer++;
if (state->m_layer > 2)
@ -565,7 +565,7 @@ static SCREEN_UPDATE(firebeat)
}
/*
if (input_code_pressed_once(screen->machine(), KEYCODE_9))
if (screen->machine().input().code_pressed_once(KEYCODE_9))
{
FILE *file = fopen("vram0.bin", "wb");
int i;

View File

@ -188,8 +188,8 @@ static SCREEN_UPDATE(gal3)
update_palette(screen->machine());
if( input_code_pressed_once(screen->machine(), KEYCODE_H)&&(pivot<15) ) pivot+=1;
if( input_code_pressed_once(screen->machine(), KEYCODE_J)&&(pivot>0) ) pivot-=1;
if( screen->machine().input().code_pressed_once(KEYCODE_H)&&(pivot<15) ) pivot+=1;
if( screen->machine().input().code_pressed_once(KEYCODE_J)&&(pivot>0) ) pivot-=1;
for( pri=0; pri<pivot; pri++ )
{

View File

@ -175,14 +175,14 @@ static SCREEN_UPDATE(galaxi)
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_R)) // remapped due to inputs changes.
if (screen->machine().input().code_pressed(KEYCODE_R)) // remapped due to inputs changes.
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_T)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_Y)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_U)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_I)) msk |= 8;
if (input_code_pressed(screen->machine(), KEYCODE_O)) msk |= 16;
if (screen->machine().input().code_pressed(KEYCODE_T)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_Y)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_U)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_I)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_O)) msk |= 16;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -599,7 +599,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime,
static void laserdisc_audio_process(device_t *device, int samplerate, int samples, const INT16 *ch0, const INT16 *ch1)
{
gottlieb_state *state = device->machine().driver_data<gottlieb_state>();
int logit = LOG_AUDIO_DECODE && input_code_pressed(device->machine(), KEYCODE_L);
int logit = LOG_AUDIO_DECODE && device->machine().input().code_pressed(KEYCODE_L);
attotime time_per_sample = attotime::from_hz(samplerate);
attotime curtime = state->m_laserdisc_last_time;
int cursamp;

View File

@ -264,12 +264,12 @@ static SCREEN_UPDATE(jingbell)
int layers_ctrl = state->m_video_enable ? -1 : 0;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) mask |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) mask |= 4;
if (mask != 0) layers_ctrl &= mask;
}
#endif

View File

@ -165,17 +165,17 @@ static SCREEN_UPDATE( igs011 )
UINT16 *pri_ram;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 0x01;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 0x02;
if (input_code_pressed(screen->machine(), KEYCODE_E)) mask |= 0x04;
if (input_code_pressed(screen->machine(), KEYCODE_R)) mask |= 0x08;
if (input_code_pressed(screen->machine(), KEYCODE_A)) mask |= 0x10;
if (input_code_pressed(screen->machine(), KEYCODE_S)) mask |= 0x20;
if (input_code_pressed(screen->machine(), KEYCODE_D)) mask |= 0x40;
if (input_code_pressed(screen->machine(), KEYCODE_F)) mask |= 0x80;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 0x01;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 0x02;
if (screen->machine().input().code_pressed(KEYCODE_E)) mask |= 0x04;
if (screen->machine().input().code_pressed(KEYCODE_R)) mask |= 0x08;
if (screen->machine().input().code_pressed(KEYCODE_A)) mask |= 0x10;
if (screen->machine().input().code_pressed(KEYCODE_S)) mask |= 0x20;
if (screen->machine().input().code_pressed(KEYCODE_D)) mask |= 0x40;
if (screen->machine().input().code_pressed(KEYCODE_F)) mask |= 0x80;
if (mask) layer_enable &= mask;
}
#endif
@ -446,7 +446,7 @@ static WRITE16_HANDLER( igs011_blit_flags_w )
#ifdef MAME_DEBUG
#if 1
if (input_code_pressed(space->machine(), KEYCODE_Z))
if (space->machine().input().code_pressed(KEYCODE_Z))
{ char buf[20];
sprintf(buf, "%02X%02X",blitter.depth,blitter.flags&0xff);
// ui_draw_text(buf, blitter.x, blitter.y); // crashes mame!

View File

@ -303,24 +303,24 @@ static int debug_viewer(running_machine &machine, bitmap_t *bitmap,const rectang
{
#ifdef MAME_DEBUG
igs017_state *state = machine.driver_data<igs017_state>();
if (input_code_pressed_once(machine, KEYCODE_T)) state->m_toggle = 1-state->m_toggle;
if (machine.input().code_pressed_once(KEYCODE_T)) state->m_toggle = 1-state->m_toggle;
if (state->m_toggle) {
int h = 256, w = state->m_debug_width, a = state->m_debug_addr;
if (input_code_pressed(machine, KEYCODE_O)) w += 1;
if (input_code_pressed(machine, KEYCODE_I)) w -= 1;
if (machine.input().code_pressed(KEYCODE_O)) w += 1;
if (machine.input().code_pressed(KEYCODE_I)) w -= 1;
if (input_code_pressed(machine, KEYCODE_U)) w += 8;
if (input_code_pressed(machine, KEYCODE_Y)) w -= 8;
if (machine.input().code_pressed(KEYCODE_U)) w += 8;
if (machine.input().code_pressed(KEYCODE_Y)) w -= 8;
if (input_code_pressed(machine, KEYCODE_RIGHT)) a += 1;
if (input_code_pressed(machine, KEYCODE_LEFT)) a -= 1;
if (machine.input().code_pressed(KEYCODE_RIGHT)) a += 1;
if (machine.input().code_pressed(KEYCODE_LEFT)) a -= 1;
if (input_code_pressed(machine, KEYCODE_DOWN)) a += w;
if (input_code_pressed(machine, KEYCODE_UP)) a -= w;
if (machine.input().code_pressed(KEYCODE_DOWN)) a += w;
if (machine.input().code_pressed(KEYCODE_UP)) a -= w;
if (input_code_pressed(machine, KEYCODE_PGDN)) a += w * h;
if (input_code_pressed(machine, KEYCODE_PGUP)) a -= w * h;
if (machine.input().code_pressed(KEYCODE_PGDN)) a += w * h;
if (machine.input().code_pressed(KEYCODE_PGUP)) a -= w * h;
if (a < 0) a = 0;
if (a > state->m_sprites_gfx_size) a = state->m_sprites_gfx_size;
@ -348,12 +348,12 @@ static SCREEN_UPDATE( igs017 )
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) mask |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) mask |= 4;
if (mask != 0) layers_ctrl &= mask;
}
#endif

View File

@ -322,7 +322,7 @@ static CUSTOM_INPUT( hopper_r )
{
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);
return field.machine().input().code_pressed(KEYCODE_H);
}
static READ8_HANDLER( exp_rom_r )

View File

@ -88,28 +88,28 @@ static SCREEN_UPDATE( itgambl2 )
int x,y,count;
const UINT8 *blit_ram = screen->machine().region("gfx1")->base();
if(input_code_pressed(screen->machine(), KEYCODE_Z))
if(screen->machine().input().code_pressed(KEYCODE_Z))
state->m_test_x++;
if(input_code_pressed(screen->machine(), KEYCODE_X))
if(screen->machine().input().code_pressed(KEYCODE_X))
state->m_test_x--;
if(input_code_pressed(screen->machine(), KEYCODE_A))
if(screen->machine().input().code_pressed(KEYCODE_A))
state->m_test_y++;
if(input_code_pressed(screen->machine(), KEYCODE_S))
if(screen->machine().input().code_pressed(KEYCODE_S))
state->m_test_y--;
if(input_code_pressed(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed(KEYCODE_Q))
state->m_start_offs+=0x200;
if(input_code_pressed(screen->machine(), KEYCODE_W))
if(screen->machine().input().code_pressed(KEYCODE_W))
state->m_start_offs-=0x200;
if(input_code_pressed(screen->machine(), KEYCODE_E))
if(screen->machine().input().code_pressed(KEYCODE_E))
state->m_start_offs++;
if(input_code_pressed(screen->machine(), KEYCODE_R))
if(screen->machine().input().code_pressed(KEYCODE_R))
state->m_start_offs--;
popmessage("%d %d %04x",state->m_test_x,state->m_test_y,state->m_start_offs);

View File

@ -76,28 +76,28 @@ static SCREEN_UPDATE( itgambl3 )
int x,y,count;
const UINT8 *blit_ram = screen->machine().region("gfx1")->base();
if(input_code_pressed(screen->machine(), KEYCODE_Z))
if(screen->machine().input().code_pressed(KEYCODE_Z))
state->m_test_x++;
if(input_code_pressed(screen->machine(), KEYCODE_X))
if(screen->machine().input().code_pressed(KEYCODE_X))
state->m_test_x--;
if(input_code_pressed(screen->machine(), KEYCODE_A))
if(screen->machine().input().code_pressed(KEYCODE_A))
state->m_test_y++;
if(input_code_pressed(screen->machine(), KEYCODE_S))
if(screen->machine().input().code_pressed(KEYCODE_S))
state->m_test_y--;
if(input_code_pressed(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed(KEYCODE_Q))
state->m_start_offs+=0x200;
if(input_code_pressed(screen->machine(), KEYCODE_W))
if(screen->machine().input().code_pressed(KEYCODE_W))
state->m_start_offs-=0x200;
if(input_code_pressed(screen->machine(), KEYCODE_E))
if(screen->machine().input().code_pressed(KEYCODE_E))
state->m_start_offs++;
if(input_code_pressed(screen->machine(), KEYCODE_R))
if(screen->machine().input().code_pressed(KEYCODE_R))
state->m_start_offs--;
popmessage("%d %d %04x",state->m_test_x,state->m_test_y,state->m_start_offs);

View File

@ -393,7 +393,7 @@ static CUSTOM_INPUT( hopper_r )
{
jackie_state *state = field.machine().driver_data<jackie_state>();
if (state->m_hopper) return !(field.machine().primary_screen->frame_number()%10);
return input_code_pressed(field.machine(), KEYCODE_H);
return field.machine().input().code_pressed(KEYCODE_H);
}
static INPUT_PORTS_START( jackie )

View File

@ -329,7 +329,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
state->m_adpcm->write_command(0x81);
}
}
if (input_code_pressed_once(device->machine(), KEYCODE_PGUP))
if (device->machine().input().code_pressed_once(KEYCODE_PGUP))
{
if (state->m_m6295_key_delay >= (0x60 * oki_time_base))
{
@ -348,7 +348,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
else
state->m_m6295_key_delay += (0x01 * oki_time_base);
}
else if (input_code_pressed_once(device->machine(), KEYCODE_PGDN))
else if (device->machine().input().code_pressed_once(KEYCODE_PGDN))
{
if (state->m_m6295_key_delay >= (0x60 * oki_time_base))
{
@ -367,7 +367,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
else
state->m_m6295_key_delay += (0x01 * oki_time_base);
}
else if (input_code_pressed_once(device->machine(), KEYCODE_INSERT))
else if (device->machine().input().code_pressed_once(KEYCODE_INSERT))
{
if (state->m_m6295_key_delay >= (0x60 * oki_time_base))
{
@ -388,7 +388,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
else
state->m_m6295_key_delay += (0x01 * oki_time_base);
}
else if (input_code_pressed_once(device->machine(), KEYCODE_DEL))
else if (device->machine().input().code_pressed_once(KEYCODE_DEL))
{
if (state->m_m6295_key_delay >= (0x60 * oki_time_base))
{
@ -409,7 +409,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
else
state->m_m6295_key_delay += (0x01 * oki_time_base);
}
else if (input_code_pressed_once(device->machine(), KEYCODE_Z))
else if (device->machine().input().code_pressed_once(KEYCODE_Z))
{
if (state->m_m6295_key_delay >= (0x80 * oki_time_base))
{

View File

@ -132,11 +132,11 @@ static SCREEN_UPDATE( lastfght )
UINT8 *gfxdata = screen->machine().region("gfx1")->base();
UINT8 data;
if (input_code_pressed_once(screen->machine(), KEYCODE_ENTER)) state->m_view_roms ^= 1;
if (screen->machine().input().code_pressed_once(KEYCODE_ENTER)) state->m_view_roms ^= 1;
if (state->m_view_roms)
{
if (input_code_pressed_once(screen->machine(), KEYCODE_PGDN)) state->m_base += 512 * 256;
if (input_code_pressed_once(screen->machine(), KEYCODE_PGUP)) state->m_base -= 512 * 256;
if (screen->machine().input().code_pressed_once(KEYCODE_PGDN)) state->m_base += 512 * 256;
if (screen->machine().input().code_pressed_once(KEYCODE_PGUP)) state->m_base -= 512 * 256;
state->m_base %= screen->machine().region("gfx1")->bytes();
count = state->m_base;

View File

@ -695,9 +695,9 @@ static MACHINE_RESET( magicard )
/*Probably there's a mask somewhere if it REALLY uses irqs at all...irq vectors dynamically changes after some time.*/
static INTERRUPT_GEN( magicard_irq )
{
if(input_code_pressed(device->machine(), KEYCODE_Z)) //vblank?
if(device->machine().input().code_pressed(KEYCODE_Z)) //vblank?
device_set_input_line_and_vector(device, 1, HOLD_LINE,0xe4/4);
if(input_code_pressed(device->machine(), KEYCODE_X)) //uart irq
if(device->machine().input().code_pressed(KEYCODE_X)) //uart irq
device_set_input_line_and_vector(device, 1, HOLD_LINE,0xf0/4);
}

View File

@ -206,31 +206,31 @@ SCREEN_UPDATE( test_vcu )
bitmap_fill(state->m_tmpbitmaps[0], NULL, color_base);
if (input_code_pressed_once(screen->machine(), KEYCODE_1)) /* plane 1 */
if (screen->machine().input().code_pressed_once(KEYCODE_1)) /* plane 1 */
planes_enabled[0] ^= 1;
if (input_code_pressed_once(screen->machine(), KEYCODE_2)) /* plane 2 */
if (screen->machine().input().code_pressed_once(KEYCODE_2)) /* plane 2 */
planes_enabled[1] ^= 1;
if (input_code_pressed_once(screen->machine(), KEYCODE_3)) /* plane 3 */
if (screen->machine().input().code_pressed_once(KEYCODE_3)) /* plane 3 */
planes_enabled[2] ^= 1;
if (input_code_pressed_once(screen->machine(), KEYCODE_4)) /* plane 4 */
if (screen->machine().input().code_pressed_once(KEYCODE_4)) /* plane 4 */
planes_enabled[3] ^= 1;
if (input_code_pressed_once(screen->machine(), KEYCODE_I)) /* show/hide debug info */
if (screen->machine().input().code_pressed_once(KEYCODE_I)) /* show/hide debug info */
state->m_dbg_info = !state->m_dbg_info;
if (input_code_pressed_once(screen->machine(), KEYCODE_G)) /* enable gfx area handling */
if (screen->machine().input().code_pressed_once(KEYCODE_G)) /* enable gfx area handling */
state->m_dbg_gfx_e = !state->m_dbg_gfx_e;
if (input_code_pressed_once(screen->machine(), KEYCODE_C)) /* enable color area handling */
if (screen->machine().input().code_pressed_once(KEYCODE_C)) /* enable color area handling */
state->m_dbg_clr_e = !state->m_dbg_clr_e;
if (input_code_pressed_once(screen->machine(), KEYCODE_V)) /* draw only when vbank==dbg_vbank */
if (screen->machine().input().code_pressed_once(KEYCODE_V)) /* draw only when vbank==dbg_vbank */
state->m_dbg_vbank ^= 1;
if (input_code_pressed_once(screen->machine(), KEYCODE_L)) /* showlookup ram */
if (screen->machine().input().code_pressed_once(KEYCODE_L)) /* showlookup ram */
state->m_dbg_lookup = (state->m_dbg_lookup + 1) % 5; //0,1,2,3, 4-off

View File

@ -365,12 +365,12 @@ static VIDEO_START( meritm )
static SCREEN_UPDATE( meritm )
{
meritm_state *state = screen->machine().driver_data<meritm_state>();
if(input_code_pressed_once(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed_once(KEYCODE_Q))
{
state->m_layer0_enabled^=1;
popmessage("Layer 0 %sabled",state->m_layer0_enabled ? "en" : "dis");
}
if(input_code_pressed_once(screen->machine(), KEYCODE_W))
if(screen->machine().input().code_pressed_once(KEYCODE_W))
{
state->m_layer1_enabled^=1;
popmessage("Layer 1 %sabled",state->m_layer1_enabled ? "en" : "dis");

View File

@ -181,11 +181,11 @@ static SCREEN_UPDATE( midas )
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if ( input_code_pressed(screen->machine(), KEYCODE_Z) )
if ( screen->machine().input().code_pressed(KEYCODE_Z) )
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1 << 0; // for state->m_tmap
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 1 << 1; // for sprites
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1 << 0; // for state->m_tmap
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 1 << 1; // for sprites
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -67,25 +67,25 @@ static SCREEN_UPDATE(monzagp)
monzagp_state *state = screen->machine().driver_data<monzagp_state>();
int x,y;
if(input_code_pressed_once(screen->machine(),KEYCODE_Z))
if(screen->machine().input().code_pressed_once(KEYCODE_Z))
state->m_bank--;
if(input_code_pressed_once(screen->machine(),KEYCODE_X))
if(screen->machine().input().code_pressed_once(KEYCODE_X))
state->m_bank++;
if(input_code_pressed_once(screen->machine(),KEYCODE_Q))
if(screen->machine().input().code_pressed_once(KEYCODE_Q))
{
state->m_screenw--;
printf("%x\n",state->m_screenw);
}
if(input_code_pressed_once(screen->machine(),KEYCODE_W))
if(screen->machine().input().code_pressed_once(KEYCODE_W))
{
state->m_screenw++;
printf("%x\n",state->m_screenw);
}
if(input_code_pressed_once(screen->machine(),KEYCODE_A))
if(screen->machine().input().code_pressed_once(KEYCODE_A))
{
FILE * p=fopen("vram.bin","wb");
fwrite(&state->m_vram[0],1,0x10000,p);

View File

@ -1329,7 +1329,7 @@ static INPUT_PORTS_START( luckywld )
PORT_START("AN4")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(8)
PORT_START("AN5") /* Steering Wheel */
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_CODE(0) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
PORT_START("AN6") /* Brake pedal */
PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(30)
PORT_START("AN7") /* Accelerator pedal */

View File

@ -183,7 +183,7 @@ static SCREEN_UPDATE( pinkiri8 )
if (!strcmp(screen->machine().system().name,"janshi")) game_type_hack = 1;
if ( input_code_pressed_once(screen->machine(), KEYCODE_W) )
if ( screen->machine().input().code_pressed_once(KEYCODE_W) )
{
int i;
int count2;

View File

@ -200,37 +200,37 @@ static SCREEN_UPDATE( pntnpuzl )
static int yyy=512;
static int sss=0xa8;
if ( input_code_pressed_once(screen->machine(), KEYCODE_Q) )
if ( screen->machine().input().code_pressed_once(KEYCODE_Q) )
{
xxx--;
mame_printf_debug("xxx %04x\n",xxx);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_W) )
if ( screen->machine().input().code_pressed_once(KEYCODE_W) )
{
xxx++;
mame_printf_debug("xxx %04x\n",xxx);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_A) )
if ( screen->machine().input().code_pressed_once(KEYCODE_A) )
{
yyy--;
mame_printf_debug("yyy %04x\n",yyy);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_S) )
if ( screen->machine().input().code_pressed_once(KEYCODE_S) )
{
yyy++;
mame_printf_debug("yyy %04x\n",yyy);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_Z) )
if ( screen->machine().input().code_pressed_once(KEYCODE_Z) )
{
sss--;
mame_printf_debug("sss %04x\n",sss);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_X) )
if ( screen->machine().input().code_pressed_once(KEYCODE_X) )
{
sss++;
mame_printf_debug("sss %04x\n",sss);

View File

@ -117,11 +117,11 @@ static SCREEN_UPDATE(quizpun2)
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -198,17 +198,17 @@ static SCREEN_UPDATE( rdx_v33 )
static int frame;
address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM);
//if(input_code_pressed_once(screen->machine(),KEYCODE_A))
//if(screen->machine().input().code_pressed_once(KEYCODE_A))
// src_addr+=0x800;
//if(input_code_pressed_once(screen->machine(),KEYCODE_S))
//if(screen->machine().input().code_pressed_once(KEYCODE_S))
// src_addr-=0x800;
frame++;
popmessage("%08x 0",src_addr);
//if(input_code_pressed_once(screen->machine(),KEYCODE_Z))
//if(screen->machine().input().code_pressed_once(KEYCODE_Z))
if(frame == 5)
{
int i,data;

View File

@ -633,11 +633,11 @@ void raiden2_state::draw_sprites(running_machine &machine, bitmap_t *bitmap, con
// static int ytlim = 1;
// static int xtlim = 1;
// if ( input_code_pressed_once(machine, KEYCODE_Q) ) ytlim--;
// if ( input_code_pressed_once(machine, KEYCODE_W) ) ytlim++;
// if ( machine.input().code_pressed_once(KEYCODE_Q) ) ytlim--;
// if ( machine.input().code_pressed_once(KEYCODE_W) ) ytlim++;
// if ( input_code_pressed_once(machine, KEYCODE_A) ) xtlim--;
// if ( input_code_pressed_once(machine, KEYCODE_S) ) xtlim++;
// if ( machine.input().code_pressed_once(KEYCODE_A) ) xtlim--;
// if ( machine.input().code_pressed_once(KEYCODE_S) ) xtlim++;
/*00 ???? ???? (colour / priority?)
@ -886,31 +886,31 @@ static SCREEN_UPDATE( raiden2 )
raiden2_state *state = screen->machine().driver_data<raiden2_state>();
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine()));
//if (!input_code_pressed(screen->machine(), KEYCODE_Q))
//if (!screen->machine().input().code_pressed(KEYCODE_Q))
{
if (!(state->raiden2_tilemap_enable & 1))
tilemap_draw(bitmap, cliprect, state->background_layer, 0, 0);
}
//if (!input_code_pressed(screen->machine(), KEYCODE_W))
//if (!screen->machine().input().code_pressed(KEYCODE_W))
{
if (!(state->raiden2_tilemap_enable & 2))
tilemap_draw(bitmap, cliprect, state->midground_layer, 0, 0);
}
//if (!input_code_pressed(screen->machine(), KEYCODE_E))
//if (!screen->machine().input().code_pressed(KEYCODE_E))
{
if (!(state->raiden2_tilemap_enable & 4))
tilemap_draw(bitmap, cliprect, state->foreground_layer, 0, 0);
}
//if (!input_code_pressed(screen->machine(), KEYCODE_S))
//if (!screen->machine().input().code_pressed(KEYCODE_S))
{
//if (!(raiden2_tilemap_enable & 0x10))
state->draw_sprites(screen->machine(), bitmap, cliprect, 0);
}
//if (!input_code_pressed(screen->machine(), KEYCODE_A))
//if (!screen->machine().input().code_pressed(KEYCODE_A))
{
if (!(state->raiden2_tilemap_enable & 8))
tilemap_draw(bitmap, cliprect, state->text_layer, 0, 0);

View File

@ -179,10 +179,10 @@ static TIMER_DEVICE_CALLBACK( scanline_callback )
int old = state->m_irq2_scanline;
/* Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines */
if (input_code_pressed(timer->machine(), KEYCODE_Q)) { while (input_code_pressed(timer->machine(), KEYCODE_Q)) ; state->m_irq2_scanline -= 10; }
if (input_code_pressed(timer->machine(), KEYCODE_W)) { while (input_code_pressed(timer->machine(), KEYCODE_W)) ; state->m_irq2_scanline -= 1; }
if (input_code_pressed(timer->machine(), KEYCODE_E)) { while (input_code_pressed(timer->machine(), KEYCODE_E)) ; state->m_irq2_scanline += 1; }
if (input_code_pressed(timer->machine(), KEYCODE_R)) { while (input_code_pressed(timer->machine(), KEYCODE_R)) ; state->m_irq2_scanline += 10; }
if (timer->machine().input().code_pressed(KEYCODE_Q)) { while (timer->machine().input().code_pressed(KEYCODE_Q)) ; state->m_irq2_scanline -= 10; }
if (timer->machine().input().code_pressed(KEYCODE_W)) { while (timer->machine().input().code_pressed(KEYCODE_W)) ; state->m_irq2_scanline -= 1; }
if (timer->machine().input().code_pressed(KEYCODE_E)) { while (timer->machine().input().code_pressed(KEYCODE_E)) ; state->m_irq2_scanline += 1; }
if (timer->machine().input().code_pressed(KEYCODE_R)) { while (timer->machine().input().code_pressed(KEYCODE_R)) ; state->m_irq2_scanline += 10; }
if (old != state->m_irq2_scanline)
popmessage("scanline = %d", state->m_irq2_scanline);
}

View File

@ -166,7 +166,7 @@ static SCREEN_UPDATE( jwildb52 )
//save vram to file
#if 0
if (input_code_pressed_once(screen->machine(), KEYCODE_Q))
if (screen->machine().input().code_pressed_once(KEYCODE_Q))
{
FILE *p = fopen("vram.bin", "wb");
fwrite(&HD63484_ram[0], 1, 0x40000 * 4, p);
@ -190,7 +190,7 @@ static SCREEN_UPDATE( jwildb52 )
}
}
if (!input_code_pressed(screen->machine(), KEYCODE_O))
if (!screen->machine().input().code_pressed(KEYCODE_O))
if ((hd63484_regs_r(hd63484, 0x06/2, 0xffff) & 0x0300) == 0x0300)
{
int sy = (hd63484_regs_r(hd63484, 0x94/2, 0xffff) & 0x0fff) - (hd63484_regs_r(hd63484, 0x88/2, 0xffff) >> 8);

View File

@ -248,13 +248,13 @@ static SCREEN_UPDATE(sigmab98)
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_R)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_R)) msk |= 8;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -109,7 +109,7 @@ static CUSTOM_INPUT( hopper_r )
spoker_state *state = machine.driver_data<spoker_state>();
if (state->m_hopper) return !(machine.primary_screen->frame_number()%10);
return input_code_pressed(machine, KEYCODE_H);
return machine.input().code_pressed(KEYCODE_H);
}
static void show_out(UINT8 *out)

View File

@ -176,13 +176,13 @@ static SCREEN_UPDATE(srmp6)
#if 0
/* debug */
if(input_code_pressed_once(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed_once(KEYCODE_Q))
{
++xixi;
printf("%x\n",xixi);
}
if(input_code_pressed_once(screen->machine(), KEYCODE_W))
if(screen->machine().input().code_pressed_once(KEYCODE_W))
{
--xixi;
printf("%x\n",xixi);
@ -273,7 +273,7 @@ static SCREEN_UPDATE(srmp6)
memcpy(state->m_sprram_old, state->m_sprram, 0x80000);
if(input_code_pressed_once(screen->machine(), KEYCODE_Q))
if(screen->machine().input().code_pressed_once(KEYCODE_Q))
{
FILE *p=fopen("tileram.bin","wb");
fwrite(state->m_tileram, 1, 0x100000*16, p);

View File

@ -610,11 +610,11 @@ static SCREEN_UPDATE( subsino2 )
int y;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -317,11 +317,11 @@ static SCREEN_UPDATE( tmaster )
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) mask |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) mask |= 2;
if (screen->machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (mask != 0) layers_ctrl &= mask;
}
#endif

View File

@ -965,7 +965,7 @@ static TIMER_CALLBACK( atarivc_eof_update )
/* use this for debugging the video controller values */
#if 0
if (input_code_pressed(machine, KEYCODE_8))
if (machine.input().code_pressed(KEYCODE_8))
{
static FILE *out;
if (!out) out = fopen("scroll.log", "w");

View File

@ -295,7 +295,7 @@ READ16_HANDLER( hdc68k_wheel_r )
UINT16 new_wheel = input_port_read(space->machine(), "12BADC0") << 4;
/* hack to display the wheel position */
if (input_code_pressed(space->machine(), KEYCODE_LSHIFT))
if (space->machine().input().code_pressed(KEYCODE_LSHIFT))
popmessage("%04X", new_wheel);
/* if we crossed the center line, latch the edge bit */
@ -830,7 +830,7 @@ WRITE16_HANDLER( hd68k_adsp_buffer_w )
static TIMER_CALLBACK( deferred_adsp_bank_switch )
{
harddriv_state *state = machine.driver_data<harddriv_state>();
if (LOG_COMMANDS && state->m_m68k_adsp_buffer_bank != param && input_code_pressed(machine, KEYCODE_L))
if (LOG_COMMANDS && state->m_m68k_adsp_buffer_bank != param && machine.input().code_pressed(KEYCODE_L))
{
static FILE *commands;
if (!commands) commands = fopen("commands.log", "w");

View File

@ -983,9 +983,9 @@ void amiga_render_scanline(running_machine &machine, bitmap_t *bitmap, int scanl
#if GUESS_COPPER_OFFSET
if (machine.primary_screen->frame_number() % 64 == 0 && scanline == 0)
{
if (input_code_pressed(machine, KEYCODE_Q))
if (machine.input().code_pressed(KEYCODE_Q))
popmessage("%d", state->m_wait_offset -= 1);
if (input_code_pressed(machine, KEYCODE_W))
if (machine.input().code_pressed(KEYCODE_W))
popmessage("%d", state->m_wait_offset += 1);
}
#endif

View File

@ -844,9 +844,9 @@ void amiga_aga_render_scanline(running_machine &machine, bitmap_t *bitmap, int s
#if GUESS_COPPER_OFFSET
if (machine.primary_screen->frame_number() % 64 == 0 && scanline == 0)
{
if (input_code_pressed(machine, KEYCODE_Q))
if (machine.input().code_pressed(KEYCODE_Q))
popmessage("%d", wait_offset -= 1);
if (input_code_pressed(machine, KEYCODE_W))
if (machine.input().code_pressed(KEYCODE_W))
popmessage("%d", wait_offset += 1);
}
#endif

View File

@ -1138,7 +1138,7 @@ static void butasan_log_vram(running_machine &machine)
argus_state *state = machine.driver_data<argus_state>();
int offs;
if (input_code_pressed(machine, KEYCODE_M))
if (machine.input().code_pressed(KEYCODE_M))
{
UINT8 *spriteram = state->m_spriteram;
int i;

View File

@ -231,14 +231,14 @@ SCREEN_UPDATE( blmbycar )
tilemap_set_scrollx(state->m_tilemap_1, 0, state->m_scroll_1[1] + 5);
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
// if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
// if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 8;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -497,13 +497,13 @@ void btoads_state::scanline_update(screen_device &screen, bitmap_t *bitmap, int
#if BT_DEBUG
popmessage("screen_control = %02X", m_screen_control & 0x7f);
if (input_code_pressed(machine(), KEYCODE_X))
if (machine().input().code_pressed(KEYCODE_X))
{
char name[10];
FILE *f;
int i;
while (input_code_pressed(machine(), KEYCODE_X)) ;
while (machine().input().code_pressed(KEYCODE_X)) ;
sprintf(name, "disp%d.log", m_xcount++);
f = fopen(name, "w");

View File

@ -1565,22 +1565,22 @@ SCREEN_UPDATE( cave )
#ifdef MAME_DEBUG
{
if ( input_code_pressed(screen->machine(), KEYCODE_Z) || input_code_pressed(screen->machine(), KEYCODE_X) || input_code_pressed(screen->machine(), KEYCODE_C) ||
input_code_pressed(screen->machine(), KEYCODE_V) || input_code_pressed(screen->machine(), KEYCODE_B) )
if ( screen->machine().input().code_pressed(KEYCODE_Z) || screen->machine().input().code_pressed(KEYCODE_X) || screen->machine().input().code_pressed(KEYCODE_C) ||
screen->machine().input().code_pressed(KEYCODE_V) || screen->machine().input().code_pressed(KEYCODE_B) )
{
int msk = 0, val = 0;
if (input_code_pressed(screen->machine(), KEYCODE_X)) val = 1; // priority 0 only
if (input_code_pressed(screen->machine(), KEYCODE_C)) val = 2; // "" 1
if (input_code_pressed(screen->machine(), KEYCODE_V)) val = 4; // "" 2
if (input_code_pressed(screen->machine(), KEYCODE_B)) val = 8; // "" 3
if (input_code_pressed(screen->machine(), KEYCODE_Z)) val = 1|2|4|8; // All of the above priorities
if (screen->machine().input().code_pressed(KEYCODE_X)) val = 1; // priority 0 only
if (screen->machine().input().code_pressed(KEYCODE_C)) val = 2; // "" 1
if (screen->machine().input().code_pressed(KEYCODE_V)) val = 4; // "" 2
if (screen->machine().input().code_pressed(KEYCODE_B)) val = 8; // "" 3
if (screen->machine().input().code_pressed(KEYCODE_Z)) val = 1|2|4|8; // All of the above priorities
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= val << 0; // for layer 0
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= val << 4; // for layer 1
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= val << 8; // for layer 2
if (input_code_pressed(screen->machine(), KEYCODE_R)) msk |= val << 12; // for layer 3
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= val << 16; // for sprites
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= val << 0; // for layer 0
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= val << 4; // for layer 1
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= val << 8; // for layer 2
if (screen->machine().input().code_pressed(KEYCODE_R)) msk |= val << 12; // for layer 3
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= val << 16; // for sprites
if (msk != 0) layers_ctrl &= msk;
#if 1

View File

@ -967,7 +967,7 @@ static void cischeat_draw_sprites(running_machine &machine, bitmap_t *bitmap , c
/* dimension of a tile after zoom */
#ifdef MAME_DEBUG
if ( input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_M) )
if ( machine.input().code_pressed(KEYCODE_Z) && machine.input().code_pressed(KEYCODE_M) )
{
xdim = 16 << 16;
ydim = 16 << 16;
@ -1033,7 +1033,7 @@ if ( (state->m_debugsprites) && ( ((attr & 0x0300)>>8) != (state->m_debugsprites
}
#ifdef MAME_DEBUG
#if 0
if (input_code_pressed(machine, KEYCODE_X))
if (machine.input().code_pressed(KEYCODE_X))
{ /* Display some info on each sprite */
sprintf(buf, "%04x",attr);
ui_draw_text(buf, sx>>16, sy>>16);
@ -1124,7 +1124,7 @@ static void bigrun_draw_sprites(running_machine &machine, bitmap_t *bitmap , con
/* dimension of a tile after zoom */
#ifdef MAME_DEBUG
if ( input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_M) )
if ( machine.input().code_pressed(KEYCODE_Z) && machine.input().code_pressed(KEYCODE_M) )
{
xdim = 16 << 16;
ydim = 16 << 16;
@ -1188,7 +1188,7 @@ if ( (state->m_debugsprites) && ( ((attr & 0x0300)>>8) != (state->m_debugsprites
}
#ifdef MAME_DEBUG
#if 0
if (input_code_pressed(machine, KEYCODE_X))
if (machine.input().code_pressed(KEYCODE_X))
{ /* Display some info on each sprite */
sprintf(buf, "%04x",attr);
ui_draw_text(buf, sx>>16, sy>>16);
@ -1210,24 +1210,24 @@ if (input_code_pressed(machine, KEYCODE_X))
#ifdef MAME_DEBUG
#define CISCHEAT_LAYERSCTRL \
state->m_debugsprites = 0; \
if ( input_code_pressed(screen->machine(), KEYCODE_Z) || input_code_pressed(screen->machine(), KEYCODE_X) ) \
if ( screen->machine().input().code_pressed(KEYCODE_Z) || screen->machine().input().code_pressed(KEYCODE_X) ) \
{ \
int msk = 0; \
if (input_code_pressed(screen->machine(), KEYCODE_Q)) { msk |= 0x01;} \
if (input_code_pressed(screen->machine(), KEYCODE_W)) { msk |= 0x02;} \
if (input_code_pressed(screen->machine(), KEYCODE_E)) { msk |= 0x04;} \
if (input_code_pressed(screen->machine(), KEYCODE_A)) { msk |= 0x08; state->m_debugsprites = 1;} \
if (input_code_pressed(screen->machine(), KEYCODE_S)) { msk |= 0x08; state->m_debugsprites = 2;} \
if (input_code_pressed(screen->machine(), KEYCODE_D)) { msk |= 0x08; state->m_debugsprites = 3;} \
if (input_code_pressed(screen->machine(), KEYCODE_F)) { msk |= 0x08; state->m_debugsprites = 4;} \
if (input_code_pressed(screen->machine(), KEYCODE_R)) { msk |= 0x10;} \
if (input_code_pressed(screen->machine(), KEYCODE_T)) { msk |= 0x20;} \
if (screen->machine().input().code_pressed(KEYCODE_Q)) { msk |= 0x01;} \
if (screen->machine().input().code_pressed(KEYCODE_W)) { msk |= 0x02;} \
if (screen->machine().input().code_pressed(KEYCODE_E)) { msk |= 0x04;} \
if (screen->machine().input().code_pressed(KEYCODE_A)) { msk |= 0x08; state->m_debugsprites = 1;} \
if (screen->machine().input().code_pressed(KEYCODE_S)) { msk |= 0x08; state->m_debugsprites = 2;} \
if (screen->machine().input().code_pressed(KEYCODE_D)) { msk |= 0x08; state->m_debugsprites = 3;} \
if (screen->machine().input().code_pressed(KEYCODE_F)) { msk |= 0x08; state->m_debugsprites = 4;} \
if (screen->machine().input().code_pressed(KEYCODE_R)) { msk |= 0x10;} \
if (screen->machine().input().code_pressed(KEYCODE_T)) { msk |= 0x20;} \
\
if (msk != 0) state->m_active_layers &= msk; \
} \
\
{ \
if ( input_code_pressed(screen->machine(), KEYCODE_Z) && input_code_pressed_once(screen->machine(), KEYCODE_U) ) \
if ( screen->machine().input().code_pressed(KEYCODE_Z) && screen->machine().input().code_pressed_once(KEYCODE_U) ) \
state->m_show_unknown ^= 1; \
if (state->m_show_unknown) \
popmessage("0:%04X 2:%04X 4:%04X 6:%04X c:%04X", \
@ -1423,16 +1423,16 @@ SCREEN_UPDATE( scudhamm )
#ifdef MAME_DEBUG
state->m_debugsprites = 0;
if ( input_code_pressed(screen->machine(), KEYCODE_Z) || input_code_pressed(screen->machine(), KEYCODE_X) )
if ( screen->machine().input().code_pressed(KEYCODE_Z) || screen->machine().input().code_pressed(KEYCODE_X) )
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) { msk |= 0x1;}
if (input_code_pressed(screen->machine(), KEYCODE_W)) { msk |= 0x2;}
if (input_code_pressed(screen->machine(), KEYCODE_E)) { msk |= 0x4;}
if (input_code_pressed(screen->machine(), KEYCODE_A)) { msk |= 0x8; state->m_debugsprites = 1;}
if (input_code_pressed(screen->machine(), KEYCODE_S)) { msk |= 0x8; state->m_debugsprites = 2;}
if (input_code_pressed(screen->machine(), KEYCODE_D)) { msk |= 0x8; state->m_debugsprites = 3;}
if (input_code_pressed(screen->machine(), KEYCODE_F)) { msk |= 0x8; state->m_debugsprites = 4;}
if (screen->machine().input().code_pressed(KEYCODE_Q)) { msk |= 0x1;}
if (screen->machine().input().code_pressed(KEYCODE_W)) { msk |= 0x2;}
if (screen->machine().input().code_pressed(KEYCODE_E)) { msk |= 0x4;}
if (screen->machine().input().code_pressed(KEYCODE_A)) { msk |= 0x8; state->m_debugsprites = 1;}
if (screen->machine().input().code_pressed(KEYCODE_S)) { msk |= 0x8; state->m_debugsprites = 2;}
if (screen->machine().input().code_pressed(KEYCODE_D)) { msk |= 0x8; state->m_debugsprites = 3;}
if (screen->machine().input().code_pressed(KEYCODE_F)) { msk |= 0x8; state->m_debugsprites = 4;}
if (msk != 0) state->m_active_layers &= msk;
#if 1

View File

@ -2565,7 +2565,7 @@ static void cps2_render_sprites( running_machine &machine, bitmap_t *bitmap, con
int yoffs = 16 - cps2_port(machine, CPS2_OBJ_YOFFS);
#ifdef MAME_DEBUG
if (input_code_pressed(machine, KEYCODE_Z) && input_code_pressed(machine, KEYCODE_R))
if (machine.input().code_pressed(KEYCODE_Z) && machine.input().code_pressed(KEYCODE_R))
{
return;
}
@ -2905,7 +2905,7 @@ if ( (cps2_port(screen->machine(), CPS2_OBJ_BASE) != 0x7080 && cps2_port(screen-
cps2_port(screen->machine(), CPS2_OBJ_UK1),
cps2_port(screen->machine(), CPS2_OBJ_UK2));
if (0 && input_code_pressed(screen->machine(), KEYCODE_Z))
if (0 && screen->machine().input().code_pressed(KEYCODE_Z))
popmessage("order: %d (%d) %d (%d) %d (%d) %d (%d)",l0,l0pri,l1,l1pri,l2,l2pri,l3,l3pri);
#endif

View File

@ -836,7 +836,7 @@ void deco16ic_print_debug_info(device_t *device, bitmap_t *bitmap)
deco16ic_state *deco16ic = get_safe_token(device);
char buf[64*5];
if (input_code_pressed(device->machine(), KEYCODE_O))
if (device->machine().input().code_pressed(KEYCODE_O))
return;
if (deco16ic->pf12_control)

View File

@ -42,7 +42,7 @@ static void blitRaster(running_machine &machine, bitmap_t *bitmap, int rasterMod
UINT32* dst=BITMAP_ADDR32(bitmap, y, 0);
UINT32 xptr=(state->m_mlc_raster_table[0][y]<<13);
if (input_code_pressed(machine, KEYCODE_X))
if (machine.input().code_pressed(KEYCODE_X))
xptr=0;
for (x=0; x<320; x++)
@ -50,7 +50,7 @@ static void blitRaster(running_machine &machine, bitmap_t *bitmap, int rasterMod
if (src[x])
dst[x]=src[(xptr>>16)&0x1ff];
//if (input_code_pressed(machine, KEYCODE_X))
//if (machine.input().code_pressed(KEYCODE_X))
// xptr+=0x10000;
//else if(rasterHackTest[0][y]<0)
xptr+=0x10000 - ((state->m_mlc_raster_table[2][y]&0x3ff)<<5);

View File

@ -535,7 +535,7 @@ SCREEN_UPDATE( decocass )
#ifdef MAME_DEBUG
{
if (input_code_pressed_once(screen->machine(), KEYCODE_I))
if (screen->machine().input().code_pressed_once(KEYCODE_I))
state->m_showmsg ^= 1;
if (state->m_showmsg)
popmessage("mode:$%02x cm:$%02x ccb:$%02x h:$%02x vl:$%02x vr:$%02x ph:$%02x pv:$%02x ch:$%02x cv:$%02x",

View File

@ -1205,16 +1205,16 @@ static int debug_mask( running_machine &machine )
{
#ifdef MAME_DEBUG
int msk = 0;
if (input_code_pressed(machine, KEYCODE_Z))
if (machine.input().code_pressed(KEYCODE_Z))
{
if (input_code_pressed(machine, KEYCODE_Q)) msk |= 0x01; // layer 0
if (input_code_pressed(machine, KEYCODE_W)) msk |= 0x02; // layer 1
if (input_code_pressed(machine, KEYCODE_E)) msk |= 0x04; // layer 2
if (input_code_pressed(machine, KEYCODE_R)) msk |= 0x08; // layer 3
if (input_code_pressed(machine, KEYCODE_A)) msk |= 0x10; // layer 4
if (input_code_pressed(machine, KEYCODE_S)) msk |= 0x20; // layer 5
if (input_code_pressed(machine, KEYCODE_D)) msk |= 0x40; // layer 6
if (input_code_pressed(machine, KEYCODE_F)) msk |= 0x80; // layer 7
if (machine.input().code_pressed(KEYCODE_Q)) msk |= 0x01; // layer 0
if (machine.input().code_pressed(KEYCODE_W)) msk |= 0x02; // layer 1
if (machine.input().code_pressed(KEYCODE_E)) msk |= 0x04; // layer 2
if (machine.input().code_pressed(KEYCODE_R)) msk |= 0x08; // layer 3
if (machine.input().code_pressed(KEYCODE_A)) msk |= 0x10; // layer 4
if (machine.input().code_pressed(KEYCODE_S)) msk |= 0x20; // layer 5
if (machine.input().code_pressed(KEYCODE_D)) msk |= 0x40; // layer 6
if (machine.input().code_pressed(KEYCODE_F)) msk |= 0x80; // layer 7
if (msk != 0) return msk;
}
#endif
@ -1232,7 +1232,7 @@ static int debug_viewer( running_machine &machine, bitmap_t *bitmap, const recta
#ifdef MAME_DEBUG
static int toggle;
if (input_code_pressed_once(machine, KEYCODE_T)) toggle = 1 - toggle;
if (machine.input().code_pressed_once(KEYCODE_T)) toggle = 1 - toggle;
if (toggle)
{
dynax_state *state = machine.driver_data<dynax_state>();
@ -1240,14 +1240,14 @@ static int debug_viewer( running_machine &machine, bitmap_t *bitmap, const recta
size_t size = machine.region( "gfx1" )->bytes();
static int i = 0, c = 0, r = 0;
if (input_code_pressed_once(machine, KEYCODE_I)) c = (c - 1) & 0x1f;
if (input_code_pressed_once(machine, KEYCODE_O)) c = (c + 1) & 0x1f;
if (input_code_pressed_once(machine, KEYCODE_R)) { r = (r + 1) & 0x7; i = size / 8 * r; }
if (input_code_pressed(machine, KEYCODE_M) | input_code_pressed_once(machine, KEYCODE_K))
if (machine.input().code_pressed_once(KEYCODE_I)) c = (c - 1) & 0x1f;
if (machine.input().code_pressed_once(KEYCODE_O)) c = (c + 1) & 0x1f;
if (machine.input().code_pressed_once(KEYCODE_R)) { r = (r + 1) & 0x7; i = size / 8 * r; }
if (machine.input().code_pressed(KEYCODE_M) | machine.input().code_pressed_once(KEYCODE_K))
{
while (i < size && RAM[i]) i++; while (i < size && !RAM[i]) i++;
}
if (input_code_pressed(machine, KEYCODE_N) | input_code_pressed_once(machine, KEYCODE_J))
if (machine.input().code_pressed(KEYCODE_N) | machine.input().code_pressed_once(KEYCODE_J))
{
if (i >= 2) i -= 2; while (i > 0 && RAM[i]) i--; i++;
}

View File

@ -337,12 +337,12 @@ SCREEN_UPDATE( esd16 )
tilemap_set_scrolly(state->m_tilemap_1, 0, state->m_scroll_1[1]);
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 4;
if (msk != 0) layers_ctrl &= msk;
}
#endif
@ -365,12 +365,12 @@ SCREEN_UPDATE( hedpanic )
bitmap_fill(screen->machine().priority_bitmap, cliprect, 0);
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 4;
if (msk != 0) layers_ctrl &= msk;
}
#endif
@ -428,12 +428,12 @@ SCREEN_UPDATE( hedpanio )
bitmap_fill(screen->machine().priority_bitmap,cliprect,0);
#ifdef MAME_DEBUG
if ( input_code_pressed(screen->machine(), KEYCODE_Z) )
if ( screen->machine().input().code_pressed(KEYCODE_Z) )
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 4;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -128,13 +128,13 @@ SCREEN_UPDATE(fitfight)
if (vblank > 0)
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine()));
else {
// if (input_code_pressed(screen->machine(), KEYCODE_Q))
// if (screen->machine().input().code_pressed(KEYCODE_Q))
// scrollbak = ((state->m_fof_a00000[0] & 0xff00) >> 5) - ((state->m_fof_700000[0] & 0x0038) >> 3);
// else if (input_code_pressed(screen->machine(), KEYCODE_W))
// else if (screen->machine().input().code_pressed(KEYCODE_W))
// scrollbak = ((state->m_fof_a00000[0] & 0xff00) >> 5) + ((state->m_fof_700000[0] & 0x01c0) >> 6);
// else if (input_code_pressed(screen->machine(), KEYCODE_E))
// else if (screen->machine().input().code_pressed(KEYCODE_E))
// scrollbak = ((state->m_fof_a00000[0] & 0xff00) >> 5) - ((state->m_fof_700000[0] & 0x01c0) >> 6);
// else if (input_code_pressed(screen->machine(), KEYCODE_R))
// else if (screen->machine().input().code_pressed(KEYCODE_R))
// scrollbak = ((state->m_fof_a00000[0] & 0xff00) >> 5) + ((state->m_fof_700000[0] & 0x0038) >> 3);
// else
scrollbak = ((state->m_fof_a00000[0] & 0xff00) >> 5);
@ -144,19 +144,19 @@ SCREEN_UPDATE(fitfight)
draw_sprites(screen->machine(), bitmap, cliprect, 0);
// if (input_code_pressed(screen->machine(), KEYCODE_A))
// if (screen->machine().input().code_pressed(KEYCODE_A))
// scrollmid = ((state->m_fof_900000[0] & 0xff00) >> 5) - ((state->m_fof_700000[0] & 0x01c0) >> 6);
// else if (input_code_pressed(screen->machine(), KEYCODE_S))
// else if (screen->machine().input().code_pressed(KEYCODE_S))
// scrollmid = ((state->m_fof_900000[0] & 0xff00) >> 5) + ((state->m_fof_700000[0] & 0x0038) >> 3);
// else if (input_code_pressed(screen->machine(), KEYCODE_D))
// else if (screen->machine().input().code_pressed(KEYCODE_D))
// scrollmid = ((state->m_fof_900000[0] & 0xff00) >> 5) - ((state->m_fof_700000[0] & 0x0038) >> 3);
// else if (input_code_pressed(screen->machine(), KEYCODE_F))
// else if (screen->machine().input().code_pressed(KEYCODE_F))
// scrollmid = ((state->m_fof_900000[0] & 0xff00) >> 5) + ((state->m_fof_700000[0] & 0x01c0) >> 6);
// else
scrollmid = ((state->m_fof_900000[0] & 0xff00) >> 5);
tilemap_set_scrollx(state->m_fof_mid_tilemap, 0, scrollmid );
tilemap_set_scrolly(state->m_fof_mid_tilemap, 0, state->m_fof_900000[0] & 0xff);
// if (!input_code_pressed(screen->machine(), KEYCODE_F))
// if (!screen->machine().input().code_pressed(KEYCODE_F))
tilemap_draw(bitmap, cliprect, state->m_fof_mid_tilemap, 0, 0);
draw_sprites(screen->machine(), bitmap, cliprect, 1);

View File

@ -97,7 +97,7 @@ SCREEN_UPDATE(funybubl)
draw_sprites(screen->machine(), bitmap, cliprect);
#if 0
if ( input_code_pressed_once(screen->machine(), KEYCODE_W) )
if ( screen->machine().input().code_pressed_once(KEYCODE_W) )
{
FILE *fp;

View File

@ -219,7 +219,7 @@ static void draw_sprites( screen_device &screen, bitmap_t *bitmap, const rectang
#ifdef MAME_DEBUG
#if 0
if (input_code_pressed(screen.machine(), KEYCODE_X))
if (screen.machine().input().code_pressed(KEYCODE_X))
{ /* Display some info on each sprite */
char buf[40];
sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);

View File

@ -211,10 +211,10 @@ static void draw_sprites( screen_device &screen, bitmap_t *bitmap, const rectang
else { ystart = 0; yend = ynum; yinc = +1; }
#if 0
if(!( (input_code_pressed(screen.machine(), KEYCODE_V) && (((attr >> 6)&3) == 0))
|| (input_code_pressed(screen.machine(), KEYCODE_B) && (((attr >> 6)&3) == 1))
|| (input_code_pressed(screen.machine(), KEYCODE_N) && (((attr >> 6)&3) == 2))
|| (input_code_pressed(screen.machine(), KEYCODE_M) && (((attr >> 6)&3) == 3))
if(!( (screen.machine().input().code_pressed(KEYCODE_V) && (((attr >> 6)&3) == 0))
|| (screen.machine().input().code_pressed(KEYCODE_B) && (((attr >> 6)&3) == 1))
|| (screen.machine().input().code_pressed(KEYCODE_N) && (((attr >> 6)&3) == 2))
|| (screen.machine().input().code_pressed(KEYCODE_M) && (((attr >> 6)&3) == 3))
))
#endif
@ -243,7 +243,7 @@ static void draw_sprites( screen_device &screen, bitmap_t *bitmap, const rectang
#ifdef MAME_DEBUG
#if 0
if (input_code_pressed(screen.machine(), KEYCODE_X))
if (screen.machine().input().code_pressed(KEYCODE_X))
{ /* Display some info on each sprite */
char buf[40];
sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);

View File

@ -451,26 +451,26 @@ SCREEN_UPDATE( gaelco3d )
gaelco3d_state *state = screen->machine().driver_data<gaelco3d_state>();
int x, y, ret;
if (DISPLAY_TEXTURE && (input_code_pressed(screen->machine(), KEYCODE_Z) || input_code_pressed(screen->machine(), KEYCODE_X)))
if (DISPLAY_TEXTURE && (screen->machine().input().code_pressed(KEYCODE_Z) || screen->machine().input().code_pressed(KEYCODE_X)))
{
static int xv = 0, yv = 0x1000;
UINT8 *base = state->m_texture;
int length = state->m_texture_size;
if (input_code_pressed(screen->machine(), KEYCODE_X))
if (screen->machine().input().code_pressed(KEYCODE_X))
{
base = state->m_texmask;
length = state->m_texmask_size;
}
if (input_code_pressed(screen->machine(), KEYCODE_LEFT) && xv >= 4)
if (screen->machine().input().code_pressed(KEYCODE_LEFT) && xv >= 4)
xv -= 4;
if (input_code_pressed(screen->machine(), KEYCODE_RIGHT) && xv < 4096 - 4)
if (screen->machine().input().code_pressed(KEYCODE_RIGHT) && xv < 4096 - 4)
xv += 4;
if (input_code_pressed(screen->machine(), KEYCODE_UP) && yv >= 4)
if (screen->machine().input().code_pressed(KEYCODE_UP) && yv >= 4)
yv -= 4;
if (input_code_pressed(screen->machine(), KEYCODE_DOWN) && yv < 0x40000)
if (screen->machine().input().code_pressed(KEYCODE_DOWN) && yv < 0x40000)
yv += 4;
for (y = cliprect->min_y; y <= cliprect->max_y; y++)

View File

@ -476,17 +476,17 @@ SCREEN_UPDATE( galastrm )
#if 0
if (layer[0]==0 && layer[1]==3 && layer[2]==2 && layer[3]==1)
{
if (!input_code_pressed(screen->machine(), KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[0], 0, 1);
if (!input_code_pressed(screen->machine(), KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[1], 0, 4);
if (!input_code_pressed(screen->machine(), KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[2], 0, 4);
if (!input_code_pressed(screen->machine(), KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[3], 0, 4);
if (!screen->machine().input().code_pressed(KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[0], 0, 1);
if (!screen->machine().input().code_pressed(KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[1], 0, 4);
if (!screen->machine().input().code_pressed(KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[2], 0, 4);
if (!screen->machine().input().code_pressed(KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[3], 0, 4);
}
else
{
if (!input_code_pressed(screen->machine(), KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[0], 0, 1);
if (!input_code_pressed(screen->machine(), KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[1], 0, 2);
if (!input_code_pressed(screen->machine(), KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[2], 0, 4);
if (!input_code_pressed(screen->machine(), KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[3], 0, 8);
if (!screen->machine().input().code_pressed(KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[0], 0, 1);
if (!screen->machine().input().code_pressed(KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[1], 0, 2);
if (!screen->machine().input().code_pressed(KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[2], 0, 4);
if (!screen->machine().input().code_pressed(KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, state->m_tmpbitmaps, &clip, layer[3], 0, 8);
}
if (layer[0]==3 && layer[1]==0 && layer[2]==1 && layer[3]==2)
@ -515,8 +515,8 @@ SCREEN_UPDATE( galastrm )
bitmap_fill(priority_bitmap, cliprect, 0);
draw_sprites(screen->machine(),bitmap,cliprect,primasks,0);
if (!input_code_pressed(screen->machine(), KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0);
if (!input_code_pressed(screen->machine(), KEYCODE_M)) tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);
if (!screen->machine().input().code_pressed(KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0);
if (!screen->machine().input().code_pressed(KEYCODE_M)) tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);

View File

@ -147,13 +147,13 @@ SCREEN_UPDATE( galpani2 )
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 8;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -256,19 +256,19 @@ SCREEN_UPDATE( gcpinbal )
UINT8 layer[3];
#ifdef MAME_DEBUG
if (input_code_pressed_once(screen->machine(), KEYCODE_V))
if (screen->machine().input().code_pressed_once(KEYCODE_V))
{
state->m_dislayer[0] ^= 1;
popmessage("bg0: %01x", state->m_dislayer[0]);
}
if (input_code_pressed_once(screen->machine(), KEYCODE_B))
if (screen->machine().input().code_pressed_once(KEYCODE_B))
{
state->m_dislayer[1] ^= 1;
popmessage("bg1: %01x", state->m_dislayer[1]);
}
if (input_code_pressed_once(screen->machine(), KEYCODE_N))
if (screen->machine().input().code_pressed_once(KEYCODE_N))
{
state->m_dislayer[2] ^= 1;
popmessage("fg: %01x", state->m_dislayer[2]);

View File

@ -251,14 +251,14 @@ SCREEN_UPDATE( ginganin )
int layers_ctrl1 = state->m_layers_ctrl;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) { msk |= 0xfff1;}
if (input_code_pressed(screen->machine(), KEYCODE_W)) { msk |= 0xfff2;}
if (input_code_pressed(screen->machine(), KEYCODE_E)) { msk |= 0xfff4;}
if (input_code_pressed(screen->machine(), KEYCODE_A)) { msk |= 0xfff8;}
if (screen->machine().input().code_pressed(KEYCODE_Q)) { msk |= 0xfff1;}
if (screen->machine().input().code_pressed(KEYCODE_W)) { msk |= 0xfff2;}
if (screen->machine().input().code_pressed(KEYCODE_E)) { msk |= 0xfff4;}
if (screen->machine().input().code_pressed(KEYCODE_A)) { msk |= 0xfff8;}
if (msk != 0) layers_ctrl1 &= msk;
#define SETSCROLL \
@ -268,11 +268,11 @@ if (input_code_pressed(screen->machine(), KEYCODE_Z))
tilemap_set_scrolly(state->m_fg_tilemap, 0, state->m_posy); \
popmessage("B>%04X:%04X F>%04X:%04X",state->m_posx%(BG_NX*16),state->m_posy%(BG_NY*16),state->m_posx%(FG_NX*16),state->m_posy%(FG_NY*16));
if (input_code_pressed(screen->machine(), KEYCODE_L)) { state->m_posx +=8; SETSCROLL }
if (input_code_pressed(screen->machine(), KEYCODE_J)) { state->m_posx -=8; SETSCROLL }
if (input_code_pressed(screen->machine(), KEYCODE_K)) { state->m_posy +=8; SETSCROLL }
if (input_code_pressed(screen->machine(), KEYCODE_I)) { state->m_posy -=8; SETSCROLL }
if (input_code_pressed(screen->machine(), KEYCODE_H)) { state->m_posx = state->m_posy = 0; SETSCROLL }
if (screen->machine().input().code_pressed(KEYCODE_L)) { state->m_posx +=8; SETSCROLL }
if (screen->machine().input().code_pressed(KEYCODE_J)) { state->m_posx -=8; SETSCROLL }
if (screen->machine().input().code_pressed(KEYCODE_K)) { state->m_posy +=8; SETSCROLL }
if (screen->machine().input().code_pressed(KEYCODE_I)) { state->m_posy -=8; SETSCROLL }
if (screen->machine().input().code_pressed(KEYCODE_H)) { state->m_posx = state->m_posy = 0; SETSCROLL }
}
#endif

View File

@ -995,15 +995,15 @@ SCREEN_UPDATE( gticlub )
if( tick >= 5 ) {
tick = 0;
if( input_code_pressed(screen->machine(), KEYCODE_O) )
if( screen->machine().input().code_pressed(KEYCODE_O) )
debug_tex_page++;
if( input_code_pressed(screen->machine(), KEYCODE_I) )
if( screen->machine().input().code_pressed(KEYCODE_I) )
debug_tex_page--;
if (input_code_pressed(screen->machine(), KEYCODE_U))
if (screen->machine().input().code_pressed(KEYCODE_U))
debug_tex_palette++;
if (input_code_pressed(screen->machine(), KEYCODE_Y))
if (screen->machine().input().code_pressed(KEYCODE_Y))
debug_tex_palette--;
if (debug_tex_page < 0)

View File

@ -224,12 +224,12 @@ SCREEN_UPDATE( gunbustr )
sprites as pdrawgfx cannot yet cope with more than 4 layers */
#ifdef MAME_DEBUG
if (!input_code_pressed (screen->machine(), KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0],TILEMAP_DRAW_OPAQUE, 0);
if (!input_code_pressed (screen->machine(), KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 1);
if (!input_code_pressed (screen->machine(), KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2);
if (!input_code_pressed (screen->machine(), KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4);
if (!input_code_pressed (screen->machine(), KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8);
if (!input_code_pressed (screen->machine(), KEYCODE_N)) draw_sprites(screen->machine(), bitmap, cliprect, primasks, 48, -116);
if (!screen->machine().input().code_pressed (KEYCODE_Z)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0],TILEMAP_DRAW_OPAQUE, 0);
if (!screen->machine().input().code_pressed (KEYCODE_X)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 1);
if (!screen->machine().input().code_pressed (KEYCODE_C)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2);
if (!screen->machine().input().code_pressed (KEYCODE_V)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4);
if (!screen->machine().input().code_pressed (KEYCODE_B)) tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8);
if (!screen->machine().input().code_pressed (KEYCODE_N)) draw_sprites(screen->machine(), bitmap, cliprect, primasks, 48, -116);
#else
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0);
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 1);

View File

@ -1461,7 +1461,7 @@ SCREEN_UPDATE( hng64 )
// press in sams64_2 attract mode for a nice debug screen from the game
// not sure how functional it is, and it doesn't appear to test everything (rowscroll modes etc.)
// but it could be useful
if ( input_code_pressed_once(screen->machine(), KEYCODE_L) )
if ( screen->machine().input().code_pressed_once(KEYCODE_L) )
{
address_space *space = screen->machine().device("maincpu")->memory().space(AS_PROGRAM);
space->write_byte(0x2f27c8, 0x2);
@ -1630,22 +1630,22 @@ SCREEN_UPDATE( hng64 )
hng64_tcram[0x58/4],
hng64_tcram[0x5c/4]);
if ( input_code_pressed_once(screen->machine(), KEYCODE_T) )
if ( screen->machine().input().code_pressed_once(KEYCODE_T) )
{
state->m_additive_tilemap_debug ^= 1;
popmessage("blend changed %02x", state->m_additive_tilemap_debug);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_Y) )
if ( screen->machine().input().code_pressed_once(KEYCODE_Y) )
{
state->m_additive_tilemap_debug ^= 2;
popmessage("blend changed %02x", state->m_additive_tilemap_debug);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_U) )
if ( screen->machine().input().code_pressed_once(KEYCODE_U) )
{
state->m_additive_tilemap_debug ^= 4;
popmessage("blend changed %02x", state->m_additive_tilemap_debug);
}
if ( input_code_pressed_once(screen->machine(), KEYCODE_I) )
if ( screen->machine().input().code_pressed_once(KEYCODE_I) )
{
state->m_additive_tilemap_debug ^= 8;
popmessage("blend changed %02x", state->m_additive_tilemap_debug);

View File

@ -22,10 +22,10 @@ static TILE_GET_INFO( holeland_get_tile_info )
int attr = state->m_colorram[tile_index];
int tile_number = state->m_videoram[tile_index] | ((attr & 0x03) << 8);
/*if (input_code_pressed(machine, KEYCODE_Q) && (attr & 0x10)) tile_number = rand(); */
/*if (input_code_pressed(machine, KEYCODE_W) && (attr & 0x20)) tile_number = rand(); */
/*if (input_code_pressed(machine, KEYCODE_E) && (attr & 0x40)) tile_number = rand(); */
/*if (input_code_pressed(machine, KEYCODE_R) && (attr & 0x80)) tile_number = rand(); */
/*if (machine.input().code_pressed(KEYCODE_Q) && (attr & 0x10)) tile_number = rand(); */
/*if (machine.input().code_pressed(KEYCODE_W) && (attr & 0x20)) tile_number = rand(); */
/*if (machine.input().code_pressed(KEYCODE_E) && (attr & 0x40)) tile_number = rand(); */
/*if (machine.input().code_pressed(KEYCODE_R) && (attr & 0x80)) tile_number = rand(); */
SET_TILE_INFO(
0,
tile_number,

View File

@ -725,12 +725,12 @@ SCREEN_UPDATE( hyprduel )
flip_screen_set(screen->machine(), screenctrl & 1);
#if 0
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{ int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 0x01;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 0x02;
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 0x04;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 0x08;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 0x01;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 0x02;
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 0x04;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 0x08;
if (msk != 0)
{
bitmap_fill(bitmap, cliprect,0);

View File

@ -383,7 +383,7 @@ WRITE32_HANDLER( itech020_paletteram_w )
static void logblit(running_machine &machine, const char *tag)
{
itech32_state *state = machine.driver_data<itech32_state>();
if (!input_code_pressed(machine, KEYCODE_L))
if (!machine.input().code_pressed(KEYCODE_L))
return;
if (state->m_is_drivedge && VIDEO_TRANSFER_FLAGS == 0x5490)
{

View File

@ -2567,7 +2567,7 @@ SCREEN_UPDATE(konamigx)
{
const pen_t *paldata = screen->machine().pens;
if ( input_code_pressed(screen->machine(), KEYCODE_W) )
if ( screen->machine().input().code_pressed(KEYCODE_W) )
{
int y,x;

View File

@ -1617,7 +1617,7 @@ static void K053936_zoom_draw(int chip,UINT16 *ctrl,UINT16 *linectrl, bitmap_t *
}
#if 0
if (input_code_pressed(machine, KEYCODE_D))
if (machine.input().code_pressed(KEYCODE_D))
popmessage("%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x",
ctrl[0x00],
ctrl[0x01],

View File

@ -1737,7 +1737,7 @@ void k007342_tilemap_update( device_t *device )
{
static int current_layer = 0;
if (input_code_pressed_once(machine, KEYCODE_Z)) current_layer = !current_layer;
if (machine.input().code_pressed_once(KEYCODE_Z)) current_layer = !current_layer;
tilemap_set_enable(k007342->tilemap[current_layer], 1);
tilemap_set_enable(k007342->tilemap[!current_layer], 0);
@ -2086,8 +2086,8 @@ void k007420_sprites_draw( device_t *device, bitmap_t *bitmap, const rectangle *
{
static int current_sprite = 0;
if (input_code_pressed_once(machine, KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1);
if (input_code_pressed_once(machine, KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1);
if (machine.input().code_pressed_once(KEYCODE_Z)) current_sprite = (current_sprite+1) & ((K007420_SPRITERAM_SIZE/8)-1);
if (machine.input().code_pressed_once(KEYCODE_X)) current_sprite = (current_sprite-1) & ((K007420_SPRITERAM_SIZE/8)-1);
popmessage("%02x:%02x %02x %02x %02x %02x %02x %02x %02x", current_sprite,
k007420->ram[(current_sprite*8)+0], k007420->ram[(current_sprite*8)+1],
@ -2547,7 +2547,7 @@ if ((k052109->scrollctrl & 0x03) == 0x01 ||
(k052109->scrollctrl & 0xc0) != 0)
popmessage("scrollcontrol = %02x", k052109->scrollctrl);
if (input_code_pressed(machine, KEYCODE_F))
if (machine.input().code_pressed(KEYCODE_F))
{
FILE *fp;
fp=fopen("TILE.DMP", "w+b");
@ -3182,7 +3182,7 @@ void k051960_sprites_draw( device_t *device, bitmap_t *bitmap, const rectangle *
}
}
#if 0
if (input_code_pressed(machine, KEYCODE_D))
if (machine.input().code_pressed(KEYCODE_D))
{
FILE *fp;
fp=fopen("SPRITE.DMP", "w+b");
@ -3766,7 +3766,7 @@ void k053245_sprites_draw( device_t *device, bitmap_t *bitmap, const rectangle *
}
}
#if 0
if (input_code_pressed(machine, KEYCODE_D))
if (machine.input().code_pressed(KEYCODE_D))
{
FILE *fp;
fp=fopen("SPRITE.DMP", "w+b");
@ -4016,7 +4016,7 @@ void k053245_sprites_draw_lethal( device_t *device, bitmap_t *bitmap, const rect
}
}
#if 0
if (input_code_pressed(machine, KEYCODE_D))
if (machine.input().code_pressed(KEYCODE_D))
{
FILE *fp;
fp=fopen("SPRITE.DMP", "w+b");
@ -5570,7 +5570,7 @@ void k053936_zoom_draw( device_t *device, bitmap_t *bitmap, const rectangle *cli
}
#if 0
if (input_code_pressed(machine, KEYCODE_D))
if (machine.input().code_pressed(KEYCODE_D))
popmessage("%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x\n%04x %04x %04x %04x",
k053936->ctrl[0x00],
k053936->ctrl[0x01],

View File

@ -331,15 +331,15 @@ SCREEN_UPDATE( lordgun )
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_R)) msk |= 8;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 16;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_R)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 16;
if (msk != 0) layers_ctrl &= msk;
}
#endif

View File

@ -231,19 +231,19 @@ SCREEN_UPDATE( mcatadv )
for (i = 0; i <= 3; i++)
{
#ifdef MAME_DEBUG
if (!input_code_pressed(screen->machine(), KEYCODE_Q))
if (!screen->machine().input().code_pressed(KEYCODE_Q))
#endif
mcatadv_draw_tilemap_part(state->m_scroll1, state->m_videoram1, i, state->m_tilemap1, bitmap, cliprect);
#ifdef MAME_DEBUG
if (!input_code_pressed(screen->machine(), KEYCODE_W))
if (!screen->machine().input().code_pressed(KEYCODE_W))
#endif
mcatadv_draw_tilemap_part(state->m_scroll2, state->m_videoram2, i, state->m_tilemap2, bitmap, cliprect);
}
g_profiler.start(PROFILER_USER1);
#ifdef MAME_DEBUG
if (!input_code_pressed(screen->machine(), KEYCODE_E))
if (!screen->machine().input().code_pressed(KEYCODE_E))
#endif
draw_sprites (screen->machine(), bitmap, cliprect);
g_profiler.stop();

View File

@ -768,13 +768,13 @@ SCREEN_UPDATE( metro )
#ifdef MAME_DEBUG
if (input_code_pressed(screen->machine(), KEYCODE_Z))
if (screen->machine().input().code_pressed(KEYCODE_Z))
{
int msk = 0;
if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1;
if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2;
if (input_code_pressed(screen->machine(), KEYCODE_E)) msk |= 4;
if (input_code_pressed(screen->machine(), KEYCODE_A)) msk |= 8;
if (screen->machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
if (screen->machine().input().code_pressed(KEYCODE_W)) msk |= 2;
if (screen->machine().input().code_pressed(KEYCODE_E)) msk |= 4;
if (screen->machine().input().code_pressed(KEYCODE_A)) msk |= 8;
if (msk != 0)
{
bitmap_fill(bitmap, cliprect, 0);

Some files were not shown because too many files have changed in this diff Show More