Skip to content

fix(download): mark extracted ROMs as downloaded - #6

Open
pawndev wants to merge 1 commit into
mainfrom
fix/233-extracted-roms-downloaded
Open

pawndev wants to merge 1 commit into
mainfrom
fix/233-extracted-roms-downloaded

Conversation

@pawndev

@pawndev pawndev commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Fixes rommapp#233.

Problem

Grout keeps no record of what it downloads. To mark a game as downloaded, it checks that the exact file name RomM reports exists on the card. Unpacking a download changes that name:

  • Zipped ROM with "Unzip Downloads" on: Game.zip is deleted after unpacking, so grout looks for a file that no longer exists.
  • Multi-file ROM: it is unpacked into <name>/, while grout looks for <name>.m3u at the root. Only muOS moves the playlist up, and only when the archive has one; on muOS the folder is _<name>/.

Change

Option D + A from the ADR (docs/contributing/adr/0001-detect-extracted-roms.md):

  • D: decode RomM's archive_members (name only, to save memory on 128 MB devices). An archive counts as present when every file listed inside it is on the card. The field has been in RomFileSchema since RomM 5.0.0; I checked it in a real API response from RomM 5.3.1.
  • A, as the fallback when the server lists nothing (RomM 4.x, hashing off, archives not rescanned since 5.0): a file or folder sharing the archive's name counts, except saves, states, patches, images and text files. Directory listings are cached per ROM directory until its modification time changes. FAT records that time to the nearest two seconds, so a listing taken within two seconds of the last change is read again.
  • Multi-file games: their extraction folder counts when it is not empty. A new firmware hook, ExtractedDirName, gives its name (_<name> on muOS).
  • LocalPath returns the file to launch for an unpacked game: the .m3u if there is one, otherwise the first file. The metadata refresh then points at the right file.
  • IsArchive moves from download to archive so cfw can use it without an import cycle.

Tests

  • cfw: listed archive members, members taking precedence over the name, members outside the ROM directory, fallback by name and its exclusions, extraction folders (including muOS), LocalPath for unpacked games, the directory listing cache.
  • catalog: end-to-end on a simulated muOS card, including the real RomM payload (a zip holding a folder of CHDs and an .m3u).
  • romm: decoding archive_members, including null.

go vet and go test ./... pass.

Not verified yet

  • On a real device: that a multi-disc game unpacked on a firmware other than muOS now shows as downloaded.
  • Grout's local cache only gets archive_members for games it fetches again, and the incremental sync only fetches games changed on the RomM side. Fallback A covers the rest until a full library refresh.

🤖 Generated with Claude Code

A zipped ROM unpacked on download lost its archive, and grout only looked
for the exact file name RomM reports, so the game never showed as
downloaded (rommapp#233). Multi-file games were unpacked into a folder while
grout looked for a playlist at the root, which only muOS creates.

- Decode RomM's archive_members (name only) and treat an archive as
  present when every file listed inside it is on the card.
- When the server lists nothing (RomM 4.x, hashing off, old scans), fall
  back to a file or folder sharing the archive's name, ignoring saves,
  states, patches, art and text files. Directory listings are cached per
  ROM directory until its modification time changes.
- Accept a multi-file game's extraction folder, named per firmware
  through a new ExtractedDirName hook (_<name> on muOS).
- LocalPath returns the file to launch for an unpacked game (playlist
  first, then the first file), so the metadata refresh points at it.
- Move IsArchive to the archive package so cfw can use it.
- Add ADR 0001 describing the options and the decision.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show extracted roms as downloaded

1 participant