18 Commits

Author SHA1 Message Date
danielcopper
3c395e9cf6 fix(platforms): give amiga-cd32 libretro's CD32 name (#5511) 2026-11-09 08:50:33 -05:00
danielcopper
6b73d36043 fix(platforms): file amigacdtv as the CDTV and give it libretro's name (#5513) 2026-11-09 08:39:13 -05:00
danielcopper
29c878abff fix(platforms): use libretro's names for Xbox and drop two it does not have (#5509)
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-09 08:22:57 -05:00
danielcopper
1afaba47e3 fix(platforms): give pc-8800-series libretro's PC-88 name (#5508) 2026-11-09 08:00:00 -05:00
Georges-Antoine Assi
b35eb4d07c fix(scan): clean up unreferenced rescan media, split scan_rom and move its parts into handler/scan (#5408)
* fix(scan): delete screenshots and media a rescan leaves unreferenced

A complete rescan keeps the stored artwork, so two kinds of file stayed on
disk with nothing pointing at them:

- screenshots indexed past a shorter new list, since files are named by
  position and only the indexes in range were rewritten
- media of a type removed from the preferences, since providers record no
  path for it and stale media was compared over the preferred types only

get_rom_screenshots now deletes the indexes past the new list, and
remove_stale_media compares every media type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scan): split scan_rom's merge into named steps

scan_rom held seeding the row, following Demozoo links, splicing scene
summaries, resetting rematched sources, the scene lock, rehash cleanup,
priority merges for fields, tags and artwork, and the SteamGridDB pass in one
body. Each step is now its own helper, the SteamGridDB lookup a _RomLookups
method, and the providers' answers a dict keyed by source instead of fourteen
locals. The Pouet and CSDb link follows share one helper. Behaviour is
unchanged.

McCabe complexity of scan_rom goes from 68 to 13, and the function from 664
to 215 lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scan): trim remove_stale_media's docstring per Greptile review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scan): move the scan vocabulary, lookups and merge into handler/scan

scan_handler.py held the scan types and metadata sources, the per-source
lookups, the merge of their answers and the orchestration in one 2,000-line
module. It now builds on a handler/scan package:

- sources.py: ScanType, MetadataSource, the tag constants, RESCAN_RULES,
  should_consult, stored_match_id and the priority ordering
- lookups.py: RomLookups, the LaunchBox and Steam resolvers and
  get_main_platform_igdb_id
- merge.py: the pure steps that merge the sources' answers into a rom's
  columns

scan_handler.py keeps scan_platform, scan_rom, the asset scans and the media
downloads. Importers point at the module that now defines each name, and the
helpers that crossed a module boundary lost their leading underscore.
clear_rehash_misses takes the attempted sources instead of the lookups, so
merge does not depend on lookups. Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ci): import ScanType from handler.scan.sources in the e2e seed script

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scan): harden leftover screenshot cleanup (pr-ready: code-review)

List the screenshots folder once, use isdecimal() for the index test, and
log rather than raise when a leftover can't be removed. Point three
comments at handler/scan instead of scan_handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scan): tidy the merge helpers and patch paths (pr-ready: simplify)

- fetch_sgdb_rom refetches by stored_id and builds the SGDB name list
  itself, so the name sources stay private to lookups.
- follow_demozoo_link checks the source is enabled; scan_rom loops over
  Pouët and CSDb.
- order_merge_sources holds the one ordering pass, and
  build_metadata_handlers adds the empty SGDB entry.
- Leftover screenshots go through the quiet-delete helper, renamed
  _discard_file.
- Tests patch rom lookups through handler.scan.lookups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scan): never leave a recorded media or screenshot path without its file

- remove_stale_media only deletes a file whose owner or source changed
  when that new owner stores the type again in this pass. A file nothing
  records is still deleted.
- Screenshots past a shorter list are pruned by remove_screenshots_past
  once the new paths are saved, in both download_rom_resources and
  update_rom, so a failed cover or manual leaves them in place.
- The release-notes schema diff watches scan_handler.py beside
  scan/sources.py, for ranges that span the move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:23:13 -04:00
