diff --git a/src/text/text-loader.c b/src/text/text-loader.c index b8c9f96c..2d29b921 100644 --- a/src/text/text-loader.c +++ b/src/text/text-loader.c @@ -5,57 +5,75 @@ #include #include "dialog_ids.h" #include "game/ingame_menu.h" -#include #include #include "libs/dir_utils.h" +#include +#include struct DialogEntry* * dialogPool; +#define _READFILE_GUESS 256 -char* load_file(char const* path) { - char* buffer = 0; - long length = 0; - FILE * f = fopen (path, "rb"); +#define SPANISH "./res/texts/es.json" +#define ENGLISH "./res/texts/us.json" - if (f) { - fseek (f, 0, SEEK_END); - length = ftell (f); - fseek (f, 0, SEEK_SET); - buffer = (char*) malloc((length+1)*sizeof(char)); - if (buffer) { - fread(buffer, sizeof(char), length, f); - } - fclose(f); - buffer[length] = '\0'; - return buffer; +char* read_file(char* name){ + FILE* file; + file = fopen(name, "r"); + + if(!file) + return NULL; + + char* result = malloc(sizeof(char) * _READFILE_GUESS + 1); + + if(result == NULL) + return NULL; + + size_t pos = 0; + size_t capacity = _READFILE_GUESS; + char ch; + + while((ch = getc(file)) != EOF){ + result[pos++] = ch; + + if(pos >= capacity){ + capacity += _READFILE_GUESS; + result = realloc(result, sizeof(char) * capacity + 1); + if(result == NULL) + return NULL; + } } - return NULL; + fclose(file); + result = realloc(result, sizeof(char) * pos); + if(result == NULL) + return NULL; + result[pos] = '\0'; + + return result; } void preloadTexts(){ - char * cwd = "/home/alex/Documents/Projects/Render96/Render96ex - FastBuild/build/us_pc"; - //getcwd(cwd, sizeof(cwd)); - #ifndef WIN32 - char * file = "/res/texts/es.json"; - #else - char * file = "\\res\\texts\\es.json"; - #endif + char * file = ENGLISH; - char * language_file = malloc((strlen(cwd) + strlen(file)) * sizeof(char)); - strcpy(language_file, ""); - strcat(language_file, cwd); - strcat(language_file, file); + #ifndef WIN32 + char * language_file = realpath(file, NULL); + #else + char * language_file = malloc(_MAX_PATH * sizeof(char)); + _fullpath(language_file, file, _MAX_PATH ); + #endif printf("Loading File: %s\n", language_file); - char * jsonTxt = load_file( language_file ); - if(jsonTxt == NULL) return; + char * jsonTxt = read_file(language_file); cJSON *json = cJSON_Parse(jsonTxt); if (json == NULL) { const char *error_ptr = cJSON_GetErrorPtr(); + if (error_ptr != NULL) { fprintf(stderr, "Error before: %s\n", error_ptr); + }else{ + fprintf(stderr, "Error loading the JSON file\n"); } exit(1); } @@ -66,14 +84,14 @@ void preloadTexts(){ cJSON_ArrayForEach(dialog, dialogs) { int id = cJSON_GetObjectItemCaseSensitive(dialog, "ID")->valueint; - + struct DialogEntry *entry = malloc (sizeof (struct DialogEntry)); - + entry->unused = 1; entry->linesPerBox = cJSON_GetObjectItemCaseSensitive(dialog, "linesPerBox")->valueint; entry->leftOffset = cJSON_GetObjectItemCaseSensitive(dialog, "leftOffset")->valueint; entry->width = cJSON_GetObjectItemCaseSensitive(dialog, "width")->valueint; - + const cJSON *line = NULL; const cJSON *lines = NULL; lines = cJSON_GetObjectItemCaseSensitive(dialog, "lines"); @@ -92,11 +110,12 @@ void preloadTexts(){ } } - entry->str = getTranslatedText(dialogTxt); + entry->str = getTranslatedText(dialogTxt); dialogPool[id] = entry; free(dialogTxt); } - free(jsonTxt); + + cJSON_Delete(json); } void alloc_dialog_pool(void){ @@ -104,7 +123,7 @@ void alloc_dialog_pool(void){ for(int i = 0; i < DIALOG_COUNT; i++){ struct DialogEntry *entry = malloc (sizeof (struct DialogEntry)); - + entry->unused = 1; entry->linesPerBox = 6; entry->leftOffset = 95; @@ -112,6 +131,6 @@ void alloc_dialog_pool(void){ entry->str = getTranslatedText("You are not supposed\nto be here.\n\nKeep this as a secret\n\n- Render96 Team"); dialogPool[i] = entry; } - + preloadTexts(); -} \ No newline at end of file +} diff --git a/src/text/txtconv.c b/src/text/txtconv.c index 3f80c4b4..61878d96 100644 --- a/src/text/txtconv.c +++ b/src/text/txtconv.c @@ -1,51 +1,51 @@ #include "txtconv.h" struct Character charmap[340] = { - {"0", 0x00}, {"0", 0x00}, {"1", 0x01}, {"1", 0x01}, {"2", 0x02}, {"2", 0x02}, {"3", 0x03}, {"3", 0x03}, {"4", 0x04}, - {"4", 0x04}, {"5", 0x05}, {"5", 0x05}, {"6", 0x06}, {"6", 0x06}, {"7", 0x07}, {"7", 0x07}, {"8", 0x08}, {"8", 0x08}, - {"9", 0x09}, {"9", 0x09}, {"A", 0x0A}, {"A", 0x0A}, {"B", 0x0B}, {"B", 0x0B}, {"C", 0x0C}, {"C", 0x0C}, {"D", 0x0D}, - {"D", 0x0D}, {"E", 0x0E}, {"E", 0x0E}, {"F", 0x0F}, {"F", 0x0F}, {"G", 0x10}, {"G", 0x10}, {"H", 0x11}, {"H", 0x11}, - {"I", 0x12}, {"I", 0x12}, {"J", 0x13}, {"J", 0x13}, {"K", 0x14}, {"K", 0x14}, {"L", 0x15}, {"L", 0x15}, {"M", 0x16}, - {"M", 0x16}, {"N", 0x17}, {"N", 0x17}, {"O", 0x18}, {"O", 0x18}, {"P", 0x19}, {"P", 0x19}, {"Q", 0x1A}, {"Q", 0x1A}, - {"R", 0x1B}, {"R", 0x1B}, {"S", 0x1C}, {"S", 0x1C}, {"T", 0x1D}, {"T", 0x1D}, {"U", 0x1E}, {"U", 0x1E}, {"V", 0x1F}, - {"V", 0x1F}, {"W", 0x20}, {"W", 0x20}, {"X", 0x21}, {"X", 0x21}, {"Y", 0x22}, {"Y", 0x22}, {"Z", 0x23}, {"Z", 0x23}, - {"a", 0x24}, {"b", 0x25}, {"c", 0x26}, {"d", 0x27}, {"e", 0x28}, {"f", 0x29}, {"g", 0x2A}, {"h", 0x2B}, {"i", 0x2C}, - {"j", 0x2D}, {"k", 0x2E}, {"l", 0x2F}, {"m", 0x30}, {"n", 0x31}, {"o", 0x32}, {"p", 0x33}, {"q", 0x34}, {"r", 0x35}, - {"s", 0x36}, {"t", 0x37}, {"u", 0x38}, {"v", 0x39}, {"w", 0x3A}, {"x", 0x3B}, {"y", 0x3C}, {"z", 0x3D}, {"\\", 0x3E}, - {".", 0x3F}, {"☺", 0x41}, {"あ", 0x40}, {"い", 0x41}, {"う", 0x42}, {"え", 0x43}, {"お", 0x44}, {"か", 0x45}, {"き", 0x46}, - {"く", 0x47}, {"け", 0x48}, {"こ", 0x49}, {"さ", 0x4A}, {"し", 0x4B}, {"す", 0x4C}, {"せ", 0x4D}, {"そ", 0x4E}, {"た", 0x4F}, - {"ち", 0x50}, {"つ", 0x51}, {"て", 0x52}, {"と", 0x53}, {"な", 0x54}, {"に", 0x55}, {"ぬ", 0x56}, {"ね", 0x57}, {"の", 0x58}, - {"は", 0x59}, {"ひ", 0x5A}, {"ふ", 0x5B}, {"へ", 0x5C}, {"ほ", 0x5D}, {"ま", 0x5E}, {"み", 0x5F}, {"む", 0x60}, {"め", 0x61}, - {"も", 0x62}, {"や", 0x63}, {"ゆ", 0x64}, {"よ", 0x65}, {"ら", 0x66}, {"り", 0x67}, {"る", 0x68}, {"れ", 0x69}, {"ろ", 0x6A}, - {"わ", 0x6B}, {"を", 0x6C}, {"ん", 0x6D}, {"。", 0x6E}, {",", 0x6F}, {"、", 0x6F}, {"ア", 0x70}, {"イ", 0x71}, {"ウ", 0x72}, - {"エ", 0x73}, {"オ", 0x74}, {"カ", 0x75}, {"キ", 0x76}, {"ク", 0x77}, {"ケ", 0x78}, {"コ", 0x79}, {"サ", 0x7A}, {"シ", 0x7B}, - {"ス", 0x7C}, {"セ", 0x7D}, {"ソ", 0x7E}, {"タ", 0x7F}, {"チ", 0x80}, {"ツ", 0x81}, {"テ", 0x82}, {"ト", 0x83}, {"ナ", 0x84}, - {"ニ", 0x85}, {"ヌ", 0x86}, {"ネ", 0x87}, {"ノ", 0x88}, {"ハ", 0x89}, {"ヒ", 0x8A}, {"フ", 0x8B}, {"ヘ", 0x8C}, {"ホ", 0x8D}, - {"マ", 0x8E}, {"ミ", 0x8F}, {"ム", 0x90}, {"メ", 0x91}, {"モ", 0x92}, {"ヤ", 0x93}, {"ユ", 0x94}, {"ヨ", 0x95}, {"ラ", 0x96}, - {"リ", 0x97}, {"ル", 0x98}, {"レ", 0x99}, {"ロ", 0x9A}, {"ワ", 0x9B}, {"ヲ", 0x9C}, {"ン", 0x9D}, {" ", 0x9E}, {" ", 0x9E}, - {"-", 0x9F}, {"ー", 0x9F}, {"ぇ", 0xA0}, {"っ", 0xA1}, {"ゃ", 0xA2}, {"ゅ", 0xA3}, {"ょ", 0xA4}, {"ぁ", 0xA5}, {"ぃ", 0xA6}, - {"ぅ", 0xA7}, {"ぉ", 0xA8}, {"ェ", 0xD0}, {"ッ", 0xD1}, {"ャ", 0xD2}, {"ュ", 0xD3}, {"ョ", 0xD4}, {"ァ", 0xD5}, {"ィ", 0xD6}, - {"ゥ", 0xD7}, {"ォ", 0xD8}, {"[%]", 0xE0}, {"(", 0xE1}, {"(", 0xE1}, {")(", 0xE2}, {")(", 0xE2}, {")", 0xE3}, {")", 0xE3}, - {"+", 0xE4}, {"↔", 0xE4}, {"&", 0xE5}, {":", 0xE6}, {"゛", 0xF0}, {"゜", 0xF1}, {"!", 0xF2}, {"!", 0xF2}, {"%", 0xF3}, - {"%", 0xF3}, {"?", 0xF4}, {"?", 0xF4}, {"『", 0xF5}, {"』", 0xF6}, {"~", 0xF7}, {"~", 0xF7}, {"…", 0xF8}, {"$", 0xF9}, - {"★", 0xFA}, {"×", 0xFB}, {"・", 0xFC}, {"☆", 0xFD}, {"\n", 0xFE}, {"が", 0x45}, {"ぎ", 0x46}, {"ぐ", 0x47}, {"げ", 0x48}, - {"ご", 0x49}, {"ざ", 0x4A}, {"じ", 0x4B}, {"ず", 0x4C}, {"ぜ", 0x4D}, {"ぞ", 0x4E}, {"だ", 0x4F}, {"ぢ", 0x50}, {"づ", 0x51}, - {"で", 0x52}, {"ど", 0x53}, {"ば", 0x59}, {"び", 0x5A}, {"ぶ", 0x5B}, {"べ", 0x5C}, {"ぼ", 0x5D}, {"ガ", 0x75}, {"ギ", 0x76}, - {"グ", 0x77}, {"ゲ", 0x78}, {"ゴ", 0x79}, {"ザ", 0x7A}, {"ジ", 0x7B}, {"ズ", 0x7C}, {"ゼ", 0x7D}, {"ゾ", 0x7E}, {"ダ", 0x7F}, - {"ヂ", 0x80}, {"ヅ", 0x81}, {"デ", 0x82}, {"ド", 0x83}, {"バ", 0x89}, {"ビ", 0x8A}, {"ブ", 0x8B}, {"ベ", 0x8C}, {"ボ", 0x8D}, - {"ぱ", 0x59}, {"ぴ", 0x5A}, {"ぷ", 0x5B}, {"ぺ", 0x5C}, {"ぽ", 0x5D}, {"パ", 0x89}, {"ピ", 0x8A}, {"プ", 0x8B}, {"ペ", 0x8C}, - {"ポ", 0x8D}, {"^", 0x50}, {"|", 0x51}, {"<", 0x52}, {">", 0x53}, {"[A]", 0x54}, {"[B]", 0x55}, {"[C]", 0x56}, {"[Z]", 0x57}, - {"[R]", 0x58}, {"/", 0xD0}, {"the", 0xD1}, {"you", 0xD2}, {"à", 0x60}, {"â", 0x61}, {"ä", 0x62}, {"À", 0x64}, {"Â", 0x65}, - {"Ä", 0x66}, {"è", 0x70}, {"ê", 0x71}, {"ë", 0x72}, {"é", 0x73}, {"È", 0x74}, {"Ê", 0x75}, {"Ë", 0x76}, {"É", 0x77}, - {"ù", 0x80}, {"û", 0x81}, {"ü", 0x82}, {"Ù", 0x84}, {"Û", 0x85}, {"Ü", 0x86}, {"ô", 0x91}, {"ö", 0x92}, {"Ô", 0x95}, + {"0", 0x00}, {"0", 0x00}, {"1", 0x01}, {"1", 0x01}, {"2", 0x02}, {"2", 0x02}, {"3", 0x03}, {"3", 0x03}, {"4", 0x04}, + {"4", 0x04}, {"5", 0x05}, {"5", 0x05}, {"6", 0x06}, {"6", 0x06}, {"7", 0x07}, {"7", 0x07}, {"8", 0x08}, {"8", 0x08}, + {"9", 0x09}, {"9", 0x09}, {"A", 0x0A}, {"A", 0x0A}, {"B", 0x0B}, {"B", 0x0B}, {"C", 0x0C}, {"C", 0x0C}, {"D", 0x0D}, + {"D", 0x0D}, {"E", 0x0E}, {"E", 0x0E}, {"F", 0x0F}, {"F", 0x0F}, {"G", 0x10}, {"G", 0x10}, {"H", 0x11}, {"H", 0x11}, + {"I", 0x12}, {"I", 0x12}, {"J", 0x13}, {"J", 0x13}, {"K", 0x14}, {"K", 0x14}, {"L", 0x15}, {"L", 0x15}, {"M", 0x16}, + {"M", 0x16}, {"N", 0x17}, {"N", 0x17}, {"O", 0x18}, {"O", 0x18}, {"P", 0x19}, {"P", 0x19}, {"Q", 0x1A}, {"Q", 0x1A}, + {"R", 0x1B}, {"R", 0x1B}, {"S", 0x1C}, {"S", 0x1C}, {"T", 0x1D}, {"T", 0x1D}, {"U", 0x1E}, {"U", 0x1E}, {"V", 0x1F}, + {"V", 0x1F}, {"W", 0x20}, {"W", 0x20}, {"X", 0x21}, {"X", 0x21}, {"Y", 0x22}, {"Y", 0x22}, {"Z", 0x23}, {"Z", 0x23}, + {"a", 0x24}, {"b", 0x25}, {"c", 0x26}, {"d", 0x27}, {"e", 0x28}, {"f", 0x29}, {"g", 0x2A}, {"h", 0x2B}, {"i", 0x2C}, + {"j", 0x2D}, {"k", 0x2E}, {"l", 0x2F}, {"m", 0x30}, {"n", 0x31}, {"o", 0x32}, {"p", 0x33}, {"q", 0x34}, {"r", 0x35}, + {"s", 0x36}, {"t", 0x37}, {"u", 0x38}, {"v", 0x39}, {"w", 0x3A}, {"x", 0x3B}, {"y", 0x3C}, {"z", 0x3D}, {"'", 0x3E}, + {".", 0x3F}, {"☺", 0x41}, {"あ", 0x40}, {"い", 0x41}, {"う", 0x42}, {"え", 0x43}, {"お", 0x44}, {"か", 0x45}, {"き", 0x46}, + {"く", 0x47}, {"け", 0x48}, {"こ", 0x49}, {"さ", 0x4A}, {"し", 0x4B}, {"す", 0x4C}, {"せ", 0x4D}, {"そ", 0x4E}, {"た", 0x4F}, + {"ち", 0x50}, {"つ", 0x51}, {"て", 0x52}, {"と", 0x53}, {"な", 0x54}, {"に", 0x55}, {"ぬ", 0x56}, {"ね", 0x57}, {"の", 0x58}, + {"は", 0x59}, {"ひ", 0x5A}, {"ふ", 0x5B}, {"へ", 0x5C}, {"ほ", 0x5D}, {"ま", 0x5E}, {"み", 0x5F}, {"む", 0x60}, {"め", 0x61}, + {"も", 0x62}, {"や", 0x63}, {"ゆ", 0x64}, {"よ", 0x65}, {"ら", 0x66}, {"り", 0x67}, {"る", 0x68}, {"れ", 0x69}, {"ろ", 0x6A}, + {"わ", 0x6B}, {"を", 0x6C}, {"ん", 0x6D}, {"。", 0x6E}, {",", 0x6F}, {"、", 0x6F}, {"ア", 0x70}, {"イ", 0x71}, {"ウ", 0x72}, + {"エ", 0x73}, {"オ", 0x74}, {"カ", 0x75}, {"キ", 0x76}, {"ク", 0x77}, {"ケ", 0x78}, {"コ", 0x79}, {"サ", 0x7A}, {"シ", 0x7B}, + {"ス", 0x7C}, {"セ", 0x7D}, {"ソ", 0x7E}, {"タ", 0x7F}, {"チ", 0x80}, {"ツ", 0x81}, {"テ", 0x82}, {"ト", 0x83}, {"ナ", 0x84}, + {"ニ", 0x85}, {"ヌ", 0x86}, {"ネ", 0x87}, {"ノ", 0x88}, {"ハ", 0x89}, {"ヒ", 0x8A}, {"フ", 0x8B}, {"ヘ", 0x8C}, {"ホ", 0x8D}, + {"マ", 0x8E}, {"ミ", 0x8F}, {"ム", 0x90}, {"メ", 0x91}, {"モ", 0x92}, {"ヤ", 0x93}, {"ユ", 0x94}, {"ヨ", 0x95}, {"ラ", 0x96}, + {"リ", 0x97}, {"ル", 0x98}, {"レ", 0x99}, {"ロ", 0x9A}, {"ワ", 0x9B}, {"ヲ", 0x9C}, {"ン", 0x9D}, {" ", 0x9E}, {" ", 0x9E}, + {"-", 0x9F}, {"ー", 0x9F}, {"ぇ", 0xA0}, {"っ", 0xA1}, {"ゃ", 0xA2}, {"ゅ", 0xA3}, {"ょ", 0xA4}, {"ぁ", 0xA5}, {"ぃ", 0xA6}, + {"ぅ", 0xA7}, {"ぉ", 0xA8}, {"ェ", 0xD0}, {"ッ", 0xD1}, {"ャ", 0xD2}, {"ュ", 0xD3}, {"ョ", 0xD4}, {"ァ", 0xD5}, {"ィ", 0xD6}, + {"ゥ", 0xD7}, {"ォ", 0xD8}, {"[%]", 0xE0}, {"(", 0xE1}, {"(", 0xE1}, {")(", 0xE2}, {")(", 0xE2}, {")", 0xE3}, {")", 0xE3}, + {"+", 0xE4}, {"↔", 0xE4}, {"&", 0xE5}, {":", 0xE6}, {"゛", 0xF0}, {"゜", 0xF1}, {"!", 0xF2}, {"!", 0xF2}, {"%", 0xF3}, + {"%", 0xF3}, {"?", 0xF4}, {"?", 0xF4}, {"『", 0xF5}, {"』", 0xF6}, {"~", 0xF7}, {"~", 0xF7}, {"…", 0xF8}, {"$", 0xF9}, + {"★", 0xFA}, {"×", 0xFB}, {"・", 0xFC}, {"☆", 0xFD}, {"\n", 0xFE}, {"が", 0x45}, {"ぎ", 0x46}, {"ぐ", 0x47}, {"げ", 0x48}, + {"ご", 0x49}, {"ざ", 0x4A}, {"じ", 0x4B}, {"ず", 0x4C}, {"ぜ", 0x4D}, {"ぞ", 0x4E}, {"だ", 0x4F}, {"ぢ", 0x50}, {"づ", 0x51}, + {"で", 0x52}, {"ど", 0x53}, {"ば", 0x59}, {"び", 0x5A}, {"ぶ", 0x5B}, {"べ", 0x5C}, {"ぼ", 0x5D}, {"ガ", 0x75}, {"ギ", 0x76}, + {"グ", 0x77}, {"ゲ", 0x78}, {"ゴ", 0x79}, {"ザ", 0x7A}, {"ジ", 0x7B}, {"ズ", 0x7C}, {"ゼ", 0x7D}, {"ゾ", 0x7E}, {"ダ", 0x7F}, + {"ヂ", 0x80}, {"ヅ", 0x81}, {"デ", 0x82}, {"ド", 0x83}, {"バ", 0x89}, {"ビ", 0x8A}, {"ブ", 0x8B}, {"ベ", 0x8C}, {"ボ", 0x8D}, + {"ぱ", 0x59}, {"ぴ", 0x5A}, {"ぷ", 0x5B}, {"ぺ", 0x5C}, {"ぽ", 0x5D}, {"パ", 0x89}, {"ピ", 0x8A}, {"プ", 0x8B}, {"ペ", 0x8C}, + {"ポ", 0x8D}, {"^", 0x50}, {"|", 0x51}, {"<", 0x52}, {">", 0x53}, {"[A]", 0x54}, {"[B]", 0x55}, {"[C]", 0x56}, {"[Z]", 0x57}, + {"[R]", 0x58}, {"/", 0xD0}, {"the", 0xD1}, {"you", 0xD2}, {"à", 0x60}, {"â", 0x61}, {"ä", 0x62}, {"À", 0x64}, {"Â", 0x65}, + {"Ä", 0x66}, {"è", 0x70}, {"ê", 0x71}, {"ë", 0x72}, {"é", 0x73}, {"È", 0x74}, {"Ê", 0x75}, {"Ë", 0x76}, {"É", 0x77}, + {"ù", 0x80}, {"û", 0x81}, {"ü", 0x82}, {"Ù", 0x84}, {"Û", 0x85}, {"Ü", 0x86}, {"ô", 0x91}, {"ö", 0x92}, {"Ô", 0x95}, {"Ö", 0x96}, {"î", 0xA1}, {"ï", 0xA2}, {"ß", 0xEC}, {"Ç", 0xED}, {"ç", 0xEE}, {"„", 0xF0} }; struct Character getCharacter(char* ch){ struct Character tmp = {NULL, 0}; for(s32 cmid = 0; cmid < 340; cmid++){ - if(strcmp(charmap[cmid].txt, ch) == 0) { - tmp = charmap[cmid]; + if(strncmp(charmap[cmid].txt, ch, strlen(charmap[cmid].txt)) == 0) { + tmp = charmap[cmid]; break; } } @@ -66,11 +66,11 @@ u8 * getTranslatedText(char * txt){ for(cid = 0; cid < strSize; cid++){ char ch = txt[cid]; - if(ch == '['){ + if(ch == '['){ tmpIcon[0] = ch; tmpIcon[1] = txt[cid + 1]; tmpIcon[2] = txt[cid + 2]; - struct Character ctm = getCharacter(tmpIcon); + struct Character ctm = getCharacter(tmpIcon); if(ctm.value != NULL){ tmp[cid - shiftArr] = ctm.value; shiftArr += 2; @@ -78,7 +78,7 @@ u8 * getTranslatedText(char * txt){ memset(tmpIcon, 0, sizeof(tmpIcon)); } }else{ - char findTxt[1] = {ch}; + char findTxt[1] = {ch}; struct Character ctm = getCharacter(findTxt); if(ctm.value != NULL){ tmp[cid - shiftArr] = ctm.value; @@ -90,6 +90,6 @@ u8 * getTranslatedText(char * txt){ tmp = realloc(tmp, (strSize - shiftArr + 1) * sizeof(u8)); tmp[strSize - shiftArr] = 0xFF; - + return tmp; } diff --git a/src/text/txtconv.h b/src/text/txtconv.h index cf05aa89..d2758c2e 100644 --- a/src/text/txtconv.h +++ b/src/text/txtconv.h @@ -4,7 +4,7 @@ #include "types.h" struct Character{ - char * txt; + char txt[3]; s32 value; };