diff --git a/data/src/GameManager.js b/data/src/GameManager.js index 15c046b..8ca4fd3 100644 --- a/data/src/GameManager.js +++ b/data/src/GameManager.js @@ -31,14 +31,9 @@ class EJS_GameManager { getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']), setVSync: this.Module.cwrap('set_vsync', 'null', ['number']) } - this.mkdir("/data"); - this.mkdir("/data/saves"); this.writeFile("/home/web_user/retroarch/userdata/retroarch.cfg", this.getRetroArchCfg()); - this.FS.mount(this.FS.filesystems.IDBFS, {autoPersist: true}, '/data/saves'); - //this.FS.syncfs(true, () => {}); - this.writeConfigFile(); this.initShaders(); @@ -47,6 +42,7 @@ class EJS_GameManager { this.functions.saveSaveFiles(); setTimeout(() => { try { + this.FS.unmount('/data/saves'); this.Module.abort(); } catch(e) { console.warn(e); @@ -54,6 +50,14 @@ class EJS_GameManager { }, 1000); }) } + mountFileSystems() { + return new Promise(async resolve => { + this.mkdir("/data"); + this.mkdir("/data/saves"); + this.FS.mount(this.FS.filesystems.IDBFS, {autoPersist: true}, '/data/saves'); + this.FS.syncfs(true, resolve); + }); + } writeConfigFile() { if (!this.EJS.defaultCoreOpts.file || !this.EJS.defaultCoreOpts.settings) { return; diff --git a/data/src/emulator.js b/data/src/emulator.js index 836f60b..507ee0e 100644 --- a/data/src/emulator.js +++ b/data/src/emulator.js @@ -980,6 +980,7 @@ class EmulatorJS { (async () => { this.gameManager = new window.EJS_GameManager(this.Module, this); await this.gameManager.loadExternalFiles(); + await this.gameManager.mountFileSystems(); if (this.getCore() === "ppsspp") { await this.gameManager.loadPpssppAssets(); }