fix: tag the BizHawk USA DSi NAND for the Americas

DecideNAND (MelonDS.cs:684-706) reads the JPN, USA, EUR, AUS, CHN and KOR
bits of header byte 0x1B0. A DSi title sold in Latin America carries the
USA bit, so the USA NAND serves it. Tagged north-america alone, it fell
out of an --emulator bizhawk --region br,jp pack.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:43:14 +01:00
1 parent 3cd4ed2566
commit 72cebb4c2b
3 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -178,7 +178,7 @@ files:
size: 251658304
storage: large_file
description: "DSi NAND (USA)"
region: [north-america]
region: [north-america, latin-america]
source_ref: "src/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs:407, src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs:484, 684-706"
note: "Slot NDS+NAND_USA has a placeholder hash, so the scan never finds it. Only a user specification reaches it. Read in DSi mode. A title whose ID upper word is 0x000300xx (DSi) gets only the NAND of a region its header byte 0x1B0 allows, any other title the first held in the order JPN, USA, EUR, AUS, CHN, KOR. The size includes the 64-byte nocash footer."
+1
View File
@@ -46107,6 +46107,7 @@
"nintendo-ds"
],
"regions": [
"latin-america",
"north-america"
],
"region_groups": [
+14
View File
@@ -1437,6 +1437,20 @@ class UsaRegionServesTheAmericas(unittest.TestCase):
regions = region.lookup_regions(index, destination, name)
self.assertEqual(region.rank(regions, requested), 0)
def test_brazil_ranks_the_usa_dsi_nand_before_the_japanese_one(self):
"""BizHawk's DecideNAND knows JPN, USA, EUR, AUS, CHN and KOR region
bits (MelonDS.cs:684-706): a DSi title from the Americas carries USA."""
import yaml
bizhawk = self.PROFILE.with_name("bizhawk.yml")
profile = yaml.safe_load(bizhawk.read_text(encoding="utf-8"))
index = region.build_region_index({"bizhawk": profile})
requested = region.parse_requested("br,jp")
usa = region.lookup_regions(index, "", "DSi_Nand_USA.bin")
jpn = region.lookup_regions(index, "", "DSi_Nand_JPN.bin")
self.assertEqual(region.rank(usa, requested), 0)
self.assertEqual(region.rank(jpn, requested), 1)
if __name__ == "__main__":
unittest.main()