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 DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
Blob.h DiscIO: Add IsCached virtual function to BlobReader. 2026-02-15 20:14:15 -06:00
CachedBlob.cpp DiscIO: Add IsCached virtual function to BlobReader. 2026-02-15 20:14:15 -06:00
CachedBlob.h DiscIO: Add CachedBlobReader which takes another BlobReader and reads it into memory in the background. 2025-11-23 05:17:22 -06:00
CISOBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
CISOBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
CMakeLists.txt Merge pull request #14174 from JoshuaVandaele/minizips-cmake 2025-12-22 13:36:52 -05:00
CompressedBlob.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
CompressedBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
DirectoryBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
DirectoryBlob.h Fix various typos and spelling mistakes 2026-01-17 20:11:38 +01:00
DiscExtractor.cpp
DiscExtractor.h Remove unused imports 2026-01-25 16:12:15 +01:00
DiscScrubber.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
DiscScrubber.h Remove unused imports 2026-01-25 16:12:15 +01:00
DiscUtils.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
DiscUtils.h DiscIO: Remove redundant qualifiers 2025-04-22 13:54:10 +02:00
Enums.cpp Enums: Unhandled switch statement 2026-02-15 20:14:15 -06:00
Enums.h Added Triforce support 2026-02-15 20:14:14 -06:00
FileBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
FileBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
Filesystem.cpp
Filesystem.h Remove unused imports 2026-01-25 16:12:15 +01:00
FileSystemGCWii.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
FileSystemGCWii.h Remove unused imports 2026-01-25 16:12:15 +01:00
GameModDescriptor.cpp DiscIO: Remove redundant qualifiers 2025-04-22 13:54:10 +02:00
GameModDescriptor.h
LaggedFibonacciGenerator.cpp
LaggedFibonacciGenerator.h
MultithreadedCompressor.h Common: Replace Result with C++23's std::expected. 2026-01-17 16:58:45 -06:00
NANDImporter.cpp Fix various typos and spelling mistakes 2026-01-17 20:11:38 +01:00
NANDImporter.h DiscIO: Make functions constant 2025-05-16 19:11:39 +02:00
NFSBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
NFSBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
RiivolutionParser.cpp RiivolutionParser: Fix XML Param Parsing 2026-02-06 18:06:27 +01:00
RiivolutionParser.h
RiivolutionPatcher.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
RiivolutionPatcher.h DiscIO: Make functions constant 2025-05-16 19:11:39 +02:00
ScrubbedBlob.cpp
ScrubbedBlob.h
SplitFileBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
SplitFileBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
TGCBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
TGCBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
Volume.cpp DiscIO: Only allow alphanumeric ASCII in game IDs 2026-02-24 21:36:02 +01:00
Volume.h DiscIO: Only allow alphanumeric ASCII in game IDs 2026-02-24 21:36:02 +01:00
VolumeDisc.cpp Triforce: Check only first byte in region flag. 2026-03-15 18:43:00 +00:00
VolumeDisc.h Triforce: Code cleanups. 2026-02-15 20:14:14 -06:00
VolumeFileBlobReader.cpp VolumeFileBlobReader: Define default destructor in source file 2026-01-04 17:56:08 -08:00
VolumeFileBlobReader.h VolumeFileBlobReader: Define default destructor in source file 2026-01-04 17:56:08 -08:00
VolumeGC.cpp Triforce: Check only first byte in region flag. 2026-03-15 18:43:00 +00:00
VolumeGC.h Added Triforce support 2026-02-15 20:14:14 -06:00
VolumeVerifier.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
VolumeVerifier.h Add Triforce platform and preliminary boot.id parsing 2025-04-21 22:05:25 +10:00
VolumeWad.cpp DiscIO: Only allow alphanumeric ASCII in game IDs 2026-02-24 21:36:02 +01:00
VolumeWad.h
VolumeWii.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
VolumeWii.h Make overriding explicit and remove redundant virtual specifiers on overriding destructors - Core & UnitTests 2025-05-01 15:00:37 +02:00
WbfsBlob.cpp DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
WbfsBlob.h DiscIO: Make all BlobReader implementations use DirectIOFile to make CopyReader functionality thread safe. 2025-11-09 03:08:14 -06:00
WIABlob.cpp Merge pull request #14267 from jordan-woyak/std-expected 2026-01-17 22:33:15 -06:00
WIABlob.h Merge pull request #13539 from tygyh/DiscIO-Remove-redundant-casts 2025-11-19 17:40:42 -06:00
WIACompression.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
WIACompression.h Make overriding explicit and remove redundant virtual specifiers on overriding destructors - Core & UnitTests 2025-05-01 15:00:37 +02:00
WiiEncryptionCache.cpp
WiiEncryptionCache.h Remove unused imports 2026-01-25 16:12:15 +01:00
WiiSaveBanner.cpp Remove unused imports 2026-01-25 16:12:15 +01:00
WiiSaveBanner.h WiiSaveBanner: fall back to $userdir/Load/WiiBanners 2025-07-04 23:15:50 +01:00