diff options
author | 2016-02-24 23:28:16 +0100 | |
---|---|---|
committer | 2016-02-24 23:28:16 +0100 | |
commit | bc2a4317caf8f416cb8a5de7b8d92f4464636d7e (patch) | |
tree | f553c26825bbafa1072d691f97041e83523e5648 | |
parent | 24ced366776e255f11fb4cc7e93c602f87d60356 (diff) |
selsoft: fixed search for software list. (nw)
-rw-r--r-- | src/emu/inpttype.h | 12 | ||||
-rw-r--r-- | src/emu/ui/custui.cpp | 1 | ||||
-rw-r--r-- | src/emu/ui/dirmenu.cpp | 115 | ||||
-rw-r--r-- | src/emu/ui/selsoft.cpp | 3 |
4 files changed, 55 insertions, 76 deletions
diff --git a/src/emu/inpttype.h b/src/emu/inpttype.h index 4d711e4d676..d5567fd2671 100644 --- a/src/emu/inpttype.h +++ b/src/emu/inpttype.h @@ -758,12 +758,12 @@ void construct_core_types_UI(simple_list<input_type_entry> &typelist) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TAPE_STOP, "UI (First) Tape Stop", input_seq(KEYCODE_F2, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DATS, "UI External DAT View", input_seq(KEYCODE_LALT, KEYCODE_D) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAVORITES, "UI Add/Remove favorites",input_seq(KEYCODE_LALT, KEYCODE_F) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_FILTER, NULL, input_seq() ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_FILTER, NULL, input_seq() ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT_PANEL, NULL, input_seq() ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT_PANEL, "UI Right switch image/info", input_seq(KEYCODE_RIGHT, KEYCODE_LCONTROL) ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_PANEL, NULL, input_seq() ) - INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_PANEL, NULL, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_FILTER, nullptr, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_FILTER, nullptr, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT_PANEL, nullptr, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT_PANEL, "UI Right switch image/info",input_seq(KEYCODE_RIGHT, KEYCODE_LCONTROL) ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP_PANEL, nullptr, input_seq() ) + INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN_PANEL, nullptr, input_seq() ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_EXPORT, "UI Export list to xml", input_seq(KEYCODE_LALT, KEYCODE_E) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT_FAST, "UI Audit Unavailable", input_seq(KEYCODE_F1, input_seq::not_code, KEYCODE_LSHIFT) ) INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_AUDIT_ALL, "UI Audit All", input_seq(KEYCODE_F1, KEYCODE_LSHIFT) ) diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 491a27e2dda..2392db122fc 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -120,6 +120,7 @@ void ui_menu_custom_ui::handle() ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_currlang)); } + break; } } } diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index 30a992f2363..1e5717fb566 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -28,33 +28,33 @@ struct folders_entry static const folders_entry s_folders[] = { - { __("ROMs"), OPTION_MEDIAPATH, ADDING }, - { __("UI"), OPTION_UI_PATH, CHANGE }, - { __("Language"), OPTION_LANGUAGEPATH, CHANGE }, - { __("Samples"), OPTION_SAMPLEPATH, ADDING }, - { __("DATs"), OPTION_HISTORY_PATH, CHANGE }, - { __("INIs"), OPTION_INIPATH, ADDING }, - { __("Extra INIs"), OPTION_EXTRAINI_PATH, CHANGE }, - { __("Icons"), OPTION_ICONS_PATH, ADDING }, - { __("Cheats"), OPTION_CHEATPATH, ADDING }, - { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, ADDING }, - { __("Cabinets"), OPTION_CABINETS_PATH, ADDING }, - { __("Flyers"), OPTION_FLYERS_PATH, ADDING }, - { __("Titles"), OPTION_TITLES_PATH, ADDING }, - { __("Ends"), OPTION_ENDS_PATH, ADDING }, - { __("PCBs"), OPTION_PCBS_PATH, ADDING }, - { __("Marquees"), OPTION_MARQUEES_PATH, ADDING }, - { __("Controls Panels"), OPTION_CPANELS_PATH, ADDING }, - { __("Crosshairs"), OPTION_CROSSHAIRPATH, ADDING }, - { __("Artworks"), OPTION_ARTPATH, ADDING }, - { __("Bosses"), OPTION_BOSSES_PATH, ADDING }, - { __("Artworks Preview"), OPTION_ARTPREV_PATH, ADDING }, - { __("Select"), OPTION_SELECT_PATH, ADDING }, - { __("GameOver"), OPTION_GAMEOVER_PATH, ADDING }, - { __("HowTo"), OPTION_HOWTO_PATH, ADDING }, - { __("Logos"), OPTION_LOGOS_PATH, ADDING }, - { __("Scores"), OPTION_SCORES_PATH, ADDING }, - { __("Versus"), OPTION_VERSUS_PATH, ADDING }, + { __("ROMs"), OPTION_MEDIAPATH, ADDING }, + { __("UI"), OPTION_UI_PATH, CHANGE }, + { __("Language"), OPTION_LANGUAGEPATH, CHANGE }, + { __("Samples"), OPTION_SAMPLEPATH, ADDING }, + { __("DATs"), OPTION_HISTORY_PATH, CHANGE }, + { __("INIs"), OPTION_INIPATH, ADDING }, + { __("Extra INIs"), OPTION_EXTRAINI_PATH, CHANGE }, + { __("Icons"), OPTION_ICONS_PATH, ADDING }, + { __("Cheats"), OPTION_CHEATPATH, ADDING }, + { __("Snapshots"), OPTION_SNAPSHOT_DIRECTORY, ADDING }, + { __("Cabinets"), OPTION_CABINETS_PATH, ADDING }, + { __("Flyers"), OPTION_FLYERS_PATH, ADDING }, + { __("Titles"), OPTION_TITLES_PATH, ADDING }, + { __("Ends"), OPTION_ENDS_PATH, ADDING }, + { __("PCBs"), OPTION_PCBS_PATH, ADDING }, + { __("Marquees"), OPTION_MARQUEES_PATH, ADDING }, + { __("Controls Panels"), OPTION_CPANELS_PATH, ADDING }, + { __("Crosshairs"), OPTION_CROSSHAIRPATH, ADDING }, + { __("Artworks"), OPTION_ARTPATH, ADDING }, + { __("Bosses"), OPTION_BOSSES_PATH, ADDING }, + { __("Artworks Preview"), OPTION_ARTPREV_PATH, ADDING }, + { __("Select"), OPTION_SELECT_PATH, ADDING }, + { __("GameOver"), OPTION_GAMEOVER_PATH, ADDING }, + { __("HowTo"), OPTION_HOWTO_PATH, ADDING }, + { __("Logos"), OPTION_LOGOS_PATH, ADDING }, + { __("Scores"), OPTION_SCORES_PATH, ADDING }, + { __("Versus"), OPTION_VERSUS_PATH, ADDING }, }; @@ -94,6 +94,7 @@ void ui_menu_directory::handle() void ui_menu_directory::populate() { + for (auto & elem : s_folders) item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action); @@ -142,7 +143,7 @@ void ui_menu_directory::custom_render(void *selectedref, float top, float bottom // ctor / dtor //------------------------------------------------- -ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref) +ui_menu_display_actual::ui_menu_display_actual(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container), m_ref(ref) { } @@ -179,12 +180,11 @@ void ui_menu_display_actual::handle() void ui_menu_display_actual::populate() { m_tempbuf.assign(_("Current ")).append(_(s_folders[m_ref].name)).append(_(" Folders")); - if (machine().ui().options().exists(s_folders[m_ref].option)) { + if (machine().ui().options().exists(s_folders[m_ref].option)) m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option)); - } - else { + else m_searchpath.assign(machine().options().value(s_folders[m_ref].option)); - } + path_iterator path(m_searchpath.c_str()); std::string curpath; m_folders.clear(); @@ -237,7 +237,7 @@ void ui_menu_display_actual::custom_render(void *selectedref, float top, float b y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + mui.draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // compute our bounds @@ -285,19 +285,14 @@ ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, r std::string searchpath; if (machine.ui().options().exists(s_folders[m_ref].option)) - { searchpath = machine.ui().options().value(s_folders[m_ref].option); - } else - { searchpath = machine.options().value(s_folders[m_ref].option); - } path_iterator path(searchpath.c_str()); std::string curpath; while (path.next(curpath, nullptr)) m_folders.push_back(curpath); - } ui_menu_add_change_folder::~ui_menu_add_change_folder() @@ -372,16 +367,11 @@ void ui_menu_add_change_folder::handle() if (m_change) { if (machine().ui().options().exists(s_folders[m_ref].option)) - { machine().ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - } - else + else if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) { - if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) - { - machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders[m_ref].option); - } + machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } machine().datfile().reset_run(); } @@ -397,16 +387,11 @@ void ui_menu_add_change_folder::handle() } if (machine().ui().options().exists(s_folders[m_ref].option)) - { machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - } - else + else if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) { - if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) - { - machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders[m_ref].option); - } + machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } } @@ -476,13 +461,13 @@ void ui_menu_add_change_folder::handle() void ui_menu_add_change_folder::populate() { // open a path - const char *volume_name; + const char *volume_name = nullptr; file_enumerator path(m_current_path.c_str()); const osd_directory_entry *dirent; int folders_count = 0; // add the drives - for (int i = 0; (volume_name = osd_get_volume_name(i)) != nullptr; i++) + for (int i = 0; (volume_name = osd_get_volume_name(i)) != nullptr; ++i) item_append(volume_name, "[DRIVE]", 0, (void *)(FPTR)++folders_count); // add the directories @@ -581,9 +566,9 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) { m_ref = ref; - if (machine.ui().options().exists(s_folders[m_ref].option)) + if (machine.ui().options().exists(s_folders[m_ref].option)) m_searchpath.assign(machine.ui().options().value(s_folders[m_ref].option)); - else + else m_searchpath.assign(machine.options().value(s_folders[m_ref].option)); path_iterator path(m_searchpath.c_str()); @@ -616,16 +601,11 @@ void ui_menu_remove_folder::handle() } if (machine().ui().options().exists(s_folders[m_ref].option)) - { machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - } - else + else if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) { - if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) - { - machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().options().mark_changed(s_folders[m_ref].option); - } + machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(s_folders[m_ref].option); } ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); @@ -644,7 +624,6 @@ void ui_menu_remove_folder::populate() item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -678,6 +657,6 @@ void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bo y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, + mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index ad374bb9b83..4cc43bbdb39 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -318,7 +318,6 @@ void ui_menu_select_software::handle() if (check_filter) { m_search[0] = '\0'; - switch (l_sw_hover) { case UI_SW_REGION: @@ -1184,7 +1183,7 @@ void ui_menu_select_software::find_matches(const char *str, int count) std::vector<int> penalty(count, 9999); int index = 0; - for (; m_displaylist[index]; ++index) + for (; index < m_displaylist.size(); ++index) { // pick the best match between driver name and description int curpenalty = fuzzy_substring(str, m_displaylist[index]->longname); |