mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Read description for changes.
- Add Script Deletion. - Display "This script does not exist." if script does not exist on ScriptBrowse. - Display "Refreshing List..." if you have more scripts.
This commit is contained in:
@@ -39,6 +39,8 @@ public:
|
|||||||
void Draw(void) const override;
|
void Draw(void) const override;
|
||||||
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
|
||||||
private:
|
private:
|
||||||
|
void deleteScript(int selectedScript);
|
||||||
|
|
||||||
void DrawSubMenu(void) const;
|
void DrawSubMenu(void) const;
|
||||||
void DrawList(void) const;
|
void DrawList(void) const;
|
||||||
void DrawSingleObject(void) const;
|
void DrawSingleObject(void) const;
|
||||||
|
|||||||
@@ -124,5 +124,9 @@
|
|||||||
"ENABLE_GODMODE_PROMPT": "Would you like to enable GodMode?\n\nBe careful when you use GodMode!!",
|
"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?",
|
"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..."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ void fixInfo(nlohmann::json &json) {
|
|||||||
if(!json[i].contains("author")) json[i]["author"] = "AUTHOR";
|
if(!json[i].contains("author")) json[i]["author"] = "AUTHOR";
|
||||||
if(!json[i].contains("shortDesc")) json[i]["shortDesc"] = "SHORTDESC";
|
if(!json[i].contains("shortDesc")) json[i]["shortDesc"] = "SHORTDESC";
|
||||||
if(!json[i].contains("revision")) json[i]["revision"] = 0;
|
if(!json[i].contains("revision")) json[i]["revision"] = 0;
|
||||||
if(!json[i].contains("curRevision")) json[i]["curRevision"] = 0;
|
if(!json[i].contains("curRevision")) json[i]["curRevision"] = -1;
|
||||||
if(!json[i].contains("version")) json[i]["revision"] = 0;
|
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);
|
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);
|
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 370);
|
||||||
} else if(infoJson[selection]["curRevision"] == infoJson[selection]["revision"]) {
|
} else if(infoJson[selection]["curRevision"] == infoJson[selection]["revision"]) {
|
||||||
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370);
|
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370);
|
||||||
|
|||||||
@@ -441,6 +441,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
switch(SubSelection) {
|
switch(SubSelection) {
|
||||||
case 0:
|
case 0:
|
||||||
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(Config::ScriptPath.c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
getDirectoryContents(dirContents, {"json"});
|
||||||
@@ -478,6 +479,7 @@ void ScriptList::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, subPos[0])) {
|
if (touching(touch, subPos[0])) {
|
||||||
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
if (returnIfExist(Config::ScriptPath, {"json"}) == true) {
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
chdir(Config::ScriptPath.c_str());
|
chdir(Config::ScriptPath.c_str());
|
||||||
getDirectoryContents(dirContents, {"json"});
|
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<dirContents.size();i++) {
|
||||||
|
fileInfo.push_back(parseInfo(dirContents[i].name));
|
||||||
|
}
|
||||||
|
if (dirContents.size() == 0) {
|
||||||
|
dirContents.clear();
|
||||||
|
fileInfo.clear();
|
||||||
|
mode = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
@@ -529,6 +551,11 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
keyRepeatDelay = 6;
|
keyRepeatDelay = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hDown & KEY_SELECT) {
|
||||||
|
if (Msg::promptMsg(Lang::get("DELETE_SCRIPT"))) {
|
||||||
|
deleteScript(selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
if (selection > 0) {
|
if (selection > 0) {
|
||||||
|
|||||||
@@ -217,8 +217,6 @@ UniStore::UniStore() {
|
|||||||
ScriptHelper::downloadFile(SI.sheetURL, SI.storeSheet, Lang::get("UPDATING"));
|
ScriptHelper::downloadFile(SI.sheetURL, SI.storeSheet, Lang::get("UPDATING"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
notConnectedMsg();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ScriptHelper::checkIfValid(Config::UniStoreFile, 1) == true) {
|
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"));
|
ScriptHelper::downloadFile(storeInfo[selectedStore].sheetURL, storeInfo[selectedStore].storeSheet, Lang::get("UPDATING"));
|
||||||
}
|
}
|
||||||
// Refresh the list.
|
// Refresh the list.
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(Config::StorePath.c_str());
|
||||||
@@ -474,6 +473,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
switch(subSelection) {
|
switch(subSelection) {
|
||||||
case 0:
|
case 0:
|
||||||
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(Config::StorePath.c_str());
|
||||||
@@ -507,6 +507,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, subPos[0])) {
|
if (touching(touch, subPos[0])) {
|
||||||
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(Config::StorePath.c_str());
|
||||||
@@ -540,6 +541,7 @@ void UniStore::deleteStore(int selectedStore) {
|
|||||||
path += dirContents[selectedStore].name;
|
path += dirContents[selectedStore].name;
|
||||||
deleteFile(path.c_str());
|
deleteFile(path.c_str());
|
||||||
// Refresh the list.
|
// Refresh the list.
|
||||||
|
Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
|
||||||
dirContents.clear();
|
dirContents.clear();
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
chdir(Config::StorePath.c_str());
|
chdir(Config::StorePath.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user