Changed 'launch string' to 'launch command' and the setting 'EnableSounds' to 'EnableNavigationSounds'.

This commit is contained in:
Leon Styhre 2020-07-08 17:06:34 +02:00
parent 5a7fb828a6
commit d1f8c3e385
9 changed files with 56 additions and 54 deletions

View file

@ -55,7 +55,7 @@ Some metadata is also marked as "statistic" - these are kept track of by ES and
* `playcount` - integer, the number of times this game has been played. * `playcount` - integer, the number of times this game has been played.
* `lastplayed` - statistic, datetime, the last date and time this game was played. * `lastplayed` - statistic, datetime, the last date and time this game was played.
* `sortname` - string, used in sorting the gamelist in a system, instead of `name`. * `sortname` - string, used in sorting the gamelist in a system, instead of `name`.
* `launchstring` - optional tag that is used to override the emulator and core settings on a per-game basis. * `launchcommand` - optional tag that is used to override the emulator and core settings on a per-game basis.
#### `<folder>` #### `<folder>`
* `name` - string, the displayed name for the folder. * `name` - string, the displayed name for the folder.

View file

@ -447,9 +447,9 @@ void FileData::launchGame(Window* window)
// Check if there is a launch string override for the game // Check if there is a launch string override for the game
// and the corresponding option to use it has been set. // and the corresponding option to use it has been set.
if (Settings::getInstance()->getBool("LaunchstringOverride") && if (Settings::getInstance()->getBool("LaunchCommandOverride") &&
!metadata.get("launchstring").empty()) !metadata.get("launchcommand").empty())
command = metadata.get("launchstring"); command = metadata.get("launchcommand");
else else
command = mEnvData->mLaunchCommand; command = mEnvData->mLaunchCommand;

View file

