mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Pull core report file to get time last built
This commit is contained in:
parent
38a496a271
commit
605a271299
1 changed files with 43 additions and 38 deletions
|
@ -1,5 +1,4 @@
|
||||||
class EmulatorJS {
|
class EmulatorJS {
|
||||||
version = 13; //Increase by 1 when cores are updated
|
|
||||||
getCore(generic) {
|
getCore(generic) {
|
||||||
const core = this.config.system;
|
const core = this.config.system;
|
||||||
if (generic) {
|
if (generic) {
|
||||||
|
@ -643,47 +642,53 @@ class EmulatorJS {
|
||||||
this.initGameCore(js, wasm, thread);
|
this.initGameCore(js, wasm, thread);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let legacy = (this.supportsWebgl2 && this.webgl2Enabled ? "" : "-legacy");
|
const report = "cores/reports/" + this.getCore() + ".json";
|
||||||
let filename = this.getCore()+(this.config.threads ? "-thread" : "")+legacy+"-wasm.data";
|
this.downloadFile(report, (rep) => {
|
||||||
this.storage.core.get(filename).then((result) => {
|
if (rep === -1) {
|
||||||
if (result && result.version === this.version && !this.debug) {
|
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 === rep.buildStart && !this.debug) {
|
||||||
gotCore(result.data);
|
gotCore(result.data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let corePath = 'cores/'+filename;
|
const corePath = 'cores/'+filename;
|
||||||
this.downloadFile(corePath, (res) => {
|
this.downloadFile(corePath, (res) => {
|
||||||
if (res === -1) {
|
if (res === -1) {
|
||||||
console.log("File not found, attemping to fetch from emulatorjs cdn");
|
console.log("File not found, attemping to fetch from emulatorjs cdn");
|
||||||
this.downloadFile("https://cdn.emulatorjs.org/stable/data/"+corePath, (res) => {
|
this.downloadFile("https://cdn.emulatorjs.org/stable/data/"+corePath, (res) => {
|
||||||
if (res === -1) {
|
if (res === -1) {
|
||||||
if (!this.supportsWebgl2) {
|
if (!this.supportsWebgl2) {
|
||||||
this.textElem.innerText = this.localization('Outdated graphics driver');
|
this.textElem.innerText = this.localization('Outdated graphics driver');
|
||||||
} else {
|
} else {
|
||||||
this.textElem.innerText = this.localization('Network Error');
|
this.textElem.innerText = this.localization('Network Error');
|
||||||
|
}
|
||||||
|
this.textElem.style.color = "red";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.textElem.style.color = "red";
|
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/");
|
||||||
return;
|
gotCore(res.data);
|
||||||
}
|
this.storage.core.put(filename, {
|
||||||
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/");
|
version: rep.buildStart,
|
||||||
gotCore(res.data);
|
data: res.data
|
||||||
this.storage.core.put(filename, {
|
});
|
||||||
version: this.version,
|
}, (progress) => {
|
||||||
data: res.data
|
this.textElem.innerText = this.localization("Download Game Core") + progress;
|
||||||
});
|
}, true, {responseType: "arraybuffer", method: "GET"})
|
||||||
}, (progress) => {
|
return;
|
||||||
this.textElem.innerText = this.localization("Download Game Core") + progress;
|
}
|
||||||
}, true, {responseType: "arraybuffer", method: "GET"})
|
gotCore(res.data);
|
||||||
return;
|
this.storage.core.put(filename, {
|
||||||
}
|
version: rep.buildStart,
|
||||||
gotCore(res.data);
|
data: res.data
|
||||||
this.storage.core.put(filename, {
|
});
|
||||||
version: this.version,
|
}, (progress) => {
|
||||||
data: res.data
|
this.textElem.innerText = this.localization("Download Game Core") + progress;
|
||||||
});
|
}, false, {responseType: "arraybuffer", method: "GET"});
|
||||||
}, (progress) => {
|
})
|
||||||
this.textElem.innerText = this.localization("Download Game Core") + progress;
|
}, null, false, {responseType: "text", method: "GET"});
|
||||||
}, false, {responseType: "arraybuffer", method: "GET"});
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
initGameCore(js, wasm, thread) {
|
initGameCore(js, wasm, thread) {
|
||||||
this.initModule(wasm, thread);
|
this.initModule(wasm, thread);
|
||||||
|
|
Loading…
Reference in a new issue