Eliminate the wstring game name.

Some cleanup throughout related code. (try to make logic in ISOFile understandable by a human)
Encode strings in UTF-8 rather than somehow trying to determine the encoding in the GUI code.

Non-windows OSes temporarily broken.
This commit is contained in:
Jordan Woyak
2013-03-02 19:46:55 -06:00
parent 2b1af36900
commit 6c8adf6130
22 changed files with 243 additions and 411 deletions

View File

@ -107,13 +107,15 @@ bool CVolumeWAD::GetTitleID(u8* _pBuffer) const
return true;
}
bool CVolumeWAD::GetWName(std::vector<std::wstring>& _rwNames) const
std::vector<std::string> CVolumeWAD::GetNames() const
{
u32 footer_size;
std::vector<std::string> names;
return names;
u32 footer_size;
if (!Read(0x1C, 4, (u8*)&footer_size))
{
return false;
return names;
}
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
@ -126,7 +128,7 @@ bool CVolumeWAD::GetWName(std::vector<std::wstring>& _rwNames) const
if (!Read(0x9C + (i*84) + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1
|| !temp[0])
{
_rwNames.push_back(L"");
names.push_back("");
continue;
}
for (int j = 0; j < 42; ++j)
@ -141,44 +143,10 @@ bool CVolumeWAD::GetWName(std::vector<std::wstring>& _rwNames) const
out_temp.push_back(t);
}
_rwNames.push_back(out_temp);
names.push_back(UTF16ToUTF8(out_temp));
}
return true;
}
std::string CVolumeWAD::GetName() const
{
u32 footer_size;
if (!Read(0x1C, 4, (u8*)&footer_size))
return "";
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
// Offset to the english title
char temp[84];
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1 ||
!Common::swap16(temp[0]))
return "";
// Remove the null bytes due to 16bit char length
std::string out_temp;
for (unsigned int i = 0; i < sizeof(temp); i+=2)
{
// Replace null chars with a single space per null section
if (temp[i] == '\0' && i > 0)
{
if (out_temp.at(out_temp.size()-1) != ' ')
out_temp.push_back(' ');
}
else
out_temp.push_back(temp[i]);
}
// Make it a null terminated string
out_temp.replace(out_temp.end()-1, out_temp.end(), 1, '\0');
return out_temp;
return names;
}
u64 CVolumeWAD::GetSize() const