diff options
author | aap <aap@papnet.eu> | 2019-07-10 13:42:48 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-10 13:42:48 +0200 |
commit | d360229b5b3a3ef82a8defd6672bfda81ded9326 (patch) | |
tree | 3e33368038e76fe770bb3cc7cb7dd3ae0e794bc5 /src/core/Text.cpp | |
parent | Merge pull request #127 from gennariarmando/master (diff) | |
download | re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar.gz re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar.bz2 re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar.lz re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar.xz re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.tar.zst re3-d360229b5b3a3ef82a8defd6672bfda81ded9326.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Text.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/core/Text.cpp b/src/core/Text.cpp index b834a44d..dfa9815c 100644 --- a/src/core/Text.cpp +++ b/src/core/Text.cpp @@ -210,7 +210,48 @@ AsciiToUnicode(const char *src, uint16 *dst) while((*dst++ = *src++) != '\0'); } -WRAPPER char UnicodeToAscii(wchar * src) { EAXJMP(0x52C2F0); } +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) @@ -218,6 +259,7 @@ TextCopy(wchar *dst, const wchar *src) while((*dst++ = *src++) != '\0'); } + STARTPATCHES InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); |