summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-04-03 18:12:23 -0400
committer Vas Crabb <cuavas@users.noreply.github.com>2017-04-04 11:33:34 +1000
commitac1cea0dcff8715a8a8abf2c9e6f84a31b0d15d2 (patch)
tree860acf4145d163c1b524c93441f212cc4907f5bb /src/frontend
parent58aa97913fa966b03d3b5bed77c6670e49821f1e (diff)
Fixed a bug that caused "Switch Item Ordering" in the software list menu to dupe entries
This was MT#6402
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/ui/swlist.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/frontend/mame/ui/swlist.cpp b/src/frontend/mame/ui/swlist.cpp
index 04c4feadad1..746c9bd80ce 100644
--- a/src/frontend/mame/ui/swlist.cpp
+++ b/src/frontend/mame/ui/swlist.cpp
@@ -22,9 +22,12 @@ namespace ui {
CONSTANTS
***************************************************************************/
-/* time (in seconds) to display errors */
+// time (in seconds) to display errors
#define ERROR_MESSAGE_TIME 5
+// item reference for "Switch Item Ordering"
+#define ITEMREF_SWITCH_ITEM_ORDERING ((void *)1)
+
/***************************************************************************
SOFTWARE PARTS
@@ -214,12 +217,15 @@ void menu_software_list::append_software_entry(const software_info &swinfo)
void menu_software_list::populate(float &customtop, float &custombottom)
{
+ // clear all entries before populating
+ m_entrylist.clear();
+
// build up the list of entries for the menu
for (const software_info &swinfo : m_swlist->get_info())
append_software_entry(swinfo);
// add an entry to change ordering
- item_append(_("Switch Item Ordering"), "", 0, (void *)1);
+ item_append(_("Switch Item Ordering"), "", 0, ITEMREF_SWITCH_ITEM_ORDERING);
// append all of the menu entries
for (auto &entry : m_entrylist)
@@ -241,7 +247,7 @@ void menu_software_list::handle()
if (event && event->itemref)
{
- if ((uintptr_t)event->itemref == 1 && event->iptkey == IPT_UI_SELECT)
+ if (event->itemref == ITEMREF_SWITCH_ITEM_ORDERING && event->iptkey == IPT_UI_SELECT)
{
m_ordered_by_shortname = !m_ordered_by_shortname;