Skip to content

Commit

Permalink
Get fetchfs working without manifest support
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeOsborn committed Jan 29, 2025
1 parent 4091182 commit 3682a56
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/emscripten/libretro/libretro.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ async function setupZipFS(mount) {
await zipReader.close();
}

function indexToManifest(index, manifest, path, base_url) {
function loadIndex(index, path) {
for (const key of Object.keys(index)) {
if (index[key]) {
indexToManifest(index[key], manifest, path+key+"/", base_url);
Module.FS.mkdirTree(path+key+"/");
loadIndex(index[key], path+key+"/");
} else {
manifest[path+key] = base_url + path + key;
Module.FS.open(path+key, "w+");
}
}
}
Expand All @@ -168,8 +169,8 @@ async function setupFileSystem()
Module.FS.mkdir("/home/web_user/retroarch/downloads",700);
let index = await (await fetch("assets/cores/.index-xhr")).json();
let manifest = {};
indexToManifest(index, manifest, "/", "");
Module.FS.mount(Module.FETCHFS, {"manifest":manifest,"base_url":"assets/cores"}, "/home/web_user/retroarch/downloads");
Module.FS.mount(Module.FETCHFS, {"base_url":"assets/cores"}, "/home/web_user/retroarch/downloads");
loadIndex(index, "/home/web_user/retroarch/downloads/");

setupZipFS("/home/web_user/retroarch");
console.log("WEBPLAYER: filesystem initialization successful");
Expand Down

0 comments on commit 3682a56

Please sign in to comment.