summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-08-31 17:14:48 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-08-31 17:19:16 -0400
commit4ccfe06061b0bf98f25e0a34157e2b7f1bd72c3c (patch)
tree060d5294d6418c335fa1d63ba26265f6e3d88806 /src/frontend/mame
parent0bb9a735059a6438cde8db00b676860f45d15bae (diff)
Distinguish DIP switches that belong to different devices but have the same name in UI menu. This is most likely to occur when multiple instances of the same device type are configured on bus slots.
Diffstat (limited to 'src/frontend/mame')
-rw-r--r--src/frontend/mame/ui/inputmap.cpp5
-rw-r--r--src/frontend/mame/ui/inputmap.h5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index a2bbf3b7a21..eb90215520e 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -592,7 +592,7 @@ void menu_settings::populate(float &customtop, float &custombottom)
/* find the matching switch name */
for (dip = diplist; dip != nullptr; dip = dip->next)
- if (strcmp(dip->name, diploc.name()) == 0)
+ if (dip->owner == &field.device() && strcmp(dip->name, diploc.name()) == 0)
break;
/* allocate new if none */
@@ -601,6 +601,7 @@ void menu_settings::populate(float &customtop, float &custombottom)
dip = (dip_descriptor *)m_pool_alloc(sizeof(*dip));
dip->next = nullptr;
dip->name = diploc.name();
+ dip->owner = &field.device();
dip->mask = dip->state = 0;
*diplist_tailptr = dip;
diplist_tailptr = &dip->next;
@@ -659,7 +660,7 @@ void menu_settings_dip_switches::custom_render(void *selectedref, float top, flo
if (field != nullptr && !field->diplocations().empty())
for (const ioport_diplocation &diploc : field->diplocations())
- if (strcmp(dip->name, diploc.name()) == 0)
+ if (dip->owner == &field->device() && strcmp(dip->name, diploc.name()) == 0)
selectedmask |= 1 << (diploc.number() - 1);
}
diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h
index eaa0eaa76f1..a37a297a2f8 100644
--- a/src/frontend/mame/ui/inputmap.h
+++ b/src/frontend/mame/ui/inputmap.h
@@ -110,8 +110,9 @@ protected:
{
dip_descriptor * next;
const char * name;
- uint32_t mask;
- uint32_t state;
+ device_t * owner;
+ uint32_t mask;
+ uint32_t state;
};
dip_descriptor * diplist;