mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Fix sticky keys due to loading screens
Fix infinite loop/hang after an assertion failure git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1113 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1613,9 +1613,15 @@ void DequeueAllKeyBoardEvents()
|
|||||||
|
|
||||||
|
|
||||||
//dequeue all the events waiting in the windows queue
|
//dequeue all the events waiting in the windows queue
|
||||||
while( PeekMessage( &KeyMessage, ghWindow, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) );
|
//Give them proper processing like the old window hook method used to.
|
||||||
|
while( PeekMessage( &KeyMessage, ghWindow, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE ) )
|
||||||
|
{
|
||||||
|
TranslateMessage( &KeyMessage);
|
||||||
|
DispatchMessage( &KeyMessage);
|
||||||
|
}
|
||||||
|
|
||||||
//Deque all the events waiting in the SGP queue
|
//Now deque all the events waiting in the SGP queue
|
||||||
|
//Including those that were just posted in the code above
|
||||||
while (DequeueEvent(&InputEvent) == TRUE)
|
while (DequeueEvent(&InputEvent) == TRUE)
|
||||||
{
|
{
|
||||||
//dont do anything
|
//dont do anything
|
||||||
|
|||||||
@@ -1743,6 +1743,12 @@ void RefreshScreen(void *DummyVariable)
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, 0, 0, gpFrameBuffer, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, 0, 0, gpFrameBuffer, (LPRECT)&Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion error lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
if (ReturnCode == DDERR_SURFACELOST)
|
||||||
@@ -2133,6 +2139,12 @@ void RefreshScreen(void *DummyVariable)
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(gMouseCursorBackground[CURRENT_MOUSE_DATA].pSurface, gMouseCursorBackground[CURRENT_MOUSE_DATA].usLeft, gMouseCursorBackground[CURRENT_MOUSE_DATA].usTop, gpBackBuffer, &Region, DDBLTFAST_NOCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(gMouseCursorBackground[CURRENT_MOUSE_DATA].pSurface, gMouseCursorBackground[CURRENT_MOUSE_DATA].usLeft, gMouseCursorBackground[CURRENT_MOUSE_DATA].usTop, gpBackBuffer, &Region, DDBLTFAST_NOCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2156,6 +2168,12 @@ void RefreshScreen(void *DummyVariable)
|
|||||||
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseXPos, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseYPos, gpMouseCursor, &Region, DDBLTFAST_SRCCOLORKEY);
|
ReturnCode = IDirectDrawSurface2_SGPBltFast(gpBackBuffer, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseXPos, gMouseCursorBackground[CURRENT_MOUSE_DATA].usMouseYPos, gpMouseCursor, &Region, DDBLTFAST_SRCCOLORKEY);
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
{
|
{
|
||||||
|
// Prevent the assertion failure lockup
|
||||||
|
if (ReturnCode == DDERR_INVALIDRECT)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user