mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Keep track of GameTDB ID separately from game ID
The difference between Dolphin's game IDs and GameTDB's game IDs is that GameTDB uses four characters for non-disc titles, whereas Dolphin uses six characters for all titles. This fixes: - TitleDatabase considering Datel discs to be NHL Hitz 2002 - Gecko code downloading not working for discs with IDs starting with P - Cover downloading mixing up discs with channels (e.g. Mario Kart Wii and Mario Kart Channel) and making extra HTTP requests. (Android was actually doing a better job at this than DolphinQt!)
This commit is contained in:
@ -323,6 +323,20 @@ std::string TMDReader::GetGameID() const
|
||||
return StringFromFormat("%016" PRIx64, GetTitleId());
|
||||
}
|
||||
|
||||
std::string TMDReader::GetGameTDBID() const
|
||||
{
|
||||
const u8* begin = m_bytes.data() + offsetof(TMDHeader, title_id) + 4;
|
||||
const u8* end = begin + 4;
|
||||
|
||||
const bool all_printable =
|
||||
std::all_of(begin, end, [](char c) { return std::isprint(c, std::locale::classic()); });
|
||||
|
||||
if (all_printable)
|
||||
return std::string(begin, end);
|
||||
|
||||
return StringFromFormat("%016" PRIx64, GetTitleId());
|
||||
}
|
||||
|
||||
u16 TMDReader::GetNumContents() const
|
||||
{
|
||||
return Common::swap16(m_bytes.data() + offsetof(TMDHeader, num_contents));
|
||||
|
@ -205,9 +205,15 @@ public:
|
||||
|
||||
// Constructs a 6-character game ID in the format typically used by Dolphin.
|
||||
// If the 6-character game ID would contain unprintable characters,
|
||||
// the title ID converted to hexadecimal is returned instead.
|
||||
// the title ID converted to 16 hexadecimal digits is returned instead.
|
||||
std::string GetGameID() const;
|
||||
|
||||
// Constructs a 4-character game ID in the format typically used by GameTDB.
|
||||
// If the 4-character game ID would contain unprintable characters,
|
||||
// the title ID converted to 16 hexadecimal digits is returned instead
|
||||
// (a format which GameTDB does not actually use).
|
||||
std::string GetGameTDBID() const;
|
||||
|
||||
u16 GetNumContents() const;
|
||||
bool GetContent(u16 index, Content* content) const;
|
||||
std::vector<Content> GetContents() const;
|
||||
|
Reference in New Issue
Block a user