From d3321154af542703370d8b184c81bdf50d85e80b Mon Sep 17 00:00:00 2001 From: Axanar Date: Thu, 12 Dec 2019 19:21:36 -0500 Subject: [PATCH 1/3] merge the 4 PS1 select states into one and add a line in the options menu to choose a select sub-state. in config.ini: "ps1select" = "All Games", "Internal Only", "Games Subdir", "Favorites" --- src/code/engine/config.cpp | 5 + src/code/gui/gui.cpp | 20 +- src/code/gui/gui.h | 19 +- src/code/gui/gui_options.cpp | 359 ++++++++++-------------- src/code/gui/gui_options.h | 28 +- src/code/launcher/gui_launcher.cpp | 62 ++-- src/code/launcher/gui_launcher.h | 2 +- src/code/launcher/gui_launcher_loop.cpp | 23 +- 8 files changed, 251 insertions(+), 267 deletions(-) diff --git a/src/code/engine/config.cpp b/src/code/engine/config.cpp index f5a0b53..1eb15f4 100644 --- a/src/code/engine/config.cpp +++ b/src/code/engine/config.cpp @@ -55,6 +55,11 @@ Config::Config() inifile.values["showingtimeout"]=DefaultShowingTimeoutText; aDefaultWasSet = true; } + if (inifile.values["ps1select"]=="") + { + inifile.values["ps1select"]="All Games"; + aDefaultWasSet = true; + } inifile.values["pcsx"]="bleemsync"; diff --git a/src/code/gui/gui.cpp b/src/code/gui/gui.cpp index 11e137a..6eef66c 100644 --- a/src/code/gui/gui.cpp +++ b/src/code/gui/gui.cpp @@ -154,6 +154,24 @@ string GuiBase::getCurrentThemeFontPath() { #endif } +//******************************* +// GuiBase::getPS1SelectSubState +// if the set is SET_PS1, the config.ini contains the sub category of the PS1 game display +//******************************* +int GuiBase::getPS1SelectSubState() { + string ps1_SelectSubStateString = cfg.inifile.values["ps1select"]; + if (ps1_SelectSubStateString == "All Games") + return CFG_PS1_All_Games; + if (ps1_SelectSubStateString == "Internal Only") + return CFG_PS1_Internal_Only; + if (ps1_SelectSubStateString == "Games Subdir") + return CFG_PS1_Games_Subdir; + if (ps1_SelectSubStateString == "Favorites") + return CFG_PS1_Favorites; + else + return CFG_PS1_All_Games; // unknown config.ini value, return default +} + //******************************* // Gui //******************************* @@ -729,7 +747,7 @@ void Gui::menuSelection() { menuVisible = false; } else { if (lastSet < 0) { - lastSet = SET_ALL; + lastSet = SET_PS1; lastSelIndex=0; resumingGui = false; } diff --git a/src/code/gui/gui.h b/src/code/gui/gui.h index 6a8afd1..30f8e0d 100644 --- a/src/code/gui/gui.h +++ b/src/code/gui/gui.h @@ -42,15 +42,14 @@ enum MenuOption { MENU_OPTION_SCAN = 1, MENU_OPTION_RUN, MENU_OPTION_SONY, MENU_ #define POS_RIGHT 2 // if you add a new set also update setNames in gui_launcher.cpp -#define SET_ALL 0 -#define SET_INTERNAL 1 -#define SET_EXTERNAL 2 -#define SET_FAVORITE 3 -#define SET_RETROARCH 4 -#define SET_APPS 5 -#define SET_LAST 5 - +#define SET_PS1 0 +#define SET_RETROARCH 1 +#define SET_APPS 2 +#define SET_LAST 2 +// CFG_PS1GAMES_SELECT select states +// in config.ini: "ps1select" = "All Games", "Internal Only", "Games Subdir", "Favorites" +enum { CFG_PS1_All_Games=0, CFG_PS1_Internal_Only, CFG_PS1_Games_Subdir, CFG_PS1_Favorites }; //******************** // GuiBase @@ -69,6 +68,8 @@ class GuiBase { std::string getCurrentThemeFontPath(); std::string getCurrentThemeSoundPath(); + int getPS1SelectSubState(); // if the set is SET_PS1, the config.ini contains the sub category of the PS1 game display + GuiBase(); ~GuiBase(); }; @@ -169,7 +170,7 @@ class Gui : public GuiBase { MenuOption menuOption = MENU_OPTION_SCAN; // these are saved in gui so the next time Start brings up the carousel it can restore to last state - int lastSet = SET_ALL; // all games, internal, usb game dir, favorites, RA playlist + int lastSet = SET_PS1; // all games, internal, usb game dir, favorites, RA playlist int lastSelIndex = 0; // index into carouselGames int lastUSBGameDirIndex = 0; // top row in menu = /Games int lastRAPlaylistIndex = 0; // top row in menu = first playlist name diff --git a/src/code/gui/gui_options.cpp b/src/code/gui/gui_options.cpp index 7298118..e6cada1 100644 --- a/src/code/gui/gui_options.cpp +++ b/src/code/gui/gui_options.cpp @@ -4,20 +4,43 @@ #include "gui_options.h" #include "../util.h" -#include "gui.h" -#include "../lang.h" #include "../environment.h" using namespace std; +enum { + CFG_THEME=0, + CFG_PS1GAMES_SELECT, + CFG_SHOW_ORIGAMES, + CFG_SHOW_RETROARCH, + CFG_UI, + CFG_JEWEL, + CFG_MUSIC, + CFG_ENABLE_BACKGROUND_MUSIC, + CFG_WIDESCREEN, + CFG_QUICK_BOOT, + CFG_QUICKMENU, + CFG_GFX_FILTER, + CFG_ADV, + CFG_SHOWINGTIMEOUT, + CFG_LANG +}; +#define CFG_LAST CFG_LANG + +// CFG_PS1GAMES_SELECT select states +// in config.ini: "ps1select" = "All Games", "Internal Only", "Games Subdir", "Favorites" +vector ps1SelectStrings { "All Games", "Internal Only", "Games Subdir", "Favorites" }; + //******************************* -// GuiOptions::getOption +// GuiOptions::getPrevNextOption //******************************* -string GuiOptions::getOption(const vector & list, const string & current, bool next) { +string GuiOptions::getPrevNextOption(const vector & list, const string & current, bool next) { + // find current position int pos = 0; for (int i = 0; i < list.size(); i++) { if (list[i] == current) { pos = i; + break; } } @@ -34,6 +57,116 @@ string GuiOptions::getOption(const vector & list, const string & current return list[pos]; } +//******************************* +// GuiOptions::doPrevNextOption +//******************************* +void GuiOptions::doPrevNextOption(shared_ptr gui, shared_ptr lang, bool next) { + if (selOption == CFG_THEME) { + string nextValue = getPrevNextOption(autobleemUIThemes, gui->cfg.inifile.values["theme"], next); + gui->cfg.inifile.values["theme"] = nextValue; + init(); + gui->loadAssets(); + } + + if (selOption == CFG_PS1GAMES_SELECT) { + string nextValue = getPrevNextOption(ps1SelectState, gui->cfg.inifile.values["ps1select"], next); + gui->cfg.inifile.values["ps1select"] = nextValue; + init(); + gui->loadAssets(); + } + + if (selOption == CFG_SHOW_ORIGAMES) { + string nextValue = getPrevNextOption(origames, gui->cfg.inifile.values["origames"], next); + gui->cfg.inifile.values["origames"] = nextValue; + } + + if (selOption == CFG_SHOW_RETROARCH) { + string nextValue = getPrevNextOption(retroarch, gui->cfg.inifile.values["retroarch"], next); + gui->cfg.inifile.values["retroarch"] = nextValue; + } + + if (selOption == CFG_UI) { + string nextValue = getPrevNextOption(ui, gui->cfg.inifile.values["ui"], next); + gui->cfg.inifile.values["ui"] = nextValue; + } + + if (selOption == CFG_JEWEL) { + string nextValue = getPrevNextOption(jewels, gui->cfg.inifile.values["jewel"], next); + gui->cfg.inifile.values["jewel"] = nextValue; + } + + if (selOption == CFG_MUSIC) { + string nextValue = getPrevNextOption(music, gui->cfg.inifile.values["music"], next); + gui->cfg.inifile.values["music"] = nextValue; + init(); + gui->loadAssets(); + } + + if (selOption == CFG_ENABLE_BACKGROUND_MUSIC) { + string nextValue = getPrevNextOption(nomusic, gui->cfg.inifile.values["nomusic"], next); + gui->cfg.inifile.values["nomusic"] = nextValue; + init(); + gui->loadAssets(); + } + + if (selOption == CFG_WIDESCREEN) { + string nextValue = getPrevNextOption(aspect, gui->cfg.inifile.values["aspect"], next); + gui->cfg.inifile.values["aspect"] = nextValue; + } + + if (selOption == CFG_QUICK_BOOT) { + string nextValue = getPrevNextOption(quickboot, gui->cfg.inifile.values["quick"], next); + if (next) { + string last = gui->cfg.inifile.values["quick"]; + gui->cfg.inifile.values["quick"] = nextValue; + int delay = atoi(gui->cfg.inifile.values["delay"].c_str()); + delay++; + if (last == "false") delay = 1; + gui->cfg.inifile.values["delay"] = to_string(delay); + } else { + int delay = atoi(gui->cfg.inifile.values["delay"].c_str()); + delay++; + gui->cfg.inifile.values["delay"] = to_string(1); + gui->cfg.inifile.values["quick"] = nextValue; + } + } + + if (selOption == CFG_QUICKMENU) { + string nextValue = getPrevNextOption(quickmenu, gui->cfg.inifile.values["quickmenu"], next); + gui->cfg.inifile.values["quickmenu"] = nextValue; + } + + if (selOption == CFG_GFX_FILTER) { + string nextValue = getPrevNextOption(mip, gui->cfg.inifile.values["mip"], next); + gui->cfg.inifile.values["mip"] = nextValue; + } + + if (selOption == CFG_ADV) { + string nextValue = getPrevNextOption(adv, gui->cfg.inifile.values["adv"], next); + gui->cfg.inifile.values["adv"] = nextValue; + } + + if (selOption == CFG_SHOWINGTIMEOUT) { +// if (next) { + string nextValue = getPrevNextOption(showingtimeout, gui->cfg.inifile.values["showingtimeout"], next); + gui->cfg.inifile.values["showingtimeout"] = nextValue; +// } else { +// // it looks like it was preventing wrap around from 0 to 20 but wrap around isn't in getPrevNextOption +// string curValue = gui->cfg.inifile.values["showingtimeout"]; +// string nextValue = getPrevNextOption(showingtimeout, curValue, false); +// if (curValue != "0") +// gui->cfg.inifile.values["showingtimeout"] = nextValue; +// } + } + + if (selOption == CFG_LANG) { + string nextValue = getPrevNextOption(languages, gui->cfg.inifile.values["language"], next); + gui->cfg.inifile.values["language"] = nextValue; + lang->load(nextValue); + init(); + } +} + //******************************* // GuiOptions::init //******************************* @@ -41,7 +174,6 @@ void GuiOptions::init() { shared_ptr lang(Lang::getInstance()); autobleemUIThemes.clear(); - menuThemes.clear(); string uiThemePath = Env::getPathToThemesDir(); DirEntries uiThemeFolders = DirEntry::diru_DirsOnly(uiThemePath); @@ -51,13 +183,8 @@ void GuiOptions::init() { } } - string menuThemePath = Env::getPathToThemesDir(); - DirEntries menuThemeFolders = DirEntry::diru_DirsOnly(menuThemePath); - for (const DirEntry & entry : menuThemeFolders) { - if (DirEntry::exists(menuThemePath + sep + entry.name + sep + "images")) { - menuThemes.push_back(entry.name); - } - } + ps1SelectState = ps1SelectStrings; + pcsx.clear(); pcsx.push_back("original"); pcsx.push_back("bleemsync"); @@ -116,22 +243,6 @@ void GuiOptions::init() { } } -#define CFG_LANG 0 -#define CFG_THEME 1 -#define CFG_UI 2 -#define CFG_JEWEL 3 -#define CFG_MUSIC 4 -#define CFG_ORIGAMES 5 -#define CFG_ASPECT 6 -#define CFG_QUICK 7 -#define CFG_QUICKMENU 8 -#define CFG_BGM 9 -#define CFG_MIP 10 -#define CFG_RA 11 -#define CFG_ADV 12 -#define CFG_SHOWINGTIMEOUT 13 -#define CFG_LAST 13 - //******************************* // GuiOptions::getBooleanIcon //******************************* @@ -187,21 +298,25 @@ void GuiOptions::render() { int offset = gui->renderLogo(true); totalHeight = 0; gui->renderTextLine("-=" + _("Configuration") + "=-", 0, offset, POS_CENTER); - renderOptionLine(_("Language:") + " " + gui->cfg.inifile.values["language"], CFG_LANG + 1, offset); + renderOptionLine(_("AutoBleem Theme:") + " " + gui->cfg.inifile.values["theme"], CFG_THEME + 1, offset); + renderOptionLine(_("PS1 Games Selection:") + " " + gui->cfg.inifile.values["ps1select"], CFG_PS1GAMES_SELECT + 1, offset); + renderOptionLine(_("Show Internal Games:") + " " + getBooleanIcon("origames"), CFG_SHOW_ORIGAMES + 1, offset); + renderOptionLine(_("Show RetroArch Games:") + " " + getBooleanIcon("retroarch"), CFG_SHOW_RETROARCH + 1, offset); renderOptionLine(_("UI:") + " " + gui->cfg.inifile.values["ui"], CFG_UI + 1, offset); renderOptionLine(_("Cover Style:") + " " + gui->cfg.inifile.values["jewel"], CFG_JEWEL + 1, offset); renderOptionLine(_("Music:") + " " + gui->cfg.inifile.values["music"], CFG_MUSIC + 1, offset); - renderOptionLine(_("Internal Games:") + " " + getBooleanIcon("origames"), CFG_ORIGAMES + 1, offset); - renderOptionLine(_("Widescreen:") + " " + getBooleanIcon("aspect"), CFG_ASPECT + 1, offset); - renderOptionLine(_("QuickBoot:") + " " + getBooleanIcon("quick"), CFG_QUICK + 1, offset); + renderOptionLine(_("Background Music:") + " " + getBooleanIcon("nomusic"), CFG_ENABLE_BACKGROUND_MUSIC + 1, offset); + renderOptionLine(_("Widescreen:") + " " + getBooleanIcon("aspect"), CFG_WIDESCREEN + 1, offset); + renderOptionLine(_("QuickBoot:") + " " + getBooleanIcon("quick"), CFG_QUICK_BOOT + 1, offset); renderOptionLine(_("QuickBoot Init:") + " " + gui->cfg.inifile.values["quickmenu"], CFG_QUICKMENU + 1, offset); - renderOptionLine(_("Background Music:") + " " + getBooleanIcon("nomusic"), CFG_BGM + 1, offset); - gui->cfg.inifile.values["autoregion"] = "true"; // removing this as an option - not needed - just set to true - renderOptionLine(_("GFX Filter:") + " " + getBooleanIcon("mip"), CFG_MIP + 1, offset); - renderOptionLine(_("Show RetroArch:") + " " + getBooleanIcon("retroarch"), CFG_RA + 1, offset); + renderOptionLine(_("GFX Filter:") + " " + getBooleanIcon("mip"), CFG_GFX_FILTER + 1, offset); renderOptionLine(_("Advanced:") + " " + getBooleanIcon("adv"), CFG_ADV + 1, offset); renderOptionLine(_("Showing Timeout (0 = no timeout):") + " " + gui->cfg.inifile.values["showingtimeout"], CFG_SHOWINGTIMEOUT + 1, offset); + renderOptionLine(_("Language:") + " " + gui->cfg.inifile.values["language"], CFG_LANG + 1, offset); + + gui->cfg.inifile.values["autoregion"] = "true"; // removing this as an option - not needed - just set to true + gui->renderStatus("|@X| " + _("OK") + " " + "|@O| " + _("Cancel") + "|"); // gui->renderSelectionBox(selOption+1,offset); @@ -279,7 +394,7 @@ void GuiOptions::loop() { Mix_PlayChannel(-1, gui->cursor, 0); selOption--; if (selOption < 0) { - selOption = 0; + selOption = CFG_LAST; } render(); } @@ -288,184 +403,20 @@ void GuiOptions::loop() { Mix_PlayChannel(-1, gui->cursor, 0); selOption++; if (selOption > CFG_LAST) { - selOption = CFG_LAST; + selOption = 0; } render(); } if (gui->mapper.isRight(&e)) { Mix_PlayChannel(-1, gui->cursor, 0); - if (selOption == CFG_LANG) { - string nextValue = getOption(languages, gui->cfg.inifile.values["language"], true); - gui->cfg.inifile.values["language"] = nextValue; - lang->load(nextValue); - init(); - } - - if (selOption == CFG_THEME) { - string nextValue = getOption(autobleemUIThemes, gui->cfg.inifile.values["theme"], true); - gui->cfg.inifile.values["theme"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_BGM) { - string nextValue = getOption(nomusic, gui->cfg.inifile.values["nomusic"], true); - gui->cfg.inifile.values["nomusic"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_MUSIC) { - string nextValue = getOption(music, gui->cfg.inifile.values["music"], true); - gui->cfg.inifile.values["music"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_MIP) { - string nextValue = getOption(mip, gui->cfg.inifile.values["mip"], true); - gui->cfg.inifile.values["mip"] = nextValue; - } - - if (selOption == CFG_UI) { - string nextValue = getOption(ui, gui->cfg.inifile.values["ui"], true); - gui->cfg.inifile.values["ui"] = nextValue; - } - - if (selOption == CFG_RA) { - string nextValue = getOption(retroarch, gui->cfg.inifile.values["retroarch"], true); - gui->cfg.inifile.values["retroarch"] = nextValue; - } - - if (selOption == CFG_ADV) { - string nextValue = getOption(adv, gui->cfg.inifile.values["adv"], true); - gui->cfg.inifile.values["adv"] = nextValue; - } - - if (selOption == CFG_ASPECT) { - string nextValue = getOption(aspect, gui->cfg.inifile.values["aspect"], true); - gui->cfg.inifile.values["aspect"] = nextValue; - } - - if (selOption == CFG_ORIGAMES) { - string nextValue = getOption(origames, gui->cfg.inifile.values["origames"], true); - gui->cfg.inifile.values["origames"] = nextValue; - } - - if (selOption == CFG_JEWEL) { - string nextValue = getOption(jewels, gui->cfg.inifile.values["jewel"], true); - gui->cfg.inifile.values["jewel"] = nextValue; - } - - if (selOption == CFG_QUICKMENU) { - string nextValue = getOption(quickmenu, gui->cfg.inifile.values["quickmenu"], true); - gui->cfg.inifile.values["quickmenu"] = nextValue; - } - - if (selOption == CFG_QUICK) { - string nextValue = getOption(quickboot, gui->cfg.inifile.values["quick"], true); - string last = gui->cfg.inifile.values["quick"]; - gui->cfg.inifile.values["quick"] = nextValue; - int delay = atoi(gui->cfg.inifile.values["delay"].c_str()); - delay++; - if (last == "false") delay = 1; - gui->cfg.inifile.values["delay"] = to_string(delay); - } - - if (selOption == CFG_SHOWINGTIMEOUT) { - string nextValue = getOption(showingtimeout, gui->cfg.inifile.values["showingtimeout"], true); - gui->cfg.inifile.values["showingtimeout"] = nextValue; - } - + doPrevNextOption(gui, lang, true); render(); } if (gui->mapper.isLeft(&e)) { Mix_PlayChannel(-1, gui->cursor, 0); - if (selOption == CFG_LANG) { - string nextValue = getOption(languages, gui->cfg.inifile.values["language"], false); - gui->cfg.inifile.values["language"] = nextValue; - lang->load(nextValue); - init(); - } - - if (selOption == CFG_THEME) { - string nextValue = getOption(autobleemUIThemes, gui->cfg.inifile.values["theme"], false); - gui->cfg.inifile.values["theme"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_MUSIC) { - string nextValue = getOption(music, gui->cfg.inifile.values["music"], false); - gui->cfg.inifile.values["music"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_BGM) { - string nextValue = getOption(nomusic, gui->cfg.inifile.values["nomusic"], false); - gui->cfg.inifile.values["nomusic"] = nextValue; - init(); - gui->loadAssets(); - } - - if (selOption == CFG_MIP) { - string nextValue = getOption(mip, gui->cfg.inifile.values["mip"], false); - gui->cfg.inifile.values["mip"] = nextValue; - } - - if (selOption == CFG_UI) { - string nextValue = getOption(ui, gui->cfg.inifile.values["ui"], false); - gui->cfg.inifile.values["ui"] = nextValue; - } - - if (selOption == CFG_RA) { - string nextValue = getOption(retroarch, gui->cfg.inifile.values["retroarch"], false); - gui->cfg.inifile.values["retroarch"] = nextValue; - } - - if (selOption == CFG_ADV) { - string nextValue = getOption(adv, gui->cfg.inifile.values["adv"], false); - gui->cfg.inifile.values["adv"] = nextValue; - } - - if (selOption == CFG_ASPECT) { - string nextValue = getOption(aspect, gui->cfg.inifile.values["aspect"], false); - gui->cfg.inifile.values["aspect"] = nextValue; - } - - if (selOption == CFG_ORIGAMES) { - string nextValue = getOption(origames, gui->cfg.inifile.values["origames"], false); - gui->cfg.inifile.values["origames"] = nextValue; - } - - if (selOption == CFG_JEWEL) { - string nextValue = getOption(jewels, gui->cfg.inifile.values["jewel"], false); - gui->cfg.inifile.values["jewel"] = nextValue; - } - - if (selOption == CFG_QUICKMENU) { - string nextValue = getOption(quickmenu, gui->cfg.inifile.values["quickmenu"], false); - gui->cfg.inifile.values["quickmenu"] = nextValue; - } - - if (selOption == CFG_QUICK) { - string nextValue = getOption(quickboot, gui->cfg.inifile.values["quick"], false); - int delay = atoi(gui->cfg.inifile.values["delay"].c_str()); - delay++; - gui->cfg.inifile.values["delay"] = to_string(1); - gui->cfg.inifile.values["quick"] = nextValue; - } - - if (selOption == CFG_SHOWINGTIMEOUT) { - string curValue =gui->cfg.inifile.values["showingtimeout"]; - string nextValue = getOption(showingtimeout, curValue, false); - if (curValue != "0") - gui->cfg.inifile.values["showingtimeout"] = nextValue; - } - + doPrevNextOption(gui, lang, false); render(); } break; diff --git a/src/code/gui/gui_options.h b/src/code/gui/gui_options.h index ac94788..2ae173f 100644 --- a/src/code/gui/gui_options.h +++ b/src/code/gui/gui_options.h @@ -4,6 +4,8 @@ #pragma once #include "gui_screen.h" +#include "gui.h" +#include "../lang.h" #include #include @@ -15,7 +17,8 @@ class GuiOptions : public GuiScreen{ void init(); void render(); void loop(); - std::string getOption(const std::vector & list, const std::string & current, bool next); + std::string getPrevNextOption(const std::vector & list, const std::string & current, bool next); + void doPrevNextOption(shared_ptr gui, shared_ptr lang, bool next); std::string getBooleanIcon(const std::string & input); void renderOptionLine(const std::string & text, int pos, int offset); @@ -24,22 +27,23 @@ class GuiOptions : public GuiScreen{ int exitCode=0; std::vector autobleemUIThemes; - std::vector menuThemes; - std::vector pcsx; - std::vector mip; - std::vector nomusic; - std::vector autoregion; - std::vector quickboot; - std::vector quickmenu; + std::vector ps1SelectState; + std::vector origames; std::vector retroarch; - std::vector adv; - std::vector languages; std::vector ui; - std::vector aspect; - std::vector origames; std::vector jewels; std::vector music; + std::vector nomusic; + std::vector aspect; + std::vector quickboot; + std::vector quickmenu; + std::vector mip; + std::vector adv; std::vector showingtimeout; + std::vector languages; + + std::vector pcsx; + std::vector autoregion; using GuiScreen::GuiScreen; }; diff --git a/src/code/launcher/gui_launcher.cpp b/src/code/launcher/gui_launcher.cpp index 98b02c2..8405746 100644 --- a/src/code/launcher/gui_launcher.cpp +++ b/src/code/launcher/gui_launcher.cpp @@ -54,6 +54,9 @@ void GuiLauncher::getGames_SET_FAVORITE(PsGames *gamesList) { [](const PsGamePtr &game) { return game->favorite; }); } +//******************************* +// GuiLauncher::getGames_SET_APPS +//******************************* void GuiLauncher::getGames_SET_APPS(PsGames *gamesList) { PsGames completeList; @@ -167,28 +170,29 @@ void GuiLauncher::switchSet(int newSet, bool noForce) { // get fresh list of games for this set PsGames gamesList; - if (currentSet == SET_ALL) { - getGames_SET_SUBDIR(0, &gamesList); // get the games in row 0 = /Games and on down - - } else if (currentSet == SET_EXTERNAL) { - getGames_SET_SUBDIR(currentUSBGameDirIndex, - &gamesList); // get the games in the current subdir of /Games and on down + if (currentSet == SET_PS1) { + + int ps1SubState = gui->getPS1SelectSubState(); + if (ps1SubState == CFG_PS1_All_Games) { + getGames_SET_SUBDIR(0, &gamesList); // get the games in row 0 = /Games and on down + if (gui->cfg.inifile.values["origames"] == "true") // if include internal games in all games + appendGames_SET_INTERNAL(&gamesList); // add internal games too + } else if (ps1SubState == CFG_PS1_Internal_Only) { + appendGames_SET_INTERNAL(&gamesList); // since it starts out empty this sets only internal + } else if (ps1SubState == CFG_PS1_Games_Subdir) { + // get the games in the current subdir of /Games and on down + getGames_SET_SUBDIR(currentUSBGameDirIndex, &gamesList); + } else if (ps1SubState == CFG_PS1_Favorites) { + getGames_SET_FAVORITE(&gamesList); + } } else if (currentSet == SET_RETROARCH) { getGames_SET_RETROARCH(currentRAPlaylistName, &gamesList); - } else if (currentSet == SET_FAVORITE) { - getGames_SET_FAVORITE(&gamesList); - } else if (currentSet == SET_APPS) { getGames_SET_APPS(&gamesList); } - if (gui->cfg.inifile.values["origames"] == "true") - if (currentSet == SET_ALL || currentSet == SET_INTERNAL) { - appendGames_SET_INTERNAL(&gamesList); - } - sort(gamesList.begin(), gamesList.end(), sortByTitle); cout << "Games Sorted" << endl; // copy the gamesList into the carousel @@ -228,12 +232,14 @@ void GuiLauncher::switchSet(int newSet, bool noForce) { // GuiLauncher::showSetName //******************************* void GuiLauncher::showSetName() { - vector setNames = {_("Showing: All games"), - _("Showing: Internal games"), - _("Showing: USB Games Directory:") + " ", - _("Showing: Favorite games"), + vector setNames = { "Showing: PS1 games", // this is a dummy entry. setPS1SubStateNames is used. _("Showing: Retroarch") + " ", - _("Showing: Apps") + " ", + _("Showing: Apps") + " " + }; + vector setPS1SubStateNames = {_("Showing: All games") + " ", + _("Showing: Internal games") + " ", + _("Showing: USB Games Directory:") + " ", + _("Showing: Favorite games") + " " }; string numGames = " (" + to_string(numberOfNonDuplicatedGamesInCarousel) + " " + _("games") + ")"; @@ -242,13 +248,21 @@ void GuiLauncher::showSetName() { if (str != "") timeout = stoi(str.c_str()) * TicksPerSecond; - if (currentSet == SET_RETROARCH) { + if (currentSet == SET_PS1) { + int ps1SubState = gui->getPS1SelectSubState(); + if (ps1SubState == CFG_PS1_All_Games) { + notificationLines[0].setText(setPS1SubStateNames[ps1SubState] + numGames, timeout); + } else if (ps1SubState == CFG_PS1_Internal_Only) { + notificationLines[0].setText(setPS1SubStateNames[ps1SubState] + numGames, timeout); + } else if (ps1SubState == CFG_PS1_Games_Subdir) { + notificationLines[0].setText(setPS1SubStateNames[ps1SubState] + currentUSBGameDirName + numGames, timeout); + } else if (ps1SubState == CFG_PS1_Favorites) { + notificationLines[0].setText(setPS1SubStateNames[ps1SubState] + numGames, timeout); + } + } else if (currentSet == SET_RETROARCH) { string playlist = DirEntry::getFileNameWithoutExtension(currentRAPlaylistName); notificationLines[0].setText(setNames[currentSet] + playlist + " " + numGames, timeout); - } else if (currentSet == SET_EXTERNAL) { - // currentUSBGameDirIndex starts at 0 for top row = /Games - notificationLines[0].setText(setNames[currentSet] + currentUSBGameDirName + numGames, timeout); - } else { + } else if (currentSet == SET_APPS) { notificationLines[0].setText(setNames[currentSet] + numGames, timeout); } } diff --git a/src/code/launcher/gui_launcher.h b/src/code/launcher/gui_launcher.h index b0a53e7..78349ab 100644 --- a/src/code/launcher/gui_launcher.h +++ b/src/code/launcher/gui_launcher.h @@ -84,7 +84,7 @@ class GuiLauncher : public GuiScreen { shared_ptr gui; - int currentSet = SET_ALL; + int currentSet = SET_PS1; void switchSet(int newSet, bool noForce); void showSetName(); diff --git a/src/code/launcher/gui_launcher_loop.cpp b/src/code/launcher/gui_launcher_loop.cpp index 112dcb9..2c6d2fb 100644 --- a/src/code/launcher/gui_launcher_loop.cpp +++ b/src/code/launcher/gui_launcher_loop.cpp @@ -392,7 +392,7 @@ void GuiLauncher::loop_chooseRAPlaylist() { void GuiLauncher::loop_selectButtonPressed() { if (state == STATE_GAMES) { if (powerOffShift) { - if (currentSet == SET_EXTERNAL) + if (currentSet == SET_PS1 && gui->getPS1SelectSubState() == CFG_PS1_Games_Subdir) loop_chooseGameDir(); else if (currentSet == SET_RETROARCH) loop_chooseRAPlaylist(); @@ -411,11 +411,6 @@ void GuiLauncher::loop_selectButtonPressed() { menuText->setText(texts[0], fgR, fgG, fgB); } - if (gui->cfg.inifile.values["origames"] != "true") { - if (currentSet == SET_INTERNAL) { - currentSet = SET_EXTERNAL; - } - } if (currentSet > SET_LAST) currentSet = 0; switchSet(currentSet,false); showSetName(); @@ -627,12 +622,6 @@ void GuiLauncher::loop_crossButtonPressed_STATE_SET__OPT_AB_SETTINGS() { currentRAPlaylistIndex = lastRAPlaylistIndex; selGameIndex = lastGame; bool resetCarouselPosition = false; - if (gui->cfg.inifile.values["origames"] != "true") { - if (currentSet == SET_INTERNAL) { - currentSet = SET_ALL; - resetCarouselPosition = true; - } - } switchSet(currentSet,false); showSetName(); @@ -703,8 +692,8 @@ void GuiLauncher::loop_crossButtonPressed_STATE_SET__OPT_EDIT_GAME_SETTINGS() { gui->db->updateTitle(carouselGames[selGameIndex]->gameId, gameIni.values["title"]); } gui->db->refreshGame(carouselGames[selGameIndex]); - if (currentSet == SET_FAVORITE && editor->gameIni.values["favorite"] == "0") { - gui->lastSet = SET_FAVORITE; + if (currentSet == SET_PS1 && editor->gameIni.values["favorite"] == "0") { + gui->lastSet = SET_PS1; loadAssets(); } } else { @@ -712,8 +701,10 @@ void GuiLauncher::loop_crossButtonPressed_STATE_SET__OPT_EDIT_GAME_SETTINGS() { gui->internalDB->updateTitle(carouselGames[selGameIndex]->gameId, editor->lastName); } gui->internalDB->refreshGameInternal(carouselGames[selGameIndex]); - if (currentSet == SET_FAVORITE && editor->gameData->favorite == false) { - gui->lastSet = SET_FAVORITE; + if (currentSet == SET_PS1 && gui->getPS1SelectSubState() == CFG_PS1_Favorites && + editor->gameData->favorite == false) + { + gui->lastSet = SET_PS1; loadAssets(); } } From bb6810aa11acaddeeb39b25cca4d1d715093e1cf Mon Sep 17 00:00:00 2001 From: Axanar Date: Thu, 12 Dec 2019 23:26:21 -0500 Subject: [PATCH 2/3] [feature/merge_PS1_selects]: lang update --- src/resources/lang/English.txt | 26 ++++++++++++++++++++++++++ src/resources/lang/Spanish.txt | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/resources/lang/English.txt b/src/resources/lang/English.txt index ed3a65a..31409f1 100644 --- a/src/resources/lang/English.txt +++ b/src/resources/lang/English.txt @@ -10,6 +10,8 @@ .-= Testing =-. +.lic file not found + About Advanced @@ -30,6 +32,8 @@ AutoBleem Theme: Background Music: +Bin file failed to verify + Button Guide Cancel @@ -58,8 +62,12 @@ Confirm Copy +Cover image file not found + Cover Style: +Cue file not found + Custom Custom Memory Cards @@ -122,10 +130,18 @@ Game GAME +Game failed to verify: + +Game file not found + Game Manager Game manager - Select game +Game.ini file not found + +Game.ini file not valid + Game: games @@ -188,6 +204,10 @@ New Card New GamePad found +No disc name + +No discs + OK OOPS! Game crashed. Resume point not available. @@ -200,6 +220,8 @@ Original Page +pcsx.cfg file not found + Player Players @@ -236,6 +258,8 @@ Quit emulation - back to AutoBleem Re/Scan +ReadMe file not found + Region: Reload Cards @@ -286,6 +310,8 @@ Showing Timeout (0 = no timeout): Showing: All games +Showing: Apps + Showing: Favorite games Showing: Internal games diff --git a/src/resources/lang/Spanish.txt b/src/resources/lang/Spanish.txt index 4462fe6..9994e41 100644 --- a/src/resources/lang/Spanish.txt +++ b/src/resources/lang/Spanish.txt @@ -10,6 +10,8 @@ .-= Retroboot y cores de emulacion =-. .-= Testing =-. .-= Testers =-. +.lic file not found +Archivo .lic no encontrado About Sobre Advanced @@ -30,6 +32,8 @@ AutoBleem Theme: Tema AutoBleem: Background Music: Musica de Fondo: +Bin file failed to verify +El archivo .bin no se pudo verificar Button Guide Guia de Botones Cancel @@ -58,8 +62,12 @@ Confirm Confirmar Copy Copiar +Cover image file not found +Caratula no encontrada Cover Style: Estilo de Caratulas: +Cue file not found +Archivo .cue no encontrado Custom Custom Custom Memory Cards @@ -122,10 +130,18 @@ Game Juego GAME JUEGO +Game failed to verify: +El juego no se pudo verificar: +Game file not found +Archivo de juego no encontrado Game Manager Administrador de Juegos Game manager - Select game Administrador de juegos - Elige juego +Game.ini file not found +Archivo game.ini no encontrado +Game.ini file not valid +El archivo game.ini no es vĂ¡lido Game: Juego: games @@ -188,6 +204,10 @@ New Card Nueva Tarjeta New GamePad found Nuevo GamePad encontrado +No disc name +Sin nombre de disco +No discs +Sin discos OK Aceptar OOPS! Game crashed. Resume point not available. @@ -200,6 +220,8 @@ Original Original Page Pagina +pcsx.cfg file not found +Archivo pcsx.cfg no encontrado Player Jugador Players @@ -236,6 +258,8 @@ Quit emulation - back to AutoBleem Quitar emulacion - volver a AutoBleem Re/Scan Re/Escanear +ReadMe file not found +Archivo ReadMe no encontrado Region: Region: Reload Cards @@ -286,6 +310,8 @@ Showing Timeout (0 = no timeout): Tiempo de Muestra (0 = sin tiempo): Showing: All games Mostrando: Todos los Juegos +Showing: Apps +Mostrando: Apps Showing: Favorite games Mostrando: Juegos Favoritos Showing: Internal games From 7aa7b3ebfc9e31b31db29469b4466d2e53864e90 Mon Sep 17 00:00:00 2001 From: Axanar Date: Fri, 13 Dec 2019 06:30:26 -0500 Subject: [PATCH 3/3] [feature/merge_PS1_selects]: remove showing retroarch menu item --- src/code/gui/gui_options.cpp | 10 ---------- src/code/gui/gui_options.h | 1 - 2 files changed, 11 deletions(-) diff --git a/src/code/gui/gui_options.cpp b/src/code/gui/gui_options.cpp index e6cada1..6c70f96 100644 --- a/src/code/gui/gui_options.cpp +++ b/src/code/gui/gui_options.cpp @@ -12,7 +12,6 @@ enum { CFG_THEME=0, CFG_PS1GAMES_SELECT, CFG_SHOW_ORIGAMES, - CFG_SHOW_RETROARCH, CFG_UI, CFG_JEWEL, CFG_MUSIC, @@ -80,11 +79,6 @@ void GuiOptions::doPrevNextOption(shared_ptr gui, shared_ptr lang, bo gui->cfg.inifile.values["origames"] = nextValue; } - if (selOption == CFG_SHOW_RETROARCH) { - string nextValue = getPrevNextOption(retroarch, gui->cfg.inifile.values["retroarch"], next); - gui->cfg.inifile.values["retroarch"] = nextValue; - } - if (selOption == CFG_UI) { string nextValue = getPrevNextOption(ui, gui->cfg.inifile.values["ui"], next); gui->cfg.inifile.values["ui"] = nextValue; @@ -197,9 +191,6 @@ void GuiOptions::init() { autoregion.clear(); autoregion.push_back("false"); autoregion.push_back("true"); - retroarch.clear(); - retroarch.push_back("false"); - retroarch.push_back("true"); adv.clear(); adv.push_back("false"); adv.push_back("true"); @@ -302,7 +293,6 @@ void GuiOptions::render() { renderOptionLine(_("AutoBleem Theme:") + " " + gui->cfg.inifile.values["theme"], CFG_THEME + 1, offset); renderOptionLine(_("PS1 Games Selection:") + " " + gui->cfg.inifile.values["ps1select"], CFG_PS1GAMES_SELECT + 1, offset); renderOptionLine(_("Show Internal Games:") + " " + getBooleanIcon("origames"), CFG_SHOW_ORIGAMES + 1, offset); - renderOptionLine(_("Show RetroArch Games:") + " " + getBooleanIcon("retroarch"), CFG_SHOW_RETROARCH + 1, offset); renderOptionLine(_("UI:") + " " + gui->cfg.inifile.values["ui"], CFG_UI + 1, offset); renderOptionLine(_("Cover Style:") + " " + gui->cfg.inifile.values["jewel"], CFG_JEWEL + 1, offset); renderOptionLine(_("Music:") + " " + gui->cfg.inifile.values["music"], CFG_MUSIC + 1, offset); diff --git a/src/code/gui/gui_options.h b/src/code/gui/gui_options.h index 2ae173f..7face03 100644 --- a/src/code/gui/gui_options.h +++ b/src/code/gui/gui_options.h @@ -29,7 +29,6 @@ class GuiOptions : public GuiScreen{ std::vector autobleemUIThemes; std::vector ps1SelectState; std::vector origames; - std::vector retroarch; std::vector ui; std::vector jewels; std::vector music;