mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
clean up config.c
This commit is contained in:
parent
58d52e396c
commit
90dd010bbf
@ -39,13 +39,12 @@ typedef struct CNCDDRAWCONFIG
|
|||||||
|
|
||||||
BOOL noactivateapp;
|
BOOL noactivateapp;
|
||||||
int maxgameticks;
|
int maxgameticks;
|
||||||
|
int minfps;
|
||||||
BOOL nonexclusive;
|
BOOL nonexclusive;
|
||||||
BOOL singlecpu;
|
BOOL singlecpu;
|
||||||
int resolutions;
|
int resolutions;
|
||||||
int fixchilds;
|
int fixchilds;
|
||||||
BOOL hook_peekmessage;
|
BOOL hook_peekmessage;
|
||||||
int minfps;
|
|
||||||
DWORD minfps_tick_len;
|
|
||||||
|
|
||||||
/* Undocumented settings */
|
/* Undocumented settings */
|
||||||
|
|
||||||
|
1
inc/dd.h
1
inc/dd.h
@ -140,6 +140,7 @@ typedef struct CNCDDRAW
|
|||||||
DWORD last_set_window_pos_tick; /* WINE hack */
|
DWORD last_set_window_pos_tick; /* WINE hack */
|
||||||
SPEEDLIMITER ticks_limiter;
|
SPEEDLIMITER ticks_limiter;
|
||||||
SPEEDLIMITER flip_limiter;
|
SPEEDLIMITER flip_limiter;
|
||||||
|
DWORD minfps_tick_len;
|
||||||
DWORD gui_thread_id;
|
DWORD gui_thread_id;
|
||||||
BOOL show_driver_warning;
|
BOOL show_driver_warning;
|
||||||
BOOL d3d9on12;
|
BOOL d3d9on12;
|
||||||
|
18
src/config.c
18
src/config.c
@ -56,24 +56,13 @@ void cfg_load()
|
|||||||
|
|
||||||
GET_BOOL(g_config.noactivateapp, "noactivateapp", FALSE);
|
GET_BOOL(g_config.noactivateapp, "noactivateapp", FALSE);
|
||||||
GET_INT(g_config.maxgameticks, "maxgameticks", 0);
|
GET_INT(g_config.maxgameticks, "maxgameticks", 0);
|
||||||
|
GET_INT(g_config.minfps, "minfps", 0);
|
||||||
GET_BOOL(g_config.nonexclusive, "nonexclusive", FALSE);
|
GET_BOOL(g_config.nonexclusive, "nonexclusive", FALSE);
|
||||||
GET_BOOL(g_config.singlecpu, "singlecpu", TRUE);
|
GET_BOOL(g_config.singlecpu, "singlecpu", TRUE);
|
||||||
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
|
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
|
||||||
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
|
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
|
||||||
GET_BOOL(g_config.hook_peekmessage, "hook_peekmessage", FALSE);
|
GET_BOOL(g_config.hook_peekmessage, "hook_peekmessage", FALSE);
|
||||||
|
|
||||||
GET_INT(g_config.minfps, "minfps", 0);
|
|
||||||
|
|
||||||
if (g_config.minfps > 1000)
|
|
||||||
{
|
|
||||||
g_config.minfps = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_config.minfps > 0)
|
|
||||||
{
|
|
||||||
g_config.minfps_tick_len = (DWORD)(1000.0f / g_config.minfps);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Undocumented settings */
|
/* Undocumented settings */
|
||||||
|
|
||||||
GET_BOOL(g_config.releasealt, "releasealt", FALSE);
|
GET_BOOL(g_config.releasealt, "releasealt", FALSE);
|
||||||
@ -113,10 +102,7 @@ void cfg_load()
|
|||||||
GET_BOOL(g_config.stronghold_hack, "stronghold_hack", FALSE);
|
GET_BOOL(g_config.stronghold_hack, "stronghold_hack", FALSE);
|
||||||
GET_BOOL(g_config.mgs_hack, "mgs_hack", FALSE);
|
GET_BOOL(g_config.mgs_hack, "mgs_hack", FALSE);
|
||||||
|
|
||||||
if (g_config.infantryhack)
|
GameHandlesClose = GameHandlesClose || g_config.infantryhack;
|
||||||
{
|
|
||||||
GameHandlesClose = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cfg_save()
|
void cfg_save()
|
||||||
|
6
src/dd.c
6
src/dd.c
@ -1378,6 +1378,12 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
|||||||
g_ddraw->wine = real_GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0;
|
g_ddraw->wine = real_GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0;
|
||||||
g_blt_use_avx = util_is_avx_supported();
|
g_blt_use_avx = util_is_avx_supported();
|
||||||
|
|
||||||
|
if (g_config.minfps > 1000)
|
||||||
|
g_config.minfps = 1000;
|
||||||
|
|
||||||
|
if (g_config.minfps > 0)
|
||||||
|
g_ddraw->minfps_tick_len = (DWORD)(1000.0f / g_config.minfps);
|
||||||
|
|
||||||
/* can't fully set it up here due to missing g_ddraw->mode.dmDisplayFrequency */
|
/* can't fully set it up here due to missing g_ddraw->mode.dmDisplayFrequency */
|
||||||
g_fpsl.htimer = CreateWaitableTimer(NULL, TRUE, NULL);
|
g_fpsl.htimer = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ DWORD WINAPI d3d9_render_main(void)
|
|||||||
|
|
||||||
BOOL needs_update = FALSE;
|
BOOL needs_update = FALSE;
|
||||||
|
|
||||||
DWORD timeout = g_config.minfps > 0 ? g_config.minfps_tick_len : INFINITE;
|
DWORD timeout = g_config.minfps > 0 ? g_ddraw->minfps_tick_len : INFINITE;
|
||||||
|
|
||||||
while (g_ddraw->render.run &&
|
while (g_ddraw->render.run &&
|
||||||
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
||||||
|
@ -38,7 +38,7 @@ DWORD WINAPI gdi_render_main(void)
|
|||||||
|
|
||||||
fpsl_init();
|
fpsl_init();
|
||||||
|
|
||||||
DWORD timeout = g_config.minfps > 0 ? g_config.minfps_tick_len : INFINITE;
|
DWORD timeout = g_config.minfps > 0 ? g_ddraw->minfps_tick_len : INFINITE;
|
||||||
|
|
||||||
while (g_ddraw->render.run &&
|
while (g_ddraw->render.run &&
|
||||||
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
||||||
|
@ -662,7 +662,7 @@ static void ogl_render()
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD timeout = g_config.minfps > 0 ? g_config.minfps_tick_len : INFINITE;
|
DWORD timeout = g_config.minfps > 0 ? g_ddraw->minfps_tick_len : INFINITE;
|
||||||
|
|
||||||
while (g_ogl.use_opengl && g_ddraw->render.run &&
|
while (g_ogl.use_opengl && g_ddraw->render.run &&
|
||||||
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user