diff options
| author | JMC47 <JMC4789@gmail.com> | 2025-04-21 13:57:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-21 13:57:57 -0400 |
| commit | 0b2338a5ee0e3cb9837d325a0ca24229e272aa89 (patch) | |
| tree | 82281c947578c78a70433071ad0c8081f7f05344 /Source/Core/DiscIO/VolumeGC.cpp | |
| parent | bc3c3eb79ae4d8dc83091d20c686aac2d772590e (diff) | |
| parent | 89fdc0b9e0db9b65b7ba81b8ee33114415e8666c (diff) | |
Merge pull request #10084 from Zopolis4/master
Identify Triforce games in gamelist
Diffstat (limited to 'Source/Core/DiscIO/VolumeGC.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeGC.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 8a95e0bb31..8cc255570a 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -29,7 +29,8 @@ namespace DiscIO { -VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) : m_reader(std::move(reader)) +VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) + : m_reader(std::move(reader)), m_is_triforce(false) { ASSERT(m_reader); @@ -39,6 +40,23 @@ VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader) : m_reader(std::move(read }; m_converted_banner = [this] { return LoadBannerFile(); }; + + constexpr u32 BTID_MAGIC = 0x44495442; + auto tmp_fs = GetFileSystem(PARTITION_NONE); + if (tmp_fs) + { + 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) + { + m_is_triforce = true; + m_triforce_id = triforce_header.id; + } + } } VolumeGC::~VolumeGC() = default; @@ -75,6 +93,14 @@ std::string VolumeGC::GetGameTDBID(const Partition& partition) const return GetGameID(partition); } +std::string VolumeGC::GetTriforceID() const +{ + if (m_is_triforce) + return (std::string(m_triforce_id.data(), m_triforce_id.size())); + else + return ""; +} + Region VolumeGC::GetRegion() const { return RegionCodeToRegion(m_reader->ReadSwapped<u32>(0x458)); @@ -139,7 +165,10 @@ const BlobReader& VolumeGC::GetBlobReader() const Platform VolumeGC::GetVolumeType() const { - return Platform::GameCubeDisc; + if (m_is_triforce) + return Platform::Triforce; + else + return Platform::GameCubeDisc; } bool VolumeGC::IsDatelDisc() const |
