diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index e32af83..935b848 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -217,6 +217,44 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } } + if (hDown & KEY_TOUCH) { + if (Config::viewMode == 0) { + for(int i=0;i (i+1)*57 && touch.py < (i+2)*57) { + if (infoJson.size() != 0) { + std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]); + std::string titleFix = infoJson[screenPos + i]["title"]; + for (int l = 0; i < (int)titleFix.size(); l++) { + if (titleFix[l] == '/') { + titleFix[l] = '-'; + } + } + DisplayMsg(fileName); + downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json", true); + infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"]; + } + } + } + } else if (Config::viewMode == 1) { + for(int i=0;i (i+1)*27 && touch.py < (i+2)*27) { + if (infoJson.size() != 0) { + std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPosList + i]["title"]); + std::string titleFix = infoJson[screenPosList + i]["title"]; + for (int l = 0; l < (int)titleFix.size(); l++) { + if (titleFix[l] == '/') { + titleFix[l] = '-'; + } + } + DisplayMsg(fileName); + downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json", true); + infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"]; + } + } + } + } + } + if (hDown & KEY_A) { if (infoJson.size() != 0) { std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[selection]["title"]); diff --git a/source/screens/scriptlist.cpp b/source/screens/scriptlist.cpp index ba0c32f..e1f434d 100644 --- a/source/screens/scriptlist.cpp +++ b/source/screens/scriptlist.cpp @@ -394,6 +394,52 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) { selection = 0; } } + + if (hDown & KEY_TOUCH) { + if (Config::viewMode == 0) { + for(int i=0;i (i+1)*57 && touch.py < (i+2)*57) { + if (dirContents[screenPos + i].isDirectory) { + } else if (fileInfo.size() != 0) { + if (ScriptHelper::checkIfValid(dirContents[screenPos + i].name) == true) { + currentFile = dirContents[screenPos + i].name; + selectedTitle = fileInfo[screenPos + i].title; + jsonFile = openScriptFile(); + Desc = Description(jsonFile); + checkForValidate(); + fileInfo2 = parseObjects(currentFile); + loadColors(jsonFile); + loadDesc(); + isScriptSelected = true; + selection = 0; + mode = 1; + } + } + } + } + } else if (Config::viewMode == 1) { + for(int i=0;i (i+1)*27 && touch.py < (i+2)*27) { + if (dirContents[screenPosList + i].isDirectory) { + } else if (fileInfo.size() != 0) { + if (ScriptHelper::checkIfValid(dirContents[screenPosList + i].name) == true) { + currentFile = dirContents[screenPosList + i].name; + selectedTitle = fileInfo[screenPosList + i].title; + jsonFile = openScriptFile(); + Desc = Description(jsonFile); + checkForValidate(); + fileInfo2 = parseObjects(currentFile); + loadColors(jsonFile); + loadDesc(); + isScriptSelected = true; + selection = 0; + mode = 1; + } + } + } + } + } + } if (hHeld & KEY_DOWN && !keyRepeatDelay) { if (selection < (int)fileInfo.size()-1) { @@ -480,6 +526,28 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) { } } + if (hDown & KEY_TOUCH) { + if (Config::viewMode == 0) { + for(int i=0;i (i+1)*57 && touch.py < (i+2)*57) { + if (fileInfo2.size() != 0) { + choice = fileInfo2[screenPos2 + i]; + runFunctions(jsonFile); + } + } + } + } else if (Config::viewMode == 1) { + for(int i=0;i (i+1)*27 && touch.py < (i+2)*27) { + if (fileInfo2.size() != 0) { + choice = fileInfo2[screenPosList2 + i]; + runFunctions(jsonFile); + } + } + } + } + } + if (hHeld & KEY_DOWN && !keyRepeatDelay) { if (selection2 < (int)fileInfo2.size()-1) { selection2++; diff --git a/source/screens/tinyDB.cpp b/source/screens/tinyDB.cpp index 6a0af11..68a5fba 100644 --- a/source/screens/tinyDB.cpp +++ b/source/screens/tinyDB.cpp @@ -219,6 +219,26 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) { } } + if (hDown & KEY_TOUCH) { + if (Config::viewMode == 0) { + for(int i=0;i (i+1)*57 && touch.py < (i+2)*57) { + selection = i; + selectedOption = tinyDBList[screenPos + i]; + execute(); + } + } + } else if (Config::viewMode == 1) { + for(int i=0;i (i+1)*27 && touch.py < (i+2)*27) { + selection = i; + selectedOption = tinyDBList[screenPosList + i]; + execute(); + } + } + } + } + if (hDown & KEY_A) { execute(); }