diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 8927b8c2f9..6617e443f6 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -126,12 +126,6 @@ const std::string SConfig::GetTitleDescription() const return m_title_description; } -std::string SConfig::GetTriforceID() const -{ - std::lock_guard lock(m_metadata_lock); - return m_triforce_id; -} - u64 SConfig::GetTitleID() const { std::lock_guard lock(m_metadata_lock); @@ -235,7 +229,7 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri const Core::TitleDatabase title_database; auto& system = Core::System::GetInstance(); const DiscIO::Language language = GetLanguageAdjustedForRegion(system.IsWii(), region); - m_title_name = title_database.GetTitleName(m_gametdb_id, m_triforce_id, language); + m_title_name = title_database.GetTitleName(m_gametdb_id, language); m_title_description = title_database.Describe(m_gametdb_id, language); NOTICE_LOG_FMT(CORE, "Active title: {}", m_title_description); Host_TitleChanged(); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index f441cd888b..5aa1f30917 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -67,7 +67,6 @@ struct SConfig const std::string GetGameTDBID() const; const std::string GetTitleName() const; const std::string GetTitleDescription() const; - std::string GetTriforceID() const; u64 GetTitleID() const; u16 GetRevision() const; void ResetRunningGameMetadata(); diff --git a/Source/Core/Core/HW/DVD/AMMediaboard.cpp b/Source/Core/Core/HW/DVD/AMMediaboard.cpp index c626aadba7..2f4f4adfe4 100644 --- a/Source/Core/Core/HW/DVD/AMMediaboard.cpp +++ b/Source/Core/Core/HW/DVD/AMMediaboard.cpp @@ -200,8 +200,8 @@ void Init(void) s_netcfg = OpenOrCreateFile(base_path + "trinetcfg.bin"); s_netctrl = OpenOrCreateFile(base_path + "trinetctrl.bin"); s_extra = OpenOrCreateFile(base_path + "triextra.bin"); - s_dimm = OpenOrCreateFile(base_path + "tridimm_" + SConfig::GetInstance().GetTriforceID() + ".bin"); - s_backup = OpenOrCreateFile(base_path + "backup_" + SConfig::GetInstance().GetTriforceID() + ".bin"); + s_dimm = OpenOrCreateFile(base_path + "tridimm_" + SConfig::GetInstance().GetGameID() + ".bin"); + s_backup = OpenOrCreateFile(base_path + "backup_" + SConfig::GetInstance().GetGameID() + ".bin"); if (!s_netcfg) PanicAlertFmt("Failed to open/create: {}", base_path + "s_netcfg.bin"); @@ -1746,13 +1746,13 @@ u32 GetGameType(void) u64 game_id = 0; // Convert game ID into hex - if (strlen(SConfig::GetInstance().GetTriforceID().c_str()) > 4) + if (strlen(SConfig::GetInstance().GetGameID().c_str()) > 4) { game_id = 0x30303030; } else { - sscanf(SConfig::GetInstance().GetTriforceID().c_str(), "%s", (char*)&game_id); + sscanf(SConfig::GetInstance().GetGameID().c_str(), "%s", (char*)&game_id); } // This is checking for the real game IDs (See boot.id within the game) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp index 864214aa86..694ef3524f 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp @@ -74,7 +74,7 @@ void GenerateInterrupt(int flag) CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system), m_position(0) { std::string backup_Filename(File::GetUserPath(D_TRIUSER_IDX) + "tribackup_" + - SConfig::GetInstance().GetTriforceID().c_str() + ".bin"); + SConfig::GetInstance().GetGameID().c_str() + ".bin"); if (File::Exists(backup_Filename)) { @@ -93,7 +93,7 @@ CEXIBaseboard::CEXIBaseboard(Core::System& system) : IEXIDevice(system), m_posit std::srand(static_cast(std::time(nullptr))); backup_Filename = File::GetUserPath(D_TRIUSER_IDX) + "tribackup_tmp_" + std::to_string(rand()) + - SConfig::GetInstance().GetTriforceID().c_str() + ".bin"; + SConfig::GetInstance().GetGameID().c_str() + ".bin"; m_backup = new File::IOFile(backup_Filename, "wb+"); } diff --git a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp index f23815a08b..f30f01dcc1 100644 --- a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp @@ -1145,7 +1145,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length) if (m_card_memory_size == 0) { std::string card_filename(File::GetUserPath(D_TRIUSER_IDX) + "tricard_" + - SConfig::GetInstance().GetTriforceID().c_str() + + SConfig::GetInstance().GetGameID().c_str() + ".bin"); if (File::Exists(card_filename)) @@ -1181,7 +1181,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length) else if (m_card_clean == 2) { std::string card_filename(File::GetUserPath(D_TRIUSER_IDX) + "tricard_" + - SConfig::GetInstance().GetTriforceID().c_str() + + SConfig::GetInstance().GetGameID().c_str() + ".bin"); if (File::Exists(card_filename)) @@ -1235,7 +1235,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length) u32 packet_offset = 0; std::string card_filename(File::GetUserPath(D_TRIUSER_IDX) + "tricard_" + - SConfig::GetInstance().GetTriforceID().c_str() + + SConfig::GetInstance().GetGameID().c_str() + ".bin"); if (File::Exists(card_filename)) @@ -1302,7 +1302,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* buffer, int request_length) bitmode, track, m_card_memory_size); std::string card_filename(File::GetUserPath(D_TRIUSER_IDX) + "tricard_" + - SConfig::GetInstance().GetTriforceID().c_str() + + SConfig::GetInstance().GetGameID().c_str() + ".bin"); File::IOFile card = File::IOFile(card_filename, "wb+"); diff --git a/Source/Core/Core/TitleDatabase.cpp b/Source/Core/Core/TitleDatabase.cpp index 4609cfddb1..5cc521995d 100644 --- a/Source/Core/Core/TitleDatabase.cpp +++ b/Source/Core/Core/TitleDatabase.cpp @@ -94,32 +94,8 @@ TitleDatabase::TitleDatabase() TitleDatabase::~TitleDatabase() = default; const std::string& TitleDatabase::GetTitleName(const std::string& gametdb_id, - const std::string& triforce_id, DiscIO::Language language) const { - if (triforce_id != "") - { - const Map& map = *m_triforce_title_maps.at(DiscIO::Language::English); - auto it = map.find(triforce_id); - if (it != map.end()) - return it->second; - - // This code has been commented out as there is currently only a english title map, and all - // Triforce games are detected as Japanese. - - // if (language != DiscIO::Language::English) - //{ - // const Map& english_triforce_map = *m_triforce_title_maps.at(DiscIO::Language::English); - // it = english_triforce_map.find(triforce_id); - // if (it != english_triforce_map.end()) - // return it->second; - //} - - // it = m_base_map.find(triforce_id); - // if (it != m_base_map.end()) - // return it->second; - } - auto it = m_user_title_map.find(gametdb_id); if (it != m_user_title_map.end()) return it->second; @@ -152,12 +128,12 @@ const std::string& TitleDatabase::GetChannelName(u64 title_id, DiscIO::Language const std::string id{ {static_cast((title_id >> 24) & 0xff), static_cast((title_id >> 16) & 0xff), static_cast((title_id >> 8) & 0xff), static_cast(title_id & 0xff)}}; - return GetTitleName(id, "", language); + return GetTitleName(id, language); } std::string TitleDatabase::Describe(const std::string& gametdb_id, DiscIO::Language language) const { - const std::string& title_name = GetTitleName(gametdb_id, "", language); + const std::string& title_name = GetTitleName(gametdb_id, language); if (title_name.empty()) return gametdb_id; return fmt::format("{} ({})", title_name, gametdb_id); diff --git a/Source/Core/Core/TitleDatabase.h b/Source/Core/Core/TitleDatabase.h index dff9a56dfe..d1163d80a6 100644 --- a/Source/Core/Core/TitleDatabase.h +++ b/Source/Core/Core/TitleDatabase.h @@ -25,8 +25,7 @@ public: // Get a user friendly title name for a GameTDB ID. // This falls back to returning an empty string if none could be found. - const std::string& GetTitleName(const std::string& gametdb_id, const std::string& triforce_id, - DiscIO::Language language) const; + const std::string& GetTitleName(const std::string& gametdb_id, DiscIO::Language language) const; // Same as above, but takes a title ID instead of a GameTDB ID, and only works for channels. const std::string& GetChannelName(u64 title_id, DiscIO::Language language) const; diff --git a/Source/Core/DiscIO/VolumeDisc.cpp b/Source/Core/DiscIO/VolumeDisc.cpp index 5d3cd54129..35a99feace 100644 --- a/Source/Core/DiscIO/VolumeDisc.cpp +++ b/Source/Core/DiscIO/VolumeDisc.cpp @@ -20,6 +20,27 @@ std::string VolumeDisc::GetGameID(const Partition& partition) const { char id[6]; + // Triforce games have their Game ID stored in the boot.id file + const FileSystem* file_system = GetFileSystem(partition); + if (file_system) + { + std::unique_ptr file_info = file_system->FindFileInfo("boot.id"); + if (file_info && !file_info->IsDirectory()) + { + u8* bootid_buffer = new u8[file_info->GetTotalSize()]; + if (Read(file_info->GetOffset(), file_info->GetTotalSize(), bootid_buffer, partition)) + { + memcpy(id, bootid_buffer + 0x30, sizeof(id)); + + delete[] bootid_buffer; + + return DecodeString(id); + } + // Fall back to normal ID from header + delete[] bootid_buffer; + } + } + if (!Read(0, sizeof(id), reinterpret_cast(id), partition)) return std::string(); diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 406461cb58..e370a40fb6 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -57,7 +57,6 @@ VolumeGC::VolumeGC(std::unique_ptr reader) if (file_size >= 4 && triforce_header.magic == BTID_MAGIC) { m_is_triforce = true; - m_triforce_id = triforce_header.id; // Load region from the file switch (triforce_header.region) @@ -112,14 +111,6 @@ 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 { if (g_triforce_region != Region::Unknown) diff --git a/Source/Core/DiscIO/VolumeGC.h b/Source/Core/DiscIO/VolumeGC.h index b9aeb35b10..bd4d64fd86 100644 --- a/Source/Core/DiscIO/VolumeGC.h +++ b/Source/Core/DiscIO/VolumeGC.h @@ -34,7 +34,6 @@ 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 GetShortNames() const override; std::map GetLongNames() const override; std::map GetShortMakers() const override; @@ -120,7 +119,6 @@ private: std::unique_ptr m_reader; bool m_is_triforce; - std::array m_triforce_id; }; } // namespace DiscIO diff --git a/Source/Core/DolphinQt/Config/InfoWidget.cpp b/Source/Core/DolphinQt/Config/InfoWidget.cpp index 53785d3cd0..2d9f32a130 100644 --- a/Source/Core/DolphinQt/Config/InfoWidget.cpp +++ b/Source/Core/DolphinQt/Config/InfoWidget.cpp @@ -123,12 +123,6 @@ QGroupBox* InfoWidget::CreateGameDetails() m_game.GetMakerID() + ")"); layout->addRow(tr("Name:"), internal_name); - if (m_game.GetPlatform() == DiscIO::Platform::Triforce) - { - const auto triforce_id_string = QString::fromStdString(m_game.GetTriforceID()); - auto* const triforce_id = CreateValueDisplay(triforce_id_string); - layout->addRow(tr("Triforce ID:"), triforce_id); - } layout->addRow(tr("Game ID:"), game_id); layout->addRow(tr("Country:"), country); layout->addRow(tr("Maker:"), maker); diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp index 69777aaa9f..8883994926 100644 --- a/Source/Core/UICommon/GameFile.cpp +++ b/Source/Core/UICommon/GameFile.cpp @@ -130,8 +130,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path)) m_internal_name = volume->GetInternalName(); m_game_id = volume->GetGameID(); - m_gametdb_id = volume->GetGameTDBID(); - m_triforce_id = volume->GetTriforceID(); + m_gametdb_id = volume->GetGameTDBID(); m_title_id = volume->GetTitleID().value_or(0); m_maker_id = volume->GetMakerID(); m_revision = volume->GetRevision().value_or(0); @@ -311,8 +310,7 @@ void GameFile::DoState(PointerWrap& p) p.Do(m_descriptions); p.Do(m_internal_name); p.Do(m_game_id); - p.Do(m_gametdb_id); - p.Do(m_triforce_id); + p.Do(m_gametdb_id); p.Do(m_title_id); p.Do(m_maker_id); @@ -502,7 +500,7 @@ const std::string& GameFile::GetName(const Core::TitleDatabase& title_database) return GetName(Variant::LongAndPossiblyCustom); const std::string& database_name = - title_database.GetTitleName(m_gametdb_id, m_triforce_id, GetConfigLanguage()); + title_database.GetTitleName(m_gametdb_id, GetConfigLanguage()); return database_name.empty() ? GetName(Variant::LongAndPossiblyCustom) : database_name; } @@ -533,7 +531,7 @@ const std::string& GameFile::GetMaker(Variant variant) const // The actual information is stored within the boot.id file // TODO: use maker name to set company IDs - if (m_triforce_id[0] == 'S' && m_triforce_id[1] == 'B') + if (m_game_id[0] == 'S' && m_game_id[1] == 'B') { return DiscIO::GetCompanyFromID("6E"); // SEGA } diff --git a/Source/Core/UICommon/GameFile.h b/Source/Core/UICommon/GameFile.h index f015fa9725..b56ca9ba57 100644 --- a/Source/Core/UICommon/GameFile.h +++ b/Source/Core/UICommon/GameFile.h @@ -75,8 +75,7 @@ public: std::vector GetLanguages() const; const std::string& GetInternalName() const { return m_internal_name; } const std::string& GetGameID() const { return m_game_id; } - const std::string& GetGameTDBID() const { return m_gametdb_id; } - std::string GetTriforceID() const { return m_triforce_id; } + const std::string& GetGameTDBID() const { return m_gametdb_id; } u64 GetTitleID() const { return m_title_id; } const std::string& GetMakerID() const { return m_maker_id; } u16 GetRevision() const { return m_revision; } @@ -160,7 +159,6 @@ private: std::string m_internal_name; std::string m_game_id; std::string m_gametdb_id; - std::string m_triforce_id; u64 m_title_id{}; std::string m_maker_id;