fix: narrow hashless name matches to their maker

AmberELEC's nec-pc-88 declares DISK.ROM with an empty md5. QUASI88 reads
that name as n88sub.rom, the 2 KB PC-88 disk ROM (libretro.c:1085), but
the name step served the 16 KB MSX disk ROM, the only primary of that
name. The quasi88 alias never reached by_name, which refuses an alias a
primary already carries.

load_platform_config now writes each entry's system as platform_system.
A platform entry with no hash and no owning emulator, whose system id
names a maker, takes no name candidate filed under another maker, in
the name step and in the hash_mismatch step after it. When nothing is
left, by_shadowed_alias, the profile aliases by_name refuses, answers
within the system's maker folder. names_manufacturer and BUCKET_FOLDERS
move to common.py, and generate_site imports them.

Across every registered platform the only resolution that moves is
AmberELEC nec-pc-88 DISK.ROM, from bios/Microsoft/MSX/DISK.ROM to
bios/NEC/PC-88/N88SUB.ROM. Manifests, truth and exports are otherwise
byte-identical.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 23:17:04 +01:00
1 parent 9a66ac3219
commit d1ebd411ab
11 files changed
+578 -27

No files matched your search

+5 -14
View File
@@ -40,6 +40,8 @@ from typing import TypeVar
sys.path.insert(0, os.path.dirname(__file__))
from common import (
BUCKET_FOLDERS,
names_manufacturer,
upstream_profile_index,
build_zip_contents_index,
GAME_DATA_TOPS,
@@ -219,21 +221,10 @@ def _copy_places(db: dict) -> dict[str, set[tuple[str, str, str]]]:
return places
# bios/Other/<emulator> and bios/Arcade/<emulator or board> file a copy by
# who loads it, not by machine. A copy also filed under a machine's maker
# places the system there.
_BUCKET_FOLDERS = frozenset({"Other", "Arcade"})
def _slug(manufacturer: str) -> str:
return manufacturer.lower().replace(" ", "-")
def _names_manufacturer(sys_id: str, manufacturer: str) -> bool:
slug = _slug(manufacturer)
return sys_id == slug or sys_id.startswith(f"{slug}-")
def _copies_by_path(db: dict) -> dict[str, set[tuple[str, str, str]]]:
"""The copy places of each content, keyed by the path the database keeps."""
files = db.get("files", {})
@@ -276,13 +267,13 @@ def _system_folder(
declared = str(fe.get("name", "")).casefold()
named = {
(m, c) for m, c, base in held
if base.casefold() == declared or _names_manufacturer(sys_id, m)
if base.casefold() == declared or names_manufacturer(sys_id, m)
}
for place in named or {(m, c) for m, c, _ in held}:
votes[place] = votes.get(place, 0) + 1
if votes:
own = [place for place in votes if _names_manufacturer(sys_id, place[0])]
makers = [place for place in votes if place[0] not in _BUCKET_FOLDERS]
own = [place for place in votes if names_manufacturer(sys_id, place[0])]
makers = [place for place in votes if place[0] not in BUCKET_FOLDERS]
candidates = own or makers or list(votes)
return max(sorted(candidates), key=lambda place: votes[place])
for fe in files: