mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
#118 fix shaders with ja2 wildfire
This commit is contained in:
parent
15438c70c4
commit
31119eacb8
@ -10,7 +10,8 @@ typedef struct CNCDDRAWCONFIG
|
||||
RECT window_rect;
|
||||
int window_state;
|
||||
char ini_path[MAX_PATH];
|
||||
char process_file_name[96];
|
||||
char game_path[MAX_PATH];
|
||||
char process_file_name[MAX_PATH];
|
||||
int save_settings;
|
||||
|
||||
} CNCDDRAWCONFIG;
|
||||
|
29
src/config.c
29
src/config.c
@ -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);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "fps_limiter.h"
|
||||
#include "opengl_utils.h"
|
||||
#include "dd.h"
|
||||
@ -140,7 +141,16 @@ static void ogl_build_programs()
|
||||
|
||||
if (g_ogl.main_program)
|
||||
{
|
||||
g_ogl.scale_program = oglu_build_program_from_file(g_ddraw->shader, wglCreateContextAttribsARB != NULL);
|
||||
char shader_path[MAX_PATH] = { 0 };
|
||||
|
||||
strncpy(shader_path, g_ddraw->shader, sizeof(shader_path) - 1);
|
||||
|
||||
if (GetFileAttributes(shader_path) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
_snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.game_path, g_ddraw->shader);
|
||||
}
|
||||
|
||||
g_ogl.scale_program = oglu_build_program_from_file(shader_path, wglCreateContextAttribsARB != NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user