dolphin/Source/Core/DiscIO
cristian64 3eea3a90b5 Triforce: Check only first byte in region flag.
In some Triforce games (e.g. _F-Zero AX_), the bytes that follow the
region flag in the `boot.id` file (at `0x38`) happen to be `0x00`.
However, in other games (e.g _Mario Kart Arcade GP 2_), it seems the
region flag is padded with `0xFF`.

_Mario Kart Arcade GP 2_ (`boot.id` in the USA version):
```
00000 0000:  42 54 49 44 00 00 01 E0  00 00 00 01 00 00 00 01  BTID.... ........
00000 0010:  FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF  ........ ........
00000 0020:  47 43 41 4D 00 00 01 C0  07 D3 05 0F 00 00 00 07  GCAM.... ........
00000 0030:  53 42 4E 4C 00 00 00 00  0E FF FF FF FF FF FF FF  SBNL.... ........
                                      -----------
                                           ^
                                           |
                                      region flag
```

When the region flag was tested in `switch` statements (where a single
byte was expected in the `case`s), the test would fail, depending
on the game.

This issue would lead to the wrong calculation of the country in
`VolumeDisc::GetCountry()`, which was then used to build the game ID in
`VolumeDisc::GetGameID()`.

The solution is to test using only the least meaningful byte in the
region flag.

Unexpected game IDs were first noticed with USA version of _Mario Kart
Arcade GP 2_, which was wrongly assigned the same game ID that is given
to the Japan version (i.e. `GNLJ82`). The correct game ID for the USA
version is `GNLE82`.
2026-03-15 18:43:00 +00:00
..
Blob.cpp
Blob.h
CachedBlob.cpp
CachedBlob.h
CISOBlob.cpp
CISOBlob.h
CMakeLists.txt
CompressedBlob.cpp
CompressedBlob.h
DirectoryBlob.cpp
DirectoryBlob.h
DiscExtractor.cpp
DiscExtractor.h
DiscScrubber.cpp
DiscScrubber.h
DiscUtils.cpp
DiscUtils.h
Enums.cpp
Enums.h
FileBlob.cpp
FileBlob.h
Filesystem.cpp
Filesystem.h
FileSystemGCWii.cpp
FileSystemGCWii.h
GameModDescriptor.cpp
GameModDescriptor.h
LaggedFibonacciGenerator.cpp
LaggedFibonacciGenerator.h
MultithreadedCompressor.h
NANDImporter.cpp
NANDImporter.h
NFSBlob.cpp
NFSBlob.h
RiivolutionParser.cpp
RiivolutionParser.h
RiivolutionPatcher.cpp
RiivolutionPatcher.h
ScrubbedBlob.cpp
ScrubbedBlob.h
SplitFileBlob.cpp
SplitFileBlob.h
TGCBlob.cpp
TGCBlob.h
Volume.cpp
Volume.h
VolumeDisc.cpp
VolumeDisc.h
VolumeFileBlobReader.cpp
VolumeFileBlobReader.h
VolumeGC.cpp
VolumeGC.h
VolumeVerifier.cpp
VolumeVerifier.h
VolumeWad.cpp
VolumeWad.h
VolumeWii.cpp
VolumeWii.h
WbfsBlob.cpp
WbfsBlob.h
WIABlob.cpp
WIABlob.h
WIACompression.cpp
WIACompression.h
WiiEncryptionCache.cpp
WiiEncryptionCache.h
WiiSaveBanner.cpp
WiiSaveBanner.h