From ed94a5b45be666b301cf4597a301d35b47a0d427 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 14 Feb 2023 17:28:43 +0100 Subject: [PATCH] Added a menu option to retain extra MAME name information for unscraped game names. --- es-app/src/guis/GuiMenu.cpp | 13 +++++++++++++ es-core/src/MameNames.h | 7 ++++++- es-core/src/Settings.cpp | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index f4821a220..e5fbca78e 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -1523,6 +1523,19 @@ void GuiMenu::openOtherOptions() } }); + // Strip extra MAME name info. + auto mameNameStripExtraInfo = std::make_shared(); + mameNameStripExtraInfo->setState(Settings::getInstance()->getBool("MAMENameStripExtraInfo")); + s->addWithLabel("STRIP EXTRA MAME NAME INFO (REQUIRES RESTART)", mameNameStripExtraInfo); + s->addSaveFunc([mameNameStripExtraInfo, s] { + if (Settings::getInstance()->getBool("MAMENameStripExtraInfo") != + mameNameStripExtraInfo->getState()) { + Settings::getInstance()->setBool("MAMENameStripExtraInfo", + mameNameStripExtraInfo->getState()); + s->setNeedsSaving(); + } + }); + #if defined(__unix__) // Whether to disable desktop composition. auto disableComposition = std::make_shared(); diff --git a/es-core/src/MameNames.h b/es-core/src/MameNames.h index d9ba48036..144017010 100644 --- a/es-core/src/MameNames.h +++ b/es-core/src/MameNames.h @@ -12,6 +12,7 @@ #ifndef ES_CORE_MAMENAMES_H #define ES_CORE_MAMENAMES_H +#include "Settings.h" #include "utils/StringUtil.h" #include @@ -36,7 +37,11 @@ public: std::string getCleanName(const std::string& mameName) { - return Utils::String::removeParenthesis(getRealName(mameName)); + static const bool stripInfo {Settings::getInstance()->getBool("MAMENameStripExtraInfo")}; + if (stripInfo) + return Utils::String::removeParenthesis(getRealName(mameName)); + else + return getRealName(mameName); } const bool isBios(const std::string& biosName) diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index f5aa295de..7bd9482ee 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -270,6 +270,7 @@ void Settings::setDefaults() mBoolMap["ShowHiddenGames"] = {true, true}; mBoolMap["CustomEventScripts"] = {false, false}; mBoolMap["ParseGamelistOnly"] = {false, false}; + mBoolMap["MAMENameStripExtraInfo"] = {true, true}; #if defined(__unix__) mBoolMap["DisableComposition"] = {false, false}; #endif