From a6f01f7f8222ac6153a6bea3c1407708cc409f27 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 24 Aug 2023 09:19:29 +0900 Subject: [PATCH] Fix path resolution in MsgSkip.Init Some games (Ojou-sama o Iinari ni Suru Game and Double Sensei Life, as far as I know) pass "SaveData\\MsgSkip.asd" to MsgSkip.Init. So this change: * uses savedir_path() to resolve the relative path, and * removes the "SaveData\\" prefix, otherwise "SaveData/" will be duplicated in the resolved path. --- src/hll/MsgSkip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hll/MsgSkip.c b/src/hll/MsgSkip.c index b84b6f5..c674d5d 100644 --- a/src/hll/MsgSkip.c +++ b/src/hll/MsgSkip.c @@ -60,7 +60,14 @@ static int MsgSkip_Init(struct string *name) nr_flags = ain->nr_messages; flags = xcalloc((nr_flags + 7) / 8, 1); - save_path = unix_path(name->text); + // Most games have system.GetSaveFolderName() prepended to `name`, but some + // games pass a constant string "SaveData\\MsgSkip.asd". If you pass it to + // savedir_path() as it is, "SaveData/" will be duplicated, so remove it. + if (!strncmp(name->text, "SaveData\\", 9)) { + save_path = savedir_path(name->text + 9); + } else { + save_path = savedir_path(name->text); + } size_t data_size; uint8_t *data = file_read(save_path, &data_size);