summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-21 16:07:04 +1100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-21 16:07:04 +1100
commiteaf07fffa33296500c4a6d35bf64a9098ca35fc0 (patch)
treef4d699a1de44c4a01d23120512f17debd6afd975 /src/frontend
parent0ec88f2ff75fcc65191c0c89ad47f635ebb8c51a (diff)
UI input menu: treat codes containing a postive and negative of the same thing as invalid (e.g. A S not A)
ioport.cpp: * better than 50% reduction in compile time, and better locality for static data * better encapsulation, const correctness and noexcept usage
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/ui/inputmap.cpp7
-rw-r--r--src/frontend/mame/ui/inputmap.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index 8e116a2d38f..33cbd9223e0 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -75,7 +75,7 @@ void menu_input_general::populate(float &customtop, float &custombottom)
assert(!pollingitem);
// iterate over the input ports and add menu items
- for (input_type_entry &entry : machine().ioport().types())
+ for (const input_type_entry &entry : machine().ioport().types())
{
// add if we match the group and we have a valid name
if ((entry.group() == group) && entry.name() && entry.name()[0])
@@ -226,9 +226,10 @@ void menu_input_specific::update_input(input_item_data &seqchangeditem)
{
ioport_field::user_settings settings;
- reinterpret_cast<ioport_field *>(seqchangeditem.ref)->get_user_settings(settings);
+ // yeah, the const_cast is naughty, but we know we stored a non-const reference in it
+ reinterpret_cast<const ioport_field *>(seqchangeditem.ref)->get_user_settings(settings);
settings.seq[seqchangeditem.seqtype] = seqchangeditem.seq;
- reinterpret_cast<ioport_field *>(seqchangeditem.ref)->set_user_settings(settings);
+ reinterpret_cast<ioport_field *>(const_cast<void *>(seqchangeditem.ref))->set_user_settings(settings);
}
diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h
index 736ddf78566..d2e41780211 100644
--- a/src/frontend/mame/ui/inputmap.h
+++ b/src/frontend/mame/ui/inputmap.h
@@ -50,7 +50,7 @@ protected:
// internal input menu item data
struct input_item_data
{
- void * ref = nullptr; // reference to type description for global inputs or field for game inputs
+ const void * ref = nullptr; // reference to type description for global inputs or field for game inputs
input_seq_type seqtype = SEQ_TYPE_INVALID; // sequence type
input_seq seq; // copy of the live sequence
const input_seq * defseq = nullptr; // pointer to the default sequence