From 9788887ff040f4356a1fd412cc8efb0ecc5bc877 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Sat, 19 Jul 2003 22:13:38 +0000 Subject: [PATCH] HQ3X updates and fixes [MaxSt] --- zsnes/src/win/winlink.cpp | 43 ++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/zsnes/src/win/winlink.cpp b/zsnes/src/win/winlink.cpp index af1d7075..e70d045a 100644 --- a/zsnes/src/win/winlink.cpp +++ b/zsnes/src/win/winlink.cpp @@ -273,14 +273,14 @@ void DrawScreen() { if (FullScreen == 1) { - DDBLTFX ddbltfx; + if ((DD_Primary != NULL) && (DD_BackBuffer != NULL)) + { + if (DD_BackBuffer->Blt(&rcWindow, DD_CFB, &BlitArea, DDBLT_WAIT, NULL) == DDERR_SURFACELOST) + DD_Primary->Restore(); - ddbltfx.dwSize = sizeof(ddbltfx); - ddbltfx.dwFillColor = 0; - - DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ); - DD_BackBuffer->Blt(&rcWindow, DD_CFB, &BlitArea, DDBLT_WAIT, NULL); - DD_Primary->Flip(NULL, DDFLIP_WAIT); + if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) + DD_Primary->Restore(); + } } else { @@ -1589,6 +1589,7 @@ extern BYTE GUIDSMODE[]; extern BYTE GUIHQ3X[]; extern unsigned short resolutn; void clearwin(); +void clear_display(); char WinName[]={"ZSNESW\0"}; @@ -1936,6 +1937,7 @@ void initwinvideo(void) FirstVid = 0; InitDirectDraw(); clearwin(); + clear_display(); return; } @@ -1946,6 +1948,7 @@ void initwinvideo(void) ReleaseDirectDraw(); InitDirectDraw(); clearwin(); + clear_display(); return; } @@ -2169,6 +2172,32 @@ void clearwin() UnlockSurface(); } +void clear_display() +{ + if ((DD_Primary != NULL) && (DD_BackBuffer != NULL)) + { + DDBLTFX ddbltfx; + + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) + DD_Primary->Restore(); + + if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) + DD_Primary->Restore(); + + if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) + DD_Primary->Restore(); + + if (DD_Primary->Flip(NULL, DDFLIP_WAIT) == DDERR_SURFACELOST) + DD_Primary->Restore(); + + if (DD_BackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx ) == DDERR_SURFACELOST) + DD_Primary->Restore(); + } +} + extern void DrawWin256x224x16(); extern void DrawWin256x224x16MB(); extern void DrawWin256x224x32();