From c1f836c713c28640cdb0c92d5fea37f4249be758 Mon Sep 17 00:00:00 2001 From: Rael Gugelmin Cunha Date: Tue, 24 Oct 2017 13:38:25 -0200 Subject: [PATCH] Add an UI option to automatically load a system gamelist (Fixes #253) --- es-app/src/guis/GuiMenu.cpp | 16 ++++++++++++++++ es-app/src/views/ViewController.cpp | 14 +++++++++++++- es-core/src/Settings.cpp | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 05a782289..9a0b79739 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -3,6 +3,7 @@ #include "Window.h" #include "Sound.h" #include "Log.h" +#include "SystemData.h" #include "Settings.h" #include "PowerSaver.h" #include "guis/GuiMsgBox.h" @@ -266,6 +267,21 @@ void GuiMenu::openUISettings() ViewController::get()->reloadAll(); }); + // Optionally start in selected system + auto systemfocus_list = std::make_shared< OptionListComponent >(mWindow, "START ON SYSTEM", false); + systemfocus_list->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == ""); + for (auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++) + { + if ("retropie" != (*it)->getName()) + { + systemfocus_list->add((*it)->getName(), (*it)->getName(), Settings::getInstance()->getString("StartupSystem") == (*it)->getName()); + } + } + s->addWithLabel("START ON SYSTEM", systemfocus_list); + s->addSaveFunc([systemfocus_list] { + Settings::getInstance()->setString("StartupSystem", systemfocus_list->getSelected()); + }); + // show help auto show_help = std::make_shared(mWindow); show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index abba8b380..01af2fbe0 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -44,6 +44,18 @@ ViewController::~ViewController() void ViewController::goToStart() { + // If specific system is requested, go directly to the game list + auto requestedSystem = Settings::getInstance()->getString("StartupSystem"); + if("" != requestedSystem && "retropie" != requestedSystem) + { + for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++){ + if ((*it)->getName() == requestedSystem) + { + goToGameList(*it); + return; + } + } + } goToSystemView(SystemData::sSystemVector.at(0)); } @@ -503,7 +515,7 @@ void ViewController::monitorUIMode() { std::string uimode = Settings::getInstance()->getString("UIMode"); if (uimode != mCurUIMode) // UIMODE HAS CHANGED - { + { mCurUIMode = uimode; reloadAll(); goToStart(); diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index c72cf81ee..e85f00366 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -47,6 +47,7 @@ void Settings::setDefaults() mBoolMap["ShowExit"] = true; mBoolMap["Windowed"] = false; mBoolMap["SplashScreen"] = true; + mStringMap["StartupSystem"] = ""; #ifdef _RPI_ // don't enable VSync by default on the Pi, since it already