DolphinQt: Store GameFile banner as empty if missing

This commit is contained in:
JosJuice 2015-06-13 16:37:37 +02:00
parent 6d9711c02c
commit 8793f7c325
2 changed files with 12 additions and 13 deletions

View File

@ -22,7 +22,6 @@
#include "DiscIO/Filesystem.h"
#include "DolphinQt/GameList/GameFile.h"
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
static const u32 CACHE_REVISION = 0x00A;
@ -72,12 +71,9 @@ static QString GetLanguageString(DiscIO::IVolume::ELanguage language, QMap<DiscI
GameFile::GameFile(const QString& fileName)
: m_file_name(fileName)
{
bool hasBanner = false;
if (LoadFromCache())
{
m_valid = true;
hasBanner = true;
}
else
{
@ -115,15 +111,13 @@ GameFile::GameFile(const QString& fileName)
(buffer[i] & 0x0000FF) >> 0));
}
m_valid = true;
if (!banner.isNull())
{
hasBanner = true;
m_banner = QPixmap::fromImage(banner);
}
m_valid = true;
if (hasBanner)
SaveToCache();
}
}
}
@ -138,9 +132,6 @@ GameFile::GameFile(const QString& fileName)
ini.GetIfExists("EmuState", "EmulationIssues", &issues_temp);
m_issues = QString::fromStdString(issues_temp);
}
if (!hasBanner)
m_banner = Resources::GetPixmap(Resources::BANNER_MISSING);
}
bool GameFile::LoadFromCache()

View File

@ -13,6 +13,8 @@
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"
#include "DolphinQt/Utils/Resources.h"
class GameFile final
{
public:
@ -39,7 +41,13 @@ public:
u64 GetVolumeSize() const { return m_volume_size; }
// 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; }
const QPixmap GetBitmap() const { return m_banner; }
const QPixmap GetBitmap() const
{
if (m_banner.isNull())
return Resources::GetPixmap(Resources::BANNER_MISSING);
return m_banner;
}
private:
QString m_file_name;