From abfa531648028be7d911b0bae7883290094f8886 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 1 Dec 2019 01:27:01 +1000 Subject: [PATCH] GameList: Add disc size --- src/core/game_list.cpp | 15 +++++++-------- src/core/game_list.h | 3 +++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 005ce3306..4a65da2bf 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -150,13 +150,12 @@ bool GameList::GetGameListEntry(const char* path, GameListEntry* entry) if (!cdi) return false; - std::string game_code = GetGameCodeForImage(cdi.get()); + entry->path = path; + entry->code = GetGameCodeForImage(cdi.get()); + entry->total_size = static_cast(CDImage::RAW_SECTOR_SIZE) * static_cast(cdi->GetLBACount()); cdi.reset(); - entry->path = path; - entry->code = game_code; - - auto iter = m_database.find(game_code); + auto iter = m_database.find(entry->code); if (iter != m_database.end()) { entry->title = iter->second.title; @@ -164,9 +163,9 @@ bool GameList::GetGameListEntry(const char* path, GameListEntry* entry) } else { - Log_WarningPrintf("'%s' not found in database", game_code.c_str()); - entry->title = game_code; - entry->region = GetRegionForCode(game_code).value_or(ConsoleRegion::NTSC_U); + Log_WarningPrintf("'%s' not found in database", entry->code.c_str()); + entry->title = entry->code; + entry->region = GetRegionForCode(entry->code).value_or(ConsoleRegion::NTSC_U); } return true; diff --git a/src/core/game_list.h b/src/core/game_list.h index 237f99f3e..ab81e5d09 100644 --- a/src/core/game_list.h +++ b/src/core/game_list.h @@ -4,6 +4,7 @@ #include #include #include +#include class CDImage; @@ -24,6 +25,7 @@ public: std::string path; std::string code; std::string title; + u64 total_size; ConsoleRegion region; }; @@ -38,6 +40,7 @@ public: const DatabaseMap& GetDatabase() const { return m_database; } const EntryList& GetEntries() const { return m_entries; } + const u32 GetEntryCount() const { return static_cast(m_entries.size()); } void AddDirectory(const char* path, bool recursive);