| 176 | } |
| 177 | |
| 178 | void EmuThread::stopFullscreenUI() |
| 179 | { |
| 180 | if (!isOnEmuThread()) |
| 181 | { |
| 182 | QMetaObject::invokeMethod(this, &EmuThread::stopFullscreenUI, Qt::QueuedConnection); |
| 183 | |
| 184 | // wait until the host display is gone |
| 185 | // have to test the bool, because MTGS::IsOpen() goes false as soon as the close request happens. |
| 186 | while (m_run_fullscreen_ui.load(std::memory_order_acquire) || (!QtHost::IsVMValid() && MTGS::IsOpen())) |
| 187 | QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); |
| 188 | |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | setFullscreen(false, true); |
| 193 | |
| 194 | if (MTGS::IsOpen() && !VMManager::HasValidVM()) |
| 195 | MTGS::WaitForClose(); |
| 196 | |
| 197 | if (m_run_fullscreen_ui.load(std::memory_order_acquire)) |
| 198 | { |
| 199 | m_run_fullscreen_ui.store(false, std::memory_order_release); |
| 200 | emit onFullscreenUIStateChange(false); |
| 201 | |
| 202 | // Resume and refresh background when FullscreenUI exits |
| 203 | QMetaObject::invokeMethod(g_main_window, "updateGameListBackground", Qt::QueuedConnection); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | void EmuThread::startVM(std::shared_ptr<VMBootParameters> boot_params) |
| 208 | { |
no test coverage detected