MESS-specific: Added hook for default keyboard key names

This commit is contained in:
Nathan Woods 2008-05-25 19:39:13 +00:00
parent fc8d7ec1b5
commit 200cda66f1

View file

@ -209,6 +209,7 @@ struct _input_field_state
UINT8 impulse; /* counter for impulse controls */ UINT8 impulse; /* counter for impulse controls */
UINT8 last; /* were we pressed last time? */ UINT8 last; /* were we pressed last time? */
UINT8 joydir; /* digital joystick direction index */ UINT8 joydir; /* digital joystick direction index */
char * name; /* overridden name */
}; };
@ -737,6 +738,8 @@ const input_port_config *input_port_by_index(const input_port_config *portlist,
const char *input_field_name(const input_field_config *field) const char *input_field_name(const input_field_config *field)
{ {
/* if we have a non-default name, use that */ /* if we have a non-default name, use that */
if ((field->state != NULL) && (field->state->name != NULL))
return field->state->name;
if (field->name != NULL) if (field->name != NULL)
return field->name; return field->name;
@ -1585,6 +1588,19 @@ static void init_port_state(running_machine *machine)
*changedinfotail = init_field_callback_info(field); *changedinfotail = init_field_callback_info(field);
changedinfotail = &(*changedinfotail)->next; changedinfotail = &(*changedinfotail)->next;
} }
#ifdef MESS
/* MESS-specific code to name keyboard key names */
if ((field->type == IPT_KEYBOARD) && (field->name == NULL))
{
astring *name = mess_get_keyboard_key_name(field);
if (name != NULL)
{
field->state->name = auto_strdup(astring_c(name));
astring_free(name);
}
}
#endif /* MESS */
} }
} }