From 91e4478a29e413ec105933a33dd3eb5224ee06e1 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Mon, 16 Jan 2023 21:50:34 +0900 Subject: [PATCH] Fix file name encoding issues in movie.c and Toushin3Loader.c --- src/hll/Toushin3Loader.c | 3 ++- src/movie.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hll/Toushin3Loader.c b/src/hll/Toushin3Loader.c index d97a232..2a12552 100644 --- a/src/hll/Toushin3Loader.c +++ b/src/hll/Toushin3Loader.c @@ -21,6 +21,7 @@ #include "little_endian.h" #include "system4/buffer.h" +#include "system4/file.h" #include "system4/string.h" #include "system4/utfsjis.h" @@ -55,7 +56,7 @@ static struct buffer *ts3m_read_buf; static FILE *open_and_read_header(struct ts3m_header *header) { char *path = gamedir_path("Data/Toushin3Map.dat"); - FILE *fp = fopen(path, "rb"); + FILE *fp = file_open_utf8(path, "rb"); free(path); uint8_t buf[28]; diff --git a/src/movie.c b/src/movie.c index 42393fa..eb403fe 100644 --- a/src/movie.c +++ b/src/movie.c @@ -15,10 +15,14 @@ */ #include +#include #include +#include +#include #include #include "system4.h" +#include "system4/file.h" #include "gfx/gfx.h" #include "movie.h" @@ -108,13 +112,14 @@ struct movie_context *movie_load(const char *filename) { struct movie_context *mc = xcalloc(1, sizeof(struct movie_context)); char *path = gamedir_path(filename); - mc->plm = plm_create_with_filename(path); - if (!mc->plm) { - WARNING("Couldn't open %s", path); + FILE *fp = file_open_utf8(path, "rb"); + if (!fp) { + WARNING("%s: %s", path, strerror(errno)); free(path); movie_free(mc); return NULL; } + mc->plm = plm_create_with_file(fp, TRUE); if (!plm_has_headers(mc->plm)) { WARNING("%s: not a MPEG-PS file", path); free(path);