From 134c2fd7af4d70c857f8026cd942e84b7a8bb5cd Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 7 Aug 2023 23:44:21 -0700 Subject: [PATCH] fix: use ut8 encoding for config and filenames Config values can now carry non-ascii values. This required also configuring allegro to treat file paths as UTF8. Fonts have varying support for characters outside ASCII characters. Probably we currently have no fonts that adequately cover non-latin characters. While you may see gibberish in the file picker, files should still load just fine. --- allegro-legacy/src/file.c | 2 +- src/launcher/launcher.cpp | 1 - src/zc/title.cpp | 4 ---- src/zc/zelda.cpp | 2 -- src/zq/zquest.cpp | 3 --- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/allegro-legacy/src/file.c b/allegro-legacy/src/file.c index 51ec919882..c4f56adff0 100644 --- a/allegro-legacy/src/file.c +++ b/allegro-legacy/src/file.c @@ -77,7 +77,7 @@ static PACKFILE_VTABLE normal_vtable; static PACKFILE *pack_fopen_special_file(AL_CONST char *filename, AL_CONST char *mode); -static int filename_encoding = U_ASCII; +static int filename_encoding = U_UTF8; #define FA_DAT_FLAGS (FA_RDONLY | FA_ARCH) diff --git a/src/launcher/launcher.cpp b/src/launcher/launcher.cpp index d0c8a0cab4..4e444ebb05 100644 --- a/src/launcher/launcher.cpp +++ b/src/launcher/launcher.cpp @@ -84,7 +84,6 @@ int32_t main(int32_t argc, char* argv[]) { common_main_setup(App::launcher, argc, argv); - set_uformat(U_ASCII); zc_srand(time(0)); diff --git a/src/zc/title.cpp b/src/zc/title.cpp index b901ca38c6..adbfc467d5 100644 --- a/src/zc/title.cpp +++ b/src/zc/title.cpp @@ -671,8 +671,6 @@ static void DX_mainscreen(int32_t f) FFCore.skip_ending_credits = 0; for ( int32_t q = 0; q < 256; q++ ) runningItemScripts[q] = 0; //Clear scripts that were running before. - set_uformat(U_ASCII); - static int32_t pic=0; //char tbuf[80]; char tbuf[2048] = {0}; char tbuf2[2048] = {0}; @@ -895,8 +893,6 @@ static void v25_mainscreen(int32_t f) FFCore.skip_ending_credits = 0; for ( int32_t q = 0; q < 256; q++ ) runningItemScripts[q] = 0; //Clear scripts that were running before. - set_uformat(U_ASCII); - static int32_t pic=0; //char tbuf[80]; char tbuf[2048] = {0}; char tbuf2[2048] = {0}; diff --git a/src/zc/zelda.cpp b/src/zc/zelda.cpp index 201daac0b1..3e2428281d 100644 --- a/src/zc/zelda.cpp +++ b/src/zc/zelda.cpp @@ -4795,8 +4795,6 @@ int main(int argc, char **argv) mididata = (DATAFILE*)datafile[ZC_MIDI].dat; - set_uformat(U_ASCII); - allocate_crap(); //script drawing bitmap allocation diff --git a/src/zq/zquest.cpp b/src/zq/zquest.cpp index 546bf72e33..3f9273acd7 100644 --- a/src/zq/zquest.cpp +++ b/src/zq/zquest.cpp @@ -28808,9 +28808,6 @@ int32_t main(int32_t argc,char **argv) zc_srand(time(0)); - - - set_uformat(U_ASCII); Z_message("Initializing Allegro... "); if(!al_init())