removed support for PORT_CATEGORY from the core, since PORT_CONDITION is enough to deal with removable controllers in MESS [Fabio Priuli]

out of whatsnew: 
- this requires a clean compile
- a bit of history: PORT_CATEGORY is an old concept introduced in MESS when there were no PORT_CONDITIONs available in the core; it basically made specific controller inputs to appear/disappear in the "Input this system" menu depending on the controller chosen to be used. As Aaron pointed out some time ago, PORT_CONDITION was already capable to give the same result, but we kept the code in MESS because newui did not fully support PORT_CONDITION. Now that newui is gone from the main MESS tree, PORT_CATEGORY has been fully replaced by PORT_CONDITION and the 'duplicate' code can finally be removed.
This commit is contained in:
Fabio Priuli 2011-08-17 06:08:33 +00:00
parent c5d355cf29
commit b081e27161
5 changed files with 2 additions and 118 deletions

View File

@ -58,7 +58,7 @@ const char info_xml_creator::s_dtd_string[] =
"\t<!ATTLIST " XML_ROOT " build CDATA #IMPLIED>\n"
"\t<!ATTLIST " XML_ROOT " debug (yes|no) \"no\">\n"
"\t<!ATTLIST " XML_ROOT " mameconfig CDATA #REQUIRED>\n"
"\t<!ELEMENT " XML_TOP " (description, year?, manufacturer?, biosset*, rom*, disk*, device_ref*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, category*, adjuster*, driver?, device*, slot*, softwarelist*, ramoption*)>\n"
"\t<!ELEMENT " XML_TOP " (description, year?, manufacturer?, biosset*, rom*, disk*, device_ref*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, adjuster*, driver?, device*, slot*, softwarelist*, ramoption*)>\n"
"\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n"
"\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n"
"\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n"
@ -149,11 +149,6 @@ const char info_xml_creator::s_dtd_string[] =
"\t\t\t\t<!ATTLIST confsetting name CDATA #REQUIRED>\n"
"\t\t\t\t<!ATTLIST confsetting value CDATA #REQUIRED>\n"
"\t\t\t\t<!ATTLIST confsetting default (yes|no) \"no\">\n"
"\t\t<!ELEMENT category (item*)>\n"
"\t\t\t<!ATTLIST category name CDATA #REQUIRED>\n"
"\t\t\t<!ELEMENT item EMPTY>\n"
"\t\t\t\t<!ATTLIST item name CDATA #REQUIRED>\n"
"\t\t\t\t<!ATTLIST item default (yes|no) \"no\">\n"
"\t\t<!ELEMENT adjuster EMPTY>\n"
"\t\t\t<!ATTLIST adjuster name CDATA #REQUIRED>\n"
"\t\t\t<!ATTLIST adjuster default CDATA #REQUIRED>\n"
@ -361,7 +356,6 @@ void info_xml_creator::output_one()
output_input(portlist);
output_switches(portlist, IPT_DIPSWITCH, "dipswitch", "dipvalue");
output_switches(portlist, IPT_CONFIG, "configuration", "confsetting");
output_categories(portlist);
output_adjusters(portlist);
output_driver();
output_images();
@ -1071,36 +1065,6 @@ void info_xml_creator::output_driver()
}
//-------------------------------------------------
// output_categories - print the Categories
// settings for a system
//-------------------------------------------------
void info_xml_creator::output_categories(const ioport_list &portlist)
{
// iterate looking for Categories
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
if (field->type == IPT_CATEGORY)
{
// output the category name information
fprintf(m_output, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
// loop over item settings
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
{
fprintf(m_output, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
if (setting->value == field->defvalue)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
}
// terminate the category entry
fprintf(m_output, "\t\t</category>\n");
}
}
//-------------------------------------------------
// output_images - prints m_output all info on
// image devices

View File

@ -669,5 +669,4 @@ void construct_core_types(simple_list<input_type_entry> &typelist)
INPUT_PORT_DIGITAL_TYPE( 0, INVALID, ADJUSTER, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, INVALID, DIPSWITCH, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, INVALID, CONFIG, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, INVALID, CATEGORY, NULL, input_seq() )
}

View File

@ -2859,7 +2859,6 @@ input_field_config::input_field_config(input_port_config &port, int _type, input
defvalue(_defvalue & _maskbits),
type(_type),
player(0),
category(0),
flags(0),
impulse(0),
name(_name),
@ -2895,7 +2894,6 @@ input_field_config::input_field_config(input_port_config &port, int _type, input
input_setting_config::input_setting_config(input_field_config &field, input_port_value _value, const char *_name)
: value(_value),
name(_name),
category(0),
m_field(field),
m_next(NULL)
{
@ -4574,9 +4572,6 @@ int input_classify_port(const input_field_config *field)
{
int result;
if (field->category && (field->type != IPT_CATEGORY))
return INPUT_CLASS_CATEGORIZED;
switch(field->type)
{
case IPT_JOYSTICK_UP:
@ -4702,45 +4697,6 @@ int input_count_players(running_machine &machine)
/*-------------------------------------------------
input_category_active - checks to see if a
specific category is active
-------------------------------------------------*/
int input_category_active(running_machine &machine, int category)
{
const input_port_config *port;
const input_field_config *field = NULL;
const input_setting_config *setting;
input_field_user_settings settings;
assert(category >= 1);
/* loop through the input ports */
for (port = machine.m_portlist.first(); port != NULL; port = port->next())
{
for (field = port->first_field(); field != NULL; field = field->next())
{
/* is this field a category? */
if (field->type == IPT_CATEGORY)
{
/* get the settings value */
input_field_get_user_settings(field, &settings);
for (setting = field->settinglist().first(); setting != NULL; setting = setting->next())
{
/* is this the category we want? if so, is this settings value correct? */
if ((setting->category == category) && (settings.value == setting->value))
return TRUE;
}
}
}
}
return FALSE;
}
/***************************************************************************
DEBUGGER SUPPORT
***************************************************************************/
@ -4856,7 +4812,7 @@ input_field_config *ioconfig_alloc_field(input_port_config &port, int type, inpu
throw emu_fatalerror("INPUT_TOKEN_FIELD encountered with no active port (mask=%X defval=%X)\n", mask, defval); \
if (type != IPT_UNKNOWN && type != IPT_UNUSED)
port.active |= mask;
if (type == IPT_DIPSWITCH || type == IPT_CONFIG || type == IPT_CATEGORY)
if (type == IPT_DIPSWITCH || type == IPT_CONFIG)
defval = port_default_value(port.tag(), mask, defval, port.owner());
return &port.fieldlist().append(*global_alloc(input_field_config(port, type, defval, mask, input_port_string_from_token(name))));
}

View File

@ -113,7 +113,6 @@ enum
IPT_DIPSWITCH,
IPT_VBLANK,
IPT_CONFIG,
IPT_CATEGORY, /* MESS only */
/* start buttons */
IPT_START1,
@ -504,7 +503,6 @@ enum
INPUT_CLASS_CONTROLLER,
INPUT_CLASS_CONFIG,
INPUT_CLASS_DIPSWITCH,
INPUT_CLASS_CATEGORIZED,
INPUT_CLASS_MISC
};
@ -573,7 +571,6 @@ public:
input_port_value value; /* value of the bits in this setting */
input_condition condition; /* condition under which this setting is valid */
const char * name; /* user-friendly name to display */
UINT16 category; /* (MESS-specific) category */
private:
input_field_config & m_field; /* pointer back to the field that owns us */
@ -623,7 +620,6 @@ public:
input_condition condition; /* condition under which this field is relevant */
UINT32 type; /* IPT_* type for this port */
UINT8 player; /* player number (0-based) */
UINT16 category; /* (MESS-specific) category */
UINT32 flags; /* combination of FIELD_FLAG_* and ANALOG_FLAG_* above */
UINT8 impulse; /* number of frames before reverting to defvalue */
const char * name; /* user-friendly name to display */
@ -1060,18 +1056,6 @@ void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &er
#define PORT_CHAR(_ch) \
ioconfig_field_add_char(*curfield, _ch, errorbuf);
/* categories */
#define PORT_CATEGORY(_category) \
curfield->category = (_category);
#define PORT_CATEGORY_CLASS(_mask, _default, _name) \
curfield = ioconfig_alloc_field(*curport, IPT_CATEGORY, (_default), (_mask), (_name)); \
cursetting = NULL;
#define PORT_CATEGORY_ITEM(_default, _name, _category) \
cursetting = ioconfig_alloc_setting(*curfield, (_default) & curfield->mask, (_name)); \
cursetting->category = (_category);
/* name of table */
#define DEVICE_INPUT_DEFAULTS_NAME(_name) device_iptdef_##_name
@ -1279,7 +1263,6 @@ int input_classify_port(const input_field_config *field);
int input_has_input_class(running_machine &machine, int inputclass);
int input_player_number(const input_field_config *field);
int input_count_players(running_machine &machine);
int input_category_active(running_machine &machine, int category);
inline running_machine &input_field_config::machine() const

View File

@ -286,7 +286,6 @@ static int CLIB_DECL menu_input_compare_items(const void *i1, const void *i2);
static void menu_input_populate_and_sort(running_machine &machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
static void menu_settings_dip_switches(running_machine &machine, ui_menu *menu, void *parameter, void *state);
static void menu_settings_driver_config(running_machine &machine, ui_menu *menu, void *parameter, void *state);
static void menu_settings_categories(running_machine &machine, ui_menu *menu, void *parameter, void *state);
static void menu_settings_common(running_machine &machine, ui_menu *menu, void *state, UINT32 type);
static void menu_settings_populate(running_machine &machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type);
static void menu_analog(running_machine &machine, ui_menu *menu, void *parameter, void *state);
@ -1636,7 +1635,6 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
{
input_field_config *field;
input_port_config *port;
int has_categories = FALSE;
int has_configs = FALSE;
int has_analog = FALSE;
int has_dips = FALSE;
@ -1649,8 +1647,6 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
has_dips = TRUE;
if (field->type == IPT_CONFIG)
has_configs = TRUE;
if (field->category > 0)
has_categories = TRUE;
if (input_type_is_analog(field->type))
has_analog = TRUE;
}
@ -1664,8 +1660,6 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
ui_menu_item_append(menu, "Dip Switches", NULL, 0, (void *)menu_settings_dip_switches);
if (has_configs)
ui_menu_item_append(menu, "Driver Configuration", NULL, 0, (void *)menu_settings_driver_config);
if (has_categories)
ui_menu_item_append(menu, "Categories", NULL, 0, (void *)menu_settings_categories);
if (has_analog)
ui_menu_item_append(menu, "Analog Controls", NULL, 0, (void *)menu_analog);
@ -1870,7 +1864,6 @@ static void menu_input_specific_populate(running_machine &machine, ui_menu *menu
/* add if we match the group and we have a valid name */
if (name != NULL && input_condition_true(machine, &field->condition, port->owner()) &&
(field->category == 0 || input_category_active(machine, field->category)) &&
((field->type == IPT_OTHER && field->name != NULL) || input_type_group(machine, field->type, field->player) != IPG_INVALID))
{
input_seq_type seqtype;
@ -2128,17 +2121,6 @@ static void menu_settings_driver_config(running_machine &machine, ui_menu *menu,
}
/*-------------------------------------------------
menu_settings_categories - handle the
categories menu
-------------------------------------------------*/
static void menu_settings_categories(running_machine &machine, ui_menu *menu, void *parameter, void *state)
{
menu_settings_common(machine, menu, state, IPT_CATEGORY);
}
/*-------------------------------------------------
menu_settings_common - handle one of the
switches menus