Commit Graph

153 Commits

Author SHA1 Message Date
Hermes Agent 5b55a53b73 Skip creating .setup.jsdos bundles for Windows games
Build & Deploy / build-and-deploy (push) Successful in 47s
- Move platform detection before setup bundle creation
- Only create setup bundle when platform != 'windows'
- Also hide the Setup button in GameDetail for Windows games
- Windows setup executables (INSTALL.EXE) can't run in DOSBox anyway
2026-05-28 14:57:13 +02:00
Hermes Agent 733bdaa44f Fix js-dos ZIP extraction: write dirs shallowest-first, then files
Build & Deploy / build-and-deploy (push) Successful in 1m40s
js-dos v8's C extraction code (jsdos-libzip.c) iterates ZIP entries
linearly and calls mkdir() on each directory entry. If a child
directory appears before its parent, mkdir() fails with perror()
and exit(1) — fatal crash with 'No such file or directory'.

Previous approach wrote directory entries interleaved with files,
deepest-first (from the file path right-to-left). Now:

Phase 1: Walk entire file tree to discover ALL directories
Phase 2: Write ALL dir entries sorted (shallowest first via TreeSet
         natural ordering — '/' sorts before any letter)
Phase 3: Write .jsdos/ config files
Phase 4: Write game files (parents already exist from Phase 2)

This guarantees that mkdir("NAS50TH/TRACKS/") runs before
mkdir("NAS50TH/TRACKS/WILKES/"), which runs before open().
2026-05-28 14:43:28 +02:00
Hermes Agent f9967eacf8 Auto-exclude disk image files (.img .iso .ccd .sub etc.) from .jsdos bundles
Build & Deploy / build-and-deploy (push) Successful in 48s
Many DOS game ZIPs include CloneCD backups (.ccd/.img/.sub) or
other disk images that are not needed for gameplay — the game data
is already extracted in the working directory. These can be 300MB+
and cause WASM memory exhaustion in js-dos.

Added a SKIP_EXT set that filters out known disk image extensions
during game file pass. The .jsdos config pass is unaffected.
2026-05-28 13:54:56 +02:00
Hermes Agent eb37cd43bb Fix ZIP entry order: write .jsdos/ config first, then game files sorted
Build & Deploy / build-and-deploy (push) Successful in 40s
js-dos reads ZIP entries sequentially and needs .jsdos/dosbox.conf and
.jsdos/jsdos.json first to configure DOSBox. Java's Files.walk() uses
filesystem readdir order which put them at the very end of the ZIP
(after the 328MB CloneCD image), causing extraction failures.

Now:
1. First pass: walk .jsdos/ directory and write config files first
2. Second pass: walk everything else (excluding .jsdos/) in sorted order
3. All directory ancestors are still added as explicit entries
4. .sorted() ensures deterministic, alphabetical entry order
2026-05-28 13:47:52 +02:00
Hermes Agent 8f14ecb5a1 Fix nested directory entries: add full ancestor chain to ZIP
Build & Deploy / build-and-deploy (push) Successful in 45s
Previously only the immediate parent directory was added as a ZIP
entry. For deeply nested paths like NAS50TH/TRACKS/WILKES/WILKES.DAT,
only NAS50TH/TRACKS/WILKES/ was created — but NAS50TH/TRACKS/ and
NAS50TH/ were skipped (they're only parents of other directories,
never the immediate parent of a file).

Emscripten's FS.createDirectory() fails if parent doesn't exist,
so intermediate directories must be in the ZIP too.

Now walks up the full ancestor chain with a while loop.
2026-05-28 13:37:21 +02:00
Hermes Agent 5a3500c586 Fix js-dos ZIP extraction: add explicit directory entries to bundles
Build & Deploy / build-and-deploy (push) Successful in 46s
js-dos uses Emscripten's virtual filesystem which requires explicit
ZIP directory entries (names ending with '/') to create directories.
Java's ZipOutputStream only writes file entries, so subdirectories
like NAS50TH/TRACKS/WILKES/ were never created — causing Emscripten
'No such file or directory' errors for any path inside them.

- createBundle: before writing each file entry, add its parent
  directory as an explicit ZIP entry if not already added
- Affects all games with subdirectory structures (NASCAR Racing 2,
  Gus Goes to Cyberopolis, etc.)
