mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-21 16:58:45 +00:00
Removed Triforce ID and updated code
This commit is contained in:
parent
62988f3888
commit
062677017a
13 changed files with 40 additions and 72 deletions
|
@ -126,12 +126,6 @@ const std::string SConfig::GetTitleDescription() const
|
|||
return m_title_description;
|
||||
}
|
||||
|
||||
std::string SConfig::GetTriforceID() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
return m_triforce_id;
|
||||
}
|
||||
|
||||
u64 SConfig::GetTitleID() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> 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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<u32>(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+");
|
||||
}
|
||||
|
|
|
@ -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+");
|
||||
|
|
|
@ -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<char>((title_id >> 24) & 0xff), static_cast<char>((title_id >> 16) & 0xff),
|
||||
static_cast<char>((title_id >> 8) & 0xff), static_cast<char>(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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<FileInfo> 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<u8*>(id), partition))
|
||||
return std::string();
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ VolumeGC::VolumeGC(std::unique_ptr<BlobReader> 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)
|
||||
|
|
|
@ -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<Language, std::string> GetShortNames() const override;
|
||||
std::map<Language, std::string> GetLongNames() const override;
|
||||
std::map<Language, std::string> GetShortMakers() const override;
|
||||
|
@ -120,7 +119,6 @@ private:
|
|||
std::unique_ptr<BlobReader> m_reader;
|
||||
|
||||
bool m_is_triforce;
|
||||
std::array<char, 4> m_triforce_id;
|
||||
};
|
||||
|
||||
} // namespace DiscIO
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -75,8 +75,7 @@ public:
|
|||
std::vector<DiscIO::Language> 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue