Check default options when getting core settings

This commit is contained in:
Ethan O'Brien 2025-06-09 10:24:37 -05:00
parent 7d4f80a273
commit b5a05d1ee5
No known key found for this signature in database
GPG Key ID: 7A6E7CCD3BD93AB1

View File

@ -4136,7 +4136,17 @@ class EmulatorJS {
return null;
}
getCoreSettings() {
if (!window.localStorage || this.config.disableLocalStorage) return;
if (!window.localStorage || this.config.disableLocalStorage) {
if (this.config.defaultOptions) {
let rv = "";
for (const k in this.config.defaultOptions) {
let value = isNaN(this.config.defaultOptions[k]) ? `"${this.config.defaultOptions[k]}"` : this.config.defaultOptions[k];
rv += `${k} = ${value}\n`;
}
return rv;
}
return "";
};
let coreSpecific = localStorage.getItem(this.getLocalStorageKey());
if (coreSpecific) {
try {
@ -4147,6 +4157,11 @@ class EmulatorJS {
let value = isNaN(coreSpecific.settings[k]) ? `"${coreSpecific.settings[k]}"` : coreSpecific.settings[k];
rv += `${k} = ${value}\n`;
}
for (const k in this.config.defaultOptions) {
if (rv.includes(k)) continue;
let value = isNaN(this.config.defaultOptions[k]) ? `"${this.config.defaultOptions[k]}"` : this.config.defaultOptions[k];
rv += `${k} = ${value}\n`;
}
return rv;
} catch(e) {
console.warn("Could not load previous settings", e);