diff --git a/include/screens/scriptlist.hpp b/include/screens/scriptlist.hpp index 560bf3c..6c3181b 100644 --- a/include/screens/scriptlist.hpp +++ b/include/screens/scriptlist.hpp @@ -39,6 +39,8 @@ public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; private: + void deleteScript(int selectedScript); + void DrawSubMenu(void) const; void DrawList(void) const; void DrawSingleObject(void) const; diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index d327caa..8804f10 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -124,5 +124,9 @@ "ENABLE_GODMODE_PROMPT": "Would you like to enable GodMode?\n\nBe careful when you use GodMode!!", "DISABLE_AUTOBOOT_STORE": "Would you like to disable autoboot?", - "AUTOBOOT_STORE": "Would you like to autoboot this Store?\n\nThis will autoboot this store on startup!" + "AUTOBOOT_STORE": "Would you like to autoboot this Store?\n\nThis will autoboot this store on startup!", + + "SCRIPT_NOT_FOUND": "This script does not exist.", + "DELETE_SCRIPT": "Would you like to delete this script?", + "REFRESHING_LIST": "Refreshing List..." } diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index b206366..7d234c4 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -45,8 +45,8 @@ void fixInfo(nlohmann::json &json) { if(!json[i].contains("author")) json[i]["author"] = "AUTHOR"; if(!json[i].contains("shortDesc")) json[i]["shortDesc"] = "SHORTDESC"; if(!json[i].contains("revision")) json[i]["revision"] = 0; - if(!json[i].contains("curRevision")) json[i]["curRevision"] = 0; - if(!json[i].contains("version")) json[i]["revision"] = 0; + if(!json[i].contains("curRevision")) json[i]["curRevision"] = -1; + if(!json[i].contains("version")) json[i]["revision"] = -1; } } @@ -119,7 +119,9 @@ void ScriptBrowse::Draw(void) const { } Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[selection]["shortDesc"]), 400); - if(infoJson[selection]["curRevision"] < infoJson[selection]["revision"]) { + if (infoJson[selection]["curRevision"] == -1) { + Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 370); + } else if(infoJson[selection]["curRevision"] < infoJson[selection]["revision"]) { Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 370); } else if(infoJson[selection]["curRevision"] == infoJson[selection]["revision"]) { Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370); diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index 25f8b16..d485d4b 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -441,6 +441,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { switch(SubSelection) { case 0: if (returnIfExist(Config::ScriptPath, {"json"}) == true) { + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); chdir(Config::ScriptPath.c_str()); getDirectoryContents(dirContents, {"json"}); @@ -478,6 +479,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { if (hDown & KEY_TOUCH) { if (touching(touch, subPos[0])) { if (returnIfExist(Config::ScriptPath, {"json"}) == true) { + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); chdir(Config::ScriptPath.c_str()); getDirectoryContents(dirContents, {"json"}); @@ -509,6 +511,26 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { } } +void ScriptList::deleteScript(int selectedScript) { + std::string path = Config::ScriptPath; + path += dirContents[selectedScript].name; + deleteFile(path.c_str()); + // Refresh the list. + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); + dirContents.clear(); + fileInfo.clear(); + chdir(Config::ScriptPath.c_str()); + getDirectoryContents(dirContents, {"json"}); + for(uint i=0;i 0) { diff --git a/source/screens/unistore.cpp b/source/screens/unistore.cpp index c365737..f576b23 100644 --- a/source/screens/unistore.cpp +++ b/source/screens/unistore.cpp @@ -217,8 +217,6 @@ UniStore::UniStore() { ScriptHelper::downloadFile(SI.sheetURL, SI.storeSheet, Lang::get("UPDATING")); } } - } else { - notConnectedMsg(); } if (ScriptHelper::checkIfValid(Config::UniStoreFile, 1) == true) { @@ -438,6 +436,7 @@ void UniStore::updateStore(int selectedStore) { ScriptHelper::downloadFile(storeInfo[selectedStore].sheetURL, storeInfo[selectedStore].storeSheet, Lang::get("UPDATING")); } // Refresh the list. + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); storeInfo.clear(); chdir(Config::StorePath.c_str()); @@ -474,6 +473,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { switch(subSelection) { case 0: if (returnIfExist(Config::StorePath, {"unistore"}) == true) { + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); storeInfo.clear(); chdir(Config::StorePath.c_str()); @@ -507,6 +507,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) { if (hDown & KEY_TOUCH) { if (touching(touch, subPos[0])) { if (returnIfExist(Config::StorePath, {"unistore"}) == true) { + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); storeInfo.clear(); chdir(Config::StorePath.c_str()); @@ -540,6 +541,7 @@ void UniStore::deleteStore(int selectedStore) { path += dirContents[selectedStore].name; deleteFile(path.c_str()); // Refresh the list. + Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); dirContents.clear(); storeInfo.clear(); chdir(Config::StorePath.c_str());