The docs link carries the grammar and the examples demonstrate it, so the prose
restating both goes. Thirteen comment lines become four.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`filesystem.structure` now spells out the whole layout rather than only the part
below a platform folder. A template is relative to the library root, `{platform}`
marks the platform folder, and `{game}` marks where a game begins.
Merge `{gameFile}` and `{gameDir}` into one `{game}` terminal. The information a
terminal carried was the depth, not the kind: at a declared level a file is a
game of its own and a folder is one multi-file game, which a stat answers. That
drops the two-template idiom for a level holding both, and `_discover_default_roms`
with it, since the default scan is now just `roms/{platform}/{game}`.
Retire the auto-detected `{platform}/roms` layout, along with
`filesystem.roms_folder` and `filesystem.firmware_folder`, which named one path
segment each that a template now contains. Both are refused at startup with the
template that reproduces the layout, so an instance that relied on either says so
instead of scanning an empty library and marking every rom missing. Firmware gets
its own `structure.firmware` key rather than following the rom layout implicitly.
`get_roms_fs_structure` keeps meaning the folder a platform's games start in, so
the `.physical` sentinel paths already in the database still resolve. Per-platform
overrides have to agree with `default` on where the platform folder sits;
relocating one platform needs platform discovery and the watcher to union several
roots, which is left out.
The setup wizard reports `library_ready` plus the configured template instead of
a `struct_a`/`struct_b` discriminator, so the banner shows the layout in force
rather than guessing it client-side.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The comment block explaining `filesystem.structure` had grown to 45 lines of
prose in an example config. Keep the syntax essentials and the examples, and
point at the docs page for the rest.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A grouping folder is no longer also a game. With `{gameDir}` and
`{category}/{gameFile}` declared together, the category folder was surfaced
as a multi-file game *and* descended into, listing its contents twice. A
folder any template descends into is now treated as a grouping level.
Relocation runs for every platform, not only those with a custom structure.
Dropping a platform's template moves every game back to the platform root,
which previously read as a library of new games and orphaned all the saves,
play history, favorites and collection membership. A library whose paths are
unchanged still costs one query and no hashing. This also removes the need
for a manual "apply relocation" toggle.
Physical games are excluded from relocation candidates: they have no file, so
they read as having disappeared from their path on every scan.
A near-miss on the terminal macro (`{gameFolder}` for `{gameDir}`) now names
the offending section instead of only reporting a missing terminal.
Documents two limits the QA pass asked about: a move that also compresses or
extracts the game changes its size and is not detected (the size pre-filter
runs before hashing), and how reverting to the default layout behaves.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Conflict resolution notes:
- Locale rom.json: master sorted and reworked every file; took master's and
re-inserted `location` / `location-copied` in sorted position. Added them to
the new tr_TR locale.
- FSRom gained a required `fs_path`, so `build_hashless_fs_rom` now takes one
and both call sites pass the rom's own path.
- `get_roms` keeps this branch's `_collect_fs_roms` discovery while adopting
master's one-pass build and in-place sort.
- `mark_missing_roms` takes full paths and now also excludes physical games
(master), and the scan loop keeps master's early missing-sync plus its
restored-rom emit alongside this branch's relocation pass. The relocation
filter now applies only to the identify loop, so a relocated rom is no longer
re-flagged missing at the end of the scan.
- Relocation writes rom files through master's `sync_rom_files` (which replaced
`purge_rom_files` / `add_rom_file`), so row ids and track metadata survive.
- Master's unique index on (platform_id, fs_name) contradicts this branch's
premise that same-named files in different folders are distinct games.
Migration 0126 widens it to (platform_id, fs_path, fs_name); physical games
all share one folder, so a duplicate title is still rejected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change detection needs equality, not a fingerprint, and the hash was the
only reason the tick handler was async. Comparing bytes drops the WebCrypto
call, its non-secure-context fallback, and both mid-flight liveness checks
the awaits had made necessary: the decision now runs before the upload with
nothing suspended in between.
Seeding reads the SRAM with getSaveFile(false), which skips the dump that
was firing a saveSaveFiles tick, so the subscription no longer has to be
ordered below it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The active flag and the install slot both said "this component still owns
the subscription", so the slot alone now carries it.
fnv1a64's second lane re-hashed the same bytes offset by one with the same
prime, leaving the halves correlated; distinct primes over a single load
drop the per-byte modulo too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Behind a new config flag, emulatorjs.auto_save_sync (default false), the
EmulatorJS player uploads the in-game save (.srm) to the server on
EmulatorJS' own "System Save interval" tick, without Save & Quit.
EmulatorJS already runs that timer (default 300 s) and its
gameManager.saveSaveFiles() fires a "saveSaveFiles" event carrying the
SRAM bytes, but nothing listens to it, so today an in-game save reaches
the server only from Save & Quit or the Export Save File button (#4201).
This subscribes to that event from Player.vue and uploads through the
existing saveSave() when the SRAM hash is unchanged since the previous
tick (a save the core is still writing is never uploaded — the corruption
the earlier automatic upload was removed for, #2349) and differs from the
last upload (an idle session uploads nothing). The tracker is seeded from
the SRAM the core holds after the server save is applied, so a launch
never uploads the server's own file back, and the subscription is turned
off before Save & Quit, Quit and unmount.
The bytes EmulatorJS hands out are views onto the emulator heap, a
SharedArrayBuffer on threaded cores; they are copied into a plain
ArrayBuffer before hashing or uploading.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both exporters rebuilt their file from the database on every run, so a
scan with `scan.gamelist.export: true` threw away everything the frontend
or the user had written into it: favorites, play counts, per-game
emulator and core overrides, hashes, `<folder>` entries, ES-DE's
`<alternativeEmulator>` block, and Pegasus launch commands.
The exporters now read the existing file first and merge into it. For a
ROM RomM knows, the tags and keys RomM emits replace the old ones and
everything else is carried over. Entries with no matching ROM, folders,
scraper provider blocks and later Pegasus collections are written back
untouched. A file that cannot be parsed or decoded is left alone and the
export for that platform fails instead of replacing it.
Fixes#4158
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XjH6MYLVFVoY92JdBFgKXw
Conflicts and how they were resolved:
- `useGameActions`: master renamed `useCanPlay`'s `canPlay` to `canPlayLocal`
and kept a local `canPlayStream`, while this branch moved `canPlayStream`
into `useCanPlay` and folded it into `canPlay`. Kept this branch's shape and
took master's `useScanTrigger()` call.
- `Player/Stream.vue`: kept this branch's force-release and session-poll block,
and re-placed master's `useUnloadGuard(sessionActive)` next to the
`sessionActive` watch.
- `locales/*/play.json`: kept both sides' keys, re-sorted.
- `__generated__/index.ts`: kept both sides' model exports, re-sorted.
- `test_config_loader.py`: kept both sides' tests.
Master took 0114 through 0118 while this branch was open, so its three
migrations are renumbered 0119-0121 and rechained after
`0118_rom_category_cheat_pg`, leaving alembic with a single head.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Extends the streaming container config so one container can serve many
platforms, adds the webstation protocol and subfolder keys, and warns
when a config still uses the deprecated per-emulator broker mods.
Also pins DB_NAME to a dedicated test database so the autouse
clear_database fixture can never wipe a real dev database.
Quality pass over the title id feature, no behaviour change.
Give the Switch platform family one home by deriving it from the sigil
slug map, and drop the two inline tuples and the local frozenset that
restated it. Express the base-title-id rule once: a base id is its own
derived base. Compose the bracket regex from the 16-hex pattern instead
of repeating it.
Return the embedded name from the extraction closure rather than writing
it through nonlocal, which removes the is_rom_level flag and the repeated
sigil_platform guards, and factor the twice-duplicated rom-level file
tail into one helper.
Cut two per-ROM costs in _identify_rom: config.yml was re-read and
re-parsed three times per ROM, and the prod.keys firmware lookup ran one
DB query per Switch ROM despite depending only on the platform. Both are
now resolved once, the latter in the per-platform callers.
Also document skip_title_id_extraction and embed_switch_title_ids, drop
the always-dashed title/save id rows from the metadata tab, and render
the file row's chips from one list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Steam covers the PC platforms RomM otherwise has thin metadata for, and
its store payload is provider-grade on its own: title, description,
portrait capsule art, screenshots, genres, developers, publishers,
release date and Metacritic score, with no API key.
Valve documents no storefront API, so this reads the two endpoints that
back the store's own search box and app pages, paced well under the ~200
requests per 5 minutes they tolerate. Every failure path degrades to "no
match" rather than aborting a scan, and the provider is opt-in behind
STEAM_API_ENABLED, matching HowLongToBeat and Flashpoint.
Matching is gated on the platform slug so the three PC platforms are the
only ones that spend a request. The storefront's search index carries
DLC, soundtracks and tools alongside games, so hits are filtered by type
and then confirmed against the app page, which is the only place a demo
or a video is distinguishable from a game. A (steam-12345) filename tag
pins a match by hand when the title is ambiguous.
SteamMetadata reuses the key names the other providers already use for
the values they share, so wiring Steam into the generated facet columns
later is a SQL change with no stored-row reshaping.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ScreenScraper scraping added the fanart and title-screen URLs to
url_screenshots even though the same images are persisted to their
dedicated fanart/ and title_screen/ media folders, downloading and
storing every image twice. Restrict url_screenshots to the actual
screenshot media type; the dedicated media still renders in the artwork
gallery. The gamelist handler had the same pattern with title_screen
and gets the same fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New opt-in config key scan.priority.region_mode with values
prefer_rom_tags (default, current behavior) and prefer_config. With
prefer_config, the configured region priority outranks the rom's
filename region tags when selecting ScreenScraper media, and the rom's
own tags remain the fallback when the configured regions have no media.
Unknown values warn and fall back to prefer_rom_tags, and the key
survives runtime config-file rewrites.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add optional scan.priority.cover / screenshot / manual keys that each
override scan.priority.artwork for a single artwork field, falling back
to the shared artwork priority when omitted. This lets users, for
example, keep original box art for covers while sourcing screenshots
from a different provider.
Backward compatible: absent keys leave behavior unchanged. Config-only
(no UI), read-only exposure via GET /api/config.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add /api/streaming endpoints for session claim/release, ROM launch,
save states, volume control, and save-and-exit against per-platform
emulator broker containers. Sessions are stored in Redis with atomic
SET NX claims, owner-bound, and admin force-releasable. Config comes
from config.yml (streaming.enabled + containers list) with a
STREAMING_SAVE_TIMEOUT env override for slow-saving brokers.
Includes 19 endpoint tests covering auth scopes, claim races,
ownership, broker failure paths, and force-release.
A single fixed-depth template can't describe a platform that holds loose
games in its root AND organizes others into grouping subfolders — `{gameFile}`
drops the grouped games, `{category}/{gameFile}` drops the loose ones. Let a
platform's `filesystem.structure` value be a list of templates; discovery is
their union, deduplicated by full path:
structure:
nes:
- "{gameFile}" # loose top-level games
- "{category}/{gameFile}" # games inside grouping subfolders
- config: accept str | list[str]; platform_structure() returns a tuple of
parsed structures; parse_platform_structures() + validation handle both forms.
- fs handler: _collect_fs_roms unions each structure's discovery, dedup by
(fs_path, fs_name).
- tests: list parsing, per-platform list config loading, and the mixed
loose+grouped discovery case.
- docs: config.example.yml leads with the mixed-layout list example.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sk2dzM3K9qxWBdPAeGb7us
Adds an RBox3D primitive that builds a rotatable, fake-3D game box from
three flat ScreenScraper scans (front, back, spine) using CSS 3D
transforms. Box proportions derive from the images themselves; it rotates
via pointer drag, arrow keys / gamepad D-pad, and the right analog stick,
drifts gently when idle, and honours prefers-reduced-motion.
The game detail hero (CoverColumn) upgrades to the spinning box when the
"3D box" boxart style is selected and the rom has the full set of faces,
falling back to the flat cover otherwise.
Backend: persist the box-2D-side (spine) scan locally, mirroring the
existing box-2D-back handling — new BOX2D_SIDE media type + box2d_side_path
on ss_metadata, opt-in via scan.media.
- RBox3D primitive + Storybook story (controls + keyboard-rotation play())
- useBoxFaces composable resolving the three faces + a `complete` gate
- box3d-alt i18n key across all locales
- backend BOX2D_SIDE persistence + tests
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019itLXRfJXGGbhPY3JyqnuN
Generalizes the opt-in subfolder scanning into a per-platform custom
library structure template, modeled on Retrom's. Replaces the
`scan.subfolders` (bool | list) flag with `filesystem.structure`
(fs_slug -> template); platforms without a template keep RomM's default
discovery (top-level files and folders), so existing setups are unaffected.
A template is relative to the platform's ROM folder (RomM already resolves
the library root, roms_folder and platform directory) and is a sequence of
`/`-separated path sections:
- a braced section is a macro, a bare section is a literal folder matched
exactly;
- the last section must be the terminal {gameFile} (each file is a game) or
{gameDir} (each folder is a single multi-file game);
- any other braced section ({region}, {category}, ...) is a wildcard
directory level that matches any folder (organizational only).
Examples:
filesystem:
structure:
nes: "{category}/{gameFile}" # roms/nes/Hacks/foo.nes
ps3: "{category}/{gameDir}" # roms/ps3/PSN/Game/
snes: "{region}/{gameFile}" # roms/snes/USA/foo.sfc
Declaring {gameFile} vs {gameDir} removes the previous disc-descriptor
guessing entirely — the user states file-vs-folder. Hidden (dot-prefixed)
folders are never descended into. Hash-based non-destructive identity
(relocate a moved/renamed game in place, preserving saves/history/favorites/
collections) is retained and now triggers for any platform with a custom
structure.
- config: parse + validate templates at load (parse_library_structure,
LibraryStructure); reject {platform}/{library} (RomM resolves those) and
malformed templates.
- fs handler: _discover_structured_roms walks literal/wildcard levels to the
terminal; _discover_default_roms preserves the default behavior.
- Tests: template parser (valid/invalid), per-platform config loading, and
structured discovery (wildcard/literal levels, file/dir terminals, depth>1,
hidden-folder skip, cross-folder name collisions). Subfolder-flag tests
replaced.
- Docs: config.example.yml documents filesystem.structure; scan.subfolders
removed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sk2dzM3K9qxWBdPAeGb7us
Adds opt-in, per-platform subfolder scanning (closes#2050). When enabled
for a platform, RomM recurses that platform's subfolders and treats each
nested file as its own ROM, instead of collapsing a subfolder into one
multi-file ROM — so libraries organized into Hacks/, Translations/,
Homebrew/, etc. are scanned correctly.
Enable per platform in config.yml (default off, existing setups unaffected):
scan:
subfolders:
nes: true # recurse every subfolder
snes: ["Hacks", "Translations"] # recurse only these; keep others whole
Key difference from a naive path-identity approach: identity is reconciled
by content hash on scan. Moving or renaming a ROM between subfolders is
detected by its hash against a now-missing ROM and relocated in place, so
saves, play history, favorites and collection membership follow it. Falls
back to path identity when hashing is unavailable (skip_hash_calculation or
a non-hashable platform). A cheap size pre-filter avoids hashing every
newly-seen file (e.g. on first enable).
Details:
- Per-platform opt-in via scan.subfolders (fs_slug -> bool | list[str]); no
DB schema change.
- Recursion skips hidden (dot-prefixed) folders, and keeps a folder whole as
a single multi-file ROM when it holds a disc/playlist descriptor
(.m3u/.cue/.gdi/.ccd/.toc) — covers cue+bin / multi-disc games.
- Path-based keying for the steady-state lookup (get_roms_by_fs_name and
mark_missing_roms key on full path) so identically-named files in different
subfolders stay distinct; the (platform_id, fs_name) index is non-unique.
- File resolution (download/delete/hash) uses the ROM's stored fs_path.
- Scan log flags entries that became "missing" because a folder is now
recursed, so stale entries are easy to clean up.
- Frontend: the Files tab shows a ROM's on-disk Location (click-to-copy),
built as a shared LocationChip mirroring HashChip's RTag-based pattern.
New i18n keys added to all locales.
Tests: backend unit tests for recursion (collisions, hidden folders,
descriptor dirs kept whole, named-list form), full-path keying in
get_roms_by_fs_name / mark_missing_roms, and hash-based relocation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sk2dzM3K9qxWBdPAeGb7us
Add metadata.pegasus.txt export alongside the existing gamelist.xml
export. Restructure the export system: rename the gamelist endpoint to
a general-purpose export endpoint (`/api/export/`) with sub-routes for
each format (`/gamelist-xml`, `/pegasus`). Move config from flat
`scan.export_gamelist` to nested `scan.export.gamelist_xml` and
`scan.export.pegasus` for auto-export on scan.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>