Add call to mount file systems before loading game assets

This commit is contained in:
Ethan O'Brien 2024-12-13 10:32:47 -06:00
parent b2747487d1
commit 627fba2f9c
2 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -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();
}