@@ -19,8 +19,6 @@ struct Context { | |||||
Scene *scene = NULL; | Scene *scene = NULL; | ||||
Engine *engine = NULL; | Engine *engine = NULL; | ||||
Window *window = NULL; | Window *window = NULL; | ||||
bool skipLoadOnLaunch = false; | |||||
}; | }; | ||||
@@ -16,6 +16,7 @@ extern float wireTension; | |||||
extern bool powerMeter; | extern bool powerMeter; | ||||
extern bool lockModules; | extern bool lockModules; | ||||
extern bool checkVersion; | extern bool checkVersion; | ||||
extern bool skipLoadOnLaunch; | |||||
} // namespace settings | } // namespace settings | ||||
@@ -88,10 +88,10 @@ int main(int argc, char *argv[]) { | |||||
if (patchFile.empty()) { | if (patchFile.empty()) { | ||||
// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. | // To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. | ||||
bool oldSkipLoadOnLaunch = context()->skipLoadOnLaunch; | |||||
context()->skipLoadOnLaunch = true; | |||||
bool oldSkipLoadOnLaunch = settings::skipLoadOnLaunch; | |||||
settings::skipLoadOnLaunch = true; | |||||
settings::save(asset::user("settings.json")); | settings::save(asset::user("settings.json")); | ||||
context()->skipLoadOnLaunch = false; | |||||
settings::skipLoadOnLaunch = false; | |||||
if (oldSkipLoadOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) { | if (oldSkipLoadOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) { | ||||
context()->scene->rackWidget->lastPath = ""; | context()->scene->rackWidget->lastPath = ""; | ||||
} | } | ||||
@@ -57,7 +57,7 @@ static json_t *settingsToJson() { | |||||
json_object_set_new(rootJ, "lastPath", lastPathJ); | json_object_set_new(rootJ, "lastPath", lastPathJ); | ||||
// skipLoadOnLaunch | // skipLoadOnLaunch | ||||
if (context()->skipLoadOnLaunch) { | |||||
if (skipLoadOnLaunch) { | |||||
json_object_set_new(rootJ, "skipLoadOnLaunch", json_true()); | json_object_set_new(rootJ, "skipLoadOnLaunch", json_true()); | ||||
} | } | ||||
@@ -130,7 +130,7 @@ static void settingsFromJson(json_t *rootJ) { | |||||
// skipLoadOnLaunch | // skipLoadOnLaunch | ||||
json_t *skipLoadOnLaunchJ = json_object_get(rootJ, "skipLoadOnLaunch"); | json_t *skipLoadOnLaunchJ = json_object_get(rootJ, "skipLoadOnLaunch"); | ||||
if (skipLoadOnLaunchJ) | if (skipLoadOnLaunchJ) | ||||
context()->skipLoadOnLaunch = json_boolean_value(skipLoadOnLaunchJ); | |||||
skipLoadOnLaunch = json_boolean_value(skipLoadOnLaunchJ); | |||||
// moduleBrowser | // moduleBrowser | ||||
json_t *moduleBrowserJ = json_object_get(rootJ, "moduleBrowser"); | json_t *moduleBrowserJ = json_object_get(rootJ, "moduleBrowser"); | ||||
@@ -189,6 +189,7 @@ float wireTension = 0.5; | |||||
bool powerMeter = false; | bool powerMeter = false; | ||||
bool lockModules = false; | bool lockModules = false; | ||||
bool checkVersion = true; | bool checkVersion = true; | ||||
bool skipLoadOnLaunch = false; | |||||
} // namespace settings | } // namespace settings | ||||