Merge pull request #257 from raelgc/master

Alow to select a system to go directly to the game list (Fixes #253)
This commit is contained in:
Jools Wills 2017-10-26 15:27:08 +01:00 committed by GitHub
commit de42e1c2bd
3 changed files with 30 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include "Window.h" #include "Window.h"
#include "Sound.h" #include "Sound.h"
#include "Log.h" #include "Log.h"
#include "SystemData.h"
#include "Settings.h" #include "Settings.h"
#include "PowerSaver.h" #include "PowerSaver.h"
#include "guis/GuiMsgBox.h" #include "guis/GuiMsgBox.h"
@ -266,6 +267,21 @@ void GuiMenu::openUISettings()
ViewController::get()->reloadAll(); ViewController::get()->reloadAll();
}); });
// Optionally start in selected system
auto systemfocus_list = std::make_shared< OptionListComponent<std::string> >(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 // show help
auto show_help = std::make_shared<SwitchComponent>(mWindow); auto show_help = std::make_shared<SwitchComponent>(mWindow);
show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts"));

View file

@ -44,6 +44,18 @@ ViewController::~ViewController()
void ViewController::goToStart() 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)); goToSystemView(SystemData::sSystemVector.at(0));
} }
@ -472,7 +484,7 @@ void ViewController::monitorUIMode()
{ {
std::string uimode = Settings::getInstance()->getString("UIMode"); std::string uimode = Settings::getInstance()->getString("UIMode");
if (uimode != mCurUIMode) // UIMODE HAS CHANGED if (uimode != mCurUIMode) // UIMODE HAS CHANGED
{ {
mCurUIMode = uimode; mCurUIMode = uimode;
reloadAll(); reloadAll();
goToStart(); goToStart();

View file

@ -47,6 +47,7 @@ void Settings::setDefaults()
mBoolMap["ShowExit"] = true; mBoolMap["ShowExit"] = true;
mBoolMap["Windowed"] = false; mBoolMap["Windowed"] = false;
mBoolMap["SplashScreen"] = true; mBoolMap["SplashScreen"] = true;
mStringMap["StartupSystem"] = "";
#ifdef _RPI_ #ifdef _RPI_
// don't enable VSync by default on the Pi, since it already // don't enable VSync by default on the Pi, since it already