diff --git a/pcsx2-gsrunner/Main.cpp b/pcsx2-gsrunner/Main.cpp index cfb61e74cb0f5..ffa89abc04df8 100644 --- a/pcsx2-gsrunner/Main.cpp +++ b/pcsx2-gsrunner/Main.cpp @@ -707,7 +707,7 @@ int main(int argc, char* argv[]) return EXIT_SUCCESS; } -void Host::VSyncOnCPUThread() +void Host::PumpMessagesOnCPUThread() { // update GS thread copy of frame number MTGS::RunOnGSThread([frame_number = GSDumpReplayer::GetFrameNumber()]() { s_dump_frame_number = frame_number; }); diff --git a/pcsx2-qt/QtHost.cpp b/pcsx2-qt/QtHost.cpp index ef3d00bd1f705..8fc16565d14dc 100644 --- a/pcsx2-qt/QtHost.cpp +++ b/pcsx2-qt/QtHost.cpp @@ -1122,7 +1122,7 @@ void Host::OnCreateMemoryCardOpenRequested() emit g_emu_thread->onCreateMemoryCardOpenRequested(); } -void Host::VSyncOnCPUThread() +void Host::PumpMessagesOnCPUThread() { g_emu_thread->getEventLoop()->processEvents(QEventLoop::AllEvents); } diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 47e8fbb40117c..062aa1746613e 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -498,6 +498,9 @@ static __fi void VSyncStart(u32 sCycle) gsPostVsyncStart(); // MUST be after framelimit; doing so before causes funk with frame times! + // Poll input after MTGS frame push, just in case it has to stall to catch up. + VMManager::Internal::PollInputOnCPUThread(); + if (EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) SysTrace.EE.Counters.Write(" ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount); diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index c04dc869601b4..a7f6be821e852 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -2484,11 +2484,13 @@ void VMManager::Internal::VSyncOnCPUThread() Achievements::FrameUpdate(); PollDiscordPresence(); +} +void VMManager::Internal::PollInputOnCPUThread() +{ + Host::PumpMessagesOnCPUThread(); InputManager::PollSources(); - Host::VSyncOnCPUThread(); - if (EmuConfig.EnableRecordingTools) { // This code is called _before_ Counter's vsync end, and _after_ vsync start diff --git a/pcsx2/VMManager.h b/pcsx2/VMManager.h index 5090a9929869f..9afa4470938b7 100644 --- a/pcsx2/VMManager.h +++ b/pcsx2/VMManager.h @@ -272,6 +272,7 @@ namespace VMManager void ELFLoadingOnCPUThread(std::string elf_path); void EntryPointCompilingOnCPUThread(); void VSyncOnCPUThread(); + void PollInputOnCPUThread(); } // namespace Internal } // namespace VMManager @@ -317,5 +318,5 @@ namespace Host const std::string& disc_serial, u32 disc_crc, u32 current_crc); /// Provided by the host; called once per frame at guest vsync. - void VSyncOnCPUThread(); + void PumpMessagesOnCPUThread(); } // namespace Host diff --git a/tests/ctest/core/StubHost.cpp b/tests/ctest/core/StubHost.cpp index 23ea03336f510..b6f66e5db1a57 100644 --- a/tests/ctest/core/StubHost.cpp +++ b/tests/ctest/core/StubHost.cpp @@ -169,7 +169,7 @@ void Host::RequestVMShutdown(bool allow_confirm, bool allow_save_state, bool def { } -void Host::VSyncOnCPUThread() +void Host::PumpMessagesOnCPUThread() { }