Add deleteTitle and bootTitle.

**ONLY USE "DELETE TITLE" WHEN NEEDED!!!!!!!!!!!!!**
This commit is contained in:
StackZ
2020-03-01 10:42:59 +01:00
parent 3c2ee7adb2
commit 1bdcf008bf
8 changed files with 111 additions and 20 deletions
+1 -8
View File
@@ -2,7 +2,7 @@
bool updatingSelf = false;
static Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType) {
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType) {
Result ret = 0;
u8 param[0x300];
u8 hmac[0x20];
@@ -74,12 +74,6 @@ Result installCia(const char * ciaPath)
AM_TitleEntry info;
Result ret = 0;
ret = amInit();
if (R_FAILED(ret)) {
printf("Error in:\namInit();\n");
return ret;
}
FS_MediaType media = MEDIATYPE_SD;
ret = openFile(&fileHandle, ciaPath, false);
@@ -140,6 +134,5 @@ Result installCia(const char * ciaPath)
if (R_FAILED(ret = CIA_LaunchTitle(info.titleID, MEDIATYPE_SD)))
return ret;
}
amExit();
return 0;
}
+32
View File
@@ -148,4 +148,36 @@ bool ScriptHelper::checkIfValid(std::string scriptFile, int mode) {
}
return true;
}
void ScriptHelper::deleteTitle(const std::string TitleID, bool isNAND, std::string message) {
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;
u64 ID = std::stoull(TitleID, 0, 16);
if (Msg::promptMsg(MSG)) {
if (isNAND == true) {
Msg::DisplayMsg(message);
deletePrevious(ID, MEDIATYPE_NAND);
} else {
Msg::DisplayMsg(message);
deletePrevious(ID, MEDIATYPE_SD);
}
}
}
void ScriptHelper::bootTitle(const std::string TitleID, bool isNAND, std::string message) {
std::string MSG = Lang::get("BOOT_TITLE") + "\n\n";
if (isNAND) MSG += Lang::get("MEDIATYPE_NAND") + "\n" + TitleID;
else MSG += Lang::get("MEDIATYPE_SD") + "\n" + TitleID;
u64 ID = std::stoull(TitleID, 0, 16);
if (Msg::promptMsg(MSG)) {
if (isNAND == true) {
Msg::DisplayMsg(message);
CIA_LaunchTitle(ID, MEDIATYPE_NAND);
} else {
Msg::DisplayMsg(message);
CIA_LaunchTitle(ID, MEDIATYPE_SD);
}
}
}