mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
#252 add presets for Nox
This commit is contained in:
parent
351a0cf467
commit
995d1f294b
@ -4,6 +4,7 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define FILE_EXISTS(a) (GetFileAttributes(a) != INVALID_FILE_ATTRIBUTES)
|
||||
|
||||
typedef struct CNCDDRAWCONFIG
|
||||
{
|
||||
|
50
src/config.c
50
src/config.c
@ -858,6 +858,16 @@ static void cfg_create_ini()
|
||||
"renderer=direct3d9\n"
|
||||
"nonexclusive=false\n"
|
||||
"windowed=false\n"
|
||||
"maxgameticks=-1\n"
|
||||
"\n"
|
||||
"; Nox Reloaded\n"
|
||||
"[NoxReloaded]\n"
|
||||
"maxgameticks=-1\n"
|
||||
"\n"
|
||||
"; Nox GOG\n"
|
||||
"[Game/2]\n"
|
||||
"checkfile=.\\nox.cfg\n"
|
||||
"maxgameticks=-1\n"
|
||||
"\n"
|
||||
"; Outlaws\n"
|
||||
"[olwin]\n"
|
||||
@ -1091,19 +1101,53 @@ static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string,
|
||||
DWORD s = GetPrivateProfileStringA(
|
||||
g_config.process_file_name, key, "", out_string, out_size, g_config.ini_path);
|
||||
|
||||
char buf[MAX_PATH] = { 0 };
|
||||
|
||||
if (s > 0)
|
||||
{
|
||||
char buf[MAX_PATH] = { 0 };
|
||||
|
||||
if (GetPrivateProfileStringA(
|
||||
g_config.process_file_name, "checkfile", "", buf, sizeof(buf), g_config.ini_path) > 0)
|
||||
{
|
||||
if (GetFileAttributes(buf) != INVALID_FILE_ATTRIBUTES)
|
||||
if (FILE_EXISTS(buf))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
char section[MAX_PATH] = { 0 };
|
||||
_snprintf(section, sizeof(section), "%s?%d", g_config.process_file_name, 2);
|
||||
|
||||
s = GetPrivateProfileStringA(section, key, "", out_string, out_size, g_config.ini_path);
|
||||
|
||||
if (s > 0)
|
||||
{
|
||||
if (GetPrivateProfileStringA(section, "checkfile", "", buf, sizeof(buf), g_config.ini_path) > 0)
|
||||
{
|
||||
if (FILE_EXISTS(buf))
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
char section[MAX_PATH] = { 0 };
|
||||
_snprintf(section, sizeof(section), "%s/%d", g_config.process_file_name, 2);
|
||||
|
||||
s = GetPrivateProfileStringA(section, key, "", out_string, out_size, g_config.ini_path);
|
||||
|
||||
if (s > 0)
|
||||
{
|
||||
if (GetPrivateProfileStringA(section, "checkfile", "", buf, sizeof(buf), g_config.ini_path) > 0)
|
||||
{
|
||||
if (FILE_EXISTS(buf))
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GetPrivateProfileStringA("ddraw", key, default_value, out_string, out_size, g_config.ini_path);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user