diff --git a/pcsx2-qt/EmuThread.cpp b/pcsx2-qt/EmuThread.cpp index a2f7fea0bf..43247b6e4b 100644 --- a/pcsx2-qt/EmuThread.cpp +++ b/pcsx2-qt/EmuThread.cpp @@ -114,7 +114,18 @@ void EmuThread::startVM(std::shared_ptr boot_params) if (!VMManager::Initialize(*boot_params)) return; - VMManager::SetState(VMState::Running); + if (!Host::GetBoolSettingValue("UI", "StartPaused", false)) + { + // This will come back and call OnVMResumed(). + VMManager::SetState(VMState::Running); + } + else + { + // When starting paused, redraw the window, so there's at least something there. + redrawDisplayWindow(); + Host::OnVMPaused(); + } + m_event_loop->quit(); } @@ -609,6 +620,21 @@ void EmuThread::onDisplayWindowResized(int width, int height, float scale) void EmuThread::onDisplayWindowFocused() {} +void EmuThread::redrawDisplayWindow() +{ + if (!isOnEmuThread()) + { + QMetaObject::invokeMethod(this, &EmuThread::redrawDisplayWindow, Qt::QueuedConnection); + return; + } + + // If we're running, we're going to re-present anyway. + if (!VMManager::HasValidVM() || VMManager::GetState() == VMState::Running) + return; + + GetMTGS().RunOnGSThread([]() { GetMTGS().PresentCurrentFrame(); }); +} + void EmuThread::runOnCPUThread(const std::function& func) { func(); diff --git a/pcsx2-qt/EmuThread.h b/pcsx2-qt/EmuThread.h index cefdb2a2b8..bd0ee0dcd1 100644 --- a/pcsx2-qt/EmuThread.h +++ b/pcsx2-qt/EmuThread.h @@ -146,6 +146,7 @@ private Q_SLOTS: void doBackgroundControllerPoll(); void onDisplayWindowResized(int width, int height, float scale); void onDisplayWindowFocused(); + void redrawDisplayWindow(); private: QThread* m_ui_thread; diff --git a/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp b/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp index cdb15182a6..b78b14c5d2 100644 --- a/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp +++ b/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp @@ -117,7 +117,6 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsDialog* dialog, QWidget tr("Hides the main window (with the game list) when a game is running, requires Render To Separate Window to be enabled.")); // Not yet used, disable the options - m_ui.pauseOnStart->setDisabled(true); m_ui.pauseOnFocusLoss->setDisabled(true); m_ui.language->setDisabled(true); diff --git a/pcsx2/Frontend/ImGuiManager.cpp b/pcsx2/Frontend/ImGuiManager.cpp index 50c7d6d268..b58fcbeb90 100644 --- a/pcsx2/Frontend/ImGuiManager.cpp +++ b/pcsx2/Frontend/ImGuiManager.cpp @@ -27,6 +27,10 @@ #include "common/Timer.h" #include "imgui.h" +#ifdef PCSX2_CORE +#include "imgui_internal.h" +#endif + #include "Config.h" #include "Counters.h" #include "Frontend/ImGuiManager.h" @@ -198,6 +202,9 @@ void ImGuiManager::NewFrame() ImGui::NewFrame(); #ifdef PCSX2_CORE + // Disable nav input on the implicit (Debug##Default) window. Otherwise we end up requesting keyboard + // focus when there's nothing there. We use GetCurrentWindowRead() because otherwise it'll make it visible. + ImGui::GetCurrentWindowRead()->Flags |= ImGuiWindowFlags_NoNavInputs; s_imgui_wants_keyboard.store(io.WantCaptureKeyboard, std::memory_order_relaxed); s_imgui_wants_mouse.store(io.WantCaptureMouse, std::memory_order_release); #endif