diff --git a/tests/test_doc_pages.py b/tests/test_doc_pages.py index cdd6c3ed1..e4b85bfea 100644 --- a/tests/test_doc_pages.py +++ b/tests/test_doc_pages.py @@ -2004,3 +2004,30 @@ class TheCatalogRowsStateFacts(unittest.TestCase): if __name__ == "__main__": unittest.main() + + +class RegionFreeRuleNamesWhereItDoesNotHold(unittest.TestCase): + """advanced-usage.md said psxonpsp660.bin is declared [world] and always + survives --region. PCSX ReARMed declares it [japan], and on the platforms + where it is the only PlayStation core the filter drops it.""" + + def test_every_platform_that_drops_a_named_file_is_named(self): + from common import (list_registered_platforms, load_emulator_profiles, + load_platform_config) + from region import WORLD, platform_region_index + + section = _section(_page("advanced-usage.md"), "Region filtering") + bullet = next(p for p in section.split("\n- ") if "Region-free" in p) + files = re.findall(r"`([^`]+\.bin)`", bullet) + self.assertTrue(files) + profiles = load_emulator_profiles(str(ROOT / "emulators")) + for platform in list_registered_platforms(str(ROOT / "platforms")): + config = load_platform_config(platform, str(ROOT / "platforms")) + index = platform_region_index(config, profiles) + for name in files: + entry = index.get(name) + drops = bool(entry and entry["regions"] and WORLD not in entry["regions"] + and not entry["has_untagged"]) + if drops: + with self.subTest(platform=platform, file=name): + self.assertRegex(bullet, rf"(?i)\b{re.escape(platform)}\b") diff --git a/wiki/advanced-usage.md b/wiki/advanced-usage.md index aff9b10b6..8ee0f0c17 100644 --- a/wiki/advanced-usage.md +++ b/wiki/advanced-usage.md @@ -134,9 +134,12 @@ Three rules keep a filtered pack usable: - **No system is ever emptied.** If nothing matches, the whole group is kept. `--region us` still ships `disksys.rom`, because the Famicom Disk System has no American BIOS. -- **Region-free files always survive.** `psxonpsp660.bin`, `ps1_rom.bin` and - `openbios.bin` are declared `[world]`: they add a capability rather than - competing regionally. +- **Region-free files survive.** A file one of the platform's cores declares + `[world]` is kept. SwanStation declares `psxonpsp660.bin` and `ps1_rom.bin` + that way, DuckStation `openbios.bin`. The tag comes from each core: + PCSX ReARMed reads the region inside `psxonpsp660.bin` and files it as + `[japan]`, so on MinUI, NextUI and MyMinUI, where it is the only PlayStation + core, `--region us` drops it. - **Untagged files always survive.** Most BIOS are not regional and carry no `region:` at all.