| 693 | } |
| 694 | |
| 695 | void MainWindow::recreate() |
| 696 | { |
| 697 | destroySubWindows(); |
| 698 | |
| 699 | const bool was_display_created = m_display_created; |
| 700 | if (was_display_created) |
| 701 | { |
| 702 | g_emu_thread->setSurfaceless(true); |
| 703 | while (m_display_surface || !g_emu_thread->isSurfaceless()) |
| 704 | QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); |
| 705 | |
| 706 | m_display_created = false; |
| 707 | } |
| 708 | |
| 709 | // We need to close input sources, because e.g. DInput uses our window handle. |
| 710 | g_emu_thread->closeInputSources(); |
| 711 | |
| 712 | close(); |
| 713 | g_main_window = nullptr; |
| 714 | |
| 715 | MainWindow* new_main_window = new MainWindow(); |
| 716 | pxAssert(g_main_window == new_main_window); |
| 717 | new_main_window->initialize(); |
| 718 | new_main_window->refreshGameList(false, false); |
| 719 | new_main_window->show(); |
| 720 | deleteLater(); |
| 721 | |
| 722 | // Recreate log window as well. Then make sure we're still on top. |
| 723 | LogWindow::updateSettings(); |
| 724 | new_main_window->raise(); |
| 725 | new_main_window->activateWindow(); |
| 726 | |
| 727 | // Reload the sources we just closed. |
| 728 | g_emu_thread->applySettings(); |
| 729 | |
| 730 | if (was_display_created) |
| 731 | { |
| 732 | g_emu_thread->setSurfaceless(false); |
| 733 | g_main_window->updateEmulationActions(false, s_vm_valid, false); |
| 734 | g_main_window->onFullscreenUIStateChange(g_emu_thread->isRunningFullscreenUI()); |
| 735 | } |
| 736 | |
| 737 | if (s_vm_valid) |
| 738 | g_emu_thread->updatePerformanceMetrics(true); |
| 739 | } |
| 740 | |
| 741 | void MainWindow::recreateSettings() |
| 742 | { |
nothing calls this directly
no test coverage detected