GameList: Add disc size

This commit is contained in:
Connor McLaughlin 2019-12-01 01:27:01 +10:00
parent ea52b9e8aa
commit abfa531648
2 changed files with 10 additions and 8 deletions

View file

@ -150,13 +150,12 @@ bool GameList::GetGameListEntry(const char* path, GameListEntry* entry)
if (!cdi) if (!cdi)
return false; return false;
std::string game_code = GetGameCodeForImage(cdi.get()); entry->path = path;
entry->code = GetGameCodeForImage(cdi.get());
entry->total_size = static_cast<u64>(CDImage::RAW_SECTOR_SIZE) * static_cast<u64>(cdi->GetLBACount());
cdi.reset(); cdi.reset();
entry->path = path; auto iter = m_database.find(entry->code);
entry->code = game_code;
auto iter = m_database.find(game_code);
if (iter != m_database.end()) if (iter != m_database.end())
{ {
entry->title = iter->second.title; entry->title = iter->second.title;
@ -164,9 +163,9 @@ bool GameList::GetGameListEntry(const char* path, GameListEntry* entry)
} }
else else
{ {
Log_WarningPrintf("'%s' not found in database", game_code.c_str()); Log_WarningPrintf("'%s' not found in database", entry->code.c_str());
entry->title = game_code; entry->title = entry->code;
entry->region = GetRegionForCode(game_code).value_or(ConsoleRegion::NTSC_U); entry->region = GetRegionForCode(entry->code).value_or(ConsoleRegion::NTSC_U);
} }
return true; return true;

View file

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <unordered_map> #include <unordered_map>
#include <vector>
class CDImage; class CDImage;
@ -24,6 +25,7 @@ public:
std::string path; std::string path;
std::string code; std::string code;
std::string title; std::string title;
u64 total_size;
ConsoleRegion region; ConsoleRegion region;
}; };
@ -38,6 +40,7 @@ public:
const DatabaseMap& GetDatabase() const { return m_database; } const DatabaseMap& GetDatabase() const { return m_database; }
const EntryList& GetEntries() const { return m_entries; } const EntryList& GetEntries() const { return m_entries; }
const u32 GetEntryCount() const { return static_cast<u32>(m_entries.size()); }
void AddDirectory(const char* path, bool recursive); void AddDirectory(const char* path, bool recursive);