diff --git a/include/utils/config.hpp b/include/utils/config.hpp index d8d27a7..ff217a5 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -32,7 +32,7 @@ namespace Config { extern int LangPath, lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor; extern std::string ScriptPath, MusicPath, StorePath; - extern bool Logging, UseBars; + extern bool Logging, UseBars, GodMode; void load(); void save(); diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index e7f9d20..187fc48 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -119,5 +119,7 @@ "BOOT_TITLE": "Would you like to boot this title?", "GODMODE": "GodMode: ", - "FUNCTION_NOT_ALLOWED": "This function is not allowed without GodMode!" + "FUNCTION_NOT_ALLOWED": "This function is not allowed without GodMode!", + "ENABLE_GODMODE": "Enable GodMode", + "ENABLE_GODMODE_PROMPT": "Would you like to enable GodMode?\n\nBe careful when you use GodMode!!" } diff --git a/source/screens/mainMenu.cpp b/source/screens/mainMenu.cpp index 3186649..ae143de 100644 --- a/source/screens/mainMenu.cpp +++ b/source/screens/mainMenu.cpp @@ -48,13 +48,13 @@ void MainMenu::Draw(void) const { } if (Config::UseBars == true) { - if (Config::getBool("GODMODE")) { + if (Config::GodMode) { Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("YES"), 400); } else { Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("NO"), 400); } } else { - if (Config::getBool("GODMODE")) { + if (Config::GodMode) { Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("YES"), 400); } else { Gui::DrawStringCentered(0, 218, 0.7f, Config::TxtColor, Lang::get("GODMODE") + Lang::get("NO"), 400); diff --git a/source/screens/settings.cpp b/source/screens/settings.cpp index e977f3b..2bc023e 100644 --- a/source/screens/settings.cpp +++ b/source/screens/settings.cpp @@ -194,7 +194,7 @@ void Settings::DrawMiscSettings(void) const { GFX::DrawBottom(); GFX::DrawArrow(0, 218, 0, 1); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 3; i++) { Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, Config::UnselectedColor); if (Selection == i) { Gui::drawAnimatedSelector(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, .060, TRANSPARENT, Config::SelectedColor); @@ -203,6 +203,7 @@ void Settings::DrawMiscSettings(void) const { Gui::DrawStringCentered(0, mainButtons[0].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_MUSICFILE"), 130); Gui::DrawStringCentered(0, mainButtons[1].y+10, 0.6f, Config::TxtColor, Lang::get("CHANGE_BAR_STYLE"), 130); + Gui::DrawStringCentered(0, mainButtons[2].y+10, 0.6f, Config::TxtColor, Lang::get("ENABLE_GODMODE"), 130); } void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { @@ -211,7 +212,7 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { } if (hDown & KEY_DOWN) { - if (Selection < 1) Selection++; + if (Selection < 2) Selection++; } if (hDown & KEY_A) { @@ -223,6 +224,10 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { } else if (Selection == 1) { if (Config::UseBars == true) Config::UseBars = false; else if (Config::UseBars == false) Config::UseBars = true; + } else if (Selection == 2) { + if (Msg::promptMsg(Lang::get("ENABLE_GODMODE_PROMPT"))) { + Config::GodMode = true; + } } } @@ -235,6 +240,10 @@ void Settings::MiscSettingsLogic(u32 hDown, u32 hHeld, touchPosition touch) { } else if (touching(touch, mainButtons[1])) { if (Config::UseBars == true) Config::UseBars = false; else if (Config::UseBars == false) Config::UseBars = true; + } else if (touching(touch, mainButtons[2])) { + if (Msg::promptMsg(Lang::get("ENABLE_GODMODE_PROMPT"))) { + Config::GodMode = true; + } } } diff --git a/source/utils/config.cpp b/source/utils/config.cpp index 8d17bdc..1829c48 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -47,6 +47,7 @@ bool Config::Logging; bool Config::UseBars; std::string Config::StorePath; int Config::LangPath; +bool Config::GodMode = false; nlohmann::json configJson; void Config::load() { @@ -203,7 +204,6 @@ void Config::initializeNewConfig() { Config::setBool("LOGGING", false); Config::setBool("BARS", true); Config::setString("STOREPATH", STORE_PATH); - if(file) fwrite(configJson.dump(1, '\t').c_str(), 1, configJson.dump(1, '\t').size(), file); fclose(file); } diff --git a/source/utils/scriptHelper.cpp b/source/utils/scriptHelper.cpp index 36a9482..811d43b 100644 --- a/source/utils/scriptHelper.cpp +++ b/source/utils/scriptHelper.cpp @@ -151,7 +151,7 @@ bool ScriptHelper::checkIfValid(std::string scriptFile, int mode) { } void ScriptHelper::deleteTitle(const std::string TitleID, bool isNAND, std::string message) { - if (Config::getBool("GODMODE")) { + if (Config::GodMode) { std::string MSG = Lang::get("DELETE_TITLE") + "\n\n"; if (isNAND) MSG += Lang::get("MEDIATYPE_NAND") + "\n" + TitleID; else MSG += Lang::get("MEDIATYPE_SD") + "\n" + TitleID;