- Use a HashSet to track already-added directories (no duplicates)
2026-05-28 13:28:10 +02:00
Hermes Agent 65e098244a Add platform auto-detection and UI flagging for Windows games
Build & Deploy / build-and-deploy (push) Successful in 49s
- Game.java: add 'platform' field ('dos'/'windows') + 'isPlayable' helper
- UploadResource.java: detect EXE type by reading PE/NE header during upload
- GameResource.java: allow PATCH to update platform
- GameCard.svelte: show 🪟 Win badge for Windows games (blue style)
- GameDetail.svelte: show platform badge, disable Play for Windows with
  'Unplayable' button; add platform dropdown to edit form
- Play.svelte: show blocking overlay for Windows games with 'Try anyway'
  option for users who want to attempt it
2026-05-28 13:16:04 +02:00
Hermes Agent efa0aa5f81 Fix MoO2 subdirectory bug + remove sockdrive references
Build & Deploy / build-and-deploy (push) Successful in 36s
- Fix flattenSingleDir: flatten when exactly 1 root directory exists,
  even if other metadata files (file_id.diz, *.nfo) are present at root
- Fix buildDosboxConf/buildJsdosJson: add 'cd <dir>' before executable
  when it lives in a subdirectory, since DOS treats '/' as switch char
  (previously 'mastori2/ORION2.EXE' was parsed as command 'mastori2'
  with switch '/ORION2.EXE')
- Remove SockdriveResource.java entirely
- Remove bundleType field from Game.java (was 'standard'/'sockdrive')
- Simplify GameResource.java download endpoint
- Clean up upload resource
2026-05-28 12:10:43 +02:00
David Alvarez ba34065278 fix: remove zos.setLevel(0) from createBundle — default DEFLATE is more reliable with emscripten libzip extraction
Build & Deploy / build-and-deploy (push) Successful in 17s
2026-05-28 10:06:28 +02:00
David Alvarez e11f19c769 fix: remove sockdrive mode, always create .jsdos ZIP bundles
Build & Deploy / build-and-deploy (push) Successful in 40s
js-dos v8's window.Dos(container, { url }) expects the URL to point
to a .jsdos ZIP archive, not a loose dosbox.conf file. The
'sockdrive' mode was serving game files loosely with a URL pointing
to a raw config file, causing: 'Unable to add .jsdos/jsdos.json
into bundle.zip'.

Changes:
- Removed SOCKDRIVE_THRESHOLD_MB and the entire sockdrive branch
- Always create a .jsdos ZIP bundle via createBundle()
- Optimized createBundle: no temp dir copy (saves 2x I/O for large
  games), uses STORE compression (level 0) since DOS files are
  often already compressed
- Removed dirSizeMB(), copyDir() and setup config builders —
  no longer needed after removing sockdrive mode
- frontend bundleUrl()/setupBundleUrl() always use the standard
  /games/{id}.jsdos path
- GameService.delete cleanup simplified
2026-05-28 09:45:45 +02:00
David Alvarez 6840b3eee1 fix: raise upload limit from 200MB to 2048MB for large DOS games
Build & Deploy / build-and-deploy (push) Successful in 56s
The previous 200M limit on quarkus.http.limits.max-body-size and
multipart input-part.max-size rejected games over 200MB. DOS CD-ROM
games can easily exceed this (e.g. DOOM 95 full CD, Diablo). Raised
to 2048M to cover the largest DOS/CD-ROM game archives.
2026-05-28 09:32:33 +02:00
David Alvarez 5f5cb8411f feat: SETUP.EXE detection + separate setup .jsdos bundle
Build & Deploy / build-and-deploy (push) Successful in 1m1s
When a game archive contains SETUP.EXE, INSTALL.EXE, CONFIG.EXE or
CUSTOM.EXE (or .com/.bat variants), the upload now:

- Detects and stores the path in game metadata (setup_exe / has_setup)
- Generates a second .jsdos bundle with SETUP.EXE as autoexec:
  - Standard mode: {gameId}.setup.jsdos (full game + setup autoexec)
  - Sockdrive mode: .jsdos-setup/ directory alongside .jsdos/
- Both bundles share the same game files; only the autoexec differs

