From 79fe86062feec162864daed015845d2995c10fa5 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 11 Sep 2018 14:20:40 +0200 Subject: [PATCH] add "sleep" setting for CnC1 --- ddraw.rc | 2 +- inc/main.h | 1 + src/main.c | 1 + src/surface.c | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ddraw.rc b/ddraw.rc index c462322..a1c86f1 100644 --- a/ddraw.rc +++ b/ddraw.rc @@ -2,7 +2,7 @@ #define vxstr(a,b,c,d) str(a##.##b##.##c##.##d) #define str(s) #s -#define VERSION 1,1,9,1 +#define VERSION 1,1,9,2 1 VERSIONINFO FILEVERSION VERSION diff --git a/inc/main.h b/inc/main.h index b91ea4a..89d1e09 100644 --- a/inc/main.h +++ b/inc/main.h @@ -98,6 +98,7 @@ typedef struct IDirectDrawImpl char shader[MAX_PATH]; BOOL autorenderer; BOOL wine; + int sleep; } IDirectDrawImpl; diff --git a/src/main.c b/src/main.c index e260d34..9837ffa 100644 --- a/src/main.c +++ b/src/main.c @@ -1118,6 +1118,7 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), SettingsIniPath); ddraw->screenshotKey = toupper(tmp[0]); + This->sleep = GetPrivateProfileIntA("ddraw", "sleep", 0, SettingsIniPath); This->render.maxfps = GetPrivateProfileIntA("ddraw", "maxfps", 0, SettingsIniPath); This->render.width = GetPrivateProfileIntA("ddraw", "width", 0, SettingsIniPath); This->render.height = GetPrivateProfileIntA("ddraw", "height", 0, SettingsIniPath); diff --git a/src/surface.c b/src/surface.c index 91d82ef..3f5e4d5 100644 --- a/src/surface.c +++ b/src/surface.c @@ -178,7 +178,12 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR ResetEvent(ddraw->render.ev); } else - SwitchToThread(); + { + if (ddraw->sleep > 0) + Sleep(ddraw->sleep); + else + SwitchToThread(); + } } return DD_OK; @@ -265,7 +270,13 @@ HRESULT __stdcall ddraw_surface_Flip(IDirectDrawSurfaceImpl *This, LPDIRECTDRAWS WaitForSingleObject(ddraw->render.ev, INFINITE); } else - SwitchToThread(); + { + if (ddraw->sleep > 0) + Sleep(ddraw->sleep); + else + SwitchToThread(); + } + } return DD_OK;