Unfuck my fuckup

This commit is contained in:
Phillip Stephens 2017-01-21 08:58:43 -08:00
parent 49839bbd6d
commit 02d9c7199a
1 changed files with 9 additions and 9 deletions

View File

@ -5,13 +5,13 @@ namespace urde
{ {
const std::vector<FourCC> CStringTable::skLanguages = const std::vector<FourCC> CStringTable::skLanguages =
{ {
'ENGL', FOURCC('ENGL'),
'FREN', FOURCC('FREN'),
'GERM', FOURCC('GERM'),
'SPAN', FOURCC('SPAN'),
'ITAL', FOURCC('ITAL'),
'DUTC', FOURCC('DUTC'),
'JAPN' FOURCC('JAPN')
}; };
FourCC CStringTable::mCurrentLanguage = CStringTable::skLanguages[0]; FourCC CStringTable::mCurrentLanguage = CStringTable::skLanguages[0];
@ -58,7 +58,7 @@ void CStringTable::LoadStringTable(CInputStream &in)
m_bufLen = dataLen; m_bufLen = dataLen;
x4_data.reset(new u8[dataLen]); x4_data.reset(new u8[dataLen]);
in.readUBytesToBuf(x4_data.get(), dataLen); in.readUBytesToBuf(x4_data.get(), dataLen);
for (u32 i = 0 ; i<x0_stringCount ; i += 4) for (u32 i = 0 ; i < (x0_stringCount * 4) ; i += 4)
{ {
u32* off = reinterpret_cast<u32*>(x4_data.get() + i); u32* off = reinterpret_cast<u32*>(x4_data.get() + i);
*off = hecl::SBig(*off); *off = hecl::SBig(*off);
@ -75,7 +75,7 @@ std::wstring CStringTable::GetString(s32 str) const
if (str < 0 || u32(str) >= x0_stringCount) if (str < 0 || u32(str) >= x0_stringCount)
return L"Invalid"; return L"Invalid";
u32 off = *(reinterpret_cast<u32*>(x4_data.get() + str * 4)); u32 off = *(reinterpret_cast<u32*>(x4_data.get() + (str * 4)));
CMemoryInStream tmp(x4_data.get() + off, m_bufLen - off); CMemoryInStream tmp(x4_data.get() + off, m_bufLen - off);
return tmp.readWString(); return tmp.readWString();
} }