From d360229b5b3a3ef82a8defd6672bfda81ded9326 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 10 Jul 2019 13:42:48 +0200 Subject: fixed some stuff in frontend, badly broke others; disabled reversed frontend for the moment --- src/core/Text.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src/core/Text.cpp') 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); -- cgit v1.2.3