mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-06 16:49:11 +00:00
Make updateSelf a optional boolean.
Should fix sometimes booting into TWiLight Menu++ for some reason.
This commit is contained in:
@@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType);
|
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType);
|
||||||
Result deletePrevious(u64 titleid, FS_MediaType media);
|
Result deletePrevious(u64 titleid, FS_MediaType media);
|
||||||
Result installCia(const char * ciaPath);
|
Result installCia(const char * ciaPath, bool updateSelf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -67,7 +67,7 @@ namespace ScriptHelper {
|
|||||||
Result downloadFile(std::string file, std::string output, std::string message);
|
Result downloadFile(std::string file, std::string output, std::string message);
|
||||||
|
|
||||||
Result removeFile(std::string file, std::string message);
|
Result removeFile(std::string file, std::string message);
|
||||||
void installFile(std::string file, std::string message);
|
void installFile(std::string file, bool updateSelf, std::string message);
|
||||||
void extractFile(std::string file, std::string input, std::string output, std::string message);
|
void extractFile(std::string file, std::string input, std::string output, std::string message);
|
||||||
Result createFile(const char * path);
|
Result createFile(const char * path);
|
||||||
void displayTimeMsg(std::string message, int seconds);
|
void displayTimeMsg(std::string message, int seconds);
|
||||||
|
|||||||
@@ -935,12 +935,15 @@ Result ScriptList::runFunctions(nlohmann::json &json) {
|
|||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if(type == "installCia") {
|
||||||
bool missing = false;
|
bool missing = false, updateSelf = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
|
if(json.at(choice).at(i).contains("updateSelf") && json.at(choice).at(i).at("updateSelf").is_boolean()) {
|
||||||
|
updateSelf = json.at(choice).at(i).at("updateSelf");
|
||||||
|
}
|
||||||
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
|
||||||
if(!missing) ScriptHelper::installFile(file, message);
|
if(!missing) ScriptHelper::installFile(file, updateSelf, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "mkdir") {
|
} else if (type == "mkdir") {
|
||||||
|
|||||||
@@ -1264,12 +1264,15 @@ Result UniStore::execute() {
|
|||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if(type == "installCia") {
|
||||||
bool missing = false;
|
bool missing = false, updateSelf = false;
|
||||||
std::string file, message;
|
std::string file, message;
|
||||||
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
|
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("updateSelf") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf").is_boolean()) {
|
||||||
|
updateSelf = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("updateSelf");
|
||||||
|
}
|
||||||
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
|
||||||
if(!missing) ScriptHelper::installFile(file, message);
|
if(!missing) ScriptHelper::installFile(file, updateSelf, message);
|
||||||
else ret = SYNTAX_ERROR;
|
else ret = SYNTAX_ERROR;
|
||||||
|
|
||||||
} else if (type == "mkdir") {
|
} else if (type == "mkdir") {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "cia.hpp"
|
#include "cia.hpp"
|
||||||
|
|
||||||
bool updatingSelf = false;
|
|
||||||
|
|
||||||
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType) {
|
Result CIA_LaunchTitle(u64 titleId, FS_MediaType mediaType) {
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
u8 param[0x300];
|
u8 param[0x300];
|
||||||
@@ -67,7 +65,7 @@ FS_MediaType getTitleDestination(u64 titleId) {
|
|||||||
// Variables.
|
// Variables.
|
||||||
u64 installSize = 0, installOffset = 0;
|
u64 installSize = 0, installOffset = 0;
|
||||||
|
|
||||||
Result installCia(const char * ciaPath)
|
Result installCia(const char * ciaPath, bool updatingSelf)
|
||||||
{
|
{
|
||||||
u32 bytes_read = 0, bytes_written;
|
u32 bytes_read = 0, bytes_written;
|
||||||
installSize = 0, installOffset = 0; u64 size = 0;
|
installSize = 0, installOffset = 0; u64 size = 0;
|
||||||
@@ -89,9 +87,6 @@ Result installCia(const char * ciaPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
media = getTitleDestination(info.titleID);
|
media = getTitleDestination(info.titleID);
|
||||||
if (info.titleID == 0x0004000004391700) {
|
|
||||||
updatingSelf = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!updatingSelf) {
|
if (!updatingSelf) {
|
||||||
ret = deletePrevious(info.titleID, media);
|
ret = deletePrevious(info.titleID, media);
|
||||||
|
|||||||
@@ -106,12 +106,12 @@ Result ScriptHelper::removeFile(std::string file, std::string message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Install a file.
|
// Install a file.
|
||||||
void ScriptHelper::installFile(std::string file, std::string message) {
|
void ScriptHelper::installFile(std::string file, bool updatingSelf, std::string message) {
|
||||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||||
showProgressBar = true;
|
showProgressBar = true;
|
||||||
progressBarType = 2;
|
progressBarType = 2;
|
||||||
Threads::create((ThreadFunc)displayProgressBar);
|
Threads::create((ThreadFunc)displayProgressBar);
|
||||||
installCia(file.c_str());
|
installCia(file.c_str(), updatingSelf);
|
||||||
showProgressBar = false;
|
showProgressBar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user