Compare commits

..

2 commits

Author SHA1 Message Date
f7fa56757b Remove usage of replaceAll
Some checks failed
Make Latest Folder On EmulatorJS CDN / run (push) Has been cancelled
2024-07-28 21:40:49 -05:00
605a271299 Pull core report file to get time last built 2024-07-27 15:23:40 -05:00

View file

@ -1,5 +1,4 @@
class EmulatorJS {
version = 13; //Increase by 1 when cores are updated
getCore(generic) {
const core = this.config.system;
if (generic) {
@ -597,7 +596,7 @@ class EmulatorJS {
}
}
versionAsInt(ver) {
return parseInt(ver.replaceAll(".", ""));
return parseInt(ver.split(".").join(""));
}
checkCoreCompatibility(version) {
// Leave commented until next release - this is ready to go.
@ -643,14 +642,19 @@ class EmulatorJS {
this.initGameCore(js, wasm, thread);
});
}
const report = "cores/reports/" + this.getCore() + ".json";
this.downloadFile(report, (rep) => {
if (rep === -1) {
rep = {buildStart: Math.random() * 100};
}
let legacy = (this.supportsWebgl2 && this.webgl2Enabled ? "" : "-legacy");
let filename = this.getCore()+(this.config.threads ? "-thread" : "")+legacy+"-wasm.data";
this.storage.core.get(filename).then((result) => {
if (result && result.version === this.version && !this.debug) {
if (result && result.version === rep.buildStart && !this.debug) {
gotCore(result.data);
return;
}
let corePath = 'cores/'+filename;
const corePath = 'cores/'+filename;
this.downloadFile(corePath, (res) => {
if (res === -1) {
console.log("File not found, attemping to fetch from emulatorjs cdn");
@ -667,7 +671,7 @@ class EmulatorJS {
console.warn("File was not found locally, but was found on the emulatorjs cdn.\nIt is recommended to download the latest release from here: https://cdn.emulatorjs.org/releases/");
gotCore(res.data);
this.storage.core.put(filename, {
version: this.version,
version: rep.buildStart,
data: res.data
});
}, (progress) => {
@ -677,13 +681,14 @@ class EmulatorJS {
}
gotCore(res.data);
this.storage.core.put(filename, {
version: this.version,
version: rep.buildStart,
data: res.data
});
}, (progress) => {
this.textElem.innerText = this.localization("Download Game Core") + progress;
}, false, {responseType: "arraybuffer", method: "GET"});
})
}, null, false, {responseType: "text", method: "GET"});
}
initGameCore(js, wasm, thread) {
this.initModule(wasm, thread);
@ -3442,7 +3447,7 @@ class EmulatorJS {
const leftHandedMode = false;
const blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;';
const controlSchemeCls = `cs_${this.getControlScheme()}`.replaceAll(/\s/g, '_');
const controlSchemeCls = `cs_${this.getControlScheme()}`.split(/\s/g).join('_');
for (let i=0; i<info.length; i++) {
if (info[i].type !== 'button') continue;