summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-03-16 10:28:17 +0100
committerJosJuice <josjuice@gmail.com>2017-03-16 11:21:31 +0100
commitff7425214a998b44de8d35ff012b84f66f3c5bba (patch)
tree4db32ae3c727b51fe3a480cc7426d8a0ad18565d /Source/Core/DiscIO/VolumeWad.cpp
parent1e7dd1ed2db7c0ee9eacd2d9c788529f7ec88d03 (diff)
Use 6-char game IDs for NAND tiles (if they are printable)
5.0-2712 made ES's code for setting the game ID use the title ID converted to hex (except for disc titles) instead of using a 6-char game ID like before. Then, 5.0-2830 made us use that code even when loading game INIs. This breaks the expectations of both users and the game INIs we ship with. This commit makes Dolphin use 6-char game IDs for all titles (unless the 6-char ID would contain unprintable characters, which is the case with e.g. the Wii Menu). I'm also putting unprintability checks in VolumeWad for consistency.
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index 79e5423d54..29bc0afd96 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -4,6 +4,7 @@
#include <cstddef>
#include <cstring>
+#include <locale>
#include <map>
#include <memory>
#include <string>
@@ -89,22 +90,18 @@ IOS::ES::TMDReader CVolumeWAD::GetTMD() const
std::string CVolumeWAD::GetGameID() const
{
- char GameCode[6];
- if (!Read(m_offset + 0x01E0, 4, (u8*)GameCode))
- return "0";
-
- std::string temp = GetMakerID();
- GameCode[4] = temp.at(0);
- GameCode[5] = temp.at(1);
-
- return DecodeString(GameCode);
+ return m_tmd.GetGameID();
}
std::string CVolumeWAD::GetMakerID() const
{
- char temp[2] = {1};
- // Some weird channels use 0x0000 in place of the MakerID, so we need a check there
- if (!Read(0x198 + m_tmd_offset, 2, (u8*)temp) || temp[0] == 0 || temp[1] == 0)
+ char temp[2];
+ if (!Read(0x198 + m_tmd_offset, 2, (u8*)temp))
+ return "00";
+
+ // Some weird channels use 0x0000 in place of the MakerID, so we need a check here
+ const std::locale& c_locale = std::locale::classic();
+ if (!std::isprint(temp[0], c_locale) || !std::isprint(temp[1], c_locale))
return "00";
return DecodeString(temp);