diff options
| author | comex <comexk@gmail.com> | 2015-05-05 16:20:04 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2015-05-05 16:20:04 -0400 |
| commit | 6414cdabb2ae7762f2d98427b9ff024af07bb959 (patch) | |
| tree | 5362ae99777fc494d6c2b059b0bd63a6bb296b97 /Source/Core/DiscIO/VolumeWad.cpp | |
| parent | 430e8b7adeb5b3adb12ef50ce7961562463b0fa0 (diff) | |
| parent | df8e768b77b551832ace0d552ec10c1b062c55f3 (diff) | |
Merge pull request #2286 from JosJuice/wii-opening-bnr
Read opening.bnr to get names from Wii discs
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeWad.cpp | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 1dc746ea4d..7b52e7a82e 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include <algorithm> #include <cstddef> +#include <map> #include <string> #include <vector> @@ -117,42 +117,12 @@ bool CVolumeWAD::IsWadFile() const return true; } -std::vector<std::string> CVolumeWAD::GetNames() const +std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames() const { - std::vector<std::string> names; - - u32 footer_size; - if (!Read(0x1C, 4, (u8*)&footer_size)) - { - return names; - } - - footer_size = Common::swap32(footer_size); - - //Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean - for (int i = 0; i != 10; ++i) - { - static const u32 string_length = 42; - static const u32 bytes_length = string_length * sizeof(u16); - - u16 temp[string_length]; - - if (footer_size < 0xF1 || !Read(0x9C + (i * bytes_length) + m_opening_bnr_offset, bytes_length, (u8*)&temp)) - { - names.push_back(""); - } - else - { - std::wstring out_temp; - out_temp.resize(string_length); - std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16); - out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end()); - - names.push_back(UTF16ToUTF8(out_temp)); - } - } - - return names; + std::vector<u8> name_data(NAMES_TOTAL_BYTES); + if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data())) + return std::map<IVolume::ELanguage, std::string>(); + return ReadWiiNames(name_data); } u64 CVolumeWAD::GetSize() const |
