mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Added a 'Debug mode' option to the Other settings menu
This commit is contained in:
parent
6df5780ed0
commit
d576cbc03f
|
@ -1546,6 +1546,39 @@ void GuiMenu::openOtherOptions()
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (Settings::getInstance()->getBool("DebugFlag")) {
|
||||||
|
// If the --debug command line option was passed then create a dummy entry.
|
||||||
|
auto debugMode = std::make_shared<SwitchComponent>();
|
||||||
|
debugMode->setState(true);
|
||||||
|
s->addWithLabel("DEBUG MODE", debugMode);
|
||||||
|
debugMode->setEnabled(false);
|
||||||
|
debugMode->setOpacity(DISABLED_OPACITY);
|
||||||
|
debugMode->getParent()
|
||||||
|
->getChild(debugMode->getChildIndex() - 1)
|
||||||
|
->setOpacity(DISABLED_OPACITY);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Debug mode.
|
||||||
|
auto debugMode = std::make_shared<SwitchComponent>();
|
||||||
|
debugMode->setState(Settings::getInstance()->getBool("DebugMode"));
|
||||||
|
s->addWithLabel("DEBUG MODE", debugMode);
|
||||||
|
s->addSaveFunc([debugMode, s] {
|
||||||
|
if (debugMode->getState() != Settings::getInstance()->getBool("DebugMode")) {
|
||||||
|
if (!Settings::getInstance()->getBool("DebugMode")) {
|
||||||
|
Settings::getInstance()->setBool("DebugMode", true);
|
||||||
|
Settings::getInstance()->setBool("Debug", true);
|
||||||
|
Log::setReportingLevel(LogDebug);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Settings::getInstance()->setBool("DebugMode", false);
|
||||||
|
Settings::getInstance()->setBool("Debug", false);
|
||||||
|
Log::setReportingLevel(LogInfo);
|
||||||
|
}
|
||||||
|
s->setNeedsSaving();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// GPU statistics overlay.
|
// GPU statistics overlay.
|
||||||
auto displayGpuStatistics = std::make_shared<SwitchComponent>();
|
auto displayGpuStatistics = std::make_shared<SwitchComponent>();
|
||||||
displayGpuStatistics->setState(Settings::getInstance()->getBool("DisplayGPUStatistics"));
|
displayGpuStatistics->setState(Settings::getInstance()->getBool("DisplayGPUStatistics"));
|
||||||
|
|
|
@ -382,6 +382,7 @@ bool parseArguments(const std::vector<std::string>& arguments)
|
||||||
}
|
}
|
||||||
else if (arguments[i] == "--debug") {
|
else if (arguments[i] == "--debug") {
|
||||||
Settings::getInstance()->setBool("Debug", true);
|
Settings::getInstance()->setBool("Debug", true);
|
||||||
|
Settings::getInstance()->setBool("DebugFlag", true);
|
||||||
Log::setReportingLevel(LogDebug);
|
Log::setReportingLevel(LogDebug);
|
||||||
}
|
}
|
||||||
else if (arguments[i] == "--version" || arguments[i] == "-v") {
|
else if (arguments[i] == "--version" || arguments[i] == "-v") {
|
||||||
|
@ -419,7 +420,7 @@ bool parseArguments(const std::vector<std::string>& arguments)
|
||||||
" --force-input-config Force configuration of input devices\n"
|
" --force-input-config Force configuration of input devices\n"
|
||||||
" --create-system-dirs Create game system directories\n"
|
" --create-system-dirs Create game system directories\n"
|
||||||
" --home [path] Directory to use as home path\n"
|
" --home [path] Directory to use as home path\n"
|
||||||
" --debug Print debug information\n"
|
" --debug Enable debug mode\n"
|
||||||
" --version, -v Display version information\n"
|
" --version, -v Display version information\n"
|
||||||
" --help, -h Summon a sentient, angry tuba\n";
|
" --help, -h Summon a sentient, angry tuba\n";
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -570,6 +571,12 @@ int main(int argc, char* argv[])
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Settings::getInstance()->getBool("DebugFlag") &&
|
||||||
|
Settings::getInstance()->getBool("DebugMode")) {
|
||||||
|
Settings::getInstance()->setBool("Debug", true);
|
||||||
|
Log::setReportingLevel(LogDebug);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FREEIMAGE_LIB)
|
#if defined(FREEIMAGE_LIB)
|
||||||
// Call this ONLY when linking with FreeImage as a static library.
|
// Call this ONLY when linking with FreeImage as a static library.
|
||||||
FreeImage_Initialise();
|
FreeImage_Initialise();
|
||||||
|
|
|
@ -38,7 +38,8 @@ namespace
|
||||||
"ForceFull", // --force-full
|
"ForceFull", // --force-full
|
||||||
"ForceKiosk", // --force-kiosk
|
"ForceKiosk", // --force-kiosk
|
||||||
"ForceKid", // --force-kid
|
"ForceKid", // --force-kid
|
||||||
"Debug", // --debug
|
"Debug", // Whether we're in debug mode.
|
||||||
|
"DebugFlag", // Whether the --debug flag was passed.
|
||||||
|
|
||||||
// These options are only used internally during the application session:
|
// These options are only used internally during the application session:
|
||||||
"PortableMode",
|
"PortableMode",
|
||||||
|
@ -288,6 +289,7 @@ void Settings::setDefaults()
|
||||||
#if defined(__unix__)
|
#if defined(__unix__)
|
||||||
mBoolMap["DisableComposition"] = {false, false};
|
mBoolMap["DisableComposition"] = {false, false};
|
||||||
#endif
|
#endif
|
||||||
|
mBoolMap["DebugMode"] = {false, false};
|
||||||
mBoolMap["DisplayGPUStatistics"] = {false, false};
|
mBoolMap["DisplayGPUStatistics"] = {false, false};
|
||||||
mBoolMap["EnableMenuKidMode"] = {false, false};
|
mBoolMap["EnableMenuKidMode"] = {false, false};
|
||||||
// macOS requires root privileges to reboot and power off so it doesn't make much
|
// macOS requires root privileges to reboot and power off so it doesn't make much
|
||||||
|
@ -339,6 +341,7 @@ void Settings::setDefaults()
|
||||||
mStringMap["ApplicationVersion"] = {"", ""};
|
mStringMap["ApplicationVersion"] = {"", ""};
|
||||||
mStringMap["ApplicationUpdaterLastCheck"] = {"", ""};
|
mStringMap["ApplicationUpdaterLastCheck"] = {"", ""};
|
||||||
mBoolMap["PortableMode"] = {false, false};
|
mBoolMap["PortableMode"] = {false, false};
|
||||||
|
mBoolMap["DebugFlag"] = {false, false};
|
||||||
mBoolMap["DebugGrid"] = {false, false};
|
mBoolMap["DebugGrid"] = {false, false};
|
||||||
mBoolMap["DebugText"] = {false, false};
|
mBoolMap["DebugText"] = {false, false};
|
||||||
mBoolMap["DebugImage"] = {false, false};
|
mBoolMap["DebugImage"] = {false, false};
|
||||||
|
|
Loading…
Reference in a new issue