diff options
| author | JosJuice <josjuice@gmail.com> | 2026-02-16 20:17:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-16 20:17:21 +0100 |
| commit | 23f5d096ae750ec1f87a05026f8279f28221692f (patch) | |
| tree | 8526aab1b5e2fd67fd3b967863bc93c965c5e679 /Source/Core/DiscIO/VolumeGC.cpp | |
| parent | d6b5af57d01a04918e9ec849689b6d39b8e33591 (diff) | |
| parent | bc0c3d9f6a4f547ee3427f42d1704f5d1ae67b7e (diff) | |
Merge pull request #13844 from crediar/master
Core: 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..5d3d372dcf 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.region_flags) + { + 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)); |
