mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 12:52:19 +01:00
[HOTFIX] getEjsControls should return null if no controls for core or default
This commit is contained in:
@@ -79,31 +79,45 @@ export default defineStore("config", {
|
||||
},
|
||||
getEJSControls(
|
||||
core: string | null,
|
||||
): Record<number, Record<number, EjsControlsButton>> {
|
||||
const defaultControls = {
|
||||
0: this.config.EJS_CONTROLS["default"]?.["_0"] || {},
|
||||
1: this.config.EJS_CONTROLS["default"]?.["_1"] || {},
|
||||
2: this.config.EJS_CONTROLS["default"]?.["_2"] || {},
|
||||
3: this.config.EJS_CONTROLS["default"]?.["_3"] || {},
|
||||
};
|
||||
if (!core) return defaultControls;
|
||||
): Record<number, Record<number, EjsControlsButton>> | null {
|
||||
const defaultControls = this.config.EJS_CONTROLS["default"];
|
||||
if (!core) {
|
||||
if (!defaultControls) return null;
|
||||
return {
|
||||
0: defaultControls["_0"],
|
||||
1: defaultControls["_1"],
|
||||
2: defaultControls["_2"],
|
||||
3: defaultControls["_3"],
|
||||
};
|
||||
}
|
||||
|
||||
const coreControls = this.config.EJS_CONTROLS[core];
|
||||
if (!coreControls) return null;
|
||||
if (!defaultControls) {
|
||||
return {
|
||||
0: coreControls["_0"],
|
||||
1: coreControls["_1"],
|
||||
2: coreControls["_2"],
|
||||
3: coreControls["_3"],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
0: {
|
||||
...defaultControls[0],
|
||||
...(this.config.EJS_CONTROLS[core]?.["_0"] || {}),
|
||||
...defaultControls["_0"],
|
||||
...coreControls["_0"],
|
||||
},
|
||||
1: {
|
||||
...defaultControls[1],
|
||||
...(this.config.EJS_CONTROLS[core]?.["_1"] || {}),
|
||||
...defaultControls["_1"],
|
||||
...coreControls["_1"],
|
||||
},
|
||||
2: {
|
||||
...defaultControls[2],
|
||||
...(this.config.EJS_CONTROLS[core]?.["_2"] || {}),
|
||||
...defaultControls["_2"],
|
||||
...coreControls["_2"],
|
||||
},
|
||||
3: {
|
||||
...defaultControls[3],
|
||||
...(this.config.EJS_CONTROLS[core]?.["_3"] || {}),
|
||||
...defaultControls["_3"],
|
||||
...coreControls["_3"],
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -125,7 +125,8 @@ window.EJS_defaultOptions = {
|
||||
rewindEnabled: "enabled",
|
||||
...coreOptions,
|
||||
};
|
||||
window.EJS_defaultControls = configStore.getEJSControls(props.core);
|
||||
const ejsControls = configStore.getEJSControls(props.core);
|
||||
if (ejsControls) window.EJS_defaultControls = ejsControls;
|
||||
// Set a valid game name
|
||||
window.EJS_gameName = romRef.value.fs_name_no_tags
|
||||
.replace(INVALID_CHARS_REGEX, "")
|
||||
|
||||
Reference in New Issue
Block a user