fix: remove .jsdos/ from bundles to avoid js-dos bundleUpdateConfig
Build & Deploy / build-and-deploy (push) Successful in 43s
Build & Deploy / build-and-deploy (push) Successful in 43s
js-dos v8.3.8 (loaded from CDN) calls bundleUpdateConfig to re-add
.jsdos/jsdos.json into the downloaded bundle. This fails on our
bundles because the WASM libzip _zipfile_add returns non-zero.
Since we can't fix js-dos's internal WASM code, we remove the .jsdos/
directory from bundles entirely. This means bundleConfig() returns null,
no editor config is set, and bundleUpdateConfig is never called.
Downside: games start with js-dos's default dosbox.conf (no custom
CD mounts or autoexec). The game files are on C:\ and the user can
type the executable name. Added autoStart + countDownStart=0 to
auto-skip the config UI.
The config API endpoint (/api/games/{id}/config) is kept for future
use where we can inject config after the emulator starts.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { getGame, getGameConfig, bundleUrl, setupBundleUrl } from "../lib/api.js";
|
||||
import { getGame, bundleUrl, setupBundleUrl } from "../lib/api.js";
|
||||
import { push } from "../lib/router.js";
|
||||
|
||||
let { id } = $props();
|
||||
@@ -68,27 +68,9 @@
|
||||
|
||||
// Start the DOS emulator
|
||||
try {
|
||||
if (isSetup) {
|
||||
// Setup mode: use the streaming setup-bundle endpoint
|
||||
const url = setupBundleUrl(game);
|
||||
if (!url || !window.Dos) throw new Error("Failed to resolve game bundle");
|
||||
dosCI = await window.Dos(dosContainer, { url });
|
||||
} else {
|
||||
// Normal mode: fetch config + bundle separately, use dosboxConf + initFs
|
||||
// This bypasses js-dos's bundleUpdateConfig which fails on our bundles
|
||||
const [config, bundleResp] = await Promise.all([
|
||||
getGameConfig(game.id),
|
||||
fetch(bundleUrl(game)),
|
||||
]);
|
||||
if (!bundleResp.ok) throw new Error("Failed to download game bundle");
|
||||
const bundle = new Uint8Array(await bundleResp.arrayBuffer());
|
||||
const jsdosConf = config.jsdos_conf ? JSON.parse(config.jsdos_conf) : undefined;
|
||||
dosCI = await window.Dos(dosContainer, {
|
||||
dosboxConf: config.dosbox_conf,
|
||||
jsdosConf,
|
||||
initFs: bundle,
|
||||
});
|
||||
}
|
||||
const url = isSetup ? setupBundleUrl(game) : bundleUrl(game);
|
||||
if (!url || !window.Dos) throw new Error("Failed to resolve game bundle");
|
||||
dosCI = await window.Dos(dosContainer, { url, autoStart: true, countDownStart: 0 });
|
||||
running = true;
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
|
||||
Reference in New Issue
Block a user