Frontend changes:
- Router strips query params from hash so ?setup=1 doesn't leak into id
- GameDetail shows a "Setup" button between Play and Edit (only when
  game.has_setup is true), navigating to /play/{id}?setup=1
- Play.svelte detects ?setup=1, loads setupBundleUrl() instead, and
  shows setup-specific overlay text

Persistence is handled automatically by js-dos v8 via the built-in
auto-save mechanism (ci.persist() → browser OPFS), so any config
changes made via SETUP.EXE survive across sessions.
2026-05-27 16:49:15 +02:00
David Alvarez 00267da3dd fix: manual title input searches IGDB first, warns before uploading
Build & Deploy / build-and-deploy (push) Successful in 45s
Flow when auto-search finds nothing:
1. User types a title → presses Enter/clicks button
2. System searches IGDB with that title
3a. Results found → shown as selectable cards
3b. No results → warning + amber 'Upload anyway as xxx' button
4. Button label changes: 'Search' → 'Upload' after manual search

Also changed Enter key behavior: first press searches, second
press uploads (if no results after manual search)
2026-05-27 11:57:16 +02:00
David Alvarez 61a83cff65 fix: increase max upload body size to 200MB
Build & Deploy / build-and-deploy (push) Successful in 46s
Quarkus defaults to 10MB max body size. DOS games like
Warcraft 2 (50-100MB) were silently rejected. Added:
- quarkus.http.limits.max-body-size=200M
- quarkus.resteasy-reactive.multipart.input-part.max-size=200M
2026-05-27 11:49:45 +02:00
David Alvarez 72391fb577 feat: auto-search IGDB on file select, pick match or type custom title
Build & Deploy / build-and-deploy (push) Successful in 54s
Upload flow is now:
1. Click +Upload → select a .zip file
2. IGDB is auto-searched with the filename
3. If matches found → show results as selectable cards + fallback
   custom title search at the bottom
4. If no matches → show 'no matches' + manual title + Upload btn
   + a fallback 'Use filename: xxx' button
5. Clicking a result uploads immediately with that game's title
   (so IGDB auto-scrape picks it up correctly)
6. Cancel button to dismiss
2026-05-27 11:25:03 +02:00
David Alvarez 3c49d72f56 refactor: flatten ZIP single-root-directory instead of path splitting
Build & Deploy / build-and-deploy (push) Successful in 1m45s
Completely new approach:
- After unzip, check if extractDir has exactly one entry (a directory)
- If so, move all its contents up and delete the empty folder
- This means game files are always at the bundle root (c:\)
- No more cd/subdirectory handling in config builders
- No more path separator conversions (forward/backslash)
- Removed splitPath() helper entirely
- Config builders are now trivial — relExe is always just a filename
2026-05-27 11:07:39 +02:00
David Alvarez e7b845e8a1 clean: remove all Doom-specific logic, fix path separator in jsdos.json
Build & Deploy / build-and-deploy (push) Successful in 1m5s
Removed:
- injectDoomConfig() — WAD-detection and WASD config injection
- buildDoomDefaultCfg() — Doom config file generator
- All calls to injectDoomConfig in both bundle paths

Fixed:
- buildJsdosJson() now also uses splitPath() helper to handle
  backslash separators (was using lastIndexOf('/') only)
- Extracted shared splitPath() method used by both
  buildJsdosJson and buildDosboxConf

