mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Check default options when getting core settings
This commit is contained in:
parent
7d4f80a273
commit
b5a05d1ee5
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user