Add an UI option to automatically load a system gamelist (Fixes #253)

This commit is contained in:
Rael Gugelmin Cunha 2017-10-24 13:38:25 -02:00
parent 3c60235363
commit c1f836c713
3 changed files with 30 additions and 1 deletions

View file

@ -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<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
auto show_help = std::make_shared<SwitchComponent>(mWindow);
show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts"));

View file

@ -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();

View file

@ -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