mirror of https://github.com/PCSX2/pcsx2.git
Qt: Implement pause on start
This commit is contained in:
parent
63163737c2
commit
dedb1e0c80
|
@ -114,7 +114,18 @@ void EmuThread::startVM(std::shared_ptr<VMBootParameters> boot_params)
|
||||||
if (!VMManager::Initialize(*boot_params))
|
if (!VMManager::Initialize(*boot_params))
|
||||||
return;
|
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();
|
m_event_loop->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,6 +620,21 @@ void EmuThread::onDisplayWindowResized(int width, int height, float scale)
|
||||||
|
|
||||||
void EmuThread::onDisplayWindowFocused() {}
|
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<void()>& func)
|
void EmuThread::runOnCPUThread(const std::function<void()>& func)
|
||||||
{
|
{
|
||||||
func();
|
func();
|
||||||
|
|
|
@ -146,6 +146,7 @@ private Q_SLOTS:
|
||||||
void doBackgroundControllerPoll();
|
void doBackgroundControllerPoll();
|
||||||
void onDisplayWindowResized(int width, int height, float scale);
|
void onDisplayWindowResized(int width, int height, float scale);
|
||||||
void onDisplayWindowFocused();
|
void onDisplayWindowFocused();
|
||||||
|
void redrawDisplayWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QThread* m_ui_thread;
|
QThread* m_ui_thread;
|
||||||
|
|
|
@ -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."));
|
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
|
// Not yet used, disable the options
|
||||||
m_ui.pauseOnStart->setDisabled(true);
|
|
||||||
m_ui.pauseOnFocusLoss->setDisabled(true);
|
m_ui.pauseOnFocusLoss->setDisabled(true);
|
||||||
m_ui.language->setDisabled(true);
|
m_ui.language->setDisabled(true);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
#include "common/Timer.h"
|
#include "common/Timer.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
|
||||||
|
#ifdef PCSX2_CORE
|
||||||
|
#include "imgui_internal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Counters.h"
|
#include "Counters.h"
|
||||||
#include "Frontend/ImGuiManager.h"
|
#include "Frontend/ImGuiManager.h"
|
||||||
|
@ -198,6 +202,9 @@ void ImGuiManager::NewFrame()
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
#ifdef PCSX2_CORE
|
#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_keyboard.store(io.WantCaptureKeyboard, std::memory_order_relaxed);
|
||||||
s_imgui_wants_mouse.store(io.WantCaptureMouse, std::memory_order_release);
|
s_imgui_wants_mouse.store(io.WantCaptureMouse, std::memory_order_release);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue