From eccd0b0a28c2cc73ee72d77cd52692a5cff97481 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 08:50:38 +0200 Subject: [PATCH] fix: file the older switch keys as variants --- .../Switch/.variants/prod.keys.d6cedce9} | 0 .../Switch/.variants/title.keys.8e6c2873} | 0 tests/test_game_data_homonyms.py | 30 +++++++++++++++++++ 3 files changed, 30 insertions(+) rename bios/{Arcade/Arcade/switch/prod.keys => Nintendo/Switch/.variants/prod.keys.d6cedce9} (100%) rename bios/{Arcade/Arcade/switch/title.keys => Nintendo/Switch/.variants/title.keys.8e6c2873} (100%) diff --git a/bios/Arcade/Arcade/switch/prod.keys b/bios/Nintendo/Switch/.variants/prod.keys.d6cedce9 similarity index 100% rename from bios/Arcade/Arcade/switch/prod.keys rename to bios/Nintendo/Switch/.variants/prod.keys.d6cedce9 diff --git a/bios/Arcade/Arcade/switch/title.keys b/bios/Nintendo/Switch/.variants/title.keys.8e6c2873 similarity index 100% rename from bios/Arcade/Arcade/switch/title.keys rename to bios/Nintendo/Switch/.variants/title.keys.8e6c2873 diff --git a/tests/test_game_data_homonyms.py b/tests/test_game_data_homonyms.py index b9592110..057e8a95 100644 --- a/tests/test_game_data_homonyms.py +++ b/tests/test_game_data_homonyms.py @@ -284,5 +284,35 @@ class ControllerDatabasesAreTheirOwn(unittest.TestCase): self.assertNotIn("C-Dogs", path or "") +class SwitchKeysAreTheNewestSet(unittest.TestCase): + """A harvested key set under Arcade/ won the name tie: master_key_10 shipped + where the collection held master_key_12.""" + + def test_every_switch_profile_gets_the_newest_master_key(self): + db_path = REPO_ROOT / "database.json" + if not db_path.exists(): + self.skipTest("no database.json") + db = load_database(str(db_path)) + profiles = load_emulator_profiles(str(REPO_ROOT / "emulators")) + held = [ + Path(entry["path"]) for entry in db["files"].values() + if entry["name"] == "prod.keys" and (REPO_ROOT / entry["path"]).exists() + ] + + def newest(path: Path) -> int: + keys = [ + line.split("=")[0].strip() for line in path.read_text(errors="replace").splitlines() + if line.startswith("master_key_") + ] + return max((int(k.rsplit("_", 1)[1], 16) for k in keys), default=-1) + + best = max(newest(REPO_ROOT / p) for p in held) + for key in ("yuzu", "citron", "eden", "suyu", "ryujinx", "kenji-nx", "skyline"): + entry = next(e for e in profiles[key]["files"] if e["name"] == "prod.keys") + with self.subTest(profile=key): + path, _status = resolve_local_file(entry, db, dest_hint=entry.get("path") or "") + self.assertEqual(newest(REPO_ROOT / path), best) + + if __name__ == "__main__": unittest.main()