From 25bc1007af6054e083d5c671f93cbe94878ef0f8 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Fri, 18 Mar 2016 22:00:47 +0100 Subject: [PATCH] Added support and configuration for the image collection "covers". Slightly modernized and simplified the code. --- src/emu/ui/auditmenu.cpp | 2 +- src/emu/ui/auditmenu.h | 2 +- src/emu/ui/barcode.cpp | 2 +- src/emu/ui/cheatopt.cpp | 2 +- src/emu/ui/cmddata.h | 4 +-- src/emu/ui/cmdrender.h | 2 +- src/emu/ui/ctrlmenu.cpp | 2 +- src/emu/ui/ctrlmenu.h | 2 +- src/emu/ui/custmenu.cpp | 2 +- src/emu/ui/custmenu.h | 2 +- src/emu/ui/custui.cpp | 2 +- src/emu/ui/custui.h | 2 +- src/emu/ui/datfile.cpp | 2 +- src/emu/ui/datfile.h | 2 +- src/emu/ui/datmenu.cpp | 32 ++++++++++---------- src/emu/ui/datmenu.h | 6 ++-- src/emu/ui/defimg.h | 3 +- src/emu/ui/devopt.cpp | 2 +- src/emu/ui/dirmenu.cpp | 1 + src/emu/ui/dirmenu.h | 2 +- src/emu/ui/dsplmenu.cpp | 2 +- src/emu/ui/dsplmenu.h | 2 +- src/emu/ui/filemngr.cpp | 2 +- src/emu/ui/filesel.cpp | 2 +- src/emu/ui/icorender.h | 2 +- src/emu/ui/info.cpp | 2 +- src/emu/ui/info_pty.cpp | 2 +- src/emu/ui/inifile.cpp | 14 ++++----- src/emu/ui/inifile.h | 45 +++++++++++++--------------- src/emu/ui/inputmap.cpp | 2 +- src/emu/ui/mainmenu.cpp | 2 +- src/emu/ui/menu.cpp | 65 ++++++++++++++++++++++++++++------------ src/emu/ui/miscmenu.cpp | 4 +-- src/emu/ui/moptions.cpp | 43 +++++++++++++------------- src/emu/ui/moptions.h | 4 ++- src/emu/ui/optsmenu.cpp | 36 ++++++++++------------ src/emu/ui/selector.cpp | 10 +++---- src/emu/ui/selector.h | 2 +- src/emu/ui/selgame.cpp | 15 +++++----- src/emu/ui/selgame.h | 2 +- src/emu/ui/selsoft.cpp | 24 +++++++-------- src/emu/ui/selsoft.h | 22 ++++++-------- src/emu/ui/sliders.cpp | 2 +- src/emu/ui/slotopt.cpp | 2 +- src/emu/ui/sndmenu.cpp | 2 +- src/emu/ui/sndmenu.h | 2 +- src/emu/ui/starimg.h | 3 +- src/emu/ui/swlist.cpp | 2 +- src/emu/ui/tapectrl.cpp | 2 +- src/emu/ui/ui.cpp | 2 +- src/emu/ui/utils.h | 2 +- src/emu/ui/videoopt.cpp | 2 +- 52 files changed, 209 insertions(+), 192 deletions(-) diff --git a/src/emu/ui/auditmenu.cpp b/src/emu/ui/auditmenu.cpp index c30619be3a9..a4d7de4779b 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/emu/ui/auditmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/auditmenu.cpp diff --git a/src/emu/ui/auditmenu.h b/src/emu/ui/auditmenu.h index caad05796a6..ba8c5e80631 100644 --- a/src/emu/ui/auditmenu.h +++ b/src/emu/ui/auditmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/auditmenu.h diff --git a/src/emu/ui/barcode.cpp b/src/emu/ui/barcode.cpp index e9f779737a8..4dc734a2bd2 100644 --- a/src/emu/ui/barcode.cpp +++ b/src/emu/ui/barcode.cpp @@ -2,7 +2,7 @@ // copyright-holders:Fabio Priuli /*************************************************************************** - ui/barcode.c + ui/barcode.cpp "Barcode Reader" control diff --git a/src/emu/ui/cheatopt.cpp b/src/emu/ui/cheatopt.cpp index 9c5f91d54bc..ceb2c3301f5 100644 --- a/src/emu/ui/cheatopt.cpp +++ b/src/emu/ui/cheatopt.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/cheatopt.c + ui/cheatopt.cpp Internal menu for the cheat interface. diff --git a/src/emu/ui/cmddata.h b/src/emu/ui/cmddata.h index 5fa2658d2cb..31dd8c5ebd8 100644 --- a/src/emu/ui/cmddata.h +++ b/src/emu/ui/cmddata.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/cmddata.h @@ -143,10 +143,8 @@ static rgb_t color_table[] = BUTTON_COLOR_SILVER // 8 Player Lever }; -// for color glyph #define COLOR_BUTTONS ARRAY_LENGTH(color_table) -// Follow Varialbe Defined Arraies for Game Command Tag struct fix_command_t { unsigned char glyph_char; diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h index 01cc169816d..b8d0eb1571b 100644 --- a/src/emu/ui/cmdrender.h +++ b/src/emu/ui/cmdrender.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/cmdrender.h diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index 9e2f4c2950d..d3d743f552e 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/ctrlmenu.cpp diff --git a/src/emu/ui/ctrlmenu.h b/src/emu/ui/ctrlmenu.h index 4c1325071d6..0db85ee878a 100644 --- a/src/emu/ui/ctrlmenu.h +++ b/src/emu/ui/ctrlmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/ctrlmenu.h diff --git a/src/emu/ui/custmenu.cpp b/src/emu/ui/custmenu.cpp index 85df4afcd8a..fb833c93c51 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/emu/ui/custmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/custmenu.cpp diff --git a/src/emu/ui/custmenu.h b/src/emu/ui/custmenu.h index d136e911164..338344dcddd 100644 --- a/src/emu/ui/custmenu.h +++ b/src/emu/ui/custmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/custmenu.h diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 14f5cefc4b6..816875131dc 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/custui.cpp diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h index 46f42967b6a..0a2e55745c9 100644 --- a/src/emu/ui/custui.h +++ b/src/emu/ui/custui.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/custui.h diff --git a/src/emu/ui/datfile.cpp b/src/emu/ui/datfile.cpp index 35dfde7249d..799cdaf3823 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/emu/ui/datfile.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/datfile.cpp diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index 7b38599ba21..fa5f527a635 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/datfile.h diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 93c776f3e51..a4d3e619ced 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/datmenu.cpp @@ -36,6 +36,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container } } m_driver = (driver == nullptr) ? &machine.system() : driver; + m_actual = 0; + m_issoft = false; init_items(); } @@ -52,8 +54,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container m_parent = swinfo->parentname; m_driver = (driver == nullptr) ? &machine.system() : driver; m_swinfo = swinfo; - - issoft = true; + m_actual = 0; + m_issoft = true; if (machine.datfile().has_software(m_list, m_short, m_parent)) m_items_list.emplace_back(_("Software History"), UI_HISTORY_LOAD, machine.datfile().rev_history()); @@ -78,15 +80,15 @@ void ui_menu_dats_view::handle() const ui_menu_event *m_event = process(MENU_FLAG_UI_DATS); if (m_event != nullptr) { - if (m_event->iptkey == IPT_UI_LEFT && actual > 0) + if (m_event->iptkey == IPT_UI_LEFT && m_actual > 0) { - actual--; + m_actual--; reset(UI_MENU_RESET_SELECT_FIRST); } - if (m_event->iptkey == IPT_UI_RIGHT && actual < m_items_list.size() - 1) + if (m_event->iptkey == IPT_UI_RIGHT && m_actual < m_items_list.size() - 1) { - actual++; + m_actual++; reset(UI_MENU_RESET_SELECT_FIRST); } } @@ -99,7 +101,7 @@ void ui_menu_dats_view::handle() void ui_menu_dats_view::populate() { machine().pause(); - (issoft == true) ? get_data_sw() : get_data(); + (m_issoft == true) ? get_data_sw() : get_data(); item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr); customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; @@ -116,7 +118,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom ui_manager &mui = machine().ui(); float maxwidth = origx2 - origx1; float width; - std::string driver = (issoft == true) ? m_swinfo->longname : m_driver->description; + std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description; mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); @@ -168,8 +170,8 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom for (auto & elem : m_items_list) { x1 += space; - rgb_t fcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; - rgb_t bcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; + rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR; + rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER, DRAW_NONE, fcolor, bcolor, &width, nullptr); if (bcolor != UI_TEXT_BG_COLOR) @@ -184,7 +186,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom // bottom std::string revision; - revision.assign(_("Revision: ")).append(m_items_list[actual].revision); + revision.assign(_("Revision: ")).append(m_items_list[m_actual].revision); mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; @@ -219,7 +221,7 @@ void ui_menu_dats_view::get_data() std::vector xend; std::string buffer; std::vector m_item; - if (m_items_list[actual].option == UI_COMMAND_LOAD) + if (m_items_list[m_actual].option == UI_COMMAND_LOAD) { machine().datfile().command_sub_menu(m_driver, m_item); if (!m_item.empty()) @@ -236,7 +238,7 @@ void ui_menu_dats_view::get_data() } } else - machine().datfile().load_data_info(m_driver, buffer, m_items_list[actual].option); + machine().datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option); int totallines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); for (int x = 0; x < totallines; ++x) @@ -252,7 +254,7 @@ void ui_menu_dats_view::get_data_sw() std::vector xend; std::string buffer; std::vector m_item; - if (m_items_list[actual].option == 0) + if (m_items_list[m_actual].option == 0) buffer = m_swinfo->usage; else { diff --git a/src/emu/ui/datmenu.h b/src/emu/ui/datmenu.h index 0d2ae7d686d..10de3894816 100644 --- a/src/emu/ui/datmenu.h +++ b/src/emu/ui/datmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/datmenu.h @@ -31,14 +31,14 @@ public: virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override; private: - int actual; + int m_actual; const game_driver *m_driver; ui_software_info *m_swinfo; std::string m_list, m_short, m_long, m_parent; void get_data(); void get_data_sw(); void init_items(); - bool issoft; + bool m_issoft; struct list_items { list_items(std::string l, int i, std::string rev) { label = l; option = i; revision = rev; } diff --git a/src/emu/ui/defimg.h b/src/emu/ui/defimg.h index 43b334b8f93..bce018449d1 100644 --- a/src/emu/ui/defimg.h +++ b/src/emu/ui/defimg.h @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota + static const UINT32 no_avail_bmp[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x01231f20, 0x04231f20, 0x11231f20, 0x2e231f20, 0x62231f20, 0x8e231f20, 0xb4231f20, 0xd4231f20, 0xe5231f20, 0xf2231f20, 0xfd231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xff231f20, 0xfd231f20, 0xf2231f20, 0xe5231f20, 0xd4231f20, 0xb4231f20, 0x8e231f20, 0x62231f20, 0x2e231f20, 0x11231f20, 0x04231f20, 0x01231f20, 0x00000000, 0x00000000, 0x00000000, 0x00231f20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/src/emu/ui/devopt.cpp b/src/emu/ui/devopt.cpp index f7c4ea2a88c..bafb8e77114 100644 --- a/src/emu/ui/devopt.cpp +++ b/src/emu/ui/devopt.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /********************************************************************* - ui/devopt.c + ui/devopt.cpp Internal menu for the device configuration. diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 03260a337d9..88c701b67ef 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -55,6 +55,7 @@ static const folders_entry s_folders[] = { __("Logos"), OPTION_LOGOS_PATH, ADDING }, { __("Scores"), OPTION_SCORES_PATH, ADDING }, { __("Versus"), OPTION_VERSUS_PATH, ADDING }, + { __("Covers"), OPTION_COVER_PATH, ADDING } }; diff --git a/src/emu/ui/dirmenu.h b/src/emu/ui/dirmenu.h index 5c48d9ad696..6b68764b258 100644 --- a/src/emu/ui/dirmenu.h +++ b/src/emu/ui/dirmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/dirmenu.h diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index ed443815b25..5ee2bfd0ca2 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/dsplmenu.cpp diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h index 814304ec6bd..69b92e3bbe0 100644 --- a/src/emu/ui/dsplmenu.h +++ b/src/emu/ui/dsplmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/dsplmenu.h diff --git a/src/emu/ui/filemngr.cpp b/src/emu/ui/filemngr.cpp index d46199793ce..fa139e1c696 100644 --- a/src/emu/ui/filemngr.cpp +++ b/src/emu/ui/filemngr.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /********************************************************************* - ui/filemngr.c + ui/filemngr.cpp MESS's clunky built-in file manager diff --git a/src/emu/ui/filesel.cpp b/src/emu/ui/filesel.cpp index a24a3e9a3cf..7a8cd32ec94 100644 --- a/src/emu/ui/filesel.cpp +++ b/src/emu/ui/filesel.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /*************************************************************************** - ui/filesel.c + ui/filesel.cpp MESS's clunky built-in file manager diff --git a/src/emu/ui/icorender.h b/src/emu/ui/icorender.h index 79452bd9fca..ac942ac922e 100644 --- a/src/emu/ui/icorender.h +++ b/src/emu/ui/icorender.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890;Victor Laskin +// copyright-holders:Maurizio Petrarota, Victor Laskin /*************************************************************************** ui/icorender.h diff --git a/src/emu/ui/info.cpp b/src/emu/ui/info.cpp index 8c202f77e91..10090c32305 100644 --- a/src/emu/ui/info.cpp +++ b/src/emu/ui/info.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /*************************************************************************** - ui/info.c + ui/info.cpp System and image info screens diff --git a/src/emu/ui/info_pty.cpp b/src/emu/ui/info_pty.cpp index 06497b876bb..563b77dbff5 100644 --- a/src/emu/ui/info_pty.cpp +++ b/src/emu/ui/info_pty.cpp @@ -2,7 +2,7 @@ // copyright-holders:F.Ulivi /*************************************************************************** - ui/info_pty.c + ui/info_pty.cpp Information screen on pseudo terminals diff --git a/src/emu/ui/inifile.cpp b/src/emu/ui/inifile.cpp index ac669e03d40..33bd433a7f7 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/emu/ui/inifile.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/inifile.cpp @@ -18,8 +18,8 @@ //------------------------------------------------- // GLOBAL VARIABLES //------------------------------------------------- -UINT16 inifile_manager::current_category = 0; -UINT16 inifile_manager::current_file = 0; +UINT16 inifile_manager::c_cat = 0; +UINT16 inifile_manager::c_file = 0; //------------------------------------------------- // ctor @@ -48,10 +48,6 @@ void inifile_manager::directory_scan() int length = strlen(dir->name); std::string filename(dir->name); - // skip ui_favorite file - if (!core_stricmp("ui_favorite.ini", filename.c_str())) - continue; - // check .ini file ending if ((length > 4) && dir->name[length - 4] == '.' && tolower((UINT8)dir->name[length - 3]) == 'i' && tolower((UINT8)dir->name[length - 2]) == 'n' && tolower((UINT8)dir->name[length - 1]) == 'i') @@ -103,8 +99,8 @@ void inifile_manager::load_ini_category(std::vector &temp_filter) return; bool search_clones = false; - std::string filename(ini_index[current_file].name); - long offset = ini_index[current_file].category[current_category].offset; + std::string filename(ini_index[c_file].first); + long offset = ini_index[c_file].second[c_cat].second; if (!core_stricmp(filename.c_str(), "category.ini") || !core_stricmp(filename.c_str(), "alltime.ini")) search_clones = true; diff --git a/src/emu/ui/inifile.h b/src/emu/ui/inifile.h index 5c9e7ebdc65..c16617b25f1 100644 --- a/src/emu/ui/inifile.h +++ b/src/emu/ui/inifile.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/inifile.h @@ -22,41 +22,36 @@ class inifile_manager { public: - // category structure - struct IniCategoryIndex - { - IniCategoryIndex(std::string _name, long _offset) { name = _name; offset = _offset; } - std::string name; - long offset; - }; - - using categoryindex = std::vector; - - // ini file structure - struct IniFileIndex - { - IniFileIndex(std::string _name, categoryindex _category) { name = _name; category = _category; } - std::string name; - categoryindex category; - }; - // construction/destruction inifile_manager(running_machine &machine); // getters running_machine &machine() const { return m_machine; } + std::string get_file(int file = -1) { return ((file == -1) ? ini_index[c_file].first : ini_index[file].first); } + std::string get_category(int cat = -1) { return ((cat == -1) ? ini_index[c_file].second[c_cat].first : ini_index[c_file].second[cat].first); } + size_t total() { return ini_index.size(); } + size_t cat_total() { return ini_index[c_file].second.size(); } + UINT16 &cur_file() { return c_file; } + UINT16 &cur_cat() { return c_cat; } // load games from category void load_ini_category(std::vector &temp_filter); - // files indices - std::vector ini_index; - static UINT16 current_file, current_category; - - std::string actual_file() { return ini_index[current_file].name; } - std::string actual_category() { return ini_index[current_file].category[current_category].name; } + // setters + void move_file(int d) { c_file += d; c_cat = 0; } + void move_cat(int d) { c_cat += d; } + void set_cat(int i = -1) { (i == -1) ? c_cat = 0 : c_cat = i; } + void set_file(int i = -1) { (i == -1) ? c_file = 0 : c_file = i; } private: + + // ini file structure + using categoryindex = std::vector>; + + // files indices + static UINT16 c_file, c_cat; + std::vector> ini_index; + // init category index void init_category(std::string &filename); diff --git a/src/emu/ui/inputmap.cpp b/src/emu/ui/inputmap.cpp index 5ecb4546cce..df146fcf3e1 100644 --- a/src/emu/ui/inputmap.cpp +++ b/src/emu/ui/inputmap.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/inputmap.c + ui/inputmap.cpp Internal menus for input mappings. diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 0cf449e8f84..7fe16d771b0 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/mainmenu.c + ui/mainmenu.cpp Internal MAME menus for the user interface. diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 4682a4fc203..cee5d132eb1 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -35,27 +35,28 @@ struct ui_arts_info { - const char *title, *path, *addpath; + const char *title, *path; }; static const ui_arts_info arts_info[] = { - { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, "snap" }, - { __("Cabinets"), OPTION_CABINETS_PATH, "cabinets;cabdevs" }, - { __("Control Panels"), OPTION_CPANELS_PATH, "cpanel" }, - { __("PCBs"), OPTION_PCBS_PATH, "pcb" }, - { __("Flyers"), OPTION_FLYERS_PATH, "flyers" }, - { __("Titles"), OPTION_TITLES_PATH, "titles" }, - { __("Ends"), OPTION_ENDS_PATH, "ends" }, - { __("Artwork Preview"), OPTION_ARTPREV_PATH, "artwork preview" }, - { __("Bosses"), OPTION_BOSSES_PATH, "bosses" }, - { __("Logos"), OPTION_LOGOS_PATH, "logo" }, - { __("Versus"), OPTION_VERSUS_PATH, "versus" }, - { __("Game Over"), OPTION_GAMEOVER_PATH, "gameover" }, - { __("HowTo"), OPTION_HOWTO_PATH, "howto" }, - { __("Scores"), OPTION_SCORES_PATH, "scores" }, - { __("Select"), OPTION_SELECT_PATH, "select" }, - { __("Marquees"), OPTION_MARQUEES_PATH, "marquees" }, + { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY }, + { __("Cabinets"), OPTION_CABINETS_PATH }, + { __("Control Panels"), OPTION_CPANELS_PATH }, + { __("PCBs"), OPTION_PCBS_PATH }, + { __("Flyers"), OPTION_FLYERS_PATH }, + { __("Titles"), OPTION_TITLES_PATH }, + { __("Ends"), OPTION_ENDS_PATH }, + { __("Artwork Preview"), OPTION_ARTPREV_PATH }, + { __("Bosses"), OPTION_BOSSES_PATH }, + { __("Logos"), OPTION_LOGOS_PATH }, + { __("Versus"), OPTION_VERSUS_PATH }, + { __("Game Over"), OPTION_GAMEOVER_PATH }, + { __("HowTo"), OPTION_HOWTO_PATH }, + { __("Scores"), OPTION_SCORES_PATH }, + { __("Select"), OPTION_SELECT_PATH }, + { __("Marquees"), OPTION_MARQUEES_PATH }, + { __("Covers"), OPTION_COVER_PATH }, { nullptr } }; @@ -1653,9 +1654,35 @@ void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) std::string tmp(searchstr); path_iterator path(tmp.c_str()); - std::string curpath; + std::string curpath, addpath; - path_iterator path_iter(arts_info[ui_globals::curimage_view].addpath); + if (ui_globals::curimage_view != SNAPSHOT_VIEW) + { + ui_options moptions; + for (ui_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) + { + const char *name = f_entry->name(); + if (name && strlen(name) && !strcmp(arts_info[ui_globals::curimage_view].path, f_entry->name())) + { + addpath = f_entry->default_value(); + break; + } + } + } + else + { + emu_options moptions; + for (emu_options::entry *f_entry = moptions.first(); f_entry != nullptr; f_entry = f_entry->next()) + { + const char *name = f_entry->name(); + if (name && strlen(name) && !strcmp(arts_info[ui_globals::curimage_view].path, f_entry->name())) + { + addpath = f_entry->default_value(); + break; + } + } + } + path_iterator path_iter(addpath.c_str()); std::string c_path; // iterate over path and add path for zipped formats diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 4c3b3257a8a..d890f4f4d35 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -1,8 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods,Dankan1890 +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods, Maurizio Petrarota /********************************************************************* - miscmenu.c + ui/miscmenu.cpp Internal MAME menus for the user interface. diff --git a/src/emu/ui/moptions.cpp b/src/emu/ui/moptions.cpp index de0b627ee9f..4f41c7fbdac 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/emu/ui/moptions.cpp @@ -2,7 +2,7 @@ // copyright-holders:Maurizio Petrarota /*************************************************************************** - ui/moptions.c + ui/moptions.cpp UI main options manager. @@ -19,26 +19,27 @@ const options_entry ui_options::s_option_entries[] = { // seach path options - { nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" }, - { OPTION_HISTORY_PATH, "history;dats;.", OPTION_STRING, "path to history files" }, - { OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" }, - { OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" }, - { OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" }, - { OPTION_PCBS_PATH, "pcb", OPTION_STRING, "path to pcbs image" }, - { OPTION_FLYERS_PATH, "flyers", OPTION_STRING, "path to flyers image" }, - { OPTION_TITLES_PATH, "titles", OPTION_STRING, "path to titles image" }, - { OPTION_ENDS_PATH, "ends", OPTION_STRING, "path to ends image" }, - { OPTION_MARQUEES_PATH, "marquees", OPTION_STRING, "path to marquees image" }, - { OPTION_ARTPREV_PATH, "artwork preview", OPTION_STRING, "path to artwork preview image" }, - { OPTION_BOSSES_PATH, "bosses", OPTION_STRING, "path to bosses image" }, - { OPTION_LOGOS_PATH, "logo", OPTION_STRING, "path to logos image" }, - { OPTION_SCORES_PATH, "scores", OPTION_STRING, "path to scores image" }, - { OPTION_VERSUS_PATH, "versus", OPTION_STRING, "path to versus image" }, - { OPTION_GAMEOVER_PATH, "gameover", OPTION_STRING, "path to gameover image" }, - { OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" }, - { OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" }, - { OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" }, - { OPTION_UI_PATH, "ui", OPTION_STRING, "path to UI files" }, + { nullptr, nullptr, OPTION_HEADER, "UI SEARCH PATH OPTIONS" }, + { OPTION_HISTORY_PATH, "history;dats;.", OPTION_STRING, "path to history files" }, + { OPTION_EXTRAINI_PATH, "folders", OPTION_STRING, "path to extra ini files" }, + { OPTION_CABINETS_PATH, "cabinets;cabdevs", OPTION_STRING, "path to cabinets / devices image" }, + { OPTION_CPANELS_PATH, "cpanel", OPTION_STRING, "path to control panel image" }, + { OPTION_PCBS_PATH, "pcb", OPTION_STRING, "path to pcbs image" }, + { OPTION_FLYERS_PATH, "flyers", OPTION_STRING, "path to flyers image" }, + { OPTION_TITLES_PATH, "titles", OPTION_STRING, "path to titles image" }, + { OPTION_ENDS_PATH, "ends", OPTION_STRING, "path to ends image" }, + { OPTION_MARQUEES_PATH, "marquees", OPTION_STRING, "path to marquees image" }, + { OPTION_ARTPREV_PATH, "artwork preview;artpreview", OPTION_STRING, "path to artwork preview image" }, + { OPTION_BOSSES_PATH, "bosses", OPTION_STRING, "path to bosses image" }, + { OPTION_LOGOS_PATH, "logo", OPTION_STRING, "path to logos image" }, + { OPTION_SCORES_PATH, "scores", OPTION_STRING, "path to scores image" }, + { OPTION_VERSUS_PATH, "versus", OPTION_STRING, "path to versus image" }, + { OPTION_GAMEOVER_PATH, "gameover", OPTION_STRING, "path to gameover image" }, + { OPTION_HOWTO_PATH, "howto", OPTION_STRING, "path to howto image" }, + { OPTION_SELECT_PATH, "select", OPTION_STRING, "path to select image" }, + { OPTION_ICONS_PATH, "icons", OPTION_STRING, "path to ICOns image" }, + { OPTION_COVER_PATH, "covers", OPTION_STRING, "path to software cover image" }, + { OPTION_UI_PATH, "ui", OPTION_STRING, "path to UI files" }, // misc options { nullptr, nullptr, OPTION_HEADER, "UI MISC OPTIONS" }, diff --git a/src/emu/ui/moptions.h b/src/emu/ui/moptions.h index 9706dcda7f5..55d800651f4 100644 --- a/src/emu/ui/moptions.h +++ b/src/emu/ui/moptions.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/moptions.h @@ -34,6 +34,7 @@ #define OPTION_HOWTO_PATH "howto_directory" #define OPTION_SELECT_PATH "select_directory" #define OPTION_ICONS_PATH "icons_directory" +#define OPTION_COVER_PATH "covers_directory" #define OPTION_UI_PATH "ui_path" // core misc options @@ -95,6 +96,7 @@ public: const char *howto_directory() const { return value(OPTION_HOWTO_PATH); } const char *select_directory() const { return value(OPTION_SELECT_PATH); } const char *icons_directory() const { return value(OPTION_ICONS_PATH); } + const char *covers_directory() const { return value(OPTION_COVER_PATH); } const char *ui_path() const { return value(OPTION_UI_PATH); } // Misc options diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index c80ad0ad00e..a87de984694 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -91,26 +91,24 @@ void ui_menu_game_options::handle() { if (m_event->iptkey == IPT_UI_LEFT) { - machine().inifile().current_file--; - machine().inifile().current_category = 0; + machine().inifile().move_file(-1); changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT) { - machine().inifile().current_file++; - machine().inifile().current_category = 0; + machine().inifile().move_file(1); changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) { inifile_manager &ifile = machine().inifile(); - int total = ifile.ini_index.size(); + int total = ifile.total(); std::vector s_sel(total); - machine().inifile().current_category = 0; + machine().inifile().set_cat(0); for (size_t index = 0; index < total; ++index) - s_sel[index] = ifile.ini_index[index].name; + s_sel[index] = ifile.get_file(index); - ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.current_file, SELECTOR_INIFILE)); + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.cur_file(), SELECTOR_INIFILE)); } break; } @@ -118,24 +116,23 @@ void ui_menu_game_options::handle() { if (m_event->iptkey == IPT_UI_LEFT) { - machine().inifile().current_category--; + machine().inifile().move_cat(-1); changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT) { - machine().inifile().current_category++; + machine().inifile().move_cat(1); changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) { inifile_manager &ifile = machine().inifile(); - int cfile = ifile.current_file; - int total = ifile.ini_index[cfile].category.size(); + int total = ifile.cat_total(); std::vector s_sel(total); for (int index = 0; index < total; ++index) - s_sel[index] = ifile.ini_index[cfile].category[index].name; + s_sel[index] = ifile.get_category(index); - ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.current_category, SELECTOR_CATEGORY)); + ui_menu::stack_push(global_alloc_clear(machine(), container, s_sel, ifile.cur_cat(), SELECTOR_CATEGORY)); } break; } @@ -217,20 +214,19 @@ void ui_menu_game_options::populate() item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU); // add category subitem - if (m_main == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + if (m_main == FILTER_CATEGORY && machine().inifile().total() > 0) { inifile_manager &inif = machine().inifile(); - int afile = inif.current_file; - arrow_flags = get_arrow_flags(0, inif.ini_index.size() - 1, afile); + arrow_flags = get_arrow_flags(0, inif.total() - 1, inif.cur_file()); fbuff = _(" ^!File"); convert_command_glyph(fbuff); - item_append(fbuff.c_str(), inif.actual_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER); + item_append(fbuff.c_str(), inif.get_file().c_str(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER); - arrow_flags = get_arrow_flags(0, inif.ini_index[afile].category.size() - 1, inif.current_category); + arrow_flags = get_arrow_flags(0, inif.cat_total() - 1, inif.cur_cat()); fbuff = _(" ^!Category"); convert_command_glyph(fbuff); - item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); + item_append(fbuff.c_str(), inif.get_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); } // add manufacturer subitem else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp index 5f1704b79fe..af199b1cfe8 100644 --- a/src/emu/ui/selector.cpp +++ b/src/emu/ui/selector.cpp @@ -1,8 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* - ui/m_selector.cpp + ui/selector.cpp Internal UI user interface. @@ -66,13 +66,13 @@ void ui_menu_selector::handle() switch (m_category) { case SELECTOR_INIFILE: - machine().inifile().current_file = m_selector; - machine().inifile().current_category = 0; + machine().inifile().set_file(m_selector); + machine().inifile().set_cat(0); ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); break; case SELECTOR_CATEGORY: - machine().inifile().current_category = m_selector; + machine().inifile().set_cat(m_selector); ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); break; diff --git a/src/emu/ui/selector.h b/src/emu/ui/selector.h index b2ccba2a8b6..6809729396d 100644 --- a/src/emu/ui/selector.h +++ b/src/emu/ui/selector.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/selector.h diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 567b0f0605c..39480dd0b79 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -194,6 +194,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai ui_globals::switch_image = false; ui_globals::default_image = true; ui_globals::panels_status = moptions.hide_panels(); + m_searchlist[0] = nullptr; } //------------------------------------------------- @@ -810,12 +811,12 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott m_isabios); std::string filtered; - if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + if (main_filters::actual == FILTER_CATEGORY && machine().inifile().total() > 0) { filtered = string_format(_("%1$s (%2$s - %3$s) - "), main_filters::text[main_filters::actual], - machine().inifile().actual_file(), - machine().inifile().actual_category()); + machine().inifile().get_file(), + machine().inifile().get_category()); } else if (main_filters::actual == FILTER_MANUFACTURER) { @@ -1097,7 +1098,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) } } - std::vector biosname; + s_bios biosname; if (!machine().ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)driver, false, false)); else @@ -1154,7 +1155,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) // if everything looks good, schedule the new driver if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { - std::vector biosname; + s_bios biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, false)); else @@ -1187,7 +1188,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { - std::vector biosname; + s_bios biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) { ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); @@ -1195,7 +1196,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) } else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { - std::unordered_map parts; + s_parts parts; for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) { if (swpart->matches_interface(ui_swinfo->interface.c_str())) diff --git a/src/emu/ui/selgame.h b/src/emu/ui/selgame.h index b099f45c796..474aa57ed8a 100644 --- a/src/emu/ui/selgame.h +++ b/src/emu/ui/selgame.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/selgame.h diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 0f0e0da4a6b..b20a35415f0 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/selsoft.cpp @@ -86,7 +86,7 @@ bool compare_software(ui_software_info a, ui_software_info b) // get bios count //------------------------------------------------- -bool has_multiple_bios(const game_driver *driver, std::vector &biosname) +bool has_multiple_bios(const game_driver *driver, s_bios &biosname) { if (driver->rom == nullptr) return 0; @@ -901,7 +901,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) if (ui_swinfo->startempty == 1) { - std::vector biosname; + s_bios biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); else @@ -929,7 +929,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { - std::vector biosname; + s_bios biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) { ui_menu::stack_push(global_alloc_clear(machine(), container, biosname, (void *)ui_swinfo, true, false)); @@ -937,7 +937,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) } else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { - std::unordered_map parts; + s_parts parts; for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) { if (swpart->matches_interface(ui_swinfo->interface.c_str())) @@ -1926,7 +1926,7 @@ void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, // ctor //------------------------------------------------- -ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info) : ui_menu(machine, container) +ui_software_parts::ui_software_parts(running_machine &machine, render_container *container, s_parts parts, ui_software_info *ui_info) : ui_menu(machine, container) { m_parts = parts; m_uiinfo = ui_info; @@ -2019,7 +2019,7 @@ void ui_software_parts::custom_render(void *selectedref, float top, float bottom // ctor //------------------------------------------------- -ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) +ui_bios_selection::ui_bios_selection(running_machine &machine, render_container *container, s_bios biosname, void *_driver, bool _software, bool _inlist) : ui_menu(machine, container) { m_bios = biosname; m_driver = _driver; @@ -2042,7 +2042,7 @@ ui_bios_selection::~ui_bios_selection() void ui_bios_selection::populate() { for (auto & elem : m_bios) - item_append(elem.name.c_str(), nullptr, 0, (void *)&elem.name); + item_append(elem.first.c_str(), nullptr, 0, (void *)&elem.first); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); @@ -2059,7 +2059,7 @@ void ui_bios_selection::handle() emu_options &moptions = machine().options(); if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) for (auto & elem : m_bios) - if ((void*)&elem.name == event->itemref) + if ((void*)&elem.first == event->itemref) { if (!m_software) { @@ -2075,7 +2075,7 @@ void ui_bios_selection::handle() } std::string error; - moptions.set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); + moptions.set_value("bios", elem.second, OPTION_PRIORITY_CMDLINE, error); machine().manager().schedule_new_driver(*s_driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); @@ -2084,14 +2084,14 @@ void ui_bios_selection::handle() { ui_software_info *ui_swinfo = (ui_software_info *)m_driver; std::string error; - machine().options().set_value("bios", elem.id, OPTION_PRIORITY_CMDLINE, error); + machine().options().set_value("bios", elem.second, OPTION_PRIORITY_CMDLINE, error); driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); drivlist.next(); software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); if (!machine().ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { - std::unordered_map parts; + s_parts parts; for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) { if (swpart->matches_interface(ui_swinfo->interface.c_str())) diff --git a/src/emu/ui/selsoft.h b/src/emu/ui/selsoft.h index afb28c48134..a3d121f52c7 100644 --- a/src/emu/ui/selsoft.h +++ b/src/emu/ui/selsoft.h @@ -14,12 +14,8 @@ #include "ui/custmenu.h" -struct s_bios -{ - s_bios(std::string _name, int _id) { name = _name; id = _id; } - std::string name; - int id; -}; +using s_bios = std::vector>; +using s_parts = std::unordered_map; // Menu Class class ui_menu_select_software : public ui_menu @@ -69,7 +65,7 @@ private: class ui_software_parts : public ui_menu { public: - ui_software_parts(running_machine &machine, render_container *container, std::unordered_map parts, ui_software_info *ui_info); + ui_software_parts(running_machine &machine, render_container *container, s_parts parts, ui_software_info *ui_info); virtual ~ui_software_parts(); virtual void populate() override; virtual void handle() override; @@ -77,13 +73,13 @@ public: private: ui_software_info *m_uiinfo; - std::unordered_map m_parts; + s_parts m_parts; }; class ui_bios_selection : public ui_menu { public: - ui_bios_selection(running_machine &machine, render_container *container, std::vector biosname, void *driver, bool software, bool inlist); + ui_bios_selection(running_machine &machine, render_container *container, s_bios biosname, void *driver, bool software, bool inlist); virtual ~ui_bios_selection(); virtual void populate() override; virtual void handle() override; @@ -91,9 +87,9 @@ public: private: - void *m_driver; - bool m_software, m_inlist; - std::vector m_bios; + void *m_driver; + bool m_software, m_inlist; + s_bios m_bios; }; struct reselect_last @@ -108,7 +104,7 @@ private: }; // Getter -bool has_multiple_bios(const game_driver *driver, std::vector &biosname); +bool has_multiple_bios(const game_driver *driver, s_bios &biosname); #endif /* __UI_SELSOFT_H__ */ diff --git a/src/emu/ui/sliders.cpp b/src/emu/ui/sliders.cpp index d53ad402943..b339eaef37b 100644 --- a/src/emu/ui/sliders.cpp +++ b/src/emu/ui/sliders.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - miscmenu.c + ui/sliders.cpp Internal MAME menus for the user interface. diff --git a/src/emu/ui/slotopt.cpp b/src/emu/ui/slotopt.cpp index a67c217c7f1..c4fd58f754f 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/emu/ui/slotopt.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/slotopt.c + ui/slotopt.cpp Internal menu for the slot options. diff --git a/src/emu/ui/sndmenu.cpp b/src/emu/ui/sndmenu.cpp index ab1731e6589..dd3e717d98a 100644 --- a/src/emu/ui/sndmenu.cpp +++ b/src/emu/ui/sndmenu.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /********************************************************************* ui/sndmenu.cpp diff --git a/src/emu/ui/sndmenu.h b/src/emu/ui/sndmenu.h index 8b13b38ea88..24bb0a79277 100644 --- a/src/emu/ui/sndmenu.h +++ b/src/emu/ui/sndmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/sndmenu.h diff --git a/src/emu/ui/starimg.h b/src/emu/ui/starimg.h index 2704e486e5b..f57ebb8797f 100644 --- a/src/emu/ui/starimg.h +++ b/src/emu/ui/starimg.h @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota + static const UINT32 favorite_star_bmp[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/src/emu/ui/swlist.cpp b/src/emu/ui/swlist.cpp index 2d4891d5673..3c2595389b2 100644 --- a/src/emu/ui/swlist.cpp +++ b/src/emu/ui/swlist.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/swlist.c + ui/swlist.cpp Internal MAME user interface for software list. diff --git a/src/emu/ui/tapectrl.cpp b/src/emu/ui/tapectrl.cpp index 0362f0c8a84..510d0eb3fb3 100644 --- a/src/emu/ui/tapectrl.cpp +++ b/src/emu/ui/tapectrl.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /*************************************************************************** - ui/tapectrl.c + ui/tapectrl.cpp Tape control diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index a265e74c7b1..549784cf971 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui.c + ui.cpp Functions used to handle MAME's user interface. diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 5c1485e102b..d6087131285 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Dankan1890 +// copyright-holders:Maurizio Petrarota /*************************************************************************** ui/utils.h diff --git a/src/emu/ui/videoopt.cpp b/src/emu/ui/videoopt.cpp index 6ba6aa710f3..388ee07981b 100644 --- a/src/emu/ui/videoopt.cpp +++ b/src/emu/ui/videoopt.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods /********************************************************************* - ui/videoopt.c + ui/videoopt.cpp Internal menus for video options