GRIM: Support localize file in UTF-16LE

This commit is contained in:
Vladimir Serbinenko 2023-05-01 23:07:12 +02:00
parent e2c1cae56a
commit 7e0d5f1c6f
2 changed files with 10 additions and 0 deletions

View File

@ -288,6 +288,7 @@ protected:
public:
int _cursorX = 0;
int _cursorY = 0;
bool _isUtf8 = false;
};
extern GrimEngine *g_grim;

View File

@ -102,6 +102,15 @@ Localizer::Localizer() {
case MKTAG('I', 'N', 'T', 'T'):
case MKTAG('6', '6', '6', 'I'):
break;
case 0xfffe4600: {
Common::String n = Common::U32String::decodeUTF16LE((const uint16 *) (data + 2), (filesize - 2) / 2).encode();
delete[] data;
data = new char[n.size() + 1];
memcpy(data, n.c_str(), n.size() + 1);
filesize = n.size();
g_grim->_isUtf8 = true;
break;
}
default:
error("Invalid magic reading %s: %08x (%s)", filename.c_str(), READ_BE_UINT32(data), tag2str(READ_BE_UINT32(data)));
}