Skip to content

Commit

Permalink
use bufferview slices instead of resize to support firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeOsborn committed Nov 17, 2023
1 parent ea32c59 commit b5d4495
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/emscripten/libretro/libretro.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ var zipTOC;

function zipfsInit() {
// 256 MB max bundle size
let buffer = new ArrayBuffer(0, {maxByteLength: 256*1024*1024});
let buffer = new ArrayBuffer(256*1024*1024);
let bufferView = new Uint8Array(buffer);
let idx = 0;
// bundle should be in four parts (this can be changed later)
Expand All @@ -199,11 +199,10 @@ function zipfsInit() {
if (idx+buf.byteLength > buffer.maxByteLength) {
console.log("WEBPLAYER: error: bundle.zip is too large");
}
buffer.resize(idx + buf.byteLength);
bufferView.set(new Uint8Array(buf), idx, buf.byteLength);
idx += buf.byteLength;
}
BrowserFS.FileSystem.ZipFS.computeIndex(BrowserFS.BFSRequire('buffer').Buffer(buffer), function(toc) {
BrowserFS.FileSystem.ZipFS.computeIndex(BrowserFS.BFSRequire('buffer').Buffer(new Uint8Array(buffer, 0, idx)), function(toc) {
zipTOC = toc;
appInitialized();
});
Expand Down

0 comments on commit b5d4495

Please sign in to comment.