Compare commits

...

5 commits

Author SHA1 Message Date
469b9fcc4e Fix core path
Some checks failed
Make Latest Folder On EmulatorJS CDN / run (push) Has been cancelled
2024-08-08 10:27:36 -05:00
b30c5f42a8 Get core config from core json 2024-08-08 10:26:13 -05:00
61620e2c77 Get mouse options from core options json 2024-08-08 10:07:46 -05:00
4bc5a8e871 Uncomment version checking code
While not yet released, this issue has been fixed in a previous commit
2024-08-08 09:52:49 -05:00
e486e70181 Maintain backwards compatibility with version.json 2024-08-08 09:51:14 -05:00
3 changed files with 24 additions and 14 deletions

View file

@ -31,9 +31,6 @@ class EJS_GameManager {
getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']), getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']),
setVSync: this.Module.cwrap('set_vsync', 'null', ['number']) setVSync: this.Module.cwrap('set_vsync', 'null', ['number'])
} }
this.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n');
this.writeFile("/home/web_user/retroarch/userdata/config/MAME 2003 (0.78)/MAME 2003 (0.78).opt", 'mame2003_skip_disclaimer = "enabled"\nmame2003_skip_warnings = "enabled"\n');
this.mkdir("/data"); this.mkdir("/data");
this.mkdir("/data/saves"); this.mkdir("/data/saves");
@ -42,6 +39,7 @@ class EJS_GameManager {
this.FS.mount(this.FS.filesystems.IDBFS, {autoPersist: true}, '/data/saves'); this.FS.mount(this.FS.filesystems.IDBFS, {autoPersist: true}, '/data/saves');
//this.FS.syncfs(true, () => {}); //this.FS.syncfs(true, () => {});
this.writeConfigFile();
this.initShaders(); this.initShaders();
this.EJS.on("exit", () => { this.EJS.on("exit", () => {
@ -52,6 +50,17 @@ class EJS_GameManager {
}, 1000); }, 1000);
}) })
} }
writeConfigFile() {
if (!this.EJS.defaultCoreOpts.file || !this.EJS.defaultCoreOpts.settings) {
return;
}
let output = "";
for (const k in this.EJS.defaultCoreOpts.settings) {
output += k + ' = "' + this.EJS.defaultCoreOpts.settings[k] +'"\n';
}
this.writeFile("/home/web_user/retroarch/userdata/config/" + this.EJS.defaultCoreOpts.file, output);
}
loadExternalFiles() { loadExternalFiles() {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (this.EJS.config.externalFiles && this.EJS.config.externalFiles.constructor.name === 'Object') { if (this.EJS.config.externalFiles && this.EJS.config.externalFiles.constructor.name === 'Object') {

View file

@ -210,8 +210,8 @@ class EmulatorJS {
if (response.ok) { if (response.ok) {
response.text().then(body => { response.text().then(body => {
let version = JSON.parse(body); let version = JSON.parse(body);
if (this.versionAsInt(this.ejs_version) < this.versionAsInt(version.current_version)) { if (this.versionAsInt(this.ejs_version) < this.versionAsInt(version.version)) {
console.log('Using EmulatorJS version ' + this.versionAsInt(this.ejs_version) + ' but the newest version is ' + this.versionAsInt(version.current_version) + '\nopen https://github.com/EmulatorJS/EmulatorJS to update'); console.log('Using EmulatorJS version ' + this.ejs_version + ' but the newest version is ' + version.current_version + '\nopen https://github.com/EmulatorJS/EmulatorJS to update');
} }
}) })
} }
@ -496,10 +496,9 @@ class EmulatorJS {
}, fileCbFunc); }, fileCbFunc);
} }
checkCoreCompatibility(version) { checkCoreCompatibility(version) {
// Leave commented until next release - this is ready to go.
if (this.versionAsInt(version.minimumEJSVersion) > this.versionAsInt(this.ejs_version)) { if (this.versionAsInt(version.minimumEJSVersion) > this.versionAsInt(this.ejs_version)) {
//this.startGameError(this.localization("Outdated EmulatorJS version")); this.startGameError(this.localization("Outdated EmulatorJS version"));
//throw new Error("Core requires minimum EmulatorJS version of " + version.minimumEJSVersion); throw new Error("Core requires minimum EmulatorJS version of " + version.minimumEJSVersion);
} }
} }
startGameError(message) { startGameError(message) {
@ -522,6 +521,7 @@ class EmulatorJS {
return; return;
} }
const gotCore = (data) => { const gotCore = (data) => {
this.defaultCoreOpts = {};
this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Core")).then((data) => { this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Core")).then((data) => {
let js, thread, wasm; let js, thread, wasm;
for (let k in data) { for (let k in data) {
@ -538,6 +538,7 @@ class EmulatorJS {
this.extensions = core.extensions; this.extensions = core.extensions;
this.coreName = core.name; this.coreName = core.name;
this.repository = core.repo; this.repository = core.repo;
this.defaultCoreOpts = core.options;
} else if (k === "license.txt") { } else if (k === "license.txt") {
this.license = new TextDecoder().decode(data[k]); this.license = new TextDecoder().decode(data[k]);
} }
@ -547,7 +548,7 @@ class EmulatorJS {
} }
const report = "cores/reports/" + this.getCore() + ".json"; const report = "cores/reports/" + this.getCore() + ".json";
this.downloadFile(report, (rep) => { this.downloadFile(report, (rep) => {
if (rep === -1) { if (rep === -1 || typeof report === "string") {
rep = {}; rep = {};
} else { } else {
rep = rep.data; rep = rep.data;
@ -578,7 +579,7 @@ class EmulatorJS {
} }
return; return;
} }
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/"); console.warn("File was not found locally, but was found on the emulatorjs cdn.\nIt is recommended to download the stable release from here: https://cdn.emulatorjs.org/releases/");
gotCore(res.data); gotCore(res.data);
this.storage.core.put(filename, { this.storage.core.put(filename, {
version: rep.buildStart, version: rep.buildStart,
@ -1624,7 +1625,7 @@ class EmulatorJS {
this.gameManager.toggleMainLoop(this.paused ? 0 : 1); this.gameManager.toggleMainLoop(this.paused ? 0 : 1);
//I now realize its not easy to pause it while the cursor is locked, just in case I guess //I now realize its not easy to pause it while the cursor is locked, just in case I guess
if (this.getCore(true) === "nds") { if (this.defaultCoreOpts.supportsMouse) {
if (this.canvas.exitPointerLock) { if (this.canvas.exitPointerLock) {
this.canvas.exitPointerLock(); this.canvas.exitPointerLock();
} else if (this.canvas.mozExitPointerLock) { } else if (this.canvas.mozExitPointerLock) {
@ -1850,7 +1851,7 @@ class EmulatorJS {
this.addEventListener(this.canvas, "click", (e) => { this.addEventListener(this.canvas, "click", (e) => {
if (e.pointerType === "touch") return; if (e.pointerType === "touch") return;
if (this.getCore(true) === "nds" && !this.paused) { if (this.defaultCoreOpts.supportsMouse && !this.paused) {
if (this.canvas.requestPointerLock) { if (this.canvas.requestPointerLock) {
this.canvas.requestPointerLock(); this.canvas.requestPointerLock();
} else if (this.canvas.mozRequestPointerLock) { } else if (this.canvas.mozRequestPointerLock) {
@ -1883,7 +1884,7 @@ class EmulatorJS {
enter.style.display = "none"; enter.style.display = "none";
if (this.isMobile) { if (this.isMobile) {
try { try {
screen.orientation.lock(this.getCore(true) === "nds" ? "portrait" : "landscape").catch(e => {});; screen.orientation.lock(this.getCore(true) === "nds" ? "portrait" : "landscape").catch(e => {});
} catch(e) {} } catch(e) {}
} }
} else { } else {

View file

@ -1 +1 @@
{ "current_version": "4.0.12" } { "readme": "CURRENT_VERSION IS NO LONGER UPDATED. USE VERION", "current_version": 999999, "version": "4.0.12" }