From 56ed7817de87736dc62d3c6725eb0779a9ee0c2e Mon Sep 17 00:00:00 2001 From: crediar Date: Wed, 12 Nov 2025 19:11:21 +0100 Subject: Triforce: Code fixes. Fixed a bug caused by static usage of Core::System::GetInstance() Removed unused headers Removed unneeded code Optimised code Added sanity checks Added SafeCopyFromEmu/SafeCopyToEmu Set Triforce buttons to be translatable --- Source/Core/DiscIO/VolumeDisc.cpp | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'Source/Core/DiscIO/VolumeDisc.cpp') diff --git a/Source/Core/DiscIO/VolumeDisc.cpp b/Source/Core/DiscIO/VolumeDisc.cpp index 12e92eb0f8..5913f63c11 100644 --- a/Source/Core/DiscIO/VolumeDisc.cpp +++ b/Source/Core/DiscIO/VolumeDisc.cpp @@ -30,41 +30,24 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const memcpy(id + 1, boot_id->game_id.data() + 2, 2); - switch (boot_id->region_flags) + switch (GetCountry()) { default: - case 0x02: // JAPAN + case Country::Japan: id[3] = 'J'; break; - case 0x08: // ASIA + case Country::Taiwan: id[3] = 'W'; break; - case 0x0E: // USA + case Country::USA: id[3] = 'E'; break; - case 0x0C: // EXPORT + case Country::Europe: id[3] = 'P'; break; } - // There only seem to be three different makers here, - // so we can just check the first char to difference between them. - // - // NAMCO CORPORATION, SEGA CORPORATION and Hitmaker co,ltd. - - switch (boot_id->manufacturer[0]) - { - case 'N': // NAMCO CORPORATION - id[4] = '8'; - id[5] = '2'; - break; - default: - case 'H': // Hitmaker co,ltd. - case 'S': // SEGA CORPORATION - id[4] = '6'; - id[5] = 'E'; - break; - } + memcpy(id + 4, GetMakerID().c_str(), 2); return DecodeString(id); } @@ -133,6 +116,11 @@ std::string VolumeDisc::GetMakerID(const Partition& partition) const { const BootID* boot_id = static_cast(this)->GetTriforceBootID(); + // There only seem to be three different makers here, + // so we can just check the first char to difference between them. + // + // NAMCO CORPORATION, SEGA CORPORATION and Hitmaker co,ltd. + switch (boot_id->manufacturer[0]) { case 'S': // SEGA CORPORATION -- cgit v1.2.3