fix: give a suffixed release its emulator's tree

_foreign_tree compared owner tokens by equality, so cxbx-reloaded-2023
read bios/Other/cxbx-reloaded/ as another emulator's tree and the
case-folded fallback served xemu's encrypted EEPROM. The leading whole
words of a profile key now name its own tree too. Across every profile
entry this moves cxbx-reloaded-2023's EEPROM.bin to the decrypted dump,
turns eight name matches on the same files into path matches, and gives
solarus-2.0.0 the Solarus tree's gamecontrollerdb.txt.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 10:09:57 +02:00
1 parent 236f30860e
commit 604ab3371b
2 files changed
+56 -1

No files matched your search

+11 -1
View File
@@ -934,11 +934,21 @@ def _affinity_tokens(text: str) -> set[str]:
def _owner_tokens(file_entry: dict) -> set[str]:
"""Tokens naming the profile that asks for the file."""
"""Tokens naming the profile that asks for the file.
A profile named after another with a suffix (cxbx-reloaded-2023,
mame4droid-2024) is a release of that emulator, and the tree named by
the shorter name is its own: cxbx-reloaded-2023 was served xemu's
encrypted EEPROM because bios/Other/cxbx-reloaded/ read as foreign.
Only whole leading words count, so dolphin-mmjr2 is not dolphin-mmjr.
"""
tokens: set[str] = set()
for owner in (file_entry.get("source_profile"), file_entry.get("source_emulator")):
if owner:
tokens |= _affinity_tokens(str(owner).replace(" ", ""))
profile = str(file_entry.get("source_profile") or "").casefold()
words = [word for word in re.split(r"[^0-9a-z]+", profile) if word]
tokens |= {"".join(words[:end]) for end in range(1, len(words))}
return tokens