From 3cd4ed256665f72f86dfa9298abeaba3d7dfef9a Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:42:05 +0100 Subject: [PATCH] fix: tag citra-mmj USA font for Latin America apt.cpp:128-140 picks the shared font archive by GetRegionValue: CHN, KOR and TWN get their own, every other CFG region gets 0x00014002. The CFG region set has USA and no Latin America value, so the USA font serves the Americas, which the repo writes [north-america, latin-america]. With latin-america missing, --region br,cn kept only the Chinese archive. --- emulators/citra-mmj.yml | 4 ++-- tests/test_region.py | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/emulators/citra-mmj.yml b/emulators/citra-mmj.yml index a9458d166..06a196d9c 100644 --- a/emulators/citra-mmj.yml +++ b/emulators/citra-mmj.yml @@ -129,7 +129,7 @@ files: system: nintendo-3ds required: false hle_fallback: true - region: [japan, north-america, europe, oceania] + region: [japan, north-america, latin-america, europe, oceania] description: "shared font system archive, title 0x0004009b00014002" note: "First step of the shared font chain, holding cbf_std.bcfnt.lz in its RomFS. This title low ID is the one the embedded open-source font answers." source_ref: "src/core/hle/service/apt/apt.cpp:124-182, src/core/file_sys/archive_ncch.cpp:143-148" @@ -178,7 +178,7 @@ files: required: false bundled: true hle_fallback: true - region: [japan, north-america, europe, oceania] + region: [japan, north-america, latin-america, europe, oceania] description: "shared font for JPN, USA, EUR and AUS" note: "Read to offset 0x80 of the shared memory block, so the file is a bare uncompressed BCFNT. Selected for every CFG region other than CHN, KOR and TWN. The embedded open-source font answers the archive request first, so this file is only reached when that archive path is taken out." source_ref: "src/core/hle/service/apt/apt.cpp:184-228, src/core/file_sys/archive_ncch.cpp:143-148" diff --git a/tests/test_region.py b/tests/test_region.py index 1699c0894..22c5624a7 100644 --- a/tests/test_region.py +++ b/tests/test_region.py @@ -1411,5 +1411,32 @@ class MachineModelRomsCarryNoTerritory(unittest.TestCase): ) +class UsaRegionServesTheAmericas(unittest.TestCase): + """A code that knows a USA region and no Latin America one selects the + USA file there: Citra's shared font for CFG USA is 0x00014002 + (apt.cpp:128-140), and a --region br,cn pack dropped it for the Chinese + archive alone.""" + + PROFILE = Path(__file__).resolve().parents[1] / "emulators" / "citra-mmj.yml" + FONT = ( + "nand/00000000000000000000000000000000/title/0004009b/00014002/" + "content/00000000.app.romfs" + ) + + def test_brazil_ranks_the_default_shared_font(self): + import yaml + + profile = yaml.safe_load(self.PROFILE.read_text(encoding="utf-8")) + index = region.build_region_index({"citra-mmj": profile}) + requested = region.parse_requested("br,cn") + for destination, name in ( + (self.FONT, "00000000.app.romfs"), + ("sysdata/cbf_std.bcfnt", "cbf_std.bcfnt"), + ): + with self.subTest(file=destination): + regions = region.lookup_regions(index, destination, name) + self.assertEqual(region.rank(regions, requested), 0) + + if __name__ == "__main__": unittest.main()