diff --git a/frontend/src/views/Player/EmulatorJS/Player.vue b/frontend/src/views/Player/EmulatorJS/Player.vue index 0d046ca17..b368ad5ea 100644 --- a/frontend/src/views/Player/EmulatorJS/Player.vue +++ b/frontend/src/views/Player/EmulatorJS/Player.vue @@ -389,6 +389,36 @@ window.EJS_onGameStart = async () => { // emulator's own start hook keeps the flag true for any entry point. playing.value = true; + // Patch the instance so unsaved keys still fall back to config defaults. + const originalPreGetSetting = window.EJS_emulator?.preGetSetting.bind( + window.EJS_emulator, + ); + if (window.EJS_emulator) { + window.EJS_emulator.preGetSetting = (setting: string) => { + const value = originalPreGetSetting(setting); + if (value !== undefined && value !== null) return value; + const defaults = window.EJS_emulator.config?.defaultOptions ?? {}; + return defaults[setting] !== undefined ? defaults[setting] : null; + }; + + window.EJS_emulator.rewindEnabled = + window.EJS_emulator.preGetSetting("rewindEnabled") === "enabled"; + + if (![0, 1, 2, 3].includes(window.EJS_emulator.config?.videoRotation)) { + window.EJS_emulator.videoRotation = + window.EJS_emulator.preGetSetting("videoRotation") || 0; + } + + const webgl2Setting = window.EJS_emulator.preGetSetting("webgl2Enabled"); + if (webgl2Setting === "disabled" || !window.EJS_emulator.supportsWebgl2) { + window.EJS_emulator.webgl2Enabled = false; + } else if (webgl2Setting === "enabled") { + window.EJS_emulator.webgl2Enabled = true; + } else { + window.EJS_emulator.webgl2Enabled = null; + } + } + // Install netplay overrides synchronously, before any await below, so they // are in place before room polling or a Create/Join action can start. const netplay = window.EJS_emulator?.netplay;