From 8e8fd808af4d4acbfcdcf08ed687e90fdc2e11e1 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Wed, 3 Apr 2019 03:13:39 +0200 Subject: [PATCH] make sure the game.exe preset is only used for cnc games (and not for diablo 2...) --- src/settings.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/settings.c b/src/settings.c index 7286e4d..3b2baeb 100644 --- a/src/settings.c +++ b/src/settings.c @@ -352,8 +352,9 @@ static void CreateSettingsIni() "maxfps=59\n" "accuratetimers=true\n" "\n" - "; Command & Conquer: Tiberian Sun\n" + "; Command & Conquer: Tiberian Sun / Command & Conquer: Red Alert 2\n" "[game]\n" + "checkfile=.\\blowfish.dll\n" "noactivateapp=true\n" "handlemouse=false\n" "maxfps=60\n" @@ -410,7 +411,17 @@ static DWORD GetString(LPCSTR key, LPCSTR defaultValue, LPSTR outString, DWORD o { DWORD s = GetPrivateProfileStringA(ProcessFileName, key, "", outString, outSize, SettingsIniPath); if (s > 0) - return s; + { + char buf[MAX_PATH] = { 0 }; + + if (GetPrivateProfileStringA(ProcessFileName, "checkfile", "", buf, sizeof(buf), SettingsIniPath) > 0) + { + if (GetFileAttributes(buf) != INVALID_FILE_ATTRIBUTES) + return s; + } + else + return s; + } return GetPrivateProfileStringA("ddraw", key, defaultValue, outString, outSize, SettingsIniPath); }