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

add "sleep" setting for CnC1

This commit is contained in:
FunkyFr3sh 2018-09-11 14:20:40 +02:00
parent 77ac049c41
commit 79fe86062f
4 changed files with 16 additions and 3 deletions

View File

@ -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

View File

@ -98,6 +98,7 @@ typedef struct IDirectDrawImpl
char shader[MAX_PATH];
BOOL autorenderer;
BOOL wine;
int sleep;
} IDirectDrawImpl;

View File

@ -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);

View File

@ -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;