Replace the single start_cmd manifest field with a "programs" list so a game can expose more than one runnable binary. Duke Nukem 3D's manifests now offer Play and Setup (DOS sound hardware config), and every ScummVM manifest offers Start and Manager (ScummVM's own graphical Launcher). Also fixes two real bugs found along the way: - All 5 ScummVM manifests were passing the game id as `-f <id>`, but -f is ScummVM's --fullscreen flag; ScummVM rejected it as a stray argument and exited before the setup page's poll interval could notice, so clicking Start silently did nothing. Switched to --auto-detect. - The page's audio-unlock listener called ctx.resume() once on first click/keydown and unconditionally removed itself with no .catch(), so a silently failed first attempt left the AudioContext stuck suspended forever with no way to retry. Now retries on every click/keydown until ctx.state actually reports "running". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NiNnj78HGx1KWyCCo39HSz
22 KiB
TODO
-
~
Reduce image size ofDone in two steps:jayfield/dosbox-novnc(currently2.3GB).- Merged the game download/extract steps and the unzip/smbclient install into a single layer (so the downloaded zips and the packages only needed to extract them no longer persist in the final image). 2.31GB -> 1.6GB.
- Stopped baking the games into the image at all (927MB of that was just t7g's two CD
ISOs).
run.shmounts a named volume (dosbox-games) so installed games persist across--rmrestarts. 1.6GB -> ~690MB. Container now needs network access tovlda-01at runtime (not just build time) to install games. - Dropped the auto-download at container startup entirely.
scripts/setup_server.pyis a small stdlib-only HTTP server that serves an HTML page on${SETUP_PORT}(70${DISPLAY_NUM}, published as7099byrun.sh) listing every*.zipon the SMB share with an Installed/Install status per game; the user clicks "Install" to fetch+extract a specific game into${GAMES_HOME}on demand.
-
Manifest-driven games + Start/Stop/Uninstall: games are no longer discovered from raw
*.zipfiles on the share.setup_server.pylists*.jsonmanifests instead (one per game, in theGames\dosbox\catalog directory), each declaringname/title/zip_path/start_cmd. The web page grew Start/Stop/Uninstall buttons alongside Install, driven entirely by that manifest — nothing about a game's identity or how to run it is hardcoded in the image anymore. Started as astuntcar-only pilot, now extended to 6 games (see the SCUMM item below).t7gstill has no manifest and won't show up in the setup page until one is added (t7g.jsonwith astart_cmdfor itsdosbox-0.74-3.conf).game.sh/scripts/start_game.sh(the olddocker exec-based launch path, with its hardcodedDOSBOX_VERSION/run.batconvention) were intentionally left untouched during the pilot and still overlap with the new Start button — worth reconciling (or removing) once every remaining game has a manifest. -
Create manifests for SCUMM engine gamesDone:scummvmadded to the Dockerfile (/usr/games/scummvm, not on$PATHby default under a non-login shell — manifests use the absolute path). Manifests live in the usualGames\dosbox\*.jsoncatalog directory on the share, but theirzip_pathnow points at wherever the game's zip actually already lived (Games\Monkey Island\...,Games\Indiana Jones\..., etc.) — this required generalizing the manifest schema from a barezipfilename (implicitly underGames\dosbox\) to a fullzip_pathrelative to the share root, since these games weren't colocated with dosbox's. Added and verified end-to-end (install/start/stop/uninstall) viamonkey2:monkey— The Secret of Monkey Islandmonkey2— Monkey Island 2: LeChuck's Revengeatlantis— Indiana Jones and the Fate of Atlantisindy3— Indiana Jones and the Last Crusadetentacle— Day of the Tentacle
Real bug found later (all 5 of the above), reported as "Indiana Jones and the Fate of Atlantis doesn't start properly": every one of these manifests' command was
["/usr/games/scummvm", "-p", ".", "-f", "atlantis"]-shaped, i.e.-f <target>.-fis ScummVM's--fullscreenflag, not "select this game" — there's no flag that takes a bare game-id positionally either; passing one is rejected outright ("Stray argument 'atlantis'"), and ScummVM exits near-instantly with a nonzero status. Because the exit happens faster than the setup page's ~3s poll interval,is_running()'s lazy cleanup silently reaped it before anyone saw a "Running" status or an error message — clicking Start just looked like nothing happened, no error surfaced anywhere. (This also means the "verified end-to-end" claim above, from when these were first added, was wrong — Stop/Uninstall working afterward isn't evidence the game itself ran; it only provesis_running()correctly saw it wasn't.) Root-caused viadocker execrunning the exact command by hand and reading ScummVM's own stderr, rather than through the setup page. Fixed by switching every one of these 5 manifests' command to["/usr/games/scummvm", "-p", ".", "--auto-detect"]— ScummVM's own flag for "scan the given path and start whatever single game it finds there", rather than fighting its target/config-file model, which fits this container's one-game-per-directory layout exactly. Verified for real this time: manually launched under a live Xvnc, screenshotted, and confirmed the actual Indiana Jones and the Fate of Atlantis title screen renders (not just "process didn't crash") - then re-verified through the real setup page end-to-end (POST /start-> "Running (Start)" ->POST /stop).Skipped the German CD release of Day of the Tentacle on the share (
Day Of The Tentacle (CD DOS, German).zip) — unlike every other zip here, it doesn't wrap its contents in a single top-level folder (loose files at the zip root plus a strayMANIAC/dir for the embedded Maniac Mansion easter egg), so it doesn't fit the current "zip's top-level folder == install name" extraction convention. Also skipped Curse of Monkey Island (much larger, untested) — could be added the same way if wanted.ScummVM's own game-target IDs (
monkey,monkey2,atlantis,indy3,tentacle) happened to exactly match each zip's existing top-level folder name, so no change was needed to the install/extraction logic itself, only to where zips are looked up from. -
Handle multiple games running at onceDone: each running game now gets its own ephemeral X session (Xvnc+fluxbox+websockify, its own display:90-:99and noVNC port8090-8099) spun up bystart_game()and torn down bystop_game()(or lazily on the next page load, if the game exited/crashed on its own) — instead of every game sharing one screen and fighting over focus/audio. Capped atMAX_CONCURRENT_GAMES = 10; starting an 11th game while all 10 slots are in use is refused with an error shown on its row rather than silently doing nothing. There is no more a single shared "default" desktop or global noVNC link —server.shno longer starts Xvnc/fluxbox/websockify at container startup at all, onlysetup_server.pyitself; each game's own "Open Screen" link appears on its row only while it's running, built with a little client-side JS (the noVNC port differs from the setup port and can't be known server-side without knowing which hostname the browser used to reach the container).run.shpublishes the whole8090-8099range up front, since Docker can't add port mappings to an already-running container. Verified end-to-end with two different games running concurrently (separate processes, separate displays, separate noVNC ports, independent stop/teardown) and the 10-slot cap logic. -
Get game sound actually audible during playDone: PulseAudio + a hand-rolled stdlib WebSocket bridge (pcm_ws_bridge.py, indocker-common— reusable, not dosbox-specific, per the earlier plan for this item) carries raw PCM to the browser, played back via a Web AudioAudioWorkletNode(pcm-worklet.js, also indocker-common). Verified real end-to-end audio: DOSBox → ALSA (default device, routed through Pulse via/etc/asound.conf) → PulseAudio's one default sink →parec→ the bridge → a raw WebSocket client, measured RMS ≈9292 whilestuntcarwas actually playing (vs. silence before advancing past its title screen) — not just a plumbing check, actual game audio.Audio is a single shared mix, not per-game — deliberately simplified from an earlier per-slot-isolated design (considered and dropped as unnecessary complexity): every running game's audio mixes into Pulse's one default sink, and every
/screen/<name>page connects to the same singleAUDIO_PORT(71${DISPLAY_NUM},7199by default). Trade-off: with more than one game running, you can't tell their audio apart.Real bug found and fixed along the way:
parec --device=@DEFAULT_SINK@.monitor(the seemingly-obvious macro syntax) fails with "Stream error: Invalid argument" — PulseAudio has a separate single-token macro,@DEFAULT_MONITOR@, for exactly this; concatenating@DEFAULT_SINK@with a literal.monitorsuffix isn't valid.server.shnow startspulseaudio --start --exit-idle-time=-1and the bridge (pcm_ws_bridge.py 7199 parec --device=@DEFAULT_MONITOR@ ...) once, beforeexec-ingsetup_server.py— both live for the container's whole lifetime, independent of any game's start/stop.No iframe, no per-game screen page — tried an
<iframe>-based/screen/<name>wrapper first (embedding noVNC + an Enable Sound button on one page), but Firefox refuses to load iframe content signed by a certificate whose warning hasn't been accepted at the top level, with no way to click through inside the iframe (Chrome is more lenient, which is why it briefly looked like it worked). Settled on: "Open Screen" is a plain top-level link straight to noVNC's own URL (opens in a new tab — normal "Accept the Risk and Continue" applies there), and the one "Enable Sound" toggle lives on the main setup page instead, meant to be left open in its own tab for as long as you're playing. Also regenerated the self-signed cert withCN=localhost+ SAN (DNS:localhost,IP:127.0.0.1) instead of the old meaninglessCN=NY— Firefox validates the WebSocket-Secure connection's cert against the hostname independently of the page load and was rejecting the CN mismatch there even after the page-level warning was accepted. Only fixes access vialocalhost/127.0.0.1; a LAN IP or other hostname would hit the same mismatch again, since a static cert can't cover every possible address in advance.A second, worse cert bug turned up right after: adding
-addextwithout also pinningbasicConstraints=CA:FALSEleftopenssl req -x509defaulting toCA:TRUE— i.e. the generated cert claimed to be a Certificate Authority, not a normal server certificate. Firefox hard-refuses a CA-flagged cert used as a TLS server cert (not an overridable "Advanced -> Accept the Risk" warning, just a dead end), which is exactly why "the warning appears but won't let me proceed" even after the CN fix above. Chrome is lenient about this too, which is why it kept looking fine there. Fixed by explicitly settingbasicConstraints=critical,CA:FALSE,keyUsage=critical,digitalSignature,keyEncipherment, andextendedKeyUsage=serverAuthin the sameopenssl req -x509 -addext ...call.Because the setup page now hosts a persistent
AudioContext/WebSocket, its old<meta http-equiv="refresh">auto-refresh was narrowed to only fire while an install was actively in progress — it used to also refresh continuously whenever any game was running (to catch a crashed game's slot being freed), which would have torn down the live audio connection every 3 seconds. Superseded entirely below by a JS-driven refresh that doesn't navigate the page at all.Removed the "Enable Sound" button — audio is on by default now. The
AudioContext/AudioWorkletNode/WebSocketall connect eagerly on page load; the only thing still gated on a user gesture (unavoidable browser autoplay policy) isctx.resume(), which now piggybacks on the page's very first click or keypress — whatever the user was already doing, e.g. clicking Start on a game — rather than requiring a dedicated audio-only click.Added a per-game volume slider. Despite audio being one shared mix, this is a real, independent control: every running game is still its own distinct PulseAudio sink-input even though they all feed the same sink, and
pactl set-sink-input-volumeadjusts one sink-input without touching the others._sink_input_index()finds the right one by matchingpactl -f json list sink-inputs'application.process.idagainst the game's own PID (confirmed exact viaps/pactlcross-check). The slider POSTs to a new/volumeroute viafetch()on every tick (not a form submit — no page navigation per drag step).Real bug found right after removing the button: audio still never actually played. Install/Start/Stop/Uninstall were still plain
<form method="post">submits — every click caused a full page navigation (via the server's303redirect back to/), which tears down whateverAudioContextwas just connected. The fresh page after that reload creates a brand-new suspended context with no further gesture to unlock it (the reload itself doesn't count), so in completely normal usage — load the page, click Start — audio never actually starts. Symptom that nailed it down: no speaker icon ever appeared on the Chrome tab. Fixed by converting the whole page away from form-based navigation entirely: every button is now a bare<button onclick="doAction(...)">,do_POSTreturns a plain204instead of a303redirect, and client-sidedoAction()/refresh()fetch()the action and the updated page, then swap just#content'sinnerHTMLin place — the page itself never navigates, so the audio connection now survives every install/start/stop/uninstall click, andsetInterval(refresh, 3000)replaces the old<meta refresh>for keeping status current (crashed-game slot cleanup, install progress) without that risk at all.Third real bug, found once audio was actually reaching the speakers: ~2s of latency, visibly getting worse the longer a game ran (lip sync drifting further out over time), and volume-slider changes taking a couple seconds to actually be heard. Root cause:
pcm-worklet.js's playback queue (docker-common/scripts/pcm-worklet.js, copied into this project) had no size cap — every incoming WebSocket message just gotpush()ed on regardless of how fast the network delivered it relative to real-time playback. On a fast local connection the browser routinely receives data faster than 48kHz real-time consumes it, so the backlog only ever grew, never shrank;set-sink-input-volumechanges the volume at the PulseAudio source, so anything already sitting in that ever-growing client queue still played at the old volume until it drained, i.e. the whole visible backlog's worth of delay before a slider change was audible. Fixed by capping the queue at ~100ms (maxQueuedFrames) and dropping the oldest excess data whenever a new chunk would push it over that cap — verified directly in Node (stubbingAudioWorkletProcessor/sampleRate/registerProcessor) that force-feeding a simulated 4.3s burst leaves only ~85ms actually queued afterward, instead of growing unbounded. Propagated to both thedocker-commoncanonical copy and this project's own copy, per the usual convention. -
Added manifests for
duke(Duke Nukem 3D, unregistered shareware — confirmed via screenshot, "UNREGISTERED SHAREWARE" watermark and the nag screen, despite the folder name) anddn3d(Duke Nukem 3D: Atomic Edition), both real DOS Build-engine games, both DOSBox manifests. Sourced from real played installs atMiscOS\MSDos\games\duke\/dn3d\on the share (found by comparing that directory againstGames\, which turned up several installs — including these — not present as zips anywhere) rather than the existingGames\zips: these are raw, unzipped folders (with real save games,duke.rts, etc.), so they were downloaded, re-zipped locally with the usual<name>/top-level-folder convention, and re-uploaded asdn3d.zip/duke.zipalongside the source folders on the share (manifests, as always, still live in theGames\dosbox\catalog regardless).A third variant found in the same comparison,
Games\duke3d_w32_bin.zip, turned out to be a native Windows binary (duke3d_w32.exe, needsmfc70.dll/msvcr70.dll) rather than a DOS game — DOSBox can't run it; would need Wine, a real new dependency. Skipped per explicit direction rather than expanding scope.Verified end-to-end with screenshots (
xwd/imagemagick, installed temporarily for testing only, not part of the image) — both games genuinely launch and render actual gameplay (HUD, level geometry, taking hits), not just a menu. Audio did not play for either despitepactlshowing dosbox as a normal, uncorked sink-input — tracked down to their carried-overduke3d.cfg(deleting it entirely breaks the game outright, forcingSETUP.EXE, so it's required; likely has a stale/mismatched sound-hardware selection from whatever machine last ranSETUP.EXEfor real, rather than DOSBox's emulated SB16). Not a bug in the audio pipeline itself — already proven working end-to-end for other games in the sound TODO item above. Left as a known gap for these two specifically; fixing it would mean either reverse-engineeringduke3d.cfg's binary format to patch the stored IRQ/DMA, or finding a way to scriptSETUP.EXE's interactive hardware wizard. -
Redesigned the manifest schema so a game can expose more than one runnable binary, replacing the single
start_cmdfield with aprogramslist of{id, label, cmd}(seesetup_server.py's module docstring for the full schema). Direct motivation: theduke/dn3daudio gap above — rather than trying to script or reverse-engineerSETUP.EXE's hardware wizard from outside, just exposeSETUP.EXEitself as a second "program" alongside the game, so the interactive fix is a button click away. Bothduke.json/dn3d.jsonnow listplay(duke3d.exe) andsetup(setup.exe); every other existing manifest on the share (stuntcar,monkey,monkey2,atlantis,indy3,tentacle) was migrated to a single-entryprograms: [{"id": "start", "label": "Start", ...}]so the "Installed" row still shows one plain "Start" button for them, unchanged in practice.start_game()now takes aprogram_idand looks up the matching entry; only one program per game can run at a time (same one-slot-per-game model as before — starting a second program while the first is still running is refused the same way restarting an already-running game is). The "Running" status now shows which program is active (e.g. "Running (Setup)") since that's no longer implied by the game name alone. Verified end-to-end: built the image, installedduke, POSTed/startwithprogram=setup, confirmed viaps auxinside the container thatdosbox setup.exe(notduke3d.exe) was the process actually running, and via a real screenshot that DOSBox's actual "Choose Sound FX Card" screen renders — i.e. the interactive fix path this was built for is genuinely reachable now. Did not go further and actually reconfigure the sound card/re-verify audio afterward — that's still a manual, per-game step left to whoever playsduke/dn3d, not something the container should do unattended. -
Real bug found via user report ("no audio, no audio icon in browser"): the page's audio-unlock listener (
unlockAudio()) calledctx.resume()once on the page's first click/keydown and then unconditionally removed itself, with no.catch()on theresume()promise. Confirmed the server-side pipeline was fine the whole time (PulseAudio sink-input active and uncorked,pareccapturing real non-silent PCM, the raw WebSocket bridge onAUDIO_PORThandshaking and streaming genuine non-zero frames when tested directly) — the browser's ownctx.statestayed"suspended"no matter how many times the user clicked the page. Root cause: if that very first resume attempt silently failed for any reason (rejected promise with no handler = no console error, easy to miss), the listener had already removed itself and there was no way left to ever retry — permanently stuck suspended for the rest of that page load. Confirmed directly: manually attaching a fresh one-off click listener that calledctx.resume()succeeded immediately (state=running), proving theAudioContextitself was fine and only the one-shot unlock logic was broken. Fixed by makingunlockAudio()idempotent and non-removing: it now callsctx.resume()(with a.catch()that logs any failure) on every click/keydown, and only detaches the listeners oncectx.statehas actually become"running"— safe to call repeatedly since resuming an already-running context is a no-op. Verified fixed by the user after rebuilding and restarting the container: audio icon now appears and sound plays. -
Added a "Manager" program to all 5 ScummVM manifests (
monkey,monkey2,atlantis,indy3,tentacle), alongside their existing "Start" (--auto-detect) - the SCUMM equivalent of Duke's "Setup" button. Plainscummvm -p .with no game argument opens ScummVM's own graphical Launcher (game list, Game Options, Global Options, MT-32/subtitle/ audio-driver settings, etc.) instead of jumping straight into the game - but confirmed via screenshot that-p .alone shows an empty list ("None" selected, nothing in the game panel); the game has to be registered first via--add(a separate one-shot command that exits after adding, confirmed idempotent - running it again just logs "already been added, skipping" and doesn't error or duplicate the config entry) before the Launcher will show it pre-selected and ready for "Game Options...". So the "manager" program's command is["bash", "-c", "/usr/games/scummvm -p . --add >/tmp/scummvm-add.log 2>&1; exec /usr/games/scummvm -p ."]--addfirst (idempotent, safe on every launch), thenexec'd into the real interactivescummvm -p .process so the tracked PID (and therefore_teardown()'s terminate/kill) is the actual ScummVM process, not a wrapper shell with an orphaned child. Verified end-to-end through the real setup page:POST /startwithprogram=manager-> "Running (Manager)" -> confirmed viaps auxthat the realscummvm -p .process (not the wrapper) is what's running -> screenshot confirms the Launcher opens with "Indiana Jones and the Fate of Atlantis" already listed and selectable.