MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / doMainLoop

Function doMainLoop

source/sdl/singleThreaded/mainloop.cpp:47–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46extern int allocatedRamPages;
47bool doMainLoop() {
48 bool shouldQuit = false;
49
50 while (KSystem::getProcessCount()>0 && !shouldQuit) {
51 bool ran = runSlice();
52 U32 t;
53
54 BOXEDWINE_RECORDER_RUN_SLICE();
55 if (!KNativeSystem::getCurrentInput()->processEvents()) {
56 shouldQuit = true;
57 break;
58 }
59 KNativeSystem::tick();
60#if !defined(BOXEDWINE_DISABLE_UI) && !defined(__TEST)
61 if (uiIsRunning()) {
62 uiLoop();
63 }
64#endif
65 t = KSystem::getMilliesSinceStart();
66
67 if (KSystem::killTime) {
68 if (KSystem::killTime <= t) {
69 KSystem::killTime = 0;
70 KSystem::killTime2 = KSystem::getMilliesSinceStart() + 30000;
71 KNativeSystem::forceShutdown();
72 }
73 }
74 if (KSystem::killTime2) {
75 if (KSystem::killTime2 <= t) {
76 klog("Forced Shutdown failed, now doing a hard exit");
77 return true;
78 }
79 }
80 if (lastTitleUpdate+5000 < t) {
81 lastTitleUpdate = t;
82 if (KSystem::title.length()) {
83 KNativeSystem::getScreen()->setTitle(KSystem::title);
84 } else {
85 BString title = B("BoxedWine " BOXEDWINE_VERSION_DISPLAY );
86 title.append(" MIPS");
87 title.append(getMIPS());
88 title.append(" : ");
89 title.append(getSize(allocatedRamPages));
90 KNativeSystem::getScreen()->setTitle(title);
91 }
92 }
93 if (ran) {
94 checkWaitingNativeSockets(0);
95 } else {
96 if (KSystem::getRunningProcessCount()==0) {
97 break;
98 }
99 if (!checkWaitingNativeSockets(20)) {
100 KNativeThread::sleep(20);
101 }
102 }
103 }
104 return true;

Callers

nothing calls this directly

Calls 12

runSliceFunction · 0.85
uiIsRunningFunction · 0.85
uiLoopFunction · 0.85
klogFunction · 0.85
BFunction · 0.85
getMIPSFunction · 0.85
processEventsMethod · 0.80
getSizeFunction · 0.70
lengthMethod · 0.45
setTitleMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected