Changed the random system or game button and made it possible to disable it altogether.

This commit is contained in:
Leon Styhre 2021-05-16 14:03:13 +02:00
parent 3ed17fbea2
commit 564fa67684
5 changed files with 29 additions and 9 deletions

View file

@ -446,7 +446,7 @@ void GuiMenu::openUISettings()
// Enable the 'Y' button for tagging games as favorites. // Enable the 'Y' button for tagging games as favorites.
auto favorites_add_button = std::make_shared<SwitchComponent>(mWindow); auto favorites_add_button = std::make_shared<SwitchComponent>(mWindow);
favorites_add_button->setState(Settings::getInstance()->getBool("FavoritesAddButton")); favorites_add_button->setState(Settings::getInstance()->getBool("FavoritesAddButton"));
s->addWithLabel("ENABLE SHORTCUT TO TOGGLE FAVORITES", favorites_add_button); s->addWithLabel("ENABLE TOGGLE FAVORITES BUTTON", favorites_add_button);
s->addSaveFunc([favorites_add_button, s] { s->addSaveFunc([favorites_add_button, s] {
if (Settings::getInstance()->getBool("FavoritesAddButton") != if (Settings::getInstance()->getBool("FavoritesAddButton") !=
favorites_add_button->getState()) { favorites_add_button->getState()) {
@ -456,6 +456,19 @@ void GuiMenu::openUISettings()
} }
}); });
// Enable the thumbstick click buttons for jumping to a random system or game.
auto random_add_button = std::make_shared<SwitchComponent>(mWindow);
random_add_button->setState(Settings::getInstance()->getBool("RandomAddButton"));
s->addWithLabel("ENABLE RANDOM SYSTEM OR GAME BUTTON", random_add_button);
s->addSaveFunc([random_add_button, s] {
if (Settings::getInstance()->getBool("RandomAddButton") !=
random_add_button->getState()) {
Settings::getInstance()->setBool("RandomAddButton",
random_add_button->getState());
s->setNeedsSaving();
}
});
// Gamelist filters. // Gamelist filters.
auto gamelist_filters = std::make_shared<SwitchComponent>(mWindow); auto gamelist_filters = std::make_shared<SwitchComponent>(mWindow);
gamelist_filters->setState(Settings::getInstance()->getBool("GamelistFilters")); gamelist_filters->setState(Settings::getInstance()->getBool("GamelistFilters"));

View file

@ -232,9 +232,10 @@ bool SystemView::input(InputConfig* config, Input input)
NavigationSounds::getInstance()->playThemeNavigationSound(SELECTSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(SELECTSOUND);
return true; return true;
} }
if (config->isMappedTo("x", input)) { if (Settings::getInstance()->getBool("RandomAddButton") &&
// Get random system. (config->isMappedTo("leftthumbstickclick", input) ||
// Go to system. config->isMappedTo("rightthumbstickclick", input))) {
// Get a random system and jump to it.
NavigationSounds::getInstance()->playThemeNavigationSound(SYSTEMBROWSESOUND); NavigationSounds::getInstance()->playThemeNavigationSound(SYSTEMBROWSESOUND);
setCursor(SystemData::getRandomSystem(getSelected())); setCursor(SystemData::getRandomSystem(getSelected()));
return true; return true;
@ -422,8 +423,11 @@ std::vector<HelpPrompt> SystemView::getHelpPrompts()
prompts.push_back(HelpPrompt("up/down", "choose")); prompts.push_back(HelpPrompt("up/down", "choose"));
else else
prompts.push_back(HelpPrompt("left/right", "choose")); prompts.push_back(HelpPrompt("left/right", "choose"));
prompts.push_back(HelpPrompt("a", "select")); prompts.push_back(HelpPrompt("a", "select"));
prompts.push_back(HelpPrompt("x", "random"));
if (Settings::getInstance()->getBool("RandomAddButton"))
prompts.push_back(HelpPrompt("thumbstickclick", "random"));
if (!UIModeController::getInstance()->isUIModeKid() && if (!UIModeController::getInstance()->isUIModeKid() &&
Settings::getInstance()->getBool("ScreensaverControls")) Settings::getInstance()->getBool("ScreensaverControls"))

View file

@ -314,8 +314,8 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
prompts.push_back(HelpPrompt("b", "back")); prompts.push_back(HelpPrompt("b", "back"));
if (!UIModeController::getInstance()->isUIModeKid()) if (!UIModeController::getInstance()->isUIModeKid())
prompts.push_back(HelpPrompt("select", "options")); prompts.push_back(HelpPrompt("select", "options"));
if (mRoot->getSystem()->isGameSystem()) if (mRoot->getSystem()->isGameSystem() && Settings::getInstance()->getBool("RandomAddButton"))
prompts.push_back(HelpPrompt("x", "random")); prompts.push_back(HelpPrompt("thumbstickclick", "random"));
if (mRoot->getSystem()->getThemeFolder() == "custom-collections" && if (mRoot->getSystem()->getThemeFolder() == "custom-collections" &&
!CollectionSystemsManager::get()->isEditing() && mCursorStack.empty() && !CollectionSystemsManager::get()->isEditing() && mCursorStack.empty() &&

View file

@ -195,10 +195,12 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
return true; return true;
} }
} }
else if (config->isMappedTo("x", input)) { else if (Settings::getInstance()->getBool("RandomAddButton") &&
(config->isMappedTo("leftthumbstickclick", input) ||
config->isMappedTo("rightthumbstickclick", input))) {
if (mRoot->getSystem()->isGameSystem() && getCursor()->getType() != PLACEHOLDER) { if (mRoot->getSystem()->isGameSystem() && getCursor()->getType() != PLACEHOLDER) {
stopListScrolling(); stopListScrolling();
// Go to random system game. // Jump to a random game.
NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND);
FileData* randomGame = getCursor()->getSystem()->getRandomGame(getCursor()); FileData* randomGame = getCursor()->getSystem()->getRandomGame(getCursor());
if (randomGame) if (randomGame)

View file

@ -133,6 +133,7 @@ void Settings::setDefaults()
mBoolMap["FavoritesStar"] = { true, true }; mBoolMap["FavoritesStar"] = { true, true };
mBoolMap["ListScrollOverlay"] = { false, false }; mBoolMap["ListScrollOverlay"] = { false, false };
mBoolMap["FavoritesAddButton"] = { true, true }; mBoolMap["FavoritesAddButton"] = { true, true };
mBoolMap["RandomAddButton"] = { true, true };
mBoolMap["GamelistFilters"] = { true, true }; mBoolMap["GamelistFilters"] = { true, true };
mBoolMap["QuickSystemSelect"] = { true, true }; mBoolMap["QuickSystemSelect"] = { true, true };
mBoolMap["ShowHelpPrompts"] = { true, true }; mBoolMap["ShowHelpPrompts"] = { true, true };