mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Push updated cheats function
This commit is contained in:
parent
babd7a9182
commit
12f0b30d57
@ -6871,7 +6871,10 @@ class EmulatorJS {
|
||||
select.style.width = "100%";
|
||||
select.classList.add("ejs_cheat_code");
|
||||
div.appendChild(select);
|
||||
return { container: div, select: select };
|
||||
return {
|
||||
container: div,
|
||||
select: select
|
||||
};
|
||||
};
|
||||
|
||||
const importDiv = this.createElement("div");
|
||||
@ -6920,6 +6923,7 @@ class EmulatorJS {
|
||||
main.appendChild(this.createElement("br"));
|
||||
popup.appendChild(main);
|
||||
|
||||
|
||||
const loadCheatList = (gameName) => {
|
||||
cheatSelectUI.select.innerHTML = "";
|
||||
|
||||
@ -6966,17 +6970,14 @@ class EmulatorJS {
|
||||
const url = this.config.cheatPath + system + ".json";
|
||||
|
||||
try {
|
||||
const res = await this.downloadFile(url, null, true, { responseType: "text", method: "GET" });
|
||||
const res = await this.downloadFile(url, null, true, {
|
||||
responseType: "text",
|
||||
method: "GET"
|
||||
});
|
||||
|
||||
let data;
|
||||
if (res === -1) {
|
||||
throw new Error("Cheat JSON not found. Create a file at: " + url);
|
||||
} else if (typeof res.data === "string") {
|
||||
try {
|
||||
data = JSON.parse(res.data);
|
||||
} catch (e) {
|
||||
throw new Error("Failed to parse cheat JSON: " + e.message);
|
||||
}
|
||||
} else {
|
||||
data = res.data;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user