@ -12,37 +12,37 @@
#include <pugixml.hpp> #include <pugixml.hpp>
MetaDataDecl gameDecls[] = { MetaDataDecl gameDecls[] = {
// key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape // key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape
{"name", MD_STRING, "", false, "name", "enter game name", true}, {"name", MD_STRING, "", false, "name", "enter game name", true},
{"sortname", MD_STRING, "", false, "sortname", "enter game sort name", false}, {"sortname", MD_STRING, "", false, "sortname", "enter game sort name", false},
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true}, {"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true},
{"rating", MD_RATING, "0", false, "rating", "enter rating", true}, {"rating", MD_RATING, "0", false, "rating", "enter rating", true},
{"releasedate", MD_DATE, "not-a-date-time", false, "release date", "enter release date", true}, {"releasedate", MD_DATE, "not-a-date-time", false, "release date", "enter release date", true},
{"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true}, {"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true},
{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, {"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true},
{"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, {"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true},
{"players", MD_INT, "unknown", false, "players", "enter number of players", true}, {"players", MD_INT, "unknown", false, "players", "enter number of players", true},
{"favorite", MD_BOOL, "false", false, "favorite", "enter favorite off/on", false}, {"favorite", MD_BOOL, "false", false, "favorite", "enter favorite off/on", false},
{"completed", MD_BOOL, "false", false, "completed", "enter completed off/on", false}, {"completed", MD_BOOL, "false", false, "completed", "enter completed off/on", false},
{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false}, {"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false},
{"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false}, {"hidden", MD_BOOL, "false", false, "hidden", "enter hidden off/on", false},
{"kidgame", MD_BOOL, "false", false, "kidgame", "enter kidgame off/on", false}, {"kidgame", MD_BOOL, "false", false, "kidgame", "enter kidgame off/on", false},
{"launchstring", MD_LAUNCHSTRING, "", false, "launch string", "enter game launch string " {"launchcommand", MD_LAUNCHCOMMAND, "", false, "launch command", "enter game launch command "
"(emulator override)", false}, "(emulator override)", false},
{"playcount", MD_INT, "0", false, "play count", "enter number of times played", false}, {"playcount", MD_INT, "0", false, "play count", "enter number of times played", false},
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false} {"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
}; };
const std::vector<MetaDataDecl> gameMDD(gameDecls, gameDecls + const std::vector<MetaDataDecl> gameMDD(gameDecls, gameDecls +
sizeof(gameDecls) / sizeof(gameDecls[0])); sizeof(gameDecls) / sizeof(gameDecls[0]));
MetaDataDecl folderDecls[] = { MetaDataDecl folderDecls[] = {
{"name", MD_STRING, "", false, "name", "enter game name", true}, {"name", MD_STRING, "", false, "name", "enter game name", true},
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true}, {"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true},
{"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true}, {"developer", MD_STRING, "unknown", false, "developer", "enter game developer", true},
{"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true}, {"publisher", MD_STRING, "unknown", false, "publisher", "enter game publisher", true},
{"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true}, {"genre", MD_STRING, "unknown", false, "genre", "enter game genre", true},
{"players", MD_INT, "unknown", false, "players", "enter number of players", true} {"players", MD_INT, "unknown", false, "players", "enter number of players", true}
}; };
const std::vector<MetaDataDecl> folderMDD(folderDecls, folderDecls + const std::vector<MetaDataDecl> folderMDD(folderDecls, folderDecls +
sizeof(folderDecls) / sizeof(folderDecls[0])); sizeof(folderDecls) / sizeof(folderDecls[0]));

View file

@ -23,7 +23,7 @@ enum MetaDataType {
// Specialized types. // Specialized types.
MD_MULTILINE_STRING, MD_MULTILINE_STRING,
MD_LAUNCHSTRING, MD_LAUNCHCOMMAND,
MD_PATH, MD_PATH,
MD_RATING, MD_RATING,
MD_DATE, MD_DATE,

View file

@ -178,17 +178,19 @@ void GuiMenu::openSoundSettings()
video_audio->getState()); }); video_audio->getState()); });
// Navigation sounds. // Navigation sounds.
auto sounds_enabled = std::make_shared<SwitchComponent>(mWindow); auto navigationsounds_enabled = std::make_shared<SwitchComponent>(mWindow);
sounds_enabled->setState(Settings::getInstance()->getBool("EnableSounds")); navigationsounds_enabled->setState(Settings::getInstance()->
s->addWithLabel("ENABLE NAVIGATION SOUNDS", sounds_enabled); getBool("EnableNavigationSounds"));
s->addSaveFunc([sounds_enabled] { s->addWithLabel("ENABLE NAVIGATION SOUNDS", navigationsounds_enabled);
if (sounds_enabled->getState() && s->addSaveFunc([navigationsounds_enabled] {
!Settings::getInstance()->getBool("EnableSounds") && if (navigationsounds_enabled->getState() &&
!Settings::getInstance()->getBool("EnableNavigationSounds") &&
PowerSaver::getMode() == PowerSaver::INSTANT) { PowerSaver::getMode() == PowerSaver::INSTANT) {
Settings::getInstance()->setString("PowerSaverMode", "default"); Settings::getInstance()->setString("PowerSaverMode", "default");
PowerSaver::init(); PowerSaver::init();
} }
Settings::getInstance()->setBool("EnableSounds", sounds_enabled->getState()); Settings::getInstance()->setBool("EnableNavigationSounds",
navigationsounds_enabled->getState());
}); });
} }
@ -451,7 +453,7 @@ void GuiMenu::openOtherSettings()
"instant" && power_saver->getSelected() == "instant") { "instant" && power_saver->getSelected() == "instant") {
Settings::getInstance()->setString("TransitionStyle", "instant"); Settings::getInstance()->setString("TransitionStyle", "instant");
Settings::getInstance()->setBool("MoveCarousel", false); Settings::getInstance()->setBool("MoveCarousel", false);
Settings::getInstance()->setBool("EnableSounds", false); Settings::getInstance()->setBool("EnableNavigationSounds", false);
} }
Settings::getInstance()->setString("PowerSaverMode", power_saver->getSelected()); Settings::getInstance()->setString("PowerSaverMode", power_saver->getSelected());
PowerSaver::init(); PowerSaver::init();
@ -493,13 +495,13 @@ void GuiMenu::openOtherSettings()
Settings::getInstance()->setString("SaveGamelistsMode", gamelistsSaveMode->getSelected()); Settings::getInstance()->setString("SaveGamelistsMode", gamelistsSaveMode->getSelected());
}); });
// Allow overriding of the launch string per game (the option // Allow overriding of the launch command per game (the option
// to disable this is intended primarily for testing purposes). // to disable this is intended primarily for testing purposes).
auto launchstring_override = std::make_shared<SwitchComponent>(mWindow); auto launchcommand_override = std::make_shared<SwitchComponent>(mWindow);
launchstring_override->setState(Settings::getInstance()->getBool("LaunchstringOverride")); launchcommand_override->setState(Settings::getInstance()->getBool("LaunchCommandOverride"));
s->addWithLabel("ENABLE PER GAME LAUNCH STRING OVERRIDE", launchstring_override); s->addWithLabel("ENABLE PER GAME LAUNCH COMMAND OVERRIDE", launchcommand_override);
s->addSaveFunc([launchstring_override] { Settings::getInstance()-> s->addSaveFunc([launchcommand_override] { Settings::getInstance()->
setBool("LaunchstringOverride", launchstring_override->getState()); }); setBool("LaunchCommandOverride", launchcommand_override->getState()); });
auto parse_gamelists = std::make_shared<SwitchComponent>(mWindow); auto parse_gamelists = std::make_shared<SwitchComponent>(mWindow);
parse_gamelists->setState(Settings::getInstance()->getBool("ParseGamelistOnly")); parse_gamelists->setState(Settings::getInstance()->getBool("ParseGamelistOnly"));

