From 6916a3d85b004c043874d8c671eedfa6a8382ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 14 May 2017 00:00:01 +0200 Subject: [PATCH] Hide non-channel WADs These cannot be booted, so it is bad UX to show them in the UI as if they were regular titles, and yet have different behaviour for them. And technically, there is no reason to allow them to be used to boot in the first place. Another reason they should not be shown is that Dolphin fails spectacularly with WADs that have a valid boot content index, but are not PPC titles (e.g. IOS WADs). The only reliable way to avoid this is to check for the title type and only show channels, just like the Wii System Menu. --- Source/Core/Core/ConfigManager.cpp | 9 +++------ Source/Core/DolphinQt2/GameList/GameFile.cpp | 11 +++++++++++ Source/Core/DolphinQt2/GameList/GameFile.h | 2 +- Source/Core/DolphinWX/ISOFile.cpp | 12 ++++++++++++ Source/Core/DolphinWX/ISOFile.h | 2 +- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index b85550c57a..f051e3bded 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -992,13 +992,10 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2) DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); const IOS::ES::TMDReader& tmd = content_loader.GetTMD(); - if (content_loader.GetContentByIndex(tmd.GetBootIndex()) == nullptr) + if (!IOS::ES::IsChannel(tmd.GetTitleId())) { - // WAD is valid yet cannot be booted. Install instead. - u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename); - if (installed) - SuccessAlertT("The WAD has been installed successfully"); - return false; // do not boot + PanicAlertT("This WAD is not bootable."); + return false; } SetRegion(tmd.GetRegion(), &set_region_dir); diff --git a/Source/Core/DolphinQt2/GameList/GameFile.cpp b/Source/Core/DolphinQt2/GameList/GameFile.cpp index 2f23107776..b81d491aff 100644 --- a/Source/Core/DolphinQt2/GameList/GameFile.cpp +++ b/Source/Core/DolphinQt2/GameList/GameFile.cpp @@ -63,6 +63,17 @@ GameFile::GameFile(const QString& path) : m_path(path) m_valid = true; } +bool GameFile::IsValid() const +{ + if (!m_valid) + return false; + + if (m_platform == DiscIO::Platform::WII_WAD && !IOS::ES::IsChannel(m_title_id)) + return false; + + return true; +} + QString GameFile::GetCacheFileName() const { QString folder = QString::fromStdString(File::GetUserPath(D_CACHE_IDX)); diff --git a/Source/Core/DolphinQt2/GameList/GameFile.h b/Source/Core/DolphinQt2/GameList/GameFile.h index 47eef18381..edbdc00d38 100644 --- a/Source/Core/DolphinQt2/GameList/GameFile.h +++ b/Source/Core/DolphinQt2/GameList/GameFile.h @@ -27,7 +27,7 @@ class GameFile final public: explicit GameFile(const QString& path); - bool IsValid() const { return m_valid; } + bool IsValid() const; // These will be properly initialized before we try to load the file. QString GetFilePath() const { return m_path; } QString GetFileName() const { return m_file_name; } diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp index 46e076d734..e45f8b3fbf 100644 --- a/Source/Core/DolphinWX/ISOFile.cpp +++ b/Source/Core/DolphinWX/ISOFile.cpp @@ -28,6 +28,7 @@ #include "Core/Boot/Boot.h" #include "Core/ConfigManager.h" +#include "Core/IOS/ES/Formats.h" #include "DiscIO/Blob.h" #include "DiscIO/Enums.h" @@ -177,6 +178,17 @@ GameListItem::~GameListItem() { } +bool GameListItem::IsValid() const +{ + if (!m_Valid) + return false; + + if (m_Platform == DiscIO::Platform::WII_WAD && !IOS::ES::IsChannel(m_title_id)) + return false; + + return true; +} + void GameListItem::ReloadINI() { if (!IsValid()) diff --git a/Source/Core/DolphinWX/ISOFile.h b/Source/Core/DolphinWX/ISOFile.h index 2361014e31..cf3ec8d066 100644 --- a/Source/Core/DolphinWX/ISOFile.h +++ b/Source/Core/DolphinWX/ISOFile.h @@ -35,7 +35,7 @@ public: // Reload settings after INI changes void ReloadINI(); - bool IsValid() const { return m_Valid; } + bool IsValid() const; const std::string& GetFileName() const { return m_FileName; } std::string GetName(DiscIO::Language language) const; std::string GetName() const;