Volume: Use DecodeString more

DecodeString handles the case where there is no trailing null byte,
so using it lets the code be a bit simpler.
This commit is contained in:
JosJuice
2015-06-18 14:45:26 +02:00
parent 6d9711c02c
commit a825c7ddfe
3 changed files with 15 additions and 30 deletions

View File

@ -70,29 +70,25 @@ IVolume::ECountry CVolumeWAD::GetCountry() const
std::string CVolumeWAD::GetUniqueID() const
{
std::string temp = GetMakerID();
char GameCode[8];
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);
GameCode[6] = 0;
return GameCode;
return DecodeString(GameCode);
}
std::string CVolumeWAD::GetMakerID() const
{
char temp[3] = {1};
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)
return "00";
temp[2] = 0;
return temp;
return DecodeString(temp);
}
bool CVolumeWAD::GetTitleID(u8* _pBuffer) const