View file

@ -76,8 +76,8 @@ GuiMetaDataEd::GuiMetaDataEd(
continue; continue;
// Don't show the launch string override entry if this option has been disabled. // Don't show the launch string override entry if this option has been disabled.
if (!Settings::getInstance()->getBool("LaunchstringOverride") && if (!Settings::getInstance()->getBool("LaunchCommandOverride") &&
iter->type == MD_LAUNCHSTRING) { iter->type == MD_LAUNCHCOMMAND) {
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL,
FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT); FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
assert(ed); assert(ed);
@ -136,7 +136,7 @@ GuiMetaDataEd::GuiMetaDataEd(
row.addElement(ed, false); row.addElement(ed, false);
break; break;
} }
case MD_LAUNCHSTRING: { case MD_LAUNCHCOMMAND: {
ed = std::make_shared<TextComponent>(window, "", ed = std::make_shared<TextComponent>(window, "",
Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT); Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
row.addElement(ed, true); row.addElement(ed, true);
@ -156,13 +156,13 @@ GuiMetaDataEd::GuiMetaDataEd(
ed->setValue(newVal); }; // OK callback (apply new value to ed). ed->setValue(newVal); }; // OK callback (apply new value to ed).
std::string staticTextString = "Default value from es_systems.cfg:"; std::string staticTextString = "Default value from es_systems.cfg:";
std::string defaultLaunchString = scraperParams.system-> std::string defaultLaunchCommand = scraperParams.system->
getSystemEnvData()->mLaunchCommand; getSystemEnvData()->mLaunchCommand;
row.makeAcceptInputHandler([this, title, staticTextString, row.makeAcceptInputHandler([this, title, staticTextString,
defaultLaunchString, ed, updateVal, multiLine] { defaultLaunchCommand, ed, updateVal, multiLine] {
mWindow->pushGui(new GuiComplexTextEditPopup(mWindow, getHelpStyle(), mWindow->pushGui(new GuiComplexTextEditPopup(mWindow, getHelpStyle(),
title, staticTextString, defaultLaunchString, ed->getValue(), title, staticTextString, defaultLaunchCommand, ed->getValue(),
updateVal, multiLine, "APPLY", "APPLY CHANGES?")); updateVal, multiLine, "APPLY", "APPLY CHANGES?"));
}); });
break; break;

View file

@ -73,7 +73,7 @@ AudioManager::~AudioManager()
std::shared_ptr<AudioManager> & AudioManager::getInstance() std::shared_ptr<AudioManager> & AudioManager::getInstance()
{ {
// Check if an AudioManager instance is already created, if not create one. // Check if an AudioManager instance is already created, if not create one.
if (sInstance == nullptr && Settings::getInstance()->getBool("EnableSounds")) { if (sInstance == nullptr && Settings::getInstance()->getBool("EnableNavigationSounds")) {
sInstance = std::shared_ptr<AudioManager>(new AudioManager); sInstance = std::shared_ptr<AudioManager>(new AudioManager);
} }
return sInstance; return sInstance;

View file

@ -119,7 +119,7 @@ void Settings::setDefaults()
mStringMap["AudioDevice"] = "Master"; mStringMap["AudioDevice"] = "Master";
#endif #endif
mBoolMap["VideoAudio"] = true; mBoolMap["VideoAudio"] = true;
mBoolMap["EnableSounds"] = true; mBoolMap["EnableNavigationSounds"] = true;
// Audio out device for Video playback using OMX player. // Audio out device for Video playback using OMX player.
mStringMap["OMXAudioDev"] = "both"; mStringMap["OMXAudioDev"] = "both";
@ -170,7 +170,7 @@ void Settings::setDefaults()
mBoolMap["ScreenSaverOmxPlayer"] = false; mBoolMap["ScreenSaverOmxPlayer"] = false;
#endif #endif
mStringMap["SaveGamelistsMode"] = "always"; mStringMap["SaveGamelistsMode"] = "always";
mBoolMap["LaunchstringOverride"] = true; mBoolMap["LaunchCommandOverride"] = true;
mBoolMap["ParseGamelistOnly"] = false; mBoolMap["ParseGamelistOnly"] = false;
mBoolMap["LocalArt"] = false; mBoolMap["LocalArt"] = false;
mBoolMap["ShowHiddenFiles"] = false; mBoolMap["ShowHiddenFiles"] = false;

View file

@ -164,7 +164,7 @@ void Sound::play()
if(mSampleData == nullptr) if(mSampleData == nullptr)
return; return;
if(!Settings::getInstance()->getBool("EnableSounds")) if(!Settings::getInstance()->getBool("EnableNavigationSounds"))
return; return;
AudioManager::getInstance(); AudioManager::getInstance();