From b081e2716125bc2729e45257d6eb55cb7d3c56e7 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Wed, 17 Aug 2011 06:08:33 +0000 Subject: [PATCH] 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. --- src/emu/info.c | 38 +------------------------------------- src/emu/inpttype.h | 1 - src/emu/ioport.c | 46 +--------------------------------------------- src/emu/ioport.h | 17 ----------------- src/emu/uimenu.c | 18 ------------------ 5 files changed, 2 insertions(+), 118 deletions(-) diff --git a/src/emu/info.c b/src/emu/info.c index 1567356f125..12e0b73f499 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -58,7 +58,7 @@ const char info_xml_creator::s_dtd_string[] = "\t\n" "\t\n" "\t\n" -"\t\n" +"\t\n" "\t\t\n" "\t\t\n" "\t\t\n" @@ -149,11 +149,6 @@ const char info_xml_creator::s_dtd_string[] = "\t\t\t\t\n" "\t\t\t\t\n" "\t\t\t\t\n" -"\t\t\n" -"\t\t\t\n" -"\t\t\t\n" -"\t\t\t\t\n" -"\t\t\t\t\n" "\t\t\n" "\t\t\t\n" "\t\t\t\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\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\tname)); - if (setting->value == field->defvalue) - fprintf(m_output, " default=\"yes\""); - fprintf(m_output, "/>\n"); - } - - // terminate the category entry - fprintf(m_output, "\t\t\n"); - } -} - - //------------------------------------------------- // output_images - prints m_output all info on // image devices diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 4e027dce5b8..a4f9c8cc514 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -669,5 +669,4 @@ void construct_core_types(simple_list &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() ) } diff --git a/src/emu/ioport.c b/src/emu/ioport.c index 55f897b07c9..eeaad51ec67 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -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)))); } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 8856ee4be95..58b449f55c1 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -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 diff --git a/src/emu/uimenu.c b/src/emu/uimenu.c index 1f0f3eccc67..bbc4bd1be99 100644 --- a/src/emu/uimenu.c +++ b/src/emu/uimenu.c @@ -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