mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-09-08 07:54:25 +00:00
A more elegant exit from the 'restart' loop (when SysClk fails to init)
This commit is contained in:
parent
e295bbb0b3
commit
094d872723
@ -288,12 +288,11 @@ void EnterMessageLoop ()
|
||||
{
|
||||
MSG message;
|
||||
|
||||
PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE);
|
||||
PeekMessage(&message, NULL, 0, 0, PM_NOREMOVE);
|
||||
|
||||
while (message.message!=WM_QUIT)
|
||||
{
|
||||
// while (GetMessage(&message,0,0,0))
|
||||
if (PeekMessage( &message, NULL, 0, 0, PM_REMOVE))
|
||||
if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
@ -304,37 +303,35 @@ void EnterMessageLoop ()
|
||||
{
|
||||
if (message.message == WM_QUIT)
|
||||
return;
|
||||
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
}
|
||||
else if (g_nAppMode == MODE_STEPPING)
|
||||
{
|
||||
DebugContinueStepping();
|
||||
}
|
||||
else
|
||||
{
|
||||
ContinueExecution();
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
{
|
||||
if (g_bFullSpeed)
|
||||
ContinueExecution();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
{
|
||||
DebuggerUpdate();
|
||||
}
|
||||
else if (g_nAppMode == MODE_LOGO)
|
||||
{
|
||||
Sleep(100); // Stop process hogging CPU
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// while (PeekMessage(&message,0,0,0,PM_REMOVE))
|
||||
// ; // intentional null statement
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void GetProgramDirectory () {
|
||||
GetModuleFileName((HINSTANCE)0,g_sProgramDir,MAX_PATH);
|
||||
@ -619,9 +616,9 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
//-----
|
||||
|
||||
// Initialize COM
|
||||
// . NB. DSInit() is done when g_hFrameWindow is created (WM_CREATE)
|
||||
CoInitialize( NULL );
|
||||
bool bSysClkOK = SysClk_InitTimer();
|
||||
// DSInit(); // Done when g_hFrameWindow is created (WM_CREATE)
|
||||
|
||||
// DO ONE-TIME INITIALIZATION
|
||||
g_hInstance = passinstance;
|
||||
@ -663,7 +660,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
if (!bSysClkOK)
|
||||
{
|
||||
MessageBox(g_hFrameWindow, "DirectX failed to create SystemClock instance", TEXT("AppleWin Error"), MB_OK);
|
||||
break;
|
||||
PostMessage(g_hFrameWindow, WM_DESTROY, 0, 0); // Close everything down
|
||||
}
|
||||
|
||||
tfe_init();
|
||||
|
@ -529,7 +529,7 @@ LRESULT CALLBACK FrameWndProc (
|
||||
VideoDestroy();
|
||||
MB_Destroy();
|
||||
DeleteGdiObjects();
|
||||
PostQuitMessage(0);
|
||||
PostQuitMessage(0); // Post WM_QUIT message to the thread's message queue
|
||||
break;
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
|
Loading…
Reference in New Issue
Block a user