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

#29 Sierra's City Building series support (Caesar III, Pharaoh and Zeus)

This commit is contained in:
FunkyFr3sh 2020-09-24 10:29:18 +02:00
parent e839dc791c
commit 3aed2239ab
3 changed files with 35 additions and 5 deletions

View File

@ -132,6 +132,7 @@ typedef struct IDirectDrawImpl
BOOL accurateTimers; BOOL accurateTimers;
BOOL resizable; BOOL resizable;
BOOL ddrawrefcount0; BOOL ddrawrefcount0;
BOOL forcewmmove;
BOOL bnetActive; BOOL bnetActive;
BOOL bnetWasFullscreen; BOOL bnetWasFullscreen;
BOOL bnetWasUpscaled; BOOL bnetWasUpscaled;

View File

@ -513,7 +513,7 @@ HRESULT __stdcall ddraw_GetCaps(IDirectDrawImpl *This, LPDDCAPS lpDDDriverCaps,
HRESULT __stdcall ddraw_GetDisplayMode(IDirectDrawImpl *This, LPDDSURFACEDESC a) HRESULT __stdcall ddraw_GetDisplayMode(IDirectDrawImpl *This, LPDDSURFACEDESC a)
{ {
printf("??? DirectDraw::GetDisplayMode(This=%p, ...)\n", This); printf("??? DirectDraw::GetDisplayMode(This=%p, ...)\n", This);
return DD_OK; return DDERR_UNSUPPORTEDMODE;
} }
HRESULT __stdcall ddraw_GetFourCCCodes(IDirectDrawImpl *This, LPDWORD a, LPDWORD b) HRESULT __stdcall ddraw_GetFourCCCodes(IDirectDrawImpl *This, LPDWORD a, LPDWORD b)
@ -957,6 +957,9 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
This->render.thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)This->renderer, NULL, 0, NULL); This->render.thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)This->renderer, NULL, 0, NULL);
} }
if (ddraw->forcewmmove)
PostMessageA(ddraw->hWnd, WM_MOVE, 0, MAKELPARAM(-32000, -32000));
return DD_OK; return DD_OK;
} }
@ -1376,6 +1379,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!ddraw->handlemouse) if (!ddraw->handlemouse)
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
if (ddraw->forcewmmove)
{
lParam = 0;
break;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */ return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
} }
@ -1779,7 +1788,13 @@ ULONG __stdcall ddraw_Release(IDirectDrawImpl *This)
} }
if (This->renderer == render_d3d9_main) if (This->renderer == render_d3d9_main)
{
Direct3D9_Release(); Direct3D9_Release();
}
else if (!ddraw->windowed)
{
ChangeDisplaySettings(&This->mode, 0);
}
} }
if(This->render.hDC) if(This->render.hDC)

View File

@ -44,6 +44,7 @@ void Settings_Load()
ddraw->accurateTimers = GetBool("accuratetimers", FALSE); ddraw->accurateTimers = GetBool("accuratetimers", FALSE);
ddraw->resizable = GetBool("resizable", TRUE); ddraw->resizable = GetBool("resizable", TRUE);
ddraw->ddrawrefcount0 = GetBool("ddrawrefcount0", FALSE); // Twisted Metal 2 DirectDraw Error hack ddraw->ddrawrefcount0 = GetBool("ddrawrefcount0", FALSE); // Twisted Metal 2 DirectDraw Error hack
ddraw->forcewmmove = GetBool("forcewmmove", FALSE); // Sierra Caesar III, Pharaoh, and Zeus hack
WindowRect.right = GetInt("width", 0); WindowRect.right = GetInt("width", 0);
WindowRect.bottom = GetInt("height", 0); WindowRect.bottom = GetInt("height", 0);
@ -274,10 +275,6 @@ 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: To workaround tearing/stuttering problems, set maxfps 1 lower than screen refresh rate (59 for flip games)\n"
"accuratetimers=false\n"
"\n"
"; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n" "; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n"
"singlecpu=true\n" "singlecpu=true\n"
"\n" "\n"
@ -450,6 +447,23 @@ static void CreateSettingsIni()
"handlemouse=false\n" "handlemouse=false\n"
"ddrawrefcount0=true\n" "ddrawrefcount0=true\n"
"\n" "\n"
"; Caesar III\n"
"[c3]\n"
"handlemouse=false\n"
"forcewmmove=true\n"
"\n"
"; Pharaoh\n"
"[Pharaoh]\n"
"handlemouse=false\n"
"forcewmmove=true\n"
"\n"
"; Master of Olympus - Zeus\n"
"[Zeus]\n"
"handlemouse=false\n"
"forcewmmove=true\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
, fh); , fh);
fclose(fh); fclose(fh);