summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2025-09-22 03:16:40 +1000
committer Vas Crabb <vas@vastheman.com>2025-09-22 03:16:40 +1000
commit20a61a456e9ee3c562622fb309cc28616bfb299c (patch)
tree2c224af121872685cb007d3ef5d221cb63054b20 /src/frontend
parent453c1be78856bb101994893d6f48fd445bc4e3fd (diff)
emu/ioport.cpp: Removed the "optional" field flag.
There are multiple issues with this flag: * It's poorly defined. Is it an input that's software-accessible but not used? Is it an input that shows in test modes but doesn't do anything useful? Is it an input that the system can be configured to not use? Is it an input that is useful but not strictly necessary? * In almost a decade, it hasn’t been used widely. It was used in less than ten places. There hasn't been substantial interest in actually applying it across the codebase. * It would be an absolute nightmare to try and apply to mahjong and hanafuda games. Consider all the cases where a game may use some but not all of the double-up game controls, and some games support multiple control schemes that use different subsets of the standard mahjong matrix. * Trying to apply it to gambling systems would also be a minefield. * If we were to expect it to be applied, it would cause an eplosion in input port definitions for platforms with multiple games, adding further maintenance burden. It would greatly reduce the value of having things like the standard mahjong panel definitions as you'd rarely actually be able to use them as-is.
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/infoxml.cpp25
-rw-r--r--src/frontend/mame/luaengine_input.cpp1
-rw-r--r--src/frontend/mame/ui/inputmap.cpp4
-rw-r--r--src/frontend/mame/ui/inputmap.h1
4 files changed, 1 insertions, 30 deletions
diff --git a/src/frontend/mame/infoxml.cpp b/src/frontend/mame/infoxml.cpp
index 46978109432..750808403a5 100644
--- a/src/frontend/mame/infoxml.cpp
+++ b/src/frontend/mame/infoxml.cpp
@@ -246,7 +246,6 @@ constexpr char f_dtd_string[] =
"\t\t\t\t<!ATTLIST control type CDATA #REQUIRED>\n"
"\t\t\t\t<!ATTLIST control player CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control buttons CDATA #IMPLIED>\n"
- "\t\t\t\t<!ATTLIST control reqbuttons CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control minimum CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control maximum CDATA #IMPLIED>\n"
"\t\t\t\t<!ATTLIST control sensitivity CDATA #IMPLIED>\n"
@@ -1464,7 +1463,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
const char * type; // general type of input
int player; // player which the input belongs to
int nbuttons; // total number of buttons
- int reqbuttons; // total number of non-optional buttons
uint32_t maxbuttons; // max index of buttons (using IPT_BUTTONn) [probably to be removed soonish]
int ways; // directions for joystick
bool analog; // is analog input?
@@ -1687,8 +1685,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
}
control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons = std::max(control_info[field.player() * CTRL_COUNT + ctrl_type].maxbuttons, field.type() - IPT_BUTTON1 + 1);
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
break;
// track maximum coin index
@@ -1713,8 +1709,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "keypad";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
break;
case IPT_KEYBOARD:
@@ -1722,8 +1716,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "keyboard";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
break;
// additional types
@@ -1742,8 +1734,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "mahjong";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
}
else if (field.type() > IPT_HANAFUDA_FIRST && field.type() < IPT_HANAFUDA_LAST)
{
@@ -1751,8 +1741,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "hanafuda";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
}
else if (field.type() > IPT_GAMBLING_FIRST && field.type() < IPT_GAMBLING_LAST)
{
@@ -1760,8 +1748,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
control_info[field.player() * CTRL_COUNT + ctrl_type].type = "gambling";
control_info[field.player() * CTRL_COUNT + ctrl_type].player = field.player() + 1;
control_info[field.player() * CTRL_COUNT + ctrl_type].nbuttons++;
- if (!field.optional())
- control_info[field.player() * CTRL_COUNT + ctrl_type].reqbuttons++;
}
break;
}
@@ -1786,7 +1772,7 @@ void output_input(std::ostream &out, const ioport_list &portlist)
// Clean-up those entries, if any, where buttons were defined in a separate port than the actual controller they belong to.
// This is quite often the case, especially for arcades where controls can be easily mapped to separate input ports on PCB.
// If such situation would only happen for joystick, it would be possible to work it around by initializing differently
- // ctrl_type above, but it is quite common among analog inputs as well (for instance, this is the tipical situation
+ // ctrl_type above, but it is quite common among analog inputs as well (for instance, this is the typical situation
// for lightguns) and therefore we really need this separate loop.
for (int i = 0; i < CTRL_PCOUNT; i++)
{
@@ -1795,7 +1781,6 @@ void output_input(std::ostream &out, const ioport_list &portlist)
if (control_info[i * CTRL_COUNT].type != nullptr && control_info[i * CTRL_COUNT + j].type != nullptr && !fix_done)
{
control_info[i * CTRL_COUNT + j].nbuttons += control_info[i * CTRL_COUNT].nbuttons;
- control_info[i * CTRL_COUNT + j].reqbuttons += control_info[i * CTRL_COUNT].reqbuttons;
control_info[i * CTRL_COUNT + j].maxbuttons = std::max(control_info[i * CTRL_COUNT + j].maxbuttons, control_info[i * CTRL_COUNT].maxbuttons);
memset(&control_info[i * CTRL_COUNT], 0, sizeof(control_info[0]));
@@ -1828,11 +1813,7 @@ void output_input(std::ostream &out, const ioport_list &portlist)
if (nplayer > 1)
util::stream_format(out, " player=\"%d\"", elem.player);
if (elem.nbuttons > 0)
- {
util::stream_format(out, " buttons=\"%u\"", strcmp(elem.type, "stick") ? elem.nbuttons : elem.maxbuttons);
- if (elem.reqbuttons < elem.nbuttons)
- util::stream_format(out, " reqbuttons=\"%d\"", elem.reqbuttons);
- }
if (elem.min != 0 || elem.max != 0)
util::stream_format(out, " minimum=\"%d\" maximum=\"%d\"", elem.min, elem.max);
if (elem.sensitivity != 0)
@@ -1854,11 +1835,7 @@ void output_input(std::ostream &out, const ioport_list &portlist)
if (nplayer > 1)
util::stream_format(out, " player=\"%d\"", elem.player);
if (elem.nbuttons > 0)
- {
util::stream_format(out, " buttons=\"%u\"", strcmp(elem.type, "joy") ? elem.nbuttons : elem.maxbuttons);
- if (elem.reqbuttons < elem.nbuttons)
- util::stream_format(out, " reqbuttons=\"%d\"", elem.reqbuttons);
- }
for (int lp = 0; lp < 3 && elem.helper[lp] != 0; lp++)
{
const char *plural = (lp==2) ? "3" : (lp==1) ? "2" : "";
diff --git a/src/frontend/mame/luaengine_input.cpp b/src/frontend/mame/luaengine_input.cpp
index 914431f82b2..a8e509936bb 100644
--- a/src/frontend/mame/luaengine_input.cpp
+++ b/src/frontend/mame/luaengine_input.cpp
@@ -355,7 +355,6 @@ void lua_engine::initialize_input(sol::table &emu)
ioport_field_type["is_analog"] = sol::property(&ioport_field::is_analog);
ioport_field_type["is_digital_joystick"] = sol::property(&ioport_field::is_digital_joystick);
ioport_field_type["enabled"] = sol::property(&ioport_field::enabled);
- ioport_field_type["optional"] = sol::property(&ioport_field::optional);
ioport_field_type["cocktail"] = sol::property(&ioport_field::cocktail);
ioport_field_type["toggle"] = sol::property(&ioport_field::toggle);
ioport_field_type["rotated"] = sol::property(&ioport_field::rotated);
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index b135780a08f..b2127f97b3e 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -109,7 +109,6 @@ void menu_input_general::populate()
item.defseq = &entry.defseq(seqtype);
item.group = entry.group();
item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
- item.is_optional = false;
item.name = name;
item.owner = nullptr;
@@ -192,7 +191,6 @@ void menu_input_specific::populate()
item.defseq = &field.defseq(seqtype);
item.group = machine().ioport().type_group(field.type(), field.player());
item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
- item.is_optional = field.optional();
item.name = field.name();
item.owner = &field.device();
@@ -594,8 +592,6 @@ void menu_input::populate_sorted()
}
text = string_format(nameformat[item.type], item.name);
- if (item.is_optional)
- text = "(" + text + ")";
uint32_t flags = 0;
if (&item == pollingitem)
diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h
index e27e58e67fc..ba9c6ffd24a 100644
--- a/src/frontend/mame/ui/inputmap.h
+++ b/src/frontend/mame/ui/inputmap.h
@@ -58,7 +58,6 @@ protected:
const device_t * owner = nullptr; // pointer to the owner of the item
ioport_group group = IPG_INVALID; // group type
uint8_t type = 0U; // type of port
- bool is_optional = false; // true if this input is considered optional
};
using data_vector = std::vector<input_item_data>;