No more game-specific hacks. Just clean config generation.
2026-05-27 10:48:38 +02:00
David Alvarez 596b897df6 fix: use backslash path separator for DOS paths
Build & Deploy / build-and-deploy (push) Successful in 49s
extractDir.relativize() returns paths with native Linux forward
slashes. DOS requires backslashes. Changed .replace('\', '/')
to .replace('/', '\') and updated buildDosboxConf split logic
to also check for backslash separator.
2026-05-27 10:41:45 +02:00
David Alvarez 542db6a916 Fix: handle DOS games in subdirectories inside .jsdos bundles
Build & Deploy / build-and-deploy (push) Successful in 48s
When a ZIP contains game files in a subdirectory (e.g. doomiido/),
findMainExe() correctly finds the executable but the bundle autoexec
was using just the filename, causing DOSBox 'Illegal command' error.

- Use extractDir.relativize() to compute the relative exe path
- buildDosboxConf() now adds 'cd dirname' before running the exe
- buildJsdosJson() uses 'cd dirname && exe' for multi-line script
- Fix applies to both sockdrive and standard bundle paths
2026-05-27 10:36:44 +02:00
David Alvarez 6c56cbc992 fix: use CRLF line endings in DEFAULT.CFG to match Doom's fgets parser
Build & Deploy / build-and-deploy (push) Successful in 51s
The dos.zone DEFAULT.CFG uses \r\n (DOS/CRLF) line endings.
Our injected config used \n (LF/Unix). While fgets() reads
both, the \r character stays in the buffer and the Doom
parser may behave differently when it's absent. Matching
the exact byte-for-byte format that works on dos.zone.
2026-05-27 09:57:41 +02:00
David Alvarez 4bd771f97f fix: add jsdos.json to bundle for proper js-dos v8 config
Build & Deploy / build-and-deploy (push) Successful in 1m4s
The missing piece — dos.zone's bundle has .jsdos/jsdos.json
which tells js-dos v8 how to configure the emulator (autoexec
command, autolock=true, etc.). Without it, js-dos may apply
different defaults that don't match our dosbox.conf.

Also simplified dosbox.conf to just the essential sections
and removed mapperfile=mapper-jsdos.map (not bundled).
Keeps usescancodes=true, autolock=true, SB16 audio.
2026-05-27 09:38:26 +02:00
David Alvarez 9a4e87d044 fix: recursive WAD detection + write BOTH DEFAULT.CFG and DOOM2.CFG
Build & Deploy / build-and-deploy (push) Successful in 49s
Previous injectDoomConfig used Files.list() which only checks the
top-level directory — if the WAD was in a subdirectory, detection
failed silently and no config was written. Switched to Files.walk()
for recursive search.

Also:
- Write BOTH DEFAULT.CFG AND DOOM2.CFG (Doom II reads DOOM2.CFG
  first as game-specific config, falling back to DEFAULT.CFG)
- Always overwrite (don't skip if file exists — the ZIP might
  contain a stock DEFAULT.CFG with arrow-key defaults)
2026-05-27 09:30:49 +02:00
David Alvarez 655d3e83cd fix: full dosbox.conf with usescancodes=true + auto WASD for Doom
Build & Deploy / build-and-deploy (push) Successful in 53s
Root cause: Dosbox.conf was missing the [sdl] section with
'usescancodes=true' — without it DOSBox doesn't translate
keyboard scan codes and WASD keys don't register as game input.

Fix:
- Generate a complete dosbox.conf matching js-dos v8 standards
  (all sections: sdl, dosbox, cpu, mixer, render, midi,
   sblaster, gus, speaker, joystick, serial, dos, ipx, autoexec)
- Key setting: usescancodes=true + mapperfile=mapper-jsdos.map
- Uses svga_s3 machine type with SB16 audio (same as dos.zone)

Bonus: Auto-detect Doom-engine games (DOOM.WAD / DOOM2.WAD)
and inject a DEFAULT.CFG with WASD controls:
  W=forward, S=backward, A=strafe-left, D=strafe-right
  Arrows=turn, Ctrl=fire, Space=use, Alt=strafe, Shift=run
  Mouse enabled for looking

Note: Existing uploaded games still have the old dosbox.conf.
They need to be re-uploaded to get the fix.
2026-05-27 09:19:56 +02:00
David Alvarez feccf4178f feat: move meta/dev under cover, upload dialog on file select
Build & Deploy / build-and-deploy (push) Successful in 52s
Game Detail:
- Year/genre badges and developer/publisher info moved from
  the info column to the cover column (below the cover image)
- Edit mode unaffected — fields remain in the form on the right
- Added CSS spacing for meta/dev in cover section

Library upload:
- Removed the always-visible title input field
- After selecting a .zip, a modal dialog appears with two options:
  1. 'Use filename as title' — uploads immediately with filename
  2. Custom title input + 'Upload' button
  Plus a Cancel button
- Modal is dismissible by clicking outside or Cancel
2026-05-26 21:31:50 +02:00
David Alvarez d751779984 fix: constrain 1fr grid column with min-width:0 and word-break
Build & Deploy / build-and-deploy (push) Successful in 51s
The info-section grid column (1fr) was expanding to fit wide content
like long game titles in Press Start 2P font (each character ~24px).
Added min-width:0 on grid children to prevent overflow, and
word-break:break-word on text elements as a safety net.
2026-05-26 21:16:15 +02:00
David Alvarez 3ae6f43ccb feat: responsive mobile UI across all pages
Build & Deploy / build-and-deploy (push) Successful in 50s
Global:
- Viewport meta already present; added -webkit-text-size-adjust: 100%
- Container padding reduces to 12px on mobile (was 24px)
- Smaller heading sizes (h1: 1.5rem, h2: 1.25rem)
- Buttons get min-height 40px for touch targets
- Inputs forced to 16px font-size to prevent iOS zoom
- Thinner scrollbar on mobile

Header:
- Logo text shrinks to 1rem on mobile, icon to 28px
- Header padding reduces to 12px

Library:
- Toolbar stacks vertically on mobile, full-width inputs
- Grid forced to 2 columns on narrow screens (480px), reduced gap

GameCard:
- Smaller info text, padding, badge on 480px screens

GameDetail:
- Cover section capped at 200px width on mobile
- Media thumbnails shrink to 160x90
- Scrape header stacks vertically with full-width buttons
- Edit rows stack vertically on mobile

Play:
- DOS container caps at 50vh on mobile, smaller border-radius
- Overlay text/icon sizes reduced, more compact layout
2026-05-26 17:22:15 +02:00
David Alvarez 404e8b6719 fix: remove java.nio.file.Path import conflicting with @Path annotation
Build & Deploy / build-and-deploy (push) Successful in 1m1s
2026-05-26 16:53:17 +02:00
David Alvarez 446a9d61b8 feat: all-video media row, clickable media selector, download button
Build & Deploy / build-and-deploy (push) Failing after 44s
- Backend: Add GET /api/games/{id}/download endpoint (ZIP streaming)
- Frontend: All videos now shown in media row alongside screenshots
- Click any media thumbnail to load it into the media container
- Videos show YouTube thumbnail, screenshots show image preview
- Active thumbnail has green border highlight
- Download button between Edit and Delete triggers ZIP download
- Early return: if no media, the entire section is hidden
2026-05-26 16:47:17 +02:00
David Alvarez 0912e43d99 IGDB: add DOS-only search, gameplay videos + screenshot support
Build & Deploy / build-and-deploy (push) Successful in 1m28s
- Search now filters to DOS platform only (platform ID 13)
- New fetchVideos() queries IGDB game_videos endpoint for YouTube IDs
- New fetchScreenshots() queries IGDB screenshots endpoint for images
- autoScrape and applyIgdbId both fetch videos + screenshots after match
- Upload auto-save also triggers when videos/screenshots found
- GameDetail: embed first YouTube video + scrollable screenshot gallery
- Handles missing media gracefully (section hidden entirely if neither exists)
2026-05-26 15:49:27 +02:00
David Alvarez 1f55f63b99 Replace Handjet font with Press Start 2P from Google Fonts
Build & Deploy / build-and-deploy (push) Successful in 18s
2026-05-25 13:57:12 +02:00
David Alvarez b8cc11caf4 Fix workflow health check: docker inspect instead of localhost curl (runner can't reach host's localhost)
Build & Deploy / build-and-deploy (push) Successful in 15s
2026-05-25 13:49:42 +02:00
David Alvarez 8c1be9db03 Replace mono font stack with Handjet from Google Fonts
Build & Deploy / build-and-deploy (push) Failing after 1m6s
2026-05-25 13:46:31 +02:00
David Alvarez b2eb99ec82 Add Gitea Actions workflow for auto-build on push; update docker-compose.yml
Build & Deploy / build-and-deploy (push) Has been cancelled
2026-05-25 13:02:55 +02:00
David Alvarez 672be01e8c Fix IGDB search: remove where category=0 filter that blocked all results; fix cover.url handling in both search and applyIgdbId; add debug logging 2026-05-25 12:03:40 +02:00
David Alvarez 466299b8f0 IGDB integration: auto-scrape on upload + manual scrape button
- New IgdbService: Twitch OAuth2, IGDB API v4 search, cover download
- Upload auto-scrapes IGDB after extracting game ZIP
- GameDetail page: 'Auto Scrape' + 'Search' buttons + result picker
- Upload dialog: optional title field (defaults to filename)
- Jackson SNAKE_CASE naming to match frontend expectations
- IGDB status endpoint to check credentials
2026-05-25 10:22:58 +02:00
David Alvarez f2bd6ca3fb Fix Path name collision: use full @jakarta.ws.rs.Path for annotation, specific imports to avoid conflict with java.nio.file.Path 2026-05-25 09:40:50 +02:00
David Alvarez 5579afb5e7 Fix pom.xml: remove quarkus-rest-multipart (built into quarkus-rest), add maven-resources-plugin version; fix Dockerfile: DOSTALGIA_DATA -> DOSTALGIA_DATA_DIR 2026-05-25 09:29:22 +02:00
David Alvarez 28ea711b24 Migrate backend from Go to Quarkus (Java 21 / JAX-RS)
- Replaced Go stdlib server with Quarkus (RESTEasy Reactive + Jackson)
- 7 Java classes: Game POJO, GameService (JSON file I/O), 4 REST resources, static file serving
- Same JSON-per-game storage, same ZIP upload + bundle creation
- Same Svelte frontend (unchanged), built into the JAR via maven-resources-plugin
- Multi-stage Dockerfile: Node → Maven → JRE runtime
2026-05-24 15:41:51 +02:00
David Alvarez 7f17f4b31e Fix Stop + broken buttons: use location.reload() which preserves hash but fully unloads page, killing workers and audio. Revert pathname routing (unnecessary). 2026-05-23 19:29:07 +02:00
David Alvarez f6a1dccdf2 Fix Stop permanently: navigate to real server path /game/{id} to force full page unload, add pathname routing to SPA 2026-05-23 19:21:50 +02:00
David Alvarez a3ba5f8098 Fix Stop button killing audio: use full page reload to terminate Web Workers and AudioContexts that js-dos spawns internally 2026-05-23 19:16:14 +02:00
David Alvarez 40aede0dfc Fix Stop button: await ci.exit() so emulator process fully terminates before navigation, prevent stale audio 2026-05-23 19:11:53 +02:00
David Alvarez 3f41f6f678 Remove test ZIP from repo, fix gitignore for uppercase extensions 2026-05-23 19:07:55 +02:00
David Alvarez 5aedf20b7e Simplify Play page: no Start Game button, seamless boot
- dos-container div always mounted (fixes circular dep: container needed for start, was gated on running)
- Overlay covers the empty canvas while booting: Loading → Booting (CDN) → Running
- No intermediate "Start Game" screen — emulator auto-starts immediately
- Error state shown inline if something fails
- Stop button + back arrow both kill emulator and return to detail
2026-05-23 19:07:38 +02:00
David Alvarez 353f1d8af3 Remove test ZIP from tracking, add *.zip to .gitignore 2026-05-23 18:59:04 +02:00
David Alvarez 338ec870f5 UX: auto-start emulator, stop button, cleanup on navigate away
- Emulator auto-starts when Play page loads (no intermediate launch screen)
- Added ⏹ Stop button while game is running
- Back arrow and Stop both kill the emulator (js-dos CI.exit())
- Cleanup on unmount prevents background emulation
- Loading state shown while js-dos CDN loads
- Manual "Start Game" fallback if auto-start fails
2026-05-23 18:58:52 +02:00
David Alvarez 2b82404cf8 Remove test ZIP from repo 2026-05-23 18:38:59 +02:00
David Alvarez 545e2d2bb5 Fix Play button 404: bundle path and field name
- .jsdos bundles saved flat in data/games/ so /games/{id}.jsdos serves them
- bundleUrl() uses game.id (matches JSON) instead of game.slug (undefined)
- Delete handler also removes flat .jsdos bundle on game deletion
2026-05-23 18:38:53 +02:00
David Alvarez df5ce4f127 Fix: remove --only=production flag so devDependencies (vite, svelte plugin) are installed 2026-05-23 18:28:05 +02:00
David Alvarez aad4ec21a6 Fix Docker build: Debian Node image, npx vite build, .dockerignore 2026-05-23 18:13:00 +02:00