summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-12-21 02:40:37 +1100
committer Vas Crabb <vas@vastheman.com>2022-12-21 02:40:37 +1100
commitbd561abff012dc4b6e638c407d0ec279d7e23538 (patch)
tree1fbfcca29c71b419b8310b76cafe0dd4c1a8382d /src/frontend/mame/ui
parent42cfed35b6fa785d383183f7cafc001786010891 (diff)
ui: Rationalised right panel behaviour:
Removed the "default" state for the image tab where it would show different things for different types of machine - it just confused users. Remember the selected tab and image in the right panel. State for system selection menu is remembered across sessions. Last used state for software selection menus is remembered across sessions. Within a session, state is remembered separately for recently selected machines, similarly to the way filter selection is remembered. Fixed some focus order issues in the software selection menu.
Diffstat (limited to 'src/frontend/mame/ui')
-rw-r--r--src/frontend/mame/ui/moptions.cpp120
-rw-r--r--src/frontend/mame/ui/moptions.h56
-rw-r--r--src/frontend/mame/ui/selgame.cpp93
-rw-r--r--src/frontend/mame/ui/selgame.h1
-rw-r--r--src/frontend/mame/ui/selmenu.cpp188
-rw-r--r--src/frontend/mame/ui/selmenu.h15
-rw-r--r--src/frontend/mame/ui/selsoft.cpp51
-rw-r--r--src/frontend/mame/ui/selsoft.h3
-rw-r--r--src/frontend/mame/ui/utils.cpp1
-rw-r--r--src/frontend/mame/ui/utils.h2
10 files changed, 334 insertions, 196 deletions
diff --git a/src/frontend/mame/ui/moptions.cpp b/src/frontend/mame/ui/moptions.cpp
index cf019588834..d6eba821947 100644
--- a/src/frontend/mame/ui/moptions.cpp
+++ b/src/frontend/mame/ui/moptions.cpp
@@ -20,66 +20,74 @@
const options_entry ui_options::s_option_entries[] =
{
// search path options
- { nullptr, nullptr, core_options::option_type::HEADER, "UI SEARCH PATH OPTIONS" },
- { OPTION_HISTORY_PATH, "history;dats;.", core_options::option_type::MULTIPATH, "path to system/software info files" },
- { OPTION_CATEGORYINI_PATH, "folders", core_options::option_type::MULTIPATH, "path to category ini files" },
- { OPTION_CABINETS_PATH, "cabinets;cabdevs", core_options::option_type::MULTIPATH, "path to cabinets / devices image" },
- { OPTION_CPANELS_PATH, "cpanel", core_options::option_type::MULTIPATH, "path to control panel image" },
- { OPTION_PCBS_PATH, "pcb", core_options::option_type::MULTIPATH, "path to pcbs image" },
- { OPTION_FLYERS_PATH, "flyers", core_options::option_type::MULTIPATH, "path to flyers image" },
- { OPTION_TITLES_PATH, "titles", core_options::option_type::MULTIPATH, "path to titles image" },
- { OPTION_ENDS_PATH, "ends", core_options::option_type::MULTIPATH, "path to ends image" },
- { OPTION_MARQUEES_PATH, "marquees", core_options::option_type::MULTIPATH, "path to marquees image" },
- { OPTION_ARTPREV_PATH, "artwork preview;artpreview", core_options::option_type::MULTIPATH, "path to artwork preview image" },
- { OPTION_BOSSES_PATH, "bosses", core_options::option_type::MULTIPATH, "path to bosses image" },
- { OPTION_LOGOS_PATH, "logo", core_options::option_type::MULTIPATH, "path to logos image" },
- { OPTION_SCORES_PATH, "scores", core_options::option_type::MULTIPATH, "path to scores image" },
- { OPTION_VERSUS_PATH, "versus", core_options::option_type::MULTIPATH, "path to versus image" },
- { OPTION_GAMEOVER_PATH, "gameover", core_options::option_type::MULTIPATH, "path to gameover image" },
- { OPTION_HOWTO_PATH, "howto", core_options::option_type::MULTIPATH, "path to howto image" },
- { OPTION_SELECT_PATH, "select", core_options::option_type::MULTIPATH, "path to select image" },
- { OPTION_ICONS_PATH, "icons", core_options::option_type::MULTIPATH, "path to ICOns image" },
- { OPTION_COVER_PATH, "covers", core_options::option_type::MULTIPATH, "path to software cover image" },
- { OPTION_UI_PATH, "ui", core_options::option_type::MULTIPATH, "path to UI files" },
+ { nullptr, nullptr, option_type::HEADER, "UI SEARCH PATH OPTIONS" },
+ { OPTION_HISTORY_PATH, "history;dats;.", option_type::MULTIPATH, "path to system/software info files" },
+ { OPTION_CATEGORYINI_PATH, "folders", option_type::MULTIPATH, "path to category ini files" },
+ { OPTION_CABINETS_PATH, "cabinets;cabdevs", option_type::MULTIPATH, "path to cabinets / devices image" },
+ { OPTION_CPANELS_PATH, "cpanel", option_type::MULTIPATH, "path to control panel image" },
+ { OPTION_PCBS_PATH, "pcb", option_type::MULTIPATH, "path to pcbs image" },
+ { OPTION_FLYERS_PATH, "flyers", option_type::MULTIPATH, "path to flyers image" },
+ { OPTION_TITLES_PATH, "titles", option_type::MULTIPATH, "path to titles image" },
+ { OPTION_ENDS_PATH, "ends", option_type::MULTIPATH, "path to ends image" },
+ { OPTION_MARQUEES_PATH, "marquees", option_type::MULTIPATH, "path to marquees image" },
+ { OPTION_ARTPREV_PATH, "artwork preview;artpreview", option_type::MULTIPATH, "path to artwork preview image" },
+ { OPTION_BOSSES_PATH, "bosses", option_type::MULTIPATH, "path to bosses image" },
+ { OPTION_LOGOS_PATH, "logo", option_type::MULTIPATH, "path to logos image" },
+ { OPTION_SCORES_PATH, "scores", option_type::MULTIPATH, "path to scores image" },
+ { OPTION_VERSUS_PATH, "versus", option_type::MULTIPATH, "path to versus image" },
+ { OPTION_GAMEOVER_PATH, "gameover", option_type::MULTIPATH, "path to gameover image" },
+ { OPTION_HOWTO_PATH, "howto", option_type::MULTIPATH, "path to howto image" },
+ { OPTION_SELECT_PATH, "select", option_type::MULTIPATH, "path to select image" },
+ { OPTION_ICONS_PATH, "icons", option_type::MULTIPATH, "path to ICOns image" },
+ { OPTION_COVER_PATH, "covers", option_type::MULTIPATH, "path to software cover image" },
+ { OPTION_UI_PATH, "ui", option_type::MULTIPATH, "path to UI files" },
// misc options
- { nullptr, nullptr, core_options::option_type::HEADER, "UI MISC OPTIONS" },
- { OPTION_SYSTEM_NAMES, "", core_options::option_type::MULTIPATH, "translated system names file" },
- { OPTION_SKIP_WARNINGS, "0", core_options::option_type::BOOLEAN, "display fewer repeated warnings about imperfect emulation" },
- { OPTION_REMEMBER_LAST, "1", core_options::option_type::BOOLEAN, "initially select last used system in main menu" },
- { OPTION_ENLARGE_SNAPS, "1", core_options::option_type::BOOLEAN, "enlarge artwork (snapshot, title, etc.) in right panel (keeping aspect ratio)" },
- { OPTION_FORCED4X3, "1", core_options::option_type::BOOLEAN, "force the appearance of the snapshot in the list software to 4:3" },
- { OPTION_USE_BACKGROUND, "1", core_options::option_type::BOOLEAN, "enable background image in main view" },
- { OPTION_SKIP_BIOS_MENU, "0", core_options::option_type::BOOLEAN, "skip bios submenu, start with configured or default" },
- { OPTION_SKIP_PARTS_MENU, "0", core_options::option_type::BOOLEAN, "skip parts submenu, start with first part" },
- { OPTION_LAST_USED_FILTER, "", core_options::option_type::STRING, "latest used filter" },
- { OPTION_LAST_RIGHT_PANEL "(0-1)", "0", core_options::option_type::INTEGER, "latest right panel focus" },
- { OPTION_LAST_USED_MACHINE, "", core_options::option_type::STRING, "latest used machine" },
- { OPTION_INFO_AUTO_AUDIT, "0", core_options::option_type::BOOLEAN, "enable auto audit in the general info panel" },
- { OPTION_HIDE_ROMLESS, "1", core_options::option_type::BOOLEAN, "hide romless machine from available list" },
- { OPTION_UNTHROTTLE_MUTE ";utm", "0", core_options::option_type::BOOLEAN, "mute audio when running unthrottled" },
+ { nullptr, nullptr, option_type::HEADER, "UI MISC OPTIONS" },
+ { OPTION_SYSTEM_NAMES, "", option_type::MULTIPATH, "translated system names file" },
+ { OPTION_SKIP_WARNINGS, "0", option_type::BOOLEAN, "display fewer repeated warnings about imperfect emulation" },
+ { OPTION_UNTHROTTLE_MUTE ";utm", "0", option_type::BOOLEAN, "mute audio when running unthrottled" },
// UI options
- { nullptr, nullptr, core_options::option_type::HEADER, "UI OPTIONS" },
- { OPTION_INFOS_SIZE "(0.20-1.00)", "0.75", core_options::option_type::FLOAT, "UI right panel infos text size (0.20 - 1.00)" },
- { OPTION_FONT_ROWS "(25-40)", "30", core_options::option_type::INTEGER, "UI font lines per screen (25 - 40)" },
- { OPTION_HIDE_PANELS "(0-3)", "0", core_options::option_type::INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" },
- { OPTION_UI_BORDER_COLOR, "ffffffff", core_options::option_type::STRING, "UI border color (ARGB)" },
- { OPTION_UI_BACKGROUND_COLOR, "ef101030", core_options::option_type::STRING, "UI background color (ARGB)" },
- { OPTION_UI_CLONE_COLOR, "ff808080", core_options::option_type::STRING, "UI clone color (ARGB)" },
- { OPTION_UI_DIPSW_COLOR, "ffffff00", core_options::option_type::STRING, "UI dipswitch color (ARGB)" },
- { OPTION_UI_GFXVIEWER_BG_COLOR, "ef101030", core_options::option_type::STRING, "UI gfx viewer color (ARGB)" },
- { OPTION_UI_MOUSEDOWN_BG_COLOR, "b0606000", core_options::option_type::STRING, "UI mouse down bg color (ARGB)" },
- { OPTION_UI_MOUSEDOWN_COLOR, "ffffff80", core_options::option_type::STRING, "UI mouse down color (ARGB)" },
- { OPTION_UI_MOUSEOVER_BG_COLOR, "70404000", core_options::option_type::STRING, "UI mouse over bg color (ARGB)" },
- { OPTION_UI_MOUSEOVER_COLOR, "ffffff80", core_options::option_type::STRING, "UI mouse over color (ARGB)" },
- { OPTION_UI_SELECTED_BG_COLOR, "ef808000", core_options::option_type::STRING, "UI selected bg color (ARGB)" },
- { OPTION_UI_SELECTED_COLOR, "ffffff00", core_options::option_type::STRING, "UI selected color (ARGB)" },
- { OPTION_UI_SLIDER_COLOR, "ffffffff", core_options::option_type::STRING, "UI slider color (ARGB)" },
- { OPTION_UI_SUBITEM_COLOR, "ffffffff", core_options::option_type::STRING, "UI subitem color (ARGB)" },
- { OPTION_UI_TEXT_BG_COLOR, "ef000000", core_options::option_type::STRING, "UI text bg color (ARGB)" },
- { OPTION_UI_TEXT_COLOR, "ffffffff", core_options::option_type::STRING, "UI text color (ARGB)" },
- { OPTION_UI_UNAVAILABLE_COLOR, "ff404040", core_options::option_type::STRING, "UI unavailable color (ARGB)" },
+ { nullptr, nullptr, option_type::HEADER, "UI OPTIONS" },
+ { OPTION_INFOS_SIZE "(0.20-1.00)", "0.75", option_type::FLOAT, "UI right panel infos text size (0.20 - 1.00)" },
+ { OPTION_FONT_ROWS "(25-40)", "30", option_type::INTEGER, "UI font lines per screen (25 - 40)" },
+ { OPTION_UI_BORDER_COLOR, "ffffffff", option_type::STRING, "UI border color (ARGB)" },
+ { OPTION_UI_BACKGROUND_COLOR, "ef101030", option_type::STRING, "UI background color (ARGB)" },
+ { OPTION_UI_CLONE_COLOR, "ff808080", option_type::STRING, "UI clone color (ARGB)" },
+ { OPTION_UI_DIPSW_COLOR, "ffffff00", option_type::STRING, "UI dipswitch color (ARGB)" },
+ { OPTION_UI_GFXVIEWER_BG_COLOR, "ef101030", option_type::STRING, "UI gfx viewer color (ARGB)" },
+ { OPTION_UI_MOUSEDOWN_BG_COLOR, "b0606000", option_type::STRING, "UI mouse down bg color (ARGB)" },
+ { OPTION_UI_MOUSEDOWN_COLOR, "ffffff80", option_type::STRING, "UI mouse down color (ARGB)" },
+ { OPTION_UI_MOUSEOVER_BG_COLOR, "70404000", option_type::STRING, "UI mouse over bg color (ARGB)" },
+ { OPTION_UI_MOUSEOVER_COLOR, "ffffff80", option_type::STRING, "UI mouse over color (ARGB)" },
+ { OPTION_UI_SELECTED_BG_COLOR, "ef808000", option_type::STRING, "UI selected bg color (ARGB)" },
+ { OPTION_UI_SELECTED_COLOR, "ffffff00", option_type::STRING, "UI selected color (ARGB)" },
+ { OPTION_UI_SLIDER_COLOR, "ffffffff", option_type::STRING, "UI slider color (ARGB)" },
+ { OPTION_UI_SUBITEM_COLOR, "ffffffff", option_type::STRING, "UI subitem color (ARGB)" },
+ { OPTION_UI_TEXT_BG_COLOR, "ef000000", option_type::STRING, "UI text bg color (ARGB)" },
+ { OPTION_UI_TEXT_COLOR, "ffffffff", option_type::STRING, "UI text color (ARGB)" },
+ { OPTION_UI_UNAVAILABLE_COLOR, "ff404040", option_type::STRING, "UI unavailable color (ARGB)" },
+
+ // system/software selection menu options
+ { nullptr, nullptr, option_type::HEADER, "SYSTEM/SOFTWARE SELECTION MENU OPTIONS" },
+ { OPTION_HIDE_PANELS "(0-3)", "0", option_type::INTEGER, "UI hide left/right panel in main view (0 = Show all, 1 = hide left, 2 = hide right, 3 = hide both" },
+ { OPTION_USE_BACKGROUND, "1", option_type::BOOLEAN, "enable background image in main view" },
+ { OPTION_SKIP_BIOS_MENU, "0", option_type::BOOLEAN, "skip bios submenu, start with configured or default" },
+ { OPTION_SKIP_PARTS_MENU, "0", option_type::BOOLEAN, "skip parts submenu, start with first part" },
+ { OPTION_REMEMBER_LAST, "1", option_type::BOOLEAN, "initially select last used system in main menu" },
+ { OPTION_LAST_USED_MACHINE, "", option_type::STRING, "last selected system" },
+ { OPTION_LAST_USED_FILTER, "", option_type::STRING, "last used system filter" },
+ { OPTION_SYSTEM_RIGHT_PANEL, "image", option_type::STRING, "selected system right panel tab" },
+ { OPTION_SOFTWARE_RIGHT_PANEL, "image", option_type::STRING, "selected software right panel tab" },
+ { OPTION_SYSTEM_RIGHT_IMAGE, "snap", option_type::STRING, "selected system right panel image" },
+ { OPTION_SOFTWARE_RIGHT_IMAGE, "snap", option_type::STRING, "selected software right panel image" },
+ { OPTION_ENLARGE_SNAPS, "1", option_type::BOOLEAN, "enlarge images in right panel (keeping aspect ratio)" },
+ { OPTION_FORCED4X3, "1", option_type::BOOLEAN, "force 4:3 aspect ratio for snapshots in the software menu" },
+ { OPTION_INFO_AUTO_AUDIT, "0", option_type::BOOLEAN, "automatically audit media for the general info panel" },
+ { OPTION_HIDE_ROMLESS, "1", option_type::BOOLEAN, "hide systems that don't require ROMs in the available system filter" },
+
+ // sentinel
{ nullptr }
};
diff --git a/src/frontend/mame/ui/moptions.h b/src/frontend/mame/ui/moptions.h
index 4b228aad974..ab854870f32 100644
--- a/src/frontend/mame/ui/moptions.h
+++ b/src/frontend/mame/ui/moptions.h
@@ -40,25 +40,12 @@
// core misc options
#define OPTION_SYSTEM_NAMES "system_names"
#define OPTION_SKIP_WARNINGS "skip_warnings"
-#define OPTION_REMEMBER_LAST "remember_last"
-#define OPTION_ENLARGE_SNAPS "enlarge_snaps"
-#define OPTION_FORCED4X3 "forced4x3"
-#define OPTION_USE_BACKGROUND "use_background"
-#define OPTION_SKIP_BIOS_MENU "skip_biosmenu"
-#define OPTION_SKIP_PARTS_MENU "skip_partsmenu"
-#define OPTION_LAST_USED_FILTER "last_used_filter"
-#define OPTION_LAST_RIGHT_PANEL "last_right_panel"
-#define OPTION_LAST_USED_MACHINE "last_used_machine"
-#define OPTION_INFO_AUTO_AUDIT "info_audit_enabled"
-#define OPTION_HIDE_ROMLESS "hide_romless"
#define OPTION_UNTHROTTLE_MUTE "unthrottle_mute"
// core UI options
#define OPTION_INFOS_SIZE "infos_text_size"
#define OPTION_FONT_ROWS "font_rows"
-#define OPTION_HIDE_PANELS "hide_main_panel"
-
#define OPTION_UI_BORDER_COLOR "ui_border_color"
#define OPTION_UI_BACKGROUND_COLOR "ui_bg_color"
#define OPTION_UI_GFXVIEWER_BG_COLOR "ui_gfxviewer_color"
@@ -76,6 +63,24 @@
#define OPTION_UI_DIPSW_COLOR "ui_dipsw_color"
#define OPTION_UI_SLIDER_COLOR "ui_slider_color"
+// system/software selection menu options
+#define OPTION_HIDE_PANELS "hide_main_panel"
+#define OPTION_USE_BACKGROUND "use_background"
+#define OPTION_SKIP_BIOS_MENU "skip_biosmenu"
+#define OPTION_SKIP_PARTS_MENU "skip_partsmenu"
+#define OPTION_REMEMBER_LAST "remember_last"
+#define OPTION_LAST_USED_MACHINE "last_used_machine"
+#define OPTION_LAST_USED_FILTER "last_used_filter"
+#define OPTION_SYSTEM_RIGHT_PANEL "system_right_panel"
+#define OPTION_SOFTWARE_RIGHT_PANEL "software_right_panel"
+#define OPTION_SYSTEM_RIGHT_IMAGE "system_right_image"
+#define OPTION_SOFTWARE_RIGHT_IMAGE "software_right_image"
+#define OPTION_ENLARGE_SNAPS "enlarge_snaps"
+#define OPTION_FORCED4X3 "forced4x3"
+#define OPTION_INFO_AUTO_AUDIT "info_audit_enabled"
+#define OPTION_HIDE_ROMLESS "hide_romless"
+
+
class ui_options : public core_options
{
public:
@@ -107,23 +112,13 @@ public:
// Misc options
const char *system_names() const { return value(OPTION_SYSTEM_NAMES); }
bool skip_warnings() const { return bool_value(OPTION_SKIP_WARNINGS); }
- bool remember_last() const { return bool_value(OPTION_REMEMBER_LAST); }
bool enlarge_snaps() const { return bool_value(OPTION_ENLARGE_SNAPS); }
bool forced_4x3_snapshot() const { return bool_value(OPTION_FORCED4X3); }
- bool use_background_image() const { return bool_value(OPTION_USE_BACKGROUND); }
- bool skip_bios_menu() const { return bool_value(OPTION_SKIP_BIOS_MENU); }
- bool skip_parts_menu() const { return bool_value(OPTION_SKIP_PARTS_MENU); }
- const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); }
- const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); }
- int last_right_panel() const { return int_value(OPTION_LAST_RIGHT_PANEL); }
- bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); }
- bool hide_romless() const { return bool_value(OPTION_HIDE_ROMLESS); }
bool unthrottle_mute() const { return bool_value(OPTION_UNTHROTTLE_MUTE); }
// UI options
float infos_size() const { return float_value(OPTION_INFOS_SIZE); }
int font_rows() const { return int_value(OPTION_FONT_ROWS); }
- int hide_panels() const { return int_value(OPTION_HIDE_PANELS); }
rgb_t border_color() const { return rgb_value(OPTION_UI_BORDER_COLOR); }
rgb_t background_color() const { return rgb_value(OPTION_UI_BACKGROUND_COLOR); }
@@ -142,6 +137,21 @@ public:
rgb_t dipsw_color() const { return rgb_value(OPTION_UI_DIPSW_COLOR); }
rgb_t slider_color() const { return rgb_value(OPTION_UI_SLIDER_COLOR); }
+ // system/software selection menu options
+ int hide_panels() const { return int_value(OPTION_HIDE_PANELS); }
+ bool use_background_image() const { return bool_value(OPTION_USE_BACKGROUND); }
+ bool skip_bios_menu() const { return bool_value(OPTION_SKIP_BIOS_MENU); }
+ bool skip_parts_menu() const { return bool_value(OPTION_SKIP_PARTS_MENU); }
+ bool remember_last() const { return bool_value(OPTION_REMEMBER_LAST); }
+ const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); }
+ const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); }
+ char const *system_right_panel() const { return value(OPTION_SYSTEM_RIGHT_PANEL); }
+ char const *software_right_panel() const { return value(OPTION_SOFTWARE_RIGHT_PANEL); }
+ char const *system_right_image() const { return value(OPTION_SYSTEM_RIGHT_IMAGE); }
+ char const *software_right_image() const { return value(OPTION_SOFTWARE_RIGHT_IMAGE); }
+ bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); }
+ bool hide_romless() const { return bool_value(OPTION_HIDE_ROMLESS); }
+
rgb_t rgb_value(const char *option) const;
private:
diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp
index 10a510aa571..15c3e3e22a6 100644
--- a/src/frontend/mame/ui/selgame.cpp
+++ b/src/frontend/mame/ui/selgame.cpp
@@ -78,7 +78,6 @@ menu_select_game::menu_select_game(mame_ui_manager &mui, render_container &conta
{
//s_first_start = false; TODO: why wasn't it ever clearing the first start flag?
reselect_last::set_driver(moptions.last_used_machine());
- ui_globals::rpanel = std::min<int>(std::max<int>(moptions.last_right_panel(), RP_FIRST), RP_LAST);
std::string tmp(moptions.last_used_filter());
std::size_t const found = tmp.find_first_of(',');
@@ -108,6 +107,10 @@ menu_select_game::menu_select_game(mame_ui_manager &mui, render_container &conta
mui.machine().options().set_value(OPTION_SNAPNAME, "%g/%i", OPTION_PRIORITY_CMDLINE);
+ // restore last right panel settings
+ set_right_panel(moptions.system_right_panel());
+ set_right_image(moptions.system_right_image());
+
ui_globals::curdats_view = 0;
ui_globals::panels_status = moptions.hide_panels();
ui_globals::curdats_total = 1;
@@ -119,22 +122,7 @@ menu_select_game::menu_select_game(mame_ui_manager &mui, render_container &conta
menu_select_game::~menu_select_game()
{
- std::string error_string, last_driver;
- ui_system_info const *system;
- ui_software_info const *swinfo;
- get_selection(swinfo, system);
- if (swinfo)
- last_driver = swinfo->shortname;
- else if (system)
- last_driver = system->driver->name;
-
- std::string const filter(m_persistent_data.filter_data().get_config_string());
-
- ui_options &mopt = ui().options();
- mopt.set_value(OPTION_LAST_RIGHT_PANEL, ui_globals::rpanel, OPTION_PRIORITY_CMDLINE);
- mopt.set_value(OPTION_LAST_USED_FILTER, filter, OPTION_PRIORITY_CMDLINE);
- mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver, OPTION_PRIORITY_CMDLINE);
- mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE);
+ // TODO: reconsider when to do this
ui().save_ui_options();
}
@@ -156,6 +144,39 @@ void menu_select_game::menu_activated()
stack_reset();
return;
}
+ else
+ {
+ menu_select_launch::menu_activated();
+ }
+}
+
+//-------------------------------------------------
+// menu_deactivated
+//-------------------------------------------------
+
+void menu_select_game::menu_deactivated()
+{
+ menu_select_launch::menu_deactivated();
+
+ // get the "last selected system" string
+ ui_system_info const *system;
+ ui_software_info const *swinfo;
+ get_selection(swinfo, system);
+ std::string last_driver;
+ if (swinfo)
+ last_driver = swinfo->shortname;
+ else if (system)
+ last_driver = system->driver->name;
+
+ // serialise the selected filter settings
+ std::string const filter(m_persistent_data.filter_data().get_config_string());
+
+ ui_options &mopt = ui().options();
+ mopt.set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE);
+ mopt.set_value(OPTION_LAST_USED_MACHINE, last_driver, OPTION_PRIORITY_CMDLINE);
+ mopt.set_value(OPTION_LAST_USED_FILTER, filter, OPTION_PRIORITY_CMDLINE);
+ mopt.set_value(OPTION_SYSTEM_RIGHT_PANEL, right_panel_config_string(), OPTION_PRIORITY_CMDLINE);
+ mopt.set_value(OPTION_SYSTEM_RIGHT_IMAGE, right_image_config_string(), OPTION_PRIORITY_CMDLINE);
}
//-------------------------------------------------
@@ -259,33 +280,21 @@ void menu_select_game::handle(event const *ev)
break;
case IPT_UI_LEFT:
- if (ui_globals::rpanel == RP_IMAGES)
- {
- // Images
- previous_image_view();
- }
- else if (ui_globals::rpanel == RP_INFOS)
- {
- // Infos
- change_info_pane(-1);
- }
+ if (right_panel() == RP_IMAGES)
+ previous_image_view(); // Images
+ else if (right_panel() == RP_INFOS)
+ change_info_pane(-1); // Infos
break;
case IPT_UI_RIGHT:
- if (ui_globals::rpanel == RP_IMAGES)
- {
- // Images
- next_image_view();
- }
- else if (ui_globals::rpanel == RP_INFOS)
- {
- // Infos
- change_info_pane(1);
- }
+ if (right_panel() == RP_IMAGES)
+ next_image_view(); // Images
+ else if (right_panel() == RP_INFOS)
+ change_info_pane(1); // Infos
break;
case IPT_UI_FAVORITES:
- if (uintptr_t(ev->itemref) > skip_main_items)
+ if (uintptr_t(ev->itemref) > m_skip_main_items)
{
favorite_manager &mfav(mame_machine_manager::instance()->favorite());
if (!m_populated_favorites)
@@ -441,14 +450,14 @@ void menu_select_game::populate(float &customtop, float &custombottom)
item_append(menu_item_type::SEPARATOR, 0);
item_append(_("General Settings"), 0, (void *)(uintptr_t)CONF_OPTS);
item_append(_("System Settings"), 0, (void *)(uintptr_t)CONF_MACHINE);
- skip_main_items = 3;
+ m_skip_main_items = 3;
if (m_prev_selected && !have_prev_selected && item_count() > 0)
m_prev_selected = item(0).ref();
}
else
{
- skip_main_items = 0;
+ m_skip_main_items = 0;
}
// configure the custom rendering
@@ -785,10 +794,10 @@ void menu_select_game::change_info_pane(int delta)
get_selection(soft, sys);
if (!m_populated_favorites)
{
- if (uintptr_t(sys) > skip_main_items)
+ if (uintptr_t(sys) > m_skip_main_items)
cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
}
- else if (uintptr_t(soft) > skip_main_items)
+ else if (uintptr_t(soft) > m_skip_main_items)
{
if (soft->startempty)
cap_delta(ui_globals::curdats_view, ui_globals::curdats_total);
diff --git a/src/frontend/mame/ui/selgame.h b/src/frontend/mame/ui/selgame.h
index 4099e248f54..7c8467f8ff9 100644
--- a/src/frontend/mame/ui/selgame.h
+++ b/src/frontend/mame/ui/selgame.h
@@ -34,6 +34,7 @@ public:
protected:
void menu_activated() override;
+ void menu_deactivated() override;
private:
enum
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index a37b7215918..ea8fb04b30b 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -42,6 +42,7 @@
#include <algorithm>
#include <cmath>
#include <cstring>
+#include <tuple>
#include <utility>
@@ -49,6 +50,10 @@ namespace ui {
namespace {
+std::pair<char const *, char const *> RIGHT_PANEL_NAMES[RP_LAST + 1] = {
+ { "image", N_("Images") },
+ { "info", N_("Info") } };
+
enum
{
FIRST_VIEW = 0,
@@ -72,25 +77,25 @@ enum
LAST_VIEW = COVERS_VIEW
};
-std::pair<char const *, char const *> const arts_info[] =
-{
- { N_p("selmenu-artwork", "Snapshots"), OPTION_SNAPSHOT_DIRECTORY },
- { N_p("selmenu-artwork", "Cabinet"), OPTION_CABINETS_PATH },
- { N_p("selmenu-artwork", "Control Panel"), OPTION_CPANELS_PATH },
- { N_p("selmenu-artwork", "PCB"), OPTION_PCBS_PATH },
- { N_p("selmenu-artwork", "Flyer"), OPTION_FLYERS_PATH },
- { N_p("selmenu-artwork", "Title Screen"), OPTION_TITLES_PATH },
- { N_p("selmenu-artwork", "Ending"), OPTION_ENDS_PATH },
- { N_p("selmenu-artwork", "Artwork Preview"), OPTION_ARTPREV_PATH },
- { N_p("selmenu-artwork", "Bosses"), OPTION_BOSSES_PATH },
- { N_p("selmenu-artwork", "Logo"), OPTION_LOGOS_PATH },
- { N_p("selmenu-artwork", "Versus"), OPTION_VERSUS_PATH },
- { N_p("selmenu-artwork", "Game Over"), OPTION_GAMEOVER_PATH },
- { N_p("selmenu-artwork", "HowTo"), OPTION_HOWTO_PATH },
- { N_p("selmenu-artwork", "Scores"), OPTION_SCORES_PATH },
- { N_p("selmenu-artwork", "Select"), OPTION_SELECT_PATH },
- { N_p("selmenu-artwork", "Marquee"), OPTION_MARQUEES_PATH },
- { N_p("selmenu-artwork", "Covers"), OPTION_COVER_PATH },
+std::tuple<char const *, char const *, char const *> const ARTS_INFO[] =
+{
+ { "snap", N_p("selmenu-artwork", "Snapshots"), OPTION_SNAPSHOT_DIRECTORY },
+ { "cabinet", N_p("selmenu-artwork", "Cabinet"), OPTION_CABINETS_PATH },
+ { "cpanel", N_p("selmenu-artwork", "Control Panel"), OPTION_CPANELS_PATH },
+ { "pcb", N_p("selmenu-artwork", "PCB"), OPTION_PCBS_PATH },
+ { "flyer", N_p("selmenu-artwork", "Flyer"), OPTION_FLYERS_PATH },
+ { "title", N_p("selmenu-artwork", "Title Screen"), OPTION_TITLES_PATH },
+ { "ending", N_p("selmenu-artwork", "Ending"), OPTION_ENDS_PATH },
+ { "artpreview", N_p("selmenu-artwork", "Artwork Preview"), OPTION_ARTPREV_PATH },
+ { "boss", N_p("selmenu-artwork", "Bosses"), OPTION_BOSSES_PATH },
+ { "logo", N_p("selmenu-artwork", "Logo"), OPTION_LOGOS_PATH },
+ { "versus", N_p("selmenu-artwork", "Versus"), OPTION_VERSUS_PATH },
+ { "gameover", N_p("selmenu-artwork", "Game Over"), OPTION_GAMEOVER_PATH },
+ { "howto", N_p("selmenu-artwork", "HowTo"), OPTION_HOWTO_PATH },
+ { "scores", N_p("selmenu-artwork", "Scores"), OPTION_SCORES_PATH },
+ { "select", N_p("selmenu-artwork", "Select"), OPTION_SELECT_PATH },
+ { "marquee", N_p("selmenu-artwork", "Marquee"), OPTION_MARQUEES_PATH },
+ { "cover", N_p("selmenu-artwork", "Covers"), OPTION_COVER_PATH },
};
char const *const hover_msg[] = {
@@ -482,6 +487,7 @@ menu_select_launch::~menu_select_launch()
menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &container, bool is_swlist)
: menu(mui, container)
+ , m_skip_main_items(0)
, m_prev_selected(nullptr)
, m_total_lines(0)
, m_topline_datsview(0)
@@ -499,9 +505,9 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c
, m_pressed(false)
, m_repeat(0)
, m_right_visible_lines(0)
+ , m_right_panel(RP_FIRST)
, m_has_icons(false)
, m_switch_image(false)
- , m_default_image(true)
, m_image_view(FIRST_VIEW)
, m_flags(256)
{
@@ -516,7 +522,6 @@ void menu_select_launch::next_image_view()
{
++m_image_view;
set_switch_image();
- m_default_image = false;
}
}
@@ -527,7 +532,6 @@ void menu_select_launch::previous_image_view()
{
--m_image_view;
set_switch_image();
- m_default_image = false;
}
}
@@ -742,20 +746,7 @@ void menu_select_launch::rotate_focus(int dir)
switch (get_focus())
{
case focused_menu::MAIN:
- if (selected_index() <= m_available_items)
- {
- if (skip_main_items || (ui_globals::panels_status != HIDE_BOTH))
- {
- m_prev_selected = get_selection_ref();
- if ((0 < dir) || (ui_globals::panels_status == HIDE_BOTH))
- set_selected_index(m_available_items + 1);
- else if (ui_globals::panels_status == HIDE_RIGHT_PANEL)
- set_focus(focused_menu::LEFT);
- else
- set_focus(focused_menu::RIGHTBOTTOM);
- }
- }
- else
+ if (selected_index() > m_available_items)
{
if ((0 > dir) || (ui_globals::panels_status == HIDE_BOTH))
select_prev();
@@ -764,13 +755,38 @@ void menu_select_launch::rotate_focus(int dir)
else
set_focus(focused_menu::LEFT);
}
+ else if (m_skip_main_items || (ui_globals::panels_status != HIDE_BOTH))
+ {
+ m_prev_selected = get_selection_ref();
+ if (0 < dir)
+ {
+ if (m_skip_main_items)
+ set_selected_index(m_available_items + 1);
+ else if (ui_globals::panels_status == HIDE_LEFT_PANEL)
+ set_focus(focused_menu::RIGHTTOP);
+ else
+ set_focus(focused_menu::LEFT);
+ }
+ else if (ui_globals::panels_status == HIDE_RIGHT_PANEL)
+ {
+ set_focus(focused_menu::LEFT);
+ }
+ else if (ui_globals::panels_status != HIDE_BOTH)
+ {
+ set_focus(focused_menu::RIGHTBOTTOM);
+ }
+ else
+ {
+ set_selected_index(m_available_items + 1);
+ }
+ }
break;
case focused_menu::LEFT:
if (0 > dir)
{
set_focus(focused_menu::MAIN);
- if (skip_main_items)
+ if (m_skip_main_items)
set_selected_index(m_available_items + 1);
else
select_prev();
@@ -798,7 +814,10 @@ void menu_select_launch::rotate_focus(int dir)
else
{
set_focus(focused_menu::MAIN);
- set_selected_index(m_available_items + 1);
+ if (m_skip_main_items)
+ set_selected_index(m_available_items + 1);
+ else
+ select_prev();
}
break;
@@ -1336,21 +1355,21 @@ void menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, flo
void menu_select_launch::get_title_search(std::string &snaptext, std::string &searchstr)
{
// get arts title text
- snaptext.assign(_("selmenu-artwork", arts_info[m_image_view].first));
+ snaptext.assign(_("selmenu-artwork", std::get<1>(ARTS_INFO[m_image_view])));
// get search path
std::string addpath;
if (m_image_view == SNAPSHOT_VIEW)
{
emu_options moptions;
- searchstr = machine().options().value(arts_info[m_image_view].second);
- addpath = moptions.value(arts_info[m_image_view].second);
+ searchstr = machine().options().value(std::get<2>(ARTS_INFO[m_image_view]));
+ addpath = moptions.value(std::get<2>(ARTS_INFO[m_image_view]));
}
else
{
ui_options moptions;
- searchstr = ui().options().value(arts_info[m_image_view].second);
- addpath = moptions.value(arts_info[m_image_view].second);
+ searchstr = ui().options().value(std::get<2>(ARTS_INFO[m_image_view]));
+ addpath = moptions.value(std::get<2>(ARTS_INFO[m_image_view]));
}
std::string tmp(searchstr);
@@ -1427,7 +1446,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
if (m_focus == focused_menu::RIGHTTOP)
{
// Swap the right panel and swallow it
- ui_globals::rpanel = RP_IMAGES;
+ m_right_panel = RP_IMAGES;
iptkey = IPT_INVALID;
}
else
@@ -1441,7 +1460,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
if (m_focus == focused_menu::RIGHTTOP)
{
// Swap the right panel and swallow it
- ui_globals::rpanel = RP_INFOS;
+ m_right_panel = RP_INFOS;
iptkey = IPT_INVALID;
}
else
@@ -1746,7 +1765,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
}
else if (hover() >= HOVER_RP_FIRST && hover() <= HOVER_RP_LAST)
{
- ui_globals::rpanel = (HOVER_RP_FIRST - hover()) * (-1);
+ m_right_panel = (HOVER_RP_FIRST - hover()) * (-1);
stop = true;
}
else if (hover() >= HOVER_FILTER_FIRST && hover() <= HOVER_FILTER_LAST)
@@ -1770,7 +1789,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
// caught scroll event
case ui_event::type::MOUSE_WHEEL:
- if (hover() >= 0 && hover() < item_count() - skip_main_items)
+ if (hover() >= 0 && hover() < item_count() - m_skip_main_items)
{
if (local_menu_event.zdelta > 0)
{
@@ -1817,7 +1836,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
break;
case ui_event::type::MOUSE_RDOWN:
- if (hover() >= 0 && hover() < item_count() - skip_main_items)
+ if (hover() >= 0 && hover() < item_count() - m_skip_main_items)
{
set_selected_index(hover());
m_prev_selected = get_selection_ref();
@@ -1883,8 +1902,8 @@ void menu_select_launch::draw(uint32_t flags)
draw_background();
clear_hover();
- m_available_items = item_count() - skip_main_items;
- float extra_height = skip_main_items * line_height;
+ m_available_items = item_count() - m_skip_main_items;
+ float extra_height = m_skip_main_items * line_height;
float visible_extra_menu_height = get_customtop() + get_custombottom() + extra_height;
// locate mouse
@@ -2196,7 +2215,7 @@ void menu_select_launch::draw_right_panel(float origx1, float origy1, float orig
draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
origy1 = draw_right_box_title(x2, origy1, origx2, origy2);
- if (ui_globals::rpanel == RP_IMAGES)
+ if (m_right_panel == RP_IMAGES)
arts_render(x2, origy1, origx2, origy2);
else
infos_render(x2, origy1, origx2, origy2);
@@ -2218,9 +2237,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
// add separator line
container().add_line(x1 + midl, y1, x1 + midl, y1 + line_height, UI_LINE_WIDTH, ui().colors().border_color(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- std::string buffer[RP_LAST + 1];
- buffer[RP_IMAGES] = _("Images");
- buffer[RP_INFOS] = _("Infos");
+ std::string buffer[RP_LAST + 1] = { _(RIGHT_PANEL_NAMES[0].second), _(RIGHT_PANEL_NAMES[1].second) };
// check size
float text_size = 1.0f;
@@ -2238,7 +2255,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
if (mouse_in_rect(x1, y1, x1 + midl, y1 + line_height))
{
- if (ui_globals::rpanel != cells)
+ if (m_right_panel != cells)
{
bgcolor = ui().colors().mouseover_bg_color();
fgcolor = ui().options().mouseover_color();
@@ -2246,7 +2263,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
}
}
- if (ui_globals::rpanel != cells)
+ if (m_right_panel != cells)
{
container().add_line(x1, y1 + line_height, x1 + midl, y1 + line_height, UI_LINE_WIDTH,
ui().colors().border_color(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
@@ -2254,7 +2271,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
fgcolor = ui().colors().clone_color();
}
- if (m_focus == focused_menu::RIGHTTOP && ui_globals::rpanel == cells)
+ if (m_focus == focused_menu::RIGHTTOP && m_right_panel == cells)
{
fgcolor = rgb_t(0xff, 0xff, 0x00);
bgcolor = rgb_t(0xff, 0xff, 0xff);
@@ -2296,9 +2313,6 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f
{
m_cache.set_snapx_driver(nullptr);
- if (m_default_image)
- m_image_view = (software->startempty == 0) ? SNAPSHOT_VIEW : CABINETS_VIEW;
-
// arts title and searchpath
std::string const searchstr = arts_render_common(origx1, origy1, origx2, origy2);
@@ -2335,9 +2349,6 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f
{
m_cache.set_snapx_software(nullptr);
- if (m_default_image)
- m_image_view = ((system->driver->flags & machine_flags::MASK_TYPE) != machine_flags::TYPE_ARCADE) ? CABINETS_VIEW : SNAPSHOT_VIEW;
-
std::string const searchstr = arts_render_common(origx1, origy1, origx2, origy2);
// loads the image if necessary
@@ -2376,7 +2387,7 @@ std::string menu_select_launch::arts_render_common(float origx1, float origy1, f
{
float text_length;
ui().draw_text_full(container(),
- _("selmenu-artwork", arts_info[x].first), origx1, origy1, origx2 - origx1,
+ _("selmenu-artwork", std::get<1>(ARTS_INFO[m_image_view])), origx1, origy1, origx2 - origx1,
text_layout::text_justify::CENTER, text_layout::word_wrapping::TRUNCATE, mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(),
&text_length, nullptr);
title_size = (std::max)(text_length + 0.01f, title_size);
@@ -2525,6 +2536,55 @@ void menu_select_launch::draw_snapx(float origx1, float origy1, float origx2, fl
}
+char const *menu_select_launch::right_panel_config_string() const
+{
+ assert(std::size(RIGHT_PANEL_NAMES) > m_right_panel);
+ return RIGHT_PANEL_NAMES[m_right_panel].first;
+}
+
+char const *menu_select_launch::right_image_config_string() const
+{
+ assert(std::size(ARTS_INFO) > m_image_view);
+ return std::get<0>(ARTS_INFO[m_image_view]);
+}
+
+void menu_select_launch::set_right_panel(u8 index)
+{
+ assert(std::size(RIGHT_PANEL_NAMES) > index);
+ m_right_panel = index;
+}
+
+void menu_select_launch::set_right_image(u8 index)
+{
+ assert(std::size(ARTS_INFO) > index);
+ if (index != m_image_view)
+ {
+ m_image_view = index;
+ set_switch_image();
+ }
+}
+
+void menu_select_launch::set_right_panel(std::string_view value)
+{
+ auto const found = std::find_if(
+ std::begin(RIGHT_PANEL_NAMES),
+ std::end(RIGHT_PANEL_NAMES),
+ [&value] (auto const &that) { return value == that.first; });
+ if (std::end(RIGHT_PANEL_NAMES) != found)
+ m_right_panel = found - std::begin(RIGHT_PANEL_NAMES);
+}
+
+void menu_select_launch::set_right_image(std::string_view value)
+{
+ auto const found = std::find_if(
+ std::begin(ARTS_INFO),
+ std::end(ARTS_INFO),
+ [&value] (auto const &that) { return value == std::get<0>(that); });
+ if (std::end(ARTS_INFO) != found)
+ m_image_view = found - std::begin(ARTS_INFO);
+}
+
+
std::string menu_select_launch::make_system_audit_fail_text(media_auditor const &auditor, media_auditor::summary summary)
{
std::ostringstream str;
diff --git a/src/frontend/mame/ui/selmenu.h b/src/frontend/mame/ui/selmenu.h
index 6568ca14a44..cec6224e08c 100644
--- a/src/frontend/mame/ui/selmenu.h
+++ b/src/frontend/mame/ui/selmenu.h
@@ -158,9 +158,18 @@ protected:
void *get_selection_ptr() const
{
void *const selected_ref(get_selection_ref());
- return (uintptr_t(selected_ref) > skip_main_items) ? selected_ref : m_prev_selected;
+ return (uintptr_t(selected_ref) > m_skip_main_items) ? selected_ref : m_prev_selected;
}
+ u8 const right_panel() const { return m_right_panel; }
+ u8 const right_image() const { return m_image_view; }
+ char const *right_panel_config_string() const;
+ char const *right_image_config_string() const;
+ void set_right_panel(u8 index);
+ void set_right_image(u8 index);
+ void set_right_panel(std::string_view value);
+ void set_right_image(std::string_view value);
+
static std::string make_system_audit_fail_text(media_auditor const &auditor, media_auditor::summary summary);
static std::string make_software_audit_fail_text(media_auditor const &auditor, media_auditor::summary summary);
static constexpr bool audit_passed(media_auditor::summary summary)
@@ -169,7 +178,7 @@ protected:
}
int m_available_items;
- int skip_main_items;
+ int m_skip_main_items;
void *m_prev_selected;
int m_total_lines;
int m_topline_datsview;
@@ -322,9 +331,9 @@ private:
int m_right_visible_lines; // right box lines
+ uint8_t m_right_panel;
bool m_has_icons;
bool m_switch_image;
- bool m_default_image;
uint8_t m_image_view;
flags_cache m_flags;
};
diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp
index 7255db8427f..427ef4c61a5 100644
--- a/src/frontend/mame/ui/selsoft.cpp
+++ b/src/frontend/mame/ui/selsoft.cpp
@@ -87,6 +87,8 @@ public:
, m_filter_type(software_filter::ALL)
, m_swinfo()
, m_searchlist()
+ , m_right_panel(menu.right_panel())
+ , m_right_image(menu.right_image())
{
// add start empty item
m_swinfo.emplace_back(*menu.m_system.driver);
@@ -347,6 +349,11 @@ public:
return m_searchlist;
}
+ u8 right_panel() const { return m_right_panel; }
+ u8 right_image() const { return m_right_image; }
+ void set_right_panel(u8 index) { m_right_panel = index; }
+ void set_right_image(u8 index) { m_right_image = index; }
+
private:
icon_cache m_icons;
bool m_has_empty_start;
@@ -356,6 +363,9 @@ private:
std::vector<ui_software_info> m_swinfo;
std::vector<search_item> m_searchlist;
+ u8 m_right_panel;
+ u8 m_right_image;
+
std::unique_ptr<std::thread> m_search_thread;
};
@@ -374,8 +384,21 @@ menu_select_software::menu_select_software(mame_ui_manager &mui, render_containe
using machine_data_cache = util::lru_cache_map<game_driver const *, std::shared_ptr<machine_data> >;
auto &cached(mui.get_session_data<menu_select_software, machine_data_cache>(8)[system.driver]);
- if (!cached)
+ if (cached)
+ {
+ // restore last right panel settings for this machine
+ set_right_panel(cached->right_panel());
+ set_right_image(cached->right_image());
+ }
+ else
+ {
+ // restore last right panel settings from UI options
+ ui_options &moptions = ui().options();
+ set_right_panel(moptions.software_right_panel());
+ set_right_image(moptions.software_right_image());
+
cached = std::make_shared<machine_data>(*this);
+ }
m_data = cached;
m_filter_highlight = m_data->filter_type();
@@ -419,12 +442,12 @@ void menu_select_software::handle(event const *ev)
break;
case IPT_UI_LEFT:
- if (ui_globals::rpanel == RP_IMAGES)
+ if (right_panel() == RP_IMAGES)
{
// Images
previous_image_view();
}
- else if (ui_globals::rpanel == RP_INFOS && ui_globals::cur_sw_dats_view > 0)
+ else if (right_panel() == RP_INFOS && ui_globals::cur_sw_dats_view > 0)
{
// Infos
ui_globals::cur_sw_dats_view--;
@@ -433,12 +456,12 @@ void menu_select_software::handle(event const *ev)
break;
case IPT_UI_RIGHT:
- if (ui_globals::rpanel == RP_IMAGES)
+ if (right_panel() == RP_IMAGES)
{
// Images
next_image_view();
}
- else if (ui_globals::rpanel == RP_INFOS && ui_globals::cur_sw_dats_view < (ui_globals::cur_sw_dats_total - 1))
+ else if (right_panel() == RP_INFOS && ui_globals::cur_sw_dats_view < (ui_globals::cur_sw_dats_total - 1))
{
// Infos
ui_globals::cur_sw_dats_view++;
@@ -503,6 +526,22 @@ void menu_select_software::handle(event const *ev)
}
//-------------------------------------------------
+// menu_deactivated
+//-------------------------------------------------
+
+void menu_select_software::menu_deactivated()
+{
+ menu_select_launch::menu_deactivated();
+
+ // save last right panel settings
+ m_data->set_right_panel(right_panel());
+ m_data->set_right_image(right_image());
+ ui_options &mopt = ui().options();
+ mopt.set_value(OPTION_SOFTWARE_RIGHT_PANEL, right_panel_config_string(), OPTION_PRIORITY_CMDLINE);
+ mopt.set_value(OPTION_SOFTWARE_RIGHT_IMAGE, right_image_config_string(), OPTION_PRIORITY_CMDLINE);
+}
+
+//-------------------------------------------------
// populate
//-------------------------------------------------
@@ -567,7 +606,7 @@ void menu_select_software::populate(float &customtop, float &custombottom)
}
// configure the custom rendering
- skip_main_items = 0;
+ m_skip_main_items = 0;
customtop = 4.0f * ui().get_line_height() + 5.0f * ui().box_tb_border();
custombottom = 4.0f * ui().get_line_height() + 4.0f * ui().box_tb_border();
diff --git a/src/frontend/mame/ui/selsoft.h b/src/frontend/mame/ui/selsoft.h
index c91495d568d..4b22ebc6eaf 100644
--- a/src/frontend/mame/ui/selsoft.h
+++ b/src/frontend/mame/ui/selsoft.h
@@ -32,6 +32,9 @@ public:
menu_select_software(mame_ui_manager &mui, render_container &container, ui_system_info const &system);
virtual ~menu_select_software() override;
+protected:
+ virtual void menu_deactivated() override;
+
private:
using filter_map = std::map<software_filter::type, software_filter::ptr>;
using icon_cache = texture_lru<ui_software_info const *>;
diff --git a/src/frontend/mame/ui/utils.cpp b/src/frontend/mame/ui/utils.cpp
index fe5f3b0c138..423e8b111e2 100644
--- a/src/frontend/mame/ui/utils.cpp
+++ b/src/frontend/mame/ui/utils.cpp
@@ -1951,7 +1951,6 @@ extern const char UI_VERSION_TAG[];
const char UI_VERSION_TAG[] = "# UI INFO ";
// Globals
-uint8_t ui_globals::rpanel = 0;
uint8_t ui_globals::curdats_view = 0;
uint8_t ui_globals::cur_sw_dats_total = 0;
uint8_t ui_globals::curdats_total = 0;
diff --git a/src/frontend/mame/ui/utils.h b/src/frontend/mame/ui/utils.h
index 02e88a73b65..e5bed5deee4 100644
--- a/src/frontend/mame/ui/utils.h
+++ b/src/frontend/mame/ui/utils.h
@@ -398,7 +398,7 @@ enum
// GLOBAL CLASS
struct ui_globals
{
- static uint8_t curdats_view, curdats_total, cur_sw_dats_view, cur_sw_dats_total, rpanel;
+ static uint8_t curdats_view, curdats_total, cur_sw_dats_view, cur_sw_dats_total;
static bool default_image, reset;
static int visible_main_lines, visible_sw_lines;
static uint16_t panels_status;