#118 fix shaders with ja2 wildfire

This commit is contained in:
FunkyFr3sh 2021-09-09 21:32:54 +02:00
parent 15438c70c4
commit 31119eacb8
3 changed files with 33 additions and 11 deletions

View file

@ -21,20 +21,31 @@ CNCDDRAWCONFIG g_config =
void cfg_load()
{
/* set up settings ini */
char cwd[MAX_PATH];
char tmp[256];
GetCurrentDirectoryA(sizeof(cwd), cwd);
_snprintf(g_config.ini_path, sizeof(g_config.ini_path), "%s\\ddraw.ini", cwd);
/* get process filename and directory */
if (GetModuleFileNameA(NULL, g_config.game_path, sizeof(g_config.game_path) - 1) > 0)
{
_splitpath(g_config.game_path, NULL, NULL, g_config.process_file_name, NULL);
char* end = strstr(g_config.game_path, g_config.process_file_name);
if (end)
{
*end = 0;
}
else
{
g_config.game_path[0] = 0;
}
}
/* set up settings ini */
strncpy(g_config.ini_path, ".\\ddraw.ini", sizeof(g_config.ini_path) - 1);
if (GetFileAttributes(g_config.ini_path) == INVALID_FILE_ATTRIBUTES)
cfg_create_ini();
/* get process filename */
char process_file_path[MAX_PATH] = { 0 };
GetModuleFileNameA(NULL, process_file_path, MAX_PATH);
_splitpath(process_file_path, NULL, NULL, g_config.process_file_name, NULL);
/* load settings from ini */
g_ddraw->windowed = cfg_get_bool("windowed", FALSE);
g_ddraw->border = cfg_get_bool("border", TRUE);