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

make real ddraw fully optional (keep old XP workaround..)

This commit is contained in:
FunkyFr3sh 2018-11-13 07:29:48 +01:00
parent 45ceb74df2
commit eced18d01f
2 changed files with 6 additions and 17 deletions

View File

@ -53,7 +53,7 @@ void DrawFrameInfoStart()
DWORD tick_start = timeGetTime();
if (tick_start >= tick_fps)
{
snprintf(
_snprintf(
debugText,
sizeof(debugText),
"FPS: %lu | Time: %2.2f ms ",

View File

@ -1323,12 +1323,10 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
if(ddraw)
{
/* FIXME: check the calling module before passing the call! */
return ddraw->DirectDrawCreate(lpGUID, lplpDD, pUnkOuter);
if (ddraw->DirectDrawCreate)
return ddraw->DirectDrawCreate(lpGUID, lplpDD, pUnkOuter);
/*
printf(" returning DDERR_DIRECTDRAWALREADYCREATED\n");
return DDERR_DIRECTDRAWALREADYCREATED;
*/
}
IDirectDrawImpl *This = (IDirectDrawImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawImpl));
@ -1343,19 +1341,10 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
if (!This->real_dll)
This->real_dll = LoadLibrary("system32\\ddraw.dll");
if(!This->real_dll)
if(This->real_dll && !This->DirectDrawCreate)
{
ddraw_Release(This);
return DDERR_GENERIC;
}
This->DirectDrawCreate =
(HRESULT (WINAPI *)(GUID FAR*, LPDIRECTDRAW FAR*, IUnknown FAR*))GetProcAddress(This->real_dll, "DirectDrawCreate");
if(!This->DirectDrawCreate)
{
ddraw_Release(This);
return DDERR_GENERIC;
This->DirectDrawCreate =
(HRESULT(WINAPI *)(GUID FAR*, LPDIRECTDRAW FAR*, IUnknown FAR*))GetProcAddress(This->real_dll, "DirectDrawCreate");
}
InitializeCriticalSection(&This->cs);