Get core config from core json

This commit is contained in:
Ethan O'Brien 2024-08-08 10:26:13 -05:00
parent 61620e2c77
commit b30c5f42a8
3 changed files with 14 additions and 5 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

@ -570,7 +570,7 @@ class EmulatorJS {
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/latest/data/"+corePath, (res) => {
if (res === -1) { if (res === -1) {
if (!this.supportsWebgl2) { if (!this.supportsWebgl2) {
this.startGameError(this.localization('Outdated graphics driver')); this.startGameError(this.localization('Outdated graphics driver'));

View file

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