mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Read opening.bnr to get names from Wii discs
This makes Dolphin display the same names as the Disc Channel.
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -120,37 +119,10 @@ bool CVolumeWAD::IsWadFile() const
|
||||
|
||||
std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames() const
|
||||
{
|
||||
std::map<IVolume::ELanguage, 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, Simplified Chinese, Traditional Chinese, 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))
|
||||
{
|
||||
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());
|
||||
std::string name = UTF16ToUTF8(out_temp);
|
||||
if (!name.empty())
|
||||
names[(IVolume::ELanguage)i] = name;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user