From 61fc34c3cb9513821aad709fe5fa402ab444ffe0 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 4 Apr 2024 09:59:04 +0900 Subject: [PATCH] check sound file existences --- GUI.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/GUI.cpp b/GUI.cpp index 2c7ae7d..f55029e 100644 --- a/GUI.cpp +++ b/GUI.cpp @@ -1229,13 +1229,19 @@ bool __fastcall XgLoadSettings(void) } if (!app_key.QuerySz(L"SoundFile0", sz, _countof(sz))) { - StringCchCopy(xg_aszSoundFiles[0], _countof(xg_aszSoundFiles[0]), sz); + if (PathFileExistsW(sz)) { + StringCchCopy(xg_aszSoundFiles[0], _countof(xg_aszSoundFiles[0]), sz); + } } if (!app_key.QuerySz(L"SoundFile1", sz, _countof(sz))) { - StringCchCopy(xg_aszSoundFiles[1], _countof(xg_aszSoundFiles[1]), sz); + if (PathFileExistsW(sz)) { + StringCchCopy(xg_aszSoundFiles[1], _countof(xg_aszSoundFiles[1]), sz); + } } if (!app_key.QuerySz(L"SoundFile2", sz, _countof(sz))) { - StringCchCopy(xg_aszSoundFiles[2], _countof(xg_aszSoundFiles[2]), sz); + if (PathFileExistsW(sz)) { + StringCchCopy(xg_aszSoundFiles[2], _countof(xg_aszSoundFiles[2]), sz); + } } // 保存先のリストを取得する。