diff options
| author | JosJuice <josjuice@gmail.com> | 2018-07-30 17:40:59 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2018-07-30 18:08:53 +0200 |
| commit | db76994a9a7328d44b13b03046d34ce262dff07a (patch) | |
| tree | 4242418711a777d7101025aad132f27a76ca1093 /Source/Core | |
| parent | 6af7c1fe277ab61a813b516babd8396dc776810e (diff) | |
Android: Don't crash when loading games into game list
Regression from PR #7285 / PR #7293.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/UICommon/GameFile.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp index 2177bc9922..147a717508 100644 --- a/Source/Core/UICommon/GameFile.cpp +++ b/Source/Core/UICommon/GameFile.cpp @@ -47,6 +47,17 @@ namespace UICommon { static const std::string EMPTY_STRING; +static bool UseGameCovers() +{ +// We ifdef this out on Android because accessing the config before emulation start makes us crash. +// The Android GUI doesn't support covers anyway, so this doesn't make us lose out on functionality. +#ifdef ANDROID + return false; +#else + return Config::Get(Config::MAIN_USE_GAME_COVERS); +#endif +} + bool operator==(const GameBanner& lhs, const GameBanner& rhs) { return std::tie(lhs.buffer, lhs.width, lhs.height) == std::tie(rhs.buffer, rhs.width, rhs.height); @@ -155,7 +166,7 @@ bool GameFile::IsValid() const bool GameFile::CustomCoverChanged() { - if (!m_custom_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS)) + if (!m_custom_cover.buffer.empty() || !UseGameCovers()) return false; std::string path, name; @@ -182,8 +193,7 @@ bool GameFile::CustomCoverChanged() void GameFile::DownloadDefaultCover() { -#ifndef ANDROID - if (!m_default_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS)) + if (!m_default_cover.buffer.empty() || !UseGameCovers()) return; const auto cover_path = File::GetUserPath(D_COVERCACHE_IDX) + DIR_SEP; @@ -256,12 +266,11 @@ void GameFile::DownloadDefaultCover() File::WriteStringToFile(std::string(response.value().begin(), response.value().end()), cover_path + m_game_id.substr(0, 4) + ".png"); } -#endif } bool GameFile::DefaultCoverChanged() { - if (!m_default_cover.buffer.empty() || !Config::Get(Config::MAIN_USE_GAME_COVERS)) + if (!m_default_cover.buffer.empty() || !UseGameCovers()) return false; const auto cover_path = File::GetUserPath(D_COVERCACHE_IDX) + DIR_SEP; |
