summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2017-03-18 15:01:03 +0100
committerLéo Lam <leo@innovatetechnologi.es>2017-03-18 19:07:11 +0100
commitc987f58319be3de0cd392e757c4ff375162c196a (patch)
tree2812d7ca7a173b6b9015104579553a16e76f60dc /Source/Core/DiscIO/VolumeWad.cpp
parentb83929477fdb890e289a199f47df686a638b81a5 (diff)
Check whether WAD is a channel before reading names
Dolphin assumes that content 0 is opening.bnr, without checking whether content 0 exists or if it is even supposed to be there (it's only there for channels). This results in sometimes reading garbage. This adds a check to only try to read names from content 0's header if the title is a channel (channel, system channel or game channel).
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 79e5423d54..a06c7483e8 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -130,6 +130,9 @@ Platform CVolumeWAD::GetVolumeType() const
std::map<Language, std::string> CVolumeWAD::GetLongNames() const
{
+ if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId()))
+ return {};
+
std::vector<u8> name_data(NAMES_TOTAL_BYTES);
if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data()))
return std::map<Language, std::string>();