Spinnich
60703be09c chore(platforms): split arcade aliases into per-emulator-family slugs (#5273)
* feat(platforms): split arcade aliases into per-emulator-family slugs

Give MAME, AdvanceMAME, FBNeo, FBA, Daphne, Singe and the arcade boards
that need their own emulator (NAOMI/NAOMI 2/NAOMI GD-ROM, Model 2/3,
Hikaru, Triforce, Lindbergh, Namco System 246/3xx, Gaelco, ...) their own
slugs with verified provider IDs. Providers without a dedicated entry fall
back to their Arcade platform via arcade_fallbacks(). MAME-only boards
(CPS1-3, System 16/32, Model 1, Namco 22) stay aliases of arcade.

Refs #5272

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(platforms): code-review pass on arcade slugs

- Retry IGDB on unmatched scans for every platform IGDB resolves, not
  just slugs in IGDB_PLATFORM_LIST.
- Resolve config binding/version values through the alias table, so a
  binding to a retired slug (cps2, model1, ...) still lands on a platform.
- Alias the Batocera `typex` folder to type-x.
- Build provider id->slug reverse maps before merging Arcade fallbacks.
- Share one MAME title lookup between base_handler and libretro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(platforms): simplify pass on arcade slugs

- Alias the three RomM-keyed IGDB versions inside IGDB_PLATFORM_VERSIONS,
  dropping IGDB_VERSION_SLUGS and _version_slug.
- Derive EmulatorJS arcade entries from ARCADE_SET_PLATFORMS.
- Remove the unused provider id->slug reverse maps, so the Arcade
  fallback merge no longer has an ordering constraint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(platforms): humanizer pass on arcade slug comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(platforms): settle arcade slug review decisions

- Migration 0154 moves platforms still on a retired MAME-only board slug
  (cps1-3, model1, system16, system32, system-32) to arcade, so no row
  carries a slug the enum no longer has.
- MAME shortname expansion keys off the RomM slug via
  MAME_SHORTNAME_PLATFORMS instead of per-provider arcade ids, so Daphne,
  Singe, Type X and Lindbergh sets are no longer read as MAME sets. Neo Geo
  now expands at ScreenScraper too, as it already did at IGDB and Moby.
- fba offers fbneo before the FinalBurn Alpha CPS cores.
- AdvanceMAME leaves the WebRcade feed; EmulatorJS and WebRcade share
  PLAYABLE_ARCADE_SET_PLATFORMS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(platforms): code-review pass (xhigh) on arcade slugs

Verify arcade-board BIOS files against the known list's arcade entries,
and make migration 0154 match retired slugs case-insensitively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(platforms): simplify pass on arcade slugs

Apply IGDB family overrides once in get_platform instead of on each
return path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(platforms): use a slug with no shipped icon

singe now ships an icon, so the no-icon prefetch test needs a slug that never will.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(platforms): add a teknoparrot arcade slug

TeknoParrot runs PC-based arcade boards outside the MAME/FinalBurn family,
so its folder gets its own platform (RetroBat and ES-DE both use
`teknoparrot`). Providers fall back to their Arcade entry, MAME shortname
expansion skips it, and it gets a placeholder icon copied from `arcade`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(platforms): give each arcade-family icon its own marquee title

Redraws the ARCADE marquee on the copied cabinet icons with each
platform's name, in the Bungee typeface with the original inline and
extrusion styling. Sega boards use Sega blue, Namco systems Namco red,
and Type X Taito blue; the rest keep the original amber.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(platforms): code-review pass (xhigh) on arcade slugs

Neo Geo BIOS lives under arcade in the known BIOS list, so map
neogeoaes and neogeomvs there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(platforms): simplify pass on arcade slug tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-28 19:53:06 -04:00
Ian Hunter
89607cd22c chore: Library support for zelda classic games (#5214)
* feat(platforms): add Zelda Classic (zc210) engine support

Recognise Batocera/REG-Linux zc210 quest folders as the zelda-classic
platform so .qst libraries scan as a first-class engine platform, matching
existing fantasy-console/engine precedents like TIC-80 and WASM-4.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(platforms): drop placeholder Zelda Classic icons

Use RomM's default platform icon until a properly licensed asset is available.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(setup): identify FS alias platforms in library wizard

The setup UI matches on-disk folders by exact fs_slug against
supported_platforms, so aliases like zc210 never matched zelda-classic.
Merge resolved filesystem platforms into the setup response.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(platforms): also alias zc250 to Zelda Classic

EmulatorJS documents both zc210 (2.10) and zc250 (2.50) cores for .qst
quests; accept either folder name as Zelda Classic.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(setup): reuse listed folders when merging FS aliases

get_filesystem_platforms was walking the library again outside the
setup endpoint's error guard, so a folder-list failure could still
500 /api/setup/library. Pass the folders already read instead.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert(setup): drop setup-wizard FS alias merge from this PR

Keep Zelda Classic platform aliases (zc210/zc250) without changing
/api/setup/library behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-27 17:49:48 -04:00
Sam Dornan
552ac3a393 fix(platforms): share provider entries across duplicate platform slugs (#5359)
* fix(platforms): share provider entries across duplicate slugs and rename system-32

Three consoles have two RomM slugs, each used by different providers, so a
library folder only matched the providers that knew its spelling:
vc-4000 / interton-vc-4000, apple-pippin / pippin and tandy-vis / vis.
DUPLICATE_PLATFORM_SLUGS lists them once, and fill_duplicate_slugs gives
each slug the other's entry in every provider table. pippin and
interton-vc-4000 now get an IGDB platform id, and IGDB's family override
also applies to a listed duplicate so both VC 4000 slugs stay in the
Interton family.

The system-32 slug mapped to Namco System 22 in ScreenScraper and
LaunchBox, easy to confuse with Sega System 32 (system32). It is now
namco-system-22. Folders and config bindings named system-32 still
resolve to it, and migration 0154 renames existing platform rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

* fix(platforms): resolve bindings to a renamed slug back to their folder

resolve_platform_slug already maps a binding to system-32 onto
namco-system-22, but resolve_fs_slug compared the raw binding with the
new slug, so a moved folder bound to the old slug was never found.
Both now go through the same renamed-slug lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

* fix(platforms): drop the system-32 slug backfill migration

Every scan resolves a platform's slug from its folder again, so the next
scan renames system-32 rows through the renamed-slug alias without a
migration, as the backend guide asks for normalizations the parser now
handles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

* chore(platforms): reword two comments so the product isn't the actor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

* revert(platforms): leave system-32 to the arcade slug split

rommapp/romm#5273 retires system-32 as an alias of arcade and resolves
aliases in config bindings in both directions, which covers what the
namco-system-22 rename and the renamed-slug lookup did here. This PR now
only shares provider entries across duplicate slugs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:28:30 -05:00
Georges-Antoine Assi
996d12adea feat(metadata): add RPG Maker platform and resolve easyrpg folders
Batocera, RetroBat and ES-DE all ship an `easyrpg` folder for RPG Maker
2000/2003 games, but RomM had no platform for them, so the folder fell
through as an unmatched platform that matched no metadata.

Add UniversalPlatformSlug.RPG_MAKER and wire it to the two providers that
carry the platform: ScreenScraper (system 231, "EasyRPG") for metadata and
libretro (system "RPG Maker") for thumbnails. IGDB, MobyGames and TheGamesDB
have no RPG Maker platform, so they stay unmapped, the same way DOOM is
wired.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 19:09:21 -04:00
Georges-Antoine Assi
eec574b49b fix(metadata): give UniversalPlatformSlug a leaf home
Both CI failures came from one import cycle. RQ could no longer resolve
`endpoints.sockets.scan.scan_platforms`, and the e2e seed script failed the
same way, because `sigil` imports the platform slug enum, importing anything
under `handler.metadata` runs its `__init__`, that reaches `gamelist_handler`
which imports `handler.filesystem`, and `roms_handler` there imports `sigil`
back while it is still half-initialised.

The cycle predates this branch. It stayed hidden because `scan.py` reached
the enum through `utils.switch`, imported late enough that
`handler.filesystem` was already loaded; naming the adapter directly moved
that import to the top of the module and the ordering luck ran out.

So the enum moves to `utils/platform_slugs.py`, which imports nothing but
`enum`. Naming a platform no longer drags in httpx, redis and the titledb
task, and the 29 call sites point at the module that owns it rather than
picking it up from a 1000-line metadata handler that happens to re-export
it. `import adapters.services.sigil` now also works on its own, which it
did not before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 14:28:49 -04:00
Georges-Antoine Assi
2eed7d56c1 feat(platforms): map doom to its standalone provider entries
Three of the ten metadata providers carry Doom as a platform in its own
right rather than folding it into DOS:

- ScreenScraper system 290 "PrBoom", a child of PC Dos scoped to wad files
- Libretro thumbnails DOOM, with boxarts, snaps and title screens
- Hasheous platform 645195 "PrBoom"

IGDB, MobyGames, RetroAchievements, LaunchBox, TheGamesDB, Flashpoint and
HowLongToBeat have no Doom platform, so they stay unmapped.

The ScreenScraper mapping is what makes metadata search work for a doom
folder: scoped to system 290 it matches Doom, Doom II and PWADs such as
Chex Quest. Its name is the user-facing platform name, so it reads "Doom"
rather than naming the source port.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 07:21:44 -04:00
Georges-Antoine Assi
90945685e4 Stuff 2026-05-17 12:43:33 -04:00
Georges-Antoine Assi
3ce0873931 fix 2026-04-12 16:09:36 -04:00
Georges-Antoine Assi
1b5943bd93 feat: fetch libretro Named_Snaps/Titles/Logos gated by SCAN_MEDIA
get_rom now also fetches Named_Snaps, Named_Titles, and Named_Logos
when the matching MetadataMediaType (SCREENSHOT, TITLE_SCREEN, LOGO)
is in SCAN_MEDIA. Box art is still fetched unconditionally — it drives
url_cover and libretro_id. Matching extras are appended to
url_screenshots so the scan_handler artwork priority loop picks them
up without further changes. All enabled listings are fetched
concurrently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 16:01:37 -04:00
Georges-Antoine Assi
62e540d60e changes from bot review 2026-04-12 15:43:14 -04:00
Georges-Antoine Assi
f94c1491e5 fix: respect SCAN_ARTWORK_PRIORITY for SGDB and align libretro search with SGDB pattern
SGDB's url_cover used to clobber whatever the artwork priority loop
picked, which meant user-set priorities (e.g. libretro > sgdb) and
manually uploaded covers were silently overridden. SGDB now only
replaces the current url_cover when it outranks every other source
that produced one under SCAN_ARTWORK_PRIORITY, and never over a
manual cover preserved on UPDATE/UNMATCHED scans. Default artwork
priority gains sgdb at the top so existing "SGDB wins" behavior is
preserved for default configs.

On the /search/roms endpoint, libretro is now an enrichment source
alongside SGDB instead of a primary match source: it decorates
entries resolved by IGDB/Moby/SS/Flashpoint/Launchbox with
libretro_id and libretro_url_cover, mirroring how SGDB works.
get_matched_roms_by_name is removed from the libretro handler since
nothing else calls it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:52:44 -04:00
Georges-Antoine Assi
4928041593 manual cleanu 2026-04-12 11:04:12 -04:00
Georges-Antoine Assi
522df9d31a feat: add libretro thumbnails as an artwork source
Adds the libretro thumbnail repository as a first-class artwork source so
region-correct box art (PAL/Europe, Japan, etc.) can be matched directly
to ROM filenames, addressing rommapp/romm#3239.

Implementation follows the SGDB handler pattern (artwork-only, no game
metadata): MetadataSource enum entry, scan-time fetch wired into the
SCAN_ARTWORK_PRIORITY loop, /search/roms integration, MatchRom dialog
chip + cover selection, and a heartbeat flag.

Matching is exact case-insensitive against the directory listing first
(so a ROM named "(Europe)" lands on the (Europe) artwork), with a
JaroWinkler fuzzy fallback at 0.8 that strips parenthetical tags from
both sides. Listings are cached in Redis with a 24h TTL.

`libretro_id` is persisted on the Rom model as the SHA1 hex of the
matched libretro filename — stable across scans, distinct per region,
indexed for lookup. Migration 0077 adds the column.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:57:20 -04:00