1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

add accuratetimers bool for dune 2000

This commit is contained in:
FunkyFr3sh 2018-11-30 04:07:43 +01:00
parent abf71c70ca
commit 3265ff30d8
2 changed files with 28 additions and 5 deletions

View File

@ -4,7 +4,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_BUILD 2 #define VERSION_BUILD 2
#define VERSION_REVISION 3 #define VERSION_REVISION 4
#define VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION #define VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION
#define VERSION_STRING ver_str(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION) #define VERSION_STRING ver_str(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION)

View File

@ -46,28 +46,36 @@ void Settings_Load()
WindowRect.left = GetInt("posX", -32000); WindowRect.left = GetInt("posX", -32000);
WindowRect.top = GetInt("posY", -32000); WindowRect.top = GetInt("posY", -32000);
BOOL accurateTimers = GetBool("accuratetimers", FALSE);
ddraw->render.maxfps = GetInt("maxfps", 125); ddraw->render.maxfps = GetInt("maxfps", 125);
if (ddraw->render.maxfps) if (ddraw->render.maxfps <= 1000)
{ {
//ddraw->fpsLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL); if (accurateTimers)
ddraw->fpsLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
//can't fully set it up here due to missing ddraw->mode.dmDisplayFrequency //can't fully set it up here due to missing ddraw->mode.dmDisplayFrequency
} }
int maxTicks = GetInt("maxgameticks", 0); int maxTicks = GetInt("maxgameticks", 0);
if (maxTicks > 0 && maxTicks <= 1000) if (maxTicks > 0 && maxTicks <= 1000)
{ {
//ddraw->ticksLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL); if (accurateTimers)
ddraw->ticksLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
float len = 1000.0f / maxTicks; float len = 1000.0f / maxTicks;
ddraw->ticksLimiter.tickLengthNs = len * 10000; ddraw->ticksLimiter.tickLengthNs = len * 10000;
ddraw->ticksLimiter.ticklength = len + 0.5f; ddraw->ticksLimiter.ticklength = len + 0.5f;
} }
//always using 60 fps for flip... //always using 60 fps for flip...
//ddraw->flipLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL); if (accurateTimers)
ddraw->flipLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
float flipLen = 1000.0f / 60; float flipLen = 1000.0f / 60;
ddraw->flipLimiter.tickLengthNs = flipLen * 10000; ddraw->flipLimiter.tickLengthNs = flipLen * 10000;
ddraw->flipLimiter.ticklength = flipLen + 0.5f; ddraw->flipLimiter.ticklength = flipLen + 0.5f;
if ((ddraw->fullscreen = GetBool("fullscreen", FALSE))) if ((ddraw->fullscreen = GetBool("fullscreen", FALSE)))
WindowRect.left = WindowRect.top = -32000; WindowRect.left = WindowRect.top = -32000;
@ -247,6 +255,11 @@ static void CreateSettingsIni()
"; Note: This option only works for games that draw their own cursor and it must be disabled for all other games\n" "; Note: This option only works for games that draw their own cursor and it must be disabled for all other games\n"
"handlemouse=true\n" "handlemouse=true\n"
"\n" "\n"
"; Use Waitable Timer Objects rather than timeGetTime+Sleep to limit FPS/Ticks/Flip\n"
"; Note: Can introduce a different type of tearing and stuttering in windowed mode\n"
"; Note: To workaround tearing/stuttering problems, set maxfps 1 lower than target ticks (59 for flip games)\n"
"accuratetimers=false\n"
"\n"
"\n" "\n"
"; Game specific settings - The following settings override all settings above, section name = executable name\n" "; Game specific settings - The following settings override all settings above, section name = executable name\n"
"\n" "\n"
@ -307,6 +320,16 @@ static void CreateSettingsIni()
"[BM]\n" "[BM]\n"
"maxgameticks=60\n" "maxgameticks=60\n"
"\n" "\n"
"; Dune 2000\n"
"[dune2000]\n"
"maxfps=59\n"
"accuratetimers=true\n"
"\n"
"; Dune 2000 Online\n"
"[dune2000-spawn]\n"
"maxfps=59\n"
"accuratetimers=true\n"
"\n"
"; Command & Conquer: Tiberian Sun\n" "; Command & Conquer: Tiberian Sun\n"
"[game]\n" "[game]\n"
"noactivateapp=true\n" "noactivateapp=true\n"