From 235ecfbed71986f0be2ecf469a10e1105dcb3c96 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 9 Apr 2015 17:44:53 +0200 Subject: Return GetNames languages, to avoid hardcoded language lists in callers This makes the code cleaner and also leads to some user-visible changes: The wx game properties will no longer let the user select WAD languages that don't have any names. The Qt game list will now display names using the languages set in the configuration instead of always using English for PAL GC games and Japanese for WADs. If a WAD doesn't have a name in the user's preferred language, English is now selected as a fallback before Japanese. --- Source/Core/DiscIO/VolumeDirectory.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/Core/DiscIO/VolumeDirectory.cpp') diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp index 6f3e4ccb7f..9db6e58e46 100644 --- a/Source/Core/DiscIO/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/VolumeDirectory.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include "Common/CommonPaths.h" @@ -183,9 +182,11 @@ std::string CVolumeDirectory::GetMakerID() const return "VOID"; } -std::vector CVolumeDirectory::GetNames() const +std::map CVolumeDirectory::GetNames() const { - return std::vector(1, (char*)(&m_diskHeader[0x20])); + std::map names; + names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = (char*)(&m_diskHeader[0x20]); + return names; } void CVolumeDirectory::SetName(const std::string& name) -- cgit v1.2.3 From ee694e327ada8c42949a3907d6fa222f73f276b0 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 10 Apr 2015 22:10:49 +0200 Subject: Get rid of banner loaders and move their functionality to volumes Having some data available in banner loaders and some other data data available in volumes gets messy, especially with GetNames(), which is available in both but returns different results depending on which one is used. This change drops support for reading names and descriptions from Wii save data. --- Source/Core/DiscIO/VolumeDirectory.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/VolumeDirectory.cpp') diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp index 9db6e58e46..876848b2d3 100644 --- a/Source/Core/DiscIO/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/VolumeDirectory.cpp @@ -182,10 +182,21 @@ std::string CVolumeDirectory::GetMakerID() const return "VOID"; } +std::string CVolumeDirectory::GetName() const +{ + char name[0x60]; + if (Read(0x20, 0x60, (u8*)name, false)) + return DecodeString(name); + else + return ""; +} + std::map CVolumeDirectory::GetNames() const { std::map names; - names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = (char*)(&m_diskHeader[0x20]); + std::string name = GetName(); + if (!name.empty()) + names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = name; return names; } -- cgit v1.2.3