*Only* open valid Scripts.

This commit is contained in:
SuperSaiyajinStackZ 2019-12-22 17:49:23 +01:00
commit 3ebdb7e95d
5 changed files with 29 additions and 15 deletions

View file

@ -131,4 +131,18 @@ void ScriptHelper::displayTimeMsg(std::string message, int seconds) {
for (int i = 0; i < 60*seconds; i++) {
gspWaitForVBlank();
}
}
bool ScriptHelper::checkIfValid(std::string scriptFile) {
FILE* file = fopen(scriptFile.c_str(), "rt");
if(!file) {
printf("File not found\n");
return false;
}
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
fclose(file);
if (!json.contains("info")) return false;
return true;
}