Lines 323-363javascript
324 async loadCore(jsPath, wasmPath, opts = {}) {
325 if (this.mod) throw new Error("core already loaded; create a new host");
327 // Proxied (multi-threaded) cores — e.g. PPSSPP/PSP — run on a dedicated "app thread" so the
328 // JS main thread never blocks while the core's worker threads proxy back to it (which would
329 // deadlock the synchronous frame-stepping). They own the ENTIRE GL stack on the app thread
330 // (native-gles + webgl-node loaded + context created + readback all there). The registry
331 // marks them; the single-threaded GL cores keep the main-thread GL path below.
332 this._proxied = !!opts.proxied;
333 this.state.proxied = this._proxied;
334 // NODERAWFS cores (flycast): the WASM FS is Node's real fs, so the core fopens the
335 // disc image straight off disk — loadMedia must pass the REAL path and NOT slurp
336 // the (up to ~1GB) file into the WASM heap. See loadMedia.
337 this._noderawfs = !!opts.noderawfs;
340 if (opts.hwRender && !this._proxied) {
341 // Set up the HW-render path: LibretroGL owns the FBO/readback; a webgl-node
342 // mock canvas backs the minified core's GLctx. Both pull the OPTIONAL native
343 // GL deps lazily (clear install hint if absent).
344 const { LibretroGL } = await import("./LibretroGL.js");
345 const { loadWebGl2Context } = await import("./glOptionalDep.js");
MediumDynamic Require
Package source references dynamic require/import behavior.
src/host/LibretroHost.jsView on unpkg · L343 346 this.hwRender = new LibretroGL();
347 await this.hwRender.ensureGl();
348 const createWebGL2Context = await loadWebGl2Context();
349 const { canvas } = createWebGL2Context(640, 480);
350 // Skip Emscripten's Safari WebGL2 workaround (breaks instanceof) by
351 // pre-setting the flag it checks.
352 canvas.getContextSafariWebGL2Fixed = canvas.getContext;
354 this._glContextCreated = true;
355 // The env callback routes SET_HW_RENDER to this handler.
356 this.state.hwRender = this.hwRender;
359 const mod = await loadLibretroCore({ jsPath, wasmPath, glCanvas });
362 // AUTO-DETECT NODERAWFS regardless of the caller's opt. A NODERAWFS build replaces
363 // the in-RAM MEMFS with Node's real fs, so `FS.writeFile("/rom.elf", …)` would target