| 45 | } |
| 46 | extern int allocatedRamPages; |
| 47 | bool 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; |
nothing calls this directly
no test coverage detected