diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-07-10 14:56:56 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-07-10 14:56:56 +0200 |
commit | 2ef5e4cd662d642b839a9e65b3176335c6b50448 (patch) | |
tree | 5e0a6dcdbf8f1566974c0514986ab7b61e5c067a /src/core/Text.cpp | |
parent | Phone start, ped spinning and cop car fix, and some love to CPed (diff) | |
parent | fixed COMMAND_IS_PLAYER_IN_AREA_3D (diff) | |
download | re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar.gz re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar.bz2 re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar.lz re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar.xz re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.tar.zst re3-2ef5e4cd662d642b839a9e65b3176335c6b50448.zip |
Diffstat (limited to 'src/core/Text.cpp')
-rw-r--r-- | src/core/Text.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/Text.cpp b/src/core/Text.cpp index d7d63467..dfa9815c 100644 --- a/src/core/Text.cpp +++ b/src/core/Text.cpp @@ -210,12 +210,56 @@ AsciiToUnicode(const char *src, uint16 *dst) while((*dst++ = *src++) != '\0'); } +char* +UnicodeToAscii(wchar *src) +{ + static char aStr[256]; + int len; + for(len = 0; src && *src != 0 && len < 256-1; len++, src++) + if(*src < 256) + aStr[len] = *src; + else + aStr[len] = '#'; + aStr[len] = '\0'; + return aStr; +} + +char* +UnicodeToAsciiForSaveLoad(wchar *src) +{ + // exact same code as above + static char aStr[256]; + int len; + for(len = 0; src && *src != 0 && len < 256-1; len++, src++) + if(*src < 256) + aStr[len] = *src; + else + aStr[len] = '#'; + aStr[len] = '\0'; + return aStr; +} + +void +UnicodeStrcpy(wchar *dst, const wchar *src) +{ + while((*dst++ = *src++) != '\0'); +} + +int +UnicodeStrlen(const wchar *str) +{ + int len; + for(len = 0; *str != 0; len++, str++); + return len; +} + void TextCopy(wchar *dst, const wchar *src) { while((*dst++ = *src++) != '\0'); } + STARTPATCHES InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); |