From 1c11a8081f246dda91ff11d4207d87bb93260b1a Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 28 Jun 2020 00:01:51 +0300 Subject: mips overdose --- src/text/Text.cpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/text/Text.cpp') diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 549f68d9..926ccd1c 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -31,29 +31,29 @@ CText::Load(void) CFileMgr::SetDir("TEXT"); switch(CMenuManager::m_PrefsLanguage){ - case LANGUAGE_AMERICAN: + case CMenuManager::LANGUAGE_AMERICAN: sprintf(filename, "AMERICAN.GXT"); break; - case LANGUAGE_FRENCH: + case CMenuManager::LANGUAGE_FRENCH: sprintf(filename, "FRENCH.GXT"); break; - case LANGUAGE_GERMAN: + case CMenuManager::LANGUAGE_GERMAN: sprintf(filename, "GERMAN.GXT"); break; - case LANGUAGE_ITALIAN: + case CMenuManager::LANGUAGE_ITALIAN: sprintf(filename, "ITALIAN.GXT"); break; - case LANGUAGE_SPANISH: + case CMenuManager::LANGUAGE_SPANISH: sprintf(filename, "SPANISH.GXT"); break; #ifdef MORE_LANGUAGES - case LANGUAGE_POLISH: + case CMenuManager::LANGUAGE_POLISH: sprintf(filename, "POLISH.GXT"); break; - case LANGUAGE_RUSSIAN: + case CMenuManager::LANGUAGE_RUSSIAN: sprintf(filename, "RUSSIAN.GXT"); break; - case LANGUAGE_JAPANESE: + case CMenuManager::LANGUAGE_JAPANESE: sprintf(filename, "JAPANESE.GXT"); break; #endif @@ -298,12 +298,32 @@ UnicodeToAsciiForSaveLoad(wchar *src) return aStr; } +char* +UnicodeToAsciiForMemoryCard(wchar *src) +{ + static char aStr[256]; + int len; + for(len = 0; *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'); } +void +UnicodeStrcat(wchar *dst, wchar *append) +{ + UnicodeStrcpy(&dst[UnicodeStrlen(dst)], append); +} + int UnicodeStrlen(const wchar *str) { -- cgit v1.2.3 From b8f633de243914aa548381d024e77ad736b91d0d Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 28 Jun 2020 01:57:01 +0300 Subject: fixes --- src/text/Text.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/text/Text.cpp') diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 926ccd1c..9d41d06e 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -271,9 +271,9 @@ UnicodeToAscii(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < 256-1; len++, src++) + for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) #ifdef MORE_LANGUAGES - if(*src < 128 || ((CGame::russianGame || CGame::japaneseGame) && *src < 256)) + if(*src < 128 || ((CGame::russianGame || CGame::japaneseGame) && *src < ARRAY_SIZE(aStr))) #else if(*src < 128) #endif @@ -289,8 +289,8 @@ UnicodeToAsciiForSaveLoad(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < 256-1; len++, src++) - if(*src < 256) + for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) + if(*src < ARRAY_SIZE(aStr)) aStr[len] = *src; else aStr[len] = '#'; @@ -303,8 +303,8 @@ UnicodeToAsciiForMemoryCard(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < 256-1; len++, src++) - if(*src < 256) + for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) + if(*src < ARRAY_SIZE(aStr)) aStr[len] = *src; else aStr[len] = '#'; -- cgit v1.2.3 From 1f1782c587600abef2bc3e77b4d126424dbd022d Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 28 Jun 2020 08:32:56 +0300 Subject: restore Text.cpp --- src/text/Text.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/text/Text.cpp') diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 9d41d06e..926ccd1c 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -271,9 +271,9 @@ UnicodeToAscii(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) + for(len = 0; *src != '\0' && len < 256-1; len++, src++) #ifdef MORE_LANGUAGES - if(*src < 128 || ((CGame::russianGame || CGame::japaneseGame) && *src < ARRAY_SIZE(aStr))) + if(*src < 128 || ((CGame::russianGame || CGame::japaneseGame) && *src < 256)) #else if(*src < 128) #endif @@ -289,8 +289,8 @@ UnicodeToAsciiForSaveLoad(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) - if(*src < ARRAY_SIZE(aStr)) + for(len = 0; *src != '\0' && len < 256-1; len++, src++) + if(*src < 256) aStr[len] = *src; else aStr[len] = '#'; @@ -303,8 +303,8 @@ UnicodeToAsciiForMemoryCard(wchar *src) { static char aStr[256]; int len; - for(len = 0; *src != '\0' && len < ARRAY_SIZE(aStr)-1; len++, src++) - if(*src < ARRAY_SIZE(aStr)) + for(len = 0; *src != '\0' && len < 256-1; len++, src++) + if(*src < 256) aStr[len] = *src; else aStr[len] = '#'; -- cgit v1.2.3