1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

clean up config.c

This commit is contained in:
FunkyFr3sh 2023-09-23 17:48:06 +02:00
parent 58d52e396c
commit 90dd010bbf
7 changed files with 13 additions and 21 deletions

View File

@ -39,13 +39,12 @@ typedef struct CNCDDRAWCONFIG
BOOL noactivateapp;
int maxgameticks;
int minfps;
BOOL nonexclusive;
BOOL singlecpu;
int resolutions;
int fixchilds;
BOOL hook_peekmessage;
int minfps;
DWORD minfps_tick_len;
/* Undocumented settings */

View File

@ -140,6 +140,7 @@ typedef struct CNCDDRAW
DWORD last_set_window_pos_tick; /* WINE hack */
SPEEDLIMITER ticks_limiter;
SPEEDLIMITER flip_limiter;
DWORD minfps_tick_len;
DWORD gui_thread_id;
BOOL show_driver_warning;
BOOL d3d9on12;

View File

@ -56,24 +56,13 @@ void cfg_load()
GET_BOOL(g_config.noactivateapp, "noactivateapp", FALSE);
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.singlecpu, "singlecpu", TRUE);
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
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 */
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.mgs_hack, "mgs_hack", FALSE);
if (g_config.infantryhack)
{
GameHandlesClose = TRUE;
}
GameHandlesClose = GameHandlesClose || g_config.infantryhack;
}
void cfg_save()

View File

@ -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_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 */
g_fpsl.htimer = CreateWaitableTimer(NULL, TRUE, NULL);

View File

@ -454,7 +454,7 @@ DWORD WINAPI d3d9_render_main(void)
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 &&
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))

View File

@ -38,7 +38,7 @@ DWORD WINAPI gdi_render_main(void)
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 &&
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))

View File

@ -662,7 +662,7 @@ static void ogl_render()
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 &&
(g_config.minfps < 0 || WaitForSingleObject(g_ddraw->render.sem, timeout) != WAIT_FAILED))