mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-06 00:38:59 +00:00
Add touch for: Scriptlist, Get Scripts and TinyDB.
This commit is contained in:
@@ -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<ENTRIES_PER_SCREEN;i++) {
|
||||||
|
if(touch.py > (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<ENTRIES_PER_LIST;i++) {
|
||||||
|
if(touch.py > (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 (hDown & KEY_A) {
|
||||||
if (infoJson.size() != 0) {
|
if (infoJson.size() != 0) {
|
||||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[selection]["title"]);
|
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[selection]["title"]);
|
||||||
|
|||||||
@@ -395,6 +395,52 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||||
|
if(touch.py > (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<ENTRIES_PER_LIST;i++) {
|
||||||
|
if(touch.py > (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 (hHeld & KEY_DOWN && !keyRepeatDelay) {
|
||||||
if (selection < (int)fileInfo.size()-1) {
|
if (selection < (int)fileInfo.size()-1) {
|
||||||
selection++;
|
selection++;
|
||||||
@@ -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<ENTRIES_PER_SCREEN;i++) {
|
||||||
|
if(touch.py > (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<ENTRIES_PER_LIST;i++) {
|
||||||
|
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
|
if (fileInfo2.size() != 0) {
|
||||||
|
choice = fileInfo2[screenPosList2 + i];
|
||||||
|
runFunctions(jsonFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hHeld & KEY_DOWN && !keyRepeatDelay) {
|
if (hHeld & KEY_DOWN && !keyRepeatDelay) {
|
||||||
if (selection2 < (int)fileInfo2.size()-1) {
|
if (selection2 < (int)fileInfo2.size()-1) {
|
||||||
selection2++;
|
selection2++;
|
||||||
|
|||||||
@@ -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<ENTRIES_PER_SCREEN;i++) {
|
||||||
|
if(touch.py > (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<ENTRIES_PER_LIST;i++) {
|
||||||
|
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
|
||||||
|
selection = i;
|
||||||
|
selectedOption = tinyDBList[screenPosList + i];
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
execute();
|
execute();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user