diff options
| author | crediar <crediar@rypp.net> | 2025-07-16 19:55:59 +0200 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2026-02-15 20:14:14 -0600 |
| commit | 2c62214875e4d409136229421c44aa8b88fbb635 (patch) | |
| tree | 43d2e45b6e763fcf2f7ab0fbb8a6d474dd2e7e6f /Source/Core/DiscIO/VolumeGC.cpp | |
| parent | d6b5af57d01a04918e9ec849689b6d39b8e33591 (diff) | |
Added Triforce support
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeGC.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index ad3d8ec74e..52dacd59a4 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -45,13 +45,11 @@ VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) std::unique_ptr<FileInfo> file_info = tmp_fs->FindFileInfo("boot.id"); if (!file_info) return; - BootID triforce_header; const u64 file_size = ReadFile(*this, PARTITION_NONE, file_info.get(), - reinterpret_cast<u8*>(&triforce_header), sizeof(BootID)); - if (file_size >= 4 && triforce_header.magic == BTID_MAGIC) + reinterpret_cast<u8*>(&m_triforce_header), sizeof(BootID)); + if (file_size >= 4 && m_triforce_header.magic == BTID_MAGIC) { m_is_triforce = true; - m_triforce_id = triforce_header.id; } } } @@ -90,16 +88,23 @@ std::string VolumeGC::GetGameTDBID(const Partition& partition) const return GetGameID(partition); } -std::string VolumeGC::GetTriforceID() const +Region VolumeGC::GetRegion() const { if (m_is_triforce) - return (std::string(m_triforce_id.data(), m_triforce_id.size())); - else - return ""; -} + { + switch (m_triforce_header.regionFlags) + { + default: + case 0x02: // JAPAN + case 0x08: // ASIA + return Region::NTSC_J; + case 0x0E: // USA + return Region::NTSC_U; + case 0x0C: // EXPORT + return Region::PAL; + } + } -Region VolumeGC::GetRegion() const -{ return RegionCodeToRegion(m_reader->ReadSwapped<u32>(0x458)); } @@ -184,6 +189,12 @@ std::array<u8, 20> VolumeGC::GetSyncHash() const VolumeGC::ConvertedGCBanner VolumeGC::LoadBannerFile() const { + // There is at least one Triforce game that has an opening.bnr file but from a different game. + if (m_is_triforce) + { + return {}; + } + GCBanner banner_file; const u64 file_size = ReadFile(*this, PARTITION_NONE, "opening.bnr", reinterpret_cast<u8*>(&banner_file), sizeof(GCBanner)); |
