From ba1f40bea130ccf420812f1bc6601942362fda51 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Tue, 23 Jul 2024 21:15:03 -0500 Subject: [PATCH] Check EmulatorJS core compatibility --- data/emulator.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/data/emulator.js b/data/emulator.js index f09fc6e..b283eab 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -639,7 +639,17 @@ class EmulatorJS { return new Promise(resolve => resolve({"!!notCompressedData": data})); } } - + } + versionAsInt(ver) { + return parseInt(ver.replaceAll(".", "")); + } + checkCoreCompatibility(version) { + // Leave commented until next release - this is ready to go. + if (this.versionAsInt(version.minimumEJSVersion) > this.versionAsInt(this.ejs_version)) { + //this.textElem.innerText = this.localization("Outdated EmulatorJS version"); + //this.textElem.style.color = "red"; + //throw new Error("Core requires minimum EmulatorJS version of " + version.minimumEJSVersion); + } } downloadGameCore() { this.textElem.innerText = this.localization("Download Game Core"); @@ -659,6 +669,8 @@ class EmulatorJS { thread = data[k]; } else if (k.endsWith(".js")) { js = data[k]; + } else if (k === "build.json") { + this.checkCoreCompatibility(JSON.parse(new TextDecoder().decode(data[k]))); } } this.initGameCore(js, wasm, thread);