Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
input-rec: wire up changes to the rest of the project
  • Loading branch information
xTVaser authored and refractionpcsx2 committed Nov 27, 2022
1 parent c98b90a commit 142a1a3
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
12 changes: 12 additions & 0 deletions pcsx2-qt/MainWindow.ui
Expand Up @@ -762,21 +762,33 @@
</property>
</action>
<action name="actionInputRecNew">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>New</string>
</property>
</action>
<action name="actionInputRecPlay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Play</string>
</property>
</action>
<action name="actionInputRecStop">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Stop</string>
</property>
</action>
<action name="actionInputRecOpenSettings">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Settings</string>
</property>
Expand Down
16 changes: 15 additions & 1 deletion pcsx2/CDVD/CDVD.cpp
Expand Up @@ -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)");
Expand All @@ -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.
Expand Down
19 changes: 17 additions & 2 deletions pcsx2/Counters.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions pcsx2/Frontend/CommonHotkeys.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions pcsx2/VMManager.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 142a1a3

Please sign in to comment.