Check EmulatorJS core compatibility

This commit is contained in:
Ethan O'Brien 2024-07-23 21:15:03 -05:00
parent cfa011fa78
commit ba1f40bea1

View file

@ -639,7 +639,17 @@ class EmulatorJS {
return new Promise(resolve => resolve({"!!notCompressedData": data})); 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() { downloadGameCore() {
this.textElem.innerText = this.localization("Download Game Core"); this.textElem.innerText = this.localization("Download Game Core");
@ -659,6 +669,8 @@ class EmulatorJS {
thread = data[k]; thread = data[k];
} else if (k.endsWith(".js")) { } else if (k.endsWith(".js")) {
js = data[k]; js = data[k];
} else if (k === "build.json") {
this.checkCoreCompatibility(JSON.parse(new TextDecoder().decode(data[k])));
} }
} }
this.initGameCore(js, wasm, thread); this.initGameCore(js, wasm, thread);