Triforce: Code cleanups.

This commit is contained in:
Jordan Woyak
2025-10-26 21:53:53 -05:00
parent 083faa8b21
commit be2da8dc7b
9 changed files with 390 additions and 456 deletions

View File

@@ -28,9 +28,9 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const
// Construct game ID from the BTID
id[0] = 'G';
memcpy(id + 1, boot_id->gameId + 2, 2);
memcpy(id + 1, boot_id->game_id.data() + 2, 2);
switch (boot_id->regionFlags)
switch (boot_id->region_flags)
{
default:
case 0x02: // JAPAN
@@ -83,7 +83,7 @@ Country VolumeDisc::GetCountry(const Partition& partition) const
{
const BootID* boot_id = static_cast<const VolumeGC*>(this)->GetTriforceBootID();
switch (boot_id->regionFlags)
switch (boot_id->region_flags)
{
default:
case 0x02: // JAPAN
@@ -166,7 +166,7 @@ std::string VolumeDisc::GetInternalName(const Partition& partition) const
if (GetVolumeType() == Platform::Triforce)
{
const BootID* boot_id = static_cast<const VolumeGC*>(this)->GetTriforceBootID();
return DecodeString(boot_id->gameName);
return DecodeString(boot_id->game_name);
}
if (!Read(0x20, sizeof(name), reinterpret_cast<u8*>(&name), partition))

View File

@@ -3,6 +3,7 @@
#pragma once
#include <array>
#include <optional>
#include <string>
@@ -18,25 +19,25 @@ public:
struct BootID
{
u32 magic; // 0x00 (Always BTID)
uint32_t unknown0[3];
uint32_t unknown1[4];
char mediaboardType[4]; // 0x20 (GCAM for Triforce)
std::array<uint32_t, 3> unknown0;
std::array<uint32_t, 4> unknown1;
std::array<char, 4> mediaboard_type; // 0x20 (GCAM for Triforce)
uint32_t unknown2;
uint16_t year; // 0x28
uint8_t month; // 0x2A
uint8_t day; // 0x2B
uint8_t videoMode; // 0x2C unknown bitmask, resolutions + horizontal/vertical
uint16_t year; // 0x28
uint8_t month; // 0x2A
uint8_t day; // 0x2B
uint8_t video_mode; // 0x2C unknown bitmask, resolutions + horizontal/vertical
uint8_t unknown3;
uint8_t type3Compatible; // 0x2E (Type-3 compatible titles have this set to 1)
uint8_t type_3_compatible; // 0x2E (Type-3 compatible titles have this set to 1)
uint8_t unknown4;
char gameId[8]; // 0x30
uint32_t regionFlags; // 0x38
uint32_t unknown6[9];
char manufacturer[0x20]; // 0x60
char gameName[0x20]; // 0x80
char gameExecutable[0x20]; // 0xA0
char testExecutable[0x20]; // 0xC0
char creditTypes[8][0x20]; // 0xE0
std::array<char, 8> game_id; // 0x30
uint32_t region_flags; // 0x38
std::array<uint32_t, 9> unknown6;
std::array<char, 0x20> manufacturer; // 0x60
std::array<char, 0x20> game_name; // 0x80
std::array<char, 0x20> game_executable; // 0xA0
std::array<char, 0x20> test_executable; // 0xC0
std::array<std::array<char, 0x20>, 8> credit_types; // 0xE0
};
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override;
@@ -53,4 +54,6 @@ protected:
void AddGamePartitionToSyncHash(Common::SHA1::Context* context) const;
};
static_assert(sizeof(VolumeDisc::BootID) == 480);
} // namespace DiscIO

View File

@@ -92,7 +92,7 @@ Region VolumeGC::GetRegion() const
{
if (m_is_triforce)
{
switch (m_triforce_header.regionFlags)
switch (m_triforce_header.region_flags)
{
default:
case 0x02: // JAPAN