Move critical section to main ddraw, fix shadow window bug when exiting fullscreen
This commit is contained in:
parent
40f196bc8f
commit
fdf8395dd1
4 changed files with 23 additions and 19 deletions
21
main.c
21
main.c
|
@ -139,21 +139,25 @@ HRESULT __stdcall ddraw_Initialize(IDirectDrawImpl *This, GUID *a)
|
|||
HRESULT __stdcall ddraw_RestoreDisplayMode(IDirectDrawImpl *This)
|
||||
{
|
||||
printf("DirectDraw::RestoreDisplayMode(This=%p)\n", This);
|
||||
|
||||
if(!This->render.run)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&This->cs);
|
||||
This->render.run = FALSE;
|
||||
LeaveCriticalSection(&This->cs);
|
||||
|
||||
WaitForSingleObject(This->render.thread, INFINITE);
|
||||
This->render.thread = NULL;
|
||||
|
||||
if(!ddraw->windowed)
|
||||
{
|
||||
This->mode.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT|DM_DISPLAYFLAGS|DM_DISPLAYFREQUENCY|DM_POSITION;
|
||||
ChangeDisplaySettings(&This->mode, 0);
|
||||
}
|
||||
|
||||
This->render.run = FALSE;
|
||||
WaitForSingleObject(This->render.thread, INFINITE);
|
||||
This->render.thread = NULL;
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
@ -165,6 +169,7 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
|
|||
{
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
This->render.run = TRUE;
|
||||
|
||||
/* currently we only support 8 bit modes */
|
||||
|
@ -429,11 +434,17 @@ ULONG __stdcall ddraw_Release(IDirectDrawImpl *This)
|
|||
{
|
||||
if(This->render.run)
|
||||
{
|
||||
EnterCriticalSection(&This->cs);
|
||||
|
||||
This->render.run = FALSE;
|
||||
WaitForSingleObject(This->render.thread, INFINITE);
|
||||
This->render.thread = NULL;
|
||||
|
||||
LeaveCriticalSection(&This->cs);
|
||||
}
|
||||
|
||||
DeleteCriticalSection(&This->cs);
|
||||
|
||||
/* restore old wndproc, subsequent ddraw creation will otherwise fail */
|
||||
SetWindowLong(This->hWnd, GWL_WNDPROC, (LONG)This->WndProc);
|
||||
//free(This);
|
||||
|
@ -520,6 +531,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
|||
return DDERR_GENERIC;
|
||||
}
|
||||
|
||||
InitializeCriticalSection(&This->cs);
|
||||
|
||||
/* load configuration options from ddraw.ini */
|
||||
char cwd[MAX_PATH];
|
||||
char ini_path[MAX_PATH];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue