MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / EnterMessageLoop

Function EnterMessageLoop

source/Windows/AppleWin.cpp:293–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291//===========================================================================
292
293void EnterMessageLoop(void)
294{
295 MSG message;
296
297 PeekMessage(&message, NULL, 0, 0, PM_NOREMOVE);
298
299 while (message.message!=WM_QUIT)
300 {
301 if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
302 {
303 TranslateMessage(&message);
304 DispatchMessage(&message);
305
306 while ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))
307 {
308 if (PeekMessage(&message,0,0,0,PM_REMOVE))
309 {
310 if (message.message == WM_QUIT)
311 return;
312
313 TranslateMessage(&message);
314 DispatchMessage(&message);
315 }
316 else if (g_nAppMode == MODE_STEPPING)
317 {
318 DebugContinueStepping();
319 }
320 else
321 {
322 ContinueExecution();
323 if (g_nAppMode != MODE_DEBUG)
324 {
325 if (g_bFullSpeed)
326 ContinueExecution();
327 }
328 }
329 }
330 }
331 else
332 {
333 if (g_nAppMode == MODE_DEBUG)
334 DebuggerUpdate();
335 else if (g_nAppMode == MODE_PAUSED)
336 Sleep(1); // Stop process hogging CPU - 1ms, as need to fade-out speaker sound buffer
337 else if (g_nAppMode == MODE_LOGO)
338 Sleep(1); // Stop process hogging CPU (NB. don't delay for too long otherwise key input can be slow in other apps - GH#569)
339 }
340 }
341}
342
343//===========================================================================
344

Callers 1

WinMainFunction · 0.85

Calls 3

DebugContinueSteppingFunction · 0.85
ContinueExecutionFunction · 0.85
DebuggerUpdateFunction · 0.85

Tested by

no test coverage detected