summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/GameFile.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2020-07-19 21:18:42 +0200
committerJosJuice <josjuice@gmail.com>2020-07-19 21:30:48 +0200
commitfe5e92f706be7e52b84d9a1d94781612e5146f59 (patch)
tree1a57a2d8e14557260b12e90f951705942d344859 /Source/Core/UICommon/GameFile.cpp
parent487cd7abd9f13da2969a992b78b08e65f9e20d9f (diff)
DolphinQt: Show WAD as "WAD" instead of "" in file format column
https://bugs.dolphin-emu.org/issues/12190
Diffstat (limited to 'Source/Core/UICommon/GameFile.cpp')
-rw-r--r--Source/Core/UICommon/GameFile.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp
index 25892bca67..b28d54e944 100644
--- a/Source/Core/UICommon/GameFile.cpp
+++ b/Source/Core/UICommon/GameFile.cpp
@@ -336,14 +336,17 @@ void GameFile::DoState(PointerWrap& p)
m_custom_cover.DoState(p);
}
-bool GameFile::IsElfOrDol() const
+std::string GameFile::GetExtension() const
{
- if (m_file_path.size() < 4)
- return false;
+ std::string extension;
+ SplitPath(m_file_path, nullptr, nullptr, &extension);
+ return extension;
+}
- std::string name_end = m_file_path.substr(m_file_path.size() - 4);
- std::transform(name_end.begin(), name_end.end(), name_end.begin(), ::tolower);
- return name_end == ".elf" || name_end == ".dol";
+bool GameFile::IsElfOrDol() const
+{
+ const std::string extension = GetExtension();
+ return extension == ".elf" || extension == ".dol";
}
bool GameFile::ReadXMLMetadata(const std::string& path)
@@ -592,6 +595,25 @@ bool GameFile::ShouldShowFileFormatDetails() const
}
}
+std::string GameFile::GetFileFormatName() const
+{
+ switch (m_platform)
+ {
+ case DiscIO::Platform::WiiWAD:
+ return "WAD";
+ case DiscIO::Platform::ELFOrDOL:
+ {
+ std::string extension = GetExtension();
+ std::transform(extension.begin(), extension.end(), extension.begin(), ::toupper);
+
+ // substr removes the dot
+ return extension.substr(std::min<size_t>(1, extension.size()));
+ }
+ default:
+ return DiscIO::GetName(m_blob_type, true);
+ }
+}
+
const GameBanner& GameFile::GetBannerImage() const
{
return m_custom_banner.empty() ? m_volume_banner : m_custom_banner;