Fixed rom loading crash; init DirectDraw on statup

This commit is contained in:
pagefault
2001-06-04 04:18:16 +00:00
parent 917506854f
commit 673d04beb3

View File

@@ -36,9 +36,9 @@ extern "C" {
DWORD WindowWidth = 256; DWORD WindowWidth = 256;
DWORD WindowHeight = 224; DWORD WindowHeight = 224;
DWORD FullScreen = 0; DWORD FullScreen=0;
DWORD PrevFull=0;
DWORD Moving= 0; DWORD Moving=0;
DWORD SoundBufferSize=1024*18; DWORD SoundBufferSize=1024*18;
DWORD FirstSound=1; DWORD FirstSound=1;
@@ -1525,9 +1525,10 @@ void initwinvideo(void)
AdjustWindowRectEx( &rc1,GetWindowLong( hMainWindow, GWL_STYLE ), AdjustWindowRectEx( &rc1,GetWindowLong( hMainWindow, GWL_STYLE ),
GetMenu( hMainWindow ) != NULL, GetWindowLong( hMainWindow, GWL_EXSTYLE ) ); GetMenu( hMainWindow ) != NULL, GetWindowLong( hMainWindow, GWL_EXSTYLE ) );
GetClientRect( hMainWindow, &rc1 ); GetClientRect(hMainWindow, &rcWindow);
ClientToScreen( hMainWindow, ( LPPOINT )&rc1 ); ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow);
ClientToScreen( hMainWindow, ( LPPOINT )&rc1 + 1 ); ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow + 1);
// return; // return;
// sprintf(WinMessage,"FirstVid!=1 end\n\0"); // sprintf(WinMessage,"FirstVid!=1 end\n\0");
// MessageBox (NULL, WinMessage, "Init", MB_ICONERROR ); // MessageBox (NULL, WinMessage, "Init", MB_ICONERROR );
@@ -1568,6 +1569,8 @@ void initwinvideo(void)
hMainWindow = CreateWindow( "ZSNESWIN", WinName, WS_VISIBLE|WS_POPUP,X,Y, //WS_OVERLAPPED "ZSNESWIN" hMainWindow = CreateWindow( "ZSNESWIN", WinName, WS_VISIBLE|WS_POPUP,X,Y, //WS_OVERLAPPED "ZSNESWIN"
WindowWidth,WindowHeight,NULL,NULL,hInst,NULL); WindowWidth,WindowHeight,NULL,NULL,hInst,NULL);
if (FullScreen == 0) InitDirectDraw();
CheckPriority(); CheckPriority();
CheckAlwaysOnTop(); CheckAlwaysOnTop();
@@ -1583,14 +1586,19 @@ void initwinvideo(void)
TestJoy(); TestJoy();
} }
if (PrevFull == 1)
{
PrevFull = 0;
ReleaseDirectDraw();
InitDirectDraw();
}
if (FullScreen == 1) { PrevFull = 1; InitDirectDraw(); }
if (Moving == 1) return; if (Moving == 1) return;
if (FullScreen == 0 || newmode == 1) if (FullScreen == 0 || newmode == 1)
{ {
if (InitDirectDraw() != TRUE)
{
exit(1);
}
if (newmode) clearwin(); if (newmode) clearwin();
} }
} }