mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Implement Triforce ID parsing
This commit is contained in:
@ -96,6 +96,7 @@ public:
|
||||
}
|
||||
virtual std::string GetGameID(const Partition& partition = PARTITION_NONE) const = 0;
|
||||
virtual std::string GetGameTDBID(const Partition& partition = PARTITION_NONE) const = 0;
|
||||
virtual std::string GetTriforceID() const { return ""; }
|
||||
virtual std::string GetMakerID(const Partition& partition = PARTITION_NONE) const = 0;
|
||||
virtual std::optional<u16> GetRevision(const Partition& partition = PARTITION_NONE) const = 0;
|
||||
virtual std::string GetInternalName(const Partition& partition = PARTITION_NONE) const = 0;
|
||||
|
@ -48,11 +48,14 @@ VolumeGC::VolumeGC(std::unique_ptr<BlobReader> reader)
|
||||
std::unique_ptr<FileInfo> file_info = tmp_fs->FindFileInfo("boot.id");
|
||||
if (!file_info)
|
||||
return;
|
||||
u32 triforce_magic; // "BTID"
|
||||
BootID triforce_header;
|
||||
const u64 file_size = ReadFile(*this, PARTITION_NONE, file_info.get(),
|
||||
reinterpret_cast<u8*>(&triforce_magic), sizeof(triforce_magic));
|
||||
if (file_size >= 4 && triforce_magic == BTID_MAGIC)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,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));
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
const Partition& partition = PARTITION_NONE) const override;
|
||||
const FileSystem* GetFileSystem(const Partition& partition = PARTITION_NONE) const override;
|
||||
std::string GetGameTDBID(const Partition& partition = PARTITION_NONE) const override;
|
||||
std::string GetTriforceID() const override;
|
||||
std::map<Language, std::string> GetShortNames() const override;
|
||||
std::map<Language, std::string> GetLongNames() const override;
|
||||
std::map<Language, std::string> GetShortMakers() const override;
|
||||
@ -76,6 +77,13 @@ private:
|
||||
// (only one for BNR1 type)
|
||||
};
|
||||
|
||||
struct BootID
|
||||
{
|
||||
u32 magic; // "BTID"
|
||||
u32 padding[11];
|
||||
std::array<char, 4> id;
|
||||
};
|
||||
|
||||
struct ConvertedGCBanner
|
||||
{
|
||||
ConvertedGCBanner();
|
||||
@ -105,6 +113,7 @@ private:
|
||||
std::unique_ptr<BlobReader> m_reader;
|
||||
|
||||
bool m_is_triforce;
|
||||
std::array<char, 4> m_triforce_id;
|
||||
};
|
||||
|
||||
} // namespace DiscIO
|
||||
|
Reference in New Issue
Block a user