From b2747487d1562b78bc566d3e6d29f623baacfc22 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Thu, 12 Dec 2024 07:12:04 -0600 Subject: [PATCH] Fix setting settings when game errored --- data/src/emulator.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/src/emulator.js b/data/src/emulator.js index 008f8d3..836f60b 100644 --- a/data/src/emulator.js +++ b/data/src/emulator.js @@ -238,6 +238,7 @@ class EmulatorJS { this.currentPopup = null; this.isFastForward = false; this.isSlowMotion = false; + this.failedToStart = false; this.rewindEnabled = this.preGetSetting("rewindEnabled") === 'enabled'; this.touch = false; this.cheats = []; @@ -519,6 +520,7 @@ class EmulatorJS { this.menu.failedToStart(); this.handleResize(); + this.failedToStart = true; } downloadGameCore() { this.textElem.innerText = this.localization("Download Game Core"); @@ -993,7 +995,7 @@ class EmulatorJS { if (typeof window.EJS_Runtime !== "function") { console.warn("EJS_Runtime is not defined!"); this.startGameError(this.localization("Failed to start game")); - return; + throw new Error("EJS_Runtime is not defined!"); } window.EJS_Runtime({ noInitialRun: true, @@ -3833,7 +3835,8 @@ class EmulatorJS { }; } saveSettings() { - if (!window.localStorage || this.config.disableLocalStorage || !this.settingsLoaded || !this.started) return; + if (!window.localStorage || this.config.disableLocalStorage || !this.settingsLoaded) return; + if (!this.started && !this.failedToStart) return; const coreSpecific = { controlSettings: this.controls, settings: this.settings,