From 142a1a392fb41f9d26932943f6df904505b55e8f Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 15 Jun 2022 20:48:02 -0400 Subject: [PATCH] input-rec: wire up changes to the rest of the project --- pcsx2-qt/MainWindow.ui | 12 ++++++++++++ pcsx2/CDVD/CDVD.cpp | 16 +++++++++++++++- pcsx2/Counters.cpp | 19 +++++++++++++++++-- pcsx2/Frontend/CommonHotkeys.cpp | 4 ++-- pcsx2/VMManager.cpp | 6 ++++++ 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/pcsx2-qt/MainWindow.ui b/pcsx2-qt/MainWindow.ui index 0aa4d4e0a0..9cf49ce8dd 100644 --- a/pcsx2-qt/MainWindow.ui +++ b/pcsx2-qt/MainWindow.ui @@ -762,21 +762,33 @@ + + false + New + + false + Play + + false + Stop + + false + Settings diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 617ef121aa..42807ca5ca 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -841,7 +841,7 @@ void cdvdReset() // If we are recording, always use the same RTC setting // for games that use the RTC to seed their RNG -- this is very important to be the same everytime! -#ifndef DISABLE_RECORDING +#ifndef PCSX2_CORE if (g_InputRecording.IsActive()) { Console.WriteLn("Input Recording Active - Using Constant RTC of 04-03-2020 (DD-MM-YYYY)"); @@ -855,6 +855,20 @@ void cdvdReset() cdvd.RTC.year = 20; } else +#else + if (g_InputRecording.isActive()) + { + Console.WriteLn("Input Recording Active - Using Constant RTC of 04-03-2020 (DD-MM-YYYY)"); + // Why not just 0 everything? Some games apparently require the date to be valid in terms of when + // the PS2 / Game actually came out. (MGS3). So set it to a value well beyond any PS2 game's release date. + cdvd.RTC.second = 0; + cdvd.RTC.minute = 0; + cdvd.RTC.hour = 0; + cdvd.RTC.day = 4; + cdvd.RTC.month = 3; + cdvd.RTC.year = 20; + } + else #endif { // CDVD internally uses GMT+9. If you think the time's wrong, you're wrong. diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 3b5ea37925..cd0f10f6a7 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -36,13 +36,13 @@ #ifndef PCSX2_CORE #include "gui/App.h" +#include "Recording/InputRecordingControls.h" #else #include "PAD/Host/PAD.h" +#include "Recording/InputRecording.h" #include "VMManager.h" #endif -#include "Recording/InputRecordingControls.h" - using namespace Threading; extern u8 psxhblankgate; @@ -612,7 +612,14 @@ static __fi void VSyncStart(u32 sCycle) { // It is imperative that any frame locking that must happen occurs before Vsync is started // Not doing so would sacrifice a frame of a savestate-based recording when loading any savestate +#ifndef PCSX2_CORE g_InputRecordingControls.HandlePausingAndLocking(); +#else + if (g_InputRecording.isActive()) + { + g_InputRecording.handleExceededFrameCounter(); + } +#endif } #ifdef PCSX2_CORE @@ -674,10 +681,18 @@ static __fi void GSVSync() static __fi void VSyncEnd(u32 sCycle) { +#ifndef PCSX2_CORE if (EmuConfig.EnableRecordingTools) { g_InputRecordingControls.CheckPauseStatus(); } +#else + if (EmuConfig.EnableRecordingTools && g_InputRecording.isActive()) + { + g_InputRecording.getControls().processControlQueue(); + g_InputRecording.incFrameCounter(); + } +#endif if(EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) SysTrace.EE.Counters.Write( " ================ EE COUNTER VSYNC END (frame: %d) ================", g_FrameCount ); diff --git a/pcsx2/Frontend/CommonHotkeys.cpp b/pcsx2/Frontend/CommonHotkeys.cpp index 94179b37ec..ce387af13a 100644 --- a/pcsx2/Frontend/CommonHotkeys.cpp +++ b/pcsx2/Frontend/CommonHotkeys.cpp @@ -24,7 +24,7 @@ #include "Host.h" #include "HostDisplay.h" #include "IconsFontAwesome5.h" -#include "Recording/InputRecordingControls.h" +#include "Recording/InputRecording.h" #include "VMManager.h" #ifdef ENABLE_ACHIEVEMENTS @@ -202,7 +202,7 @@ DEFINE_HOTKEY("ResetVM", "System", "Reset Virtual Machine", [](s32 pressed) { }) DEFINE_HOTKEY("InputRecToggleMode", "System", "Toggle Input Recording Mode", [](s32 pressed) { if (!pressed && VMManager::HasValidVM()) - g_InputRecordingControls.RecordModeToggle(); + g_InputRecording.getControls().toggleRecordMode(); }) DEFINE_HOTKEY("PreviousSaveStateSlot", "Save States", "Select Previous Save Slot", [](s32 pressed) { diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 6c5b1acf0d..fdad287137 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -60,6 +60,8 @@ #include "IconsFontAwesome5.h" +#include "Recording/InputRecording.h" + #include "common/emitter/tools.h" #ifdef _M_X86 #include "common/emitter/x86_intrin.h" @@ -1177,6 +1179,10 @@ bool VMManager::DoLoadState(const char* filename) SaveState_UnzipFromDisk(filename); UpdateRunningGame(false, false); Host::OnSaveStateLoaded(filename, true); + if (g_InputRecording.isActive()) + { + g_InputRecording.handleLoadingSavestate(); + } return true; } catch (Exception::BaseException& e)