summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/GameList/GameFile.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2015-09-06 18:03:02 +0200
committerJosJuice <josjuice@gmail.com>2015-09-11 16:02:38 +0200
commit3e6d62ae9e19ae3c0c5c237ecd33c9cc06beae26 (patch)
tree08972522658b34fa71ea4f33eea6d7c5275fe16f /Source/Core/DolphinQt/GameList/GameFile.cpp
parent047ddb94a223b7967423485e596a4de8373ed4d0 (diff)
DolphinQt: Support banners in Homebrew Channel format
HBC uses files named icon.png for icons. This change makes Dolphin support that file name, and also [executable file name].png in case someone wants to have multiple files in one folder. The HBC banner support is mainly intended for DOL and ELF files, but it can also be used to override banners of disc images, something that wasn't possible in the past. That sure was simple compared to the wx version of this commit...
Diffstat (limited to 'Source/Core/DolphinQt/GameList/GameFile.cpp')
-rw-r--r--Source/Core/DolphinQt/GameList/GameFile.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt/GameList/GameFile.cpp b/Source/Core/DolphinQt/GameList/GameFile.cpp
index 7e22d389c9..a3f2d40d8c 100644
--- a/Source/Core/DolphinQt/GameList/GameFile.cpp
+++ b/Source/Core/DolphinQt/GameList/GameFile.cpp
@@ -73,7 +73,8 @@ GameFile::GameFile(const QString& fileName)
: m_file_name(fileName)
{
QFileInfo info(m_file_name);
- m_folder_name = info.absoluteDir().dirName();
+ QDir directory = info.absoluteDir();
+ m_folder_name = directory.dirName();
if (LoadFromCache())
{
@@ -140,6 +141,16 @@ GameFile::GameFile(const QString& fileName)
m_file_size = info.size();
m_platform = DiscIO::IVolume::ELF_DOL;
}
+
+ // PNG files can optionally be used as banners. Typical for DOLs and ELFs, but also works with
+ // volumes. icon.png is the file name used by Homebrew Channel. The ability to use a PNG file
+ // with the same name as the main file is provided as an alternative for those who want to have
+ // multiple files in one folder instead of having a Homebrew Channel-style folder structure.
+ QImage banner(directory.filePath(info.baseName() + SL(".png")));
+ if (banner.isNull())
+ banner.load(directory.filePath(SL("icon.png")));
+ if (!banner.isNull())
+ m_banner = QPixmap::fromImage(banner);
}
bool GameFile::LoadFromCache()
@@ -259,6 +270,7 @@ QString GameFile::CreateCacheFilename() const
return fullname;
}
+// Outputs to m_banner
void GameFile::ReadBanner(const DiscIO::IVolume& volume)
{
int width, height;