mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
Added support for subdir and sync of dll and ini names
https://github.com/FunkyFr3sh/cnc-ddraw/issues/287
This commit is contained in:
parent
d147e91630
commit
d70d316c7e
@ -13,8 +13,11 @@ typedef struct CNCDDRAWCONFIG
|
||||
int upscaled_state;
|
||||
char ini_path[MAX_PATH];
|
||||
char game_path[MAX_PATH];
|
||||
char dll_path[MAX_PATH];
|
||||
char process_file_name[MAX_PATH];
|
||||
char dll_file_name[MAX_PATH];
|
||||
char process_file_ext[MAX_PATH];
|
||||
char dll_file_ext[MAX_PATH];
|
||||
INIFILE ini;
|
||||
BOOL is_wine;
|
||||
|
||||
|
24
src/config.c
24
src/config.c
@ -1095,11 +1095,29 @@ static void cfg_init()
|
||||
}
|
||||
}
|
||||
|
||||
/* get dll filename and directory */
|
||||
if (GetModuleFileNameA(g_ddraw_module, g_config.dll_path, sizeof(g_config.dll_path) - 1) > 0)
|
||||
{
|
||||
_splitpath(g_config.dll_path, NULL, NULL, g_config.dll_file_name, g_config.dll_file_ext);
|
||||
|
||||
int len = strlen(g_config.dll_path) - strlen(g_config.dll_file_name) - strlen(g_config.dll_file_ext);
|
||||
char* end = strstr(g_config.dll_path + len, g_config.dll_file_name);
|
||||
|
||||
if (end)
|
||||
{
|
||||
*end = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_config.dll_path[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetEnvironmentVariableA("CNC_DDRAW_CONFIG_FILE", g_config.ini_path, sizeof(g_config.ini_path) - 1))
|
||||
{
|
||||
if (strlen(g_config.game_path) > 0)
|
||||
if (strlen(g_config.dll_path) > 0 && strlen(g_config.dll_file_name) > 0)
|
||||
{
|
||||
_snprintf(g_config.ini_path, sizeof(g_config.ini_path) - 1, "%sddraw.ini", g_config.game_path);
|
||||
_snprintf(g_config.ini_path, sizeof(g_config.ini_path) - 1, "%s%s.ini", g_config.dll_path, g_config.dll_file_name);
|
||||
|
||||
if (GetFileAttributes(g_config.ini_path) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
@ -1108,7 +1126,7 @@ static void cfg_init()
|
||||
|
||||
if (GetFileAttributes(g_config.ini_path) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
strncpy(g_config.ini_path, ".\\ddraw.ini", sizeof(g_config.ini_path) - 1);
|
||||
_snprintf(g_config.ini_path, sizeof(g_config.ini_path) - 1, "%s%s.ini", g_config.dll_path, g_config.dll_file_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -160,7 +160,7 @@ static void ogl_build_programs()
|
||||
|
||||
if (GetFileAttributes(shader_path) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
_snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.game_path, g_config.shader);
|
||||
_snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.dll_path, g_config.shader);
|
||||
}
|
||||
|
||||
/* detect common upscaling shaders and disable them if no upscaling is required */
|
||||
|
Loading…
x
Reference in New Issue
Block a user