diff --git a/src/text/text-loader.c b/src/text/text-loader.c index 98e1d863..7a388a5f 100644 --- a/src/text/text-loader.c +++ b/src/text/text-loader.c @@ -29,7 +29,7 @@ void load_language(char *jsonTxt, s8 language){ cJSON *json = cJSON_ParseWithOpts(jsonTxt, &endTxt, 1); if(*endTxt != 0) { - fprintf(stderr, "Error before: %s\n", endTxt); + fprintf(stderr, "Loading File: Error before: %s\n", endTxt); exit(1); } @@ -60,9 +60,9 @@ void load_language(char *jsonTxt, s8 language){ int eid = 0; 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; @@ -221,7 +221,12 @@ void alloc_languages(char *exePath, char *gamedir){ printf("Loading File: %s\n", file); char *jsonTxt = read_file(file); - load_language(jsonTxt, languagesAmount - 1); + if(jsonTxt != NULL){ + load_language(jsonTxt, languagesAmount - 1); + }else{ + fprintf(stderr, "Loading File: Error reading '%s'\n", file); + exit(1); + } free(jsonTxt); free(file); } @@ -230,11 +235,11 @@ void alloc_languages(char *exePath, char *gamedir){ free(languagesDir); free(parent); closedir(lf); - + if(languagesAmount > 0){ languages = realloc(languages, sizeof(struct LanguageEntry*) * (languagesAmount)); }else{ - printf("Loading File: No language files found, aborting.\n"); + fprintf(stderr, "Loading File: No language files found, aborting.\n"); exit(1); } } diff --git a/src/text/txtconv.c b/src/text/txtconv.c index d0dcf1cd..ead3e377 100644 --- a/src/text/txtconv.c +++ b/src/text/txtconv.c @@ -1,4 +1,6 @@ +#include #include +#include #include "txtconv.h" struct Character charmap[358] = { @@ -62,10 +64,10 @@ struct Character charmap[358] = { // *MISSING* SPECIAL CHARACTERS WITH SUBSTITIONS // *NOTE: when adding characters here, don't forget to increment charmap size // (value is number of '}}' in this file minus 1) - {"{00227}", {0x61, NULL}}, // latin small letter a with tilde (PT_br) - {"{00195}", {0x65, NULL}}, // latin capital letter A with tilde (PT_br) - {"{00245}", {0x91, NULL}}, // latin small letter o with tilde (PT_br) - {"{00213}", {0x95, NULL}}, // latin capital letter O with tilde (PT_br) + {"{00227}", {0x24, NULL}}, // latin small letter a with tilde (PT_br) + {"{00195}", {0x0a, NULL}}, // latin capital letter A with tilde (PT_br) + {"{00245}", {0x32, NULL}}, // latin small letter o with tilde (PT_br) + {"{00213}", {0x18, NULL}}, // latin capital letter O with tilde (PT_br) {"{00236}", {0x2c, NULL}}, // latin small letter i with grave (ES_es) {"{07765}", {0x33, NULL}} // latin small letter p with acute (ES_la) };