From 86ed9f68f6d2a9237306df7205526a7ffb851d85 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Mon, 17 Aug 2020 01:39:01 +0200 Subject: [PATCH] PNACH: combined patch effects --- pcsx2/Patch.h | 11 +++++++++++ pcsx2/System/SysCoreThread.cpp | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index bedec07c9c..27f23ae875 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -61,9 +61,20 @@ enum patch_data_type { // PCSX2 currently supports the following values: // 0 - apply the patch line once on game boot/startup // 1 - apply the patch line continuously (technically - on every vsync) +// 2 - effect of 0 and 1 combined, see below +// Note: +// - while it may seem that a value of 1 does the same as 0, but also later +// continues to apply the patch on every vsync - it's not. +// The current (and past) behavior is that these patches are applied at different +// places at the code, and it's possible, depending on circumstances, that 0 patches +// will get applied before the first vsync and therefore earlier than 1 patches. +// - There's no "place" value which indicates to apply both once on startup +// and then also continuously, however such behavior can be achieved by +// duplicating the line where one has a 0 place and the other has a 1 place. enum patch_place_type { PPT_ONCE_ON_LOAD = 0, PPT_CONTINUOUSLY = 1, + PPT_COMBINED_0_1 = 2, _PPT_END_MARKER }; diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index 4b2d891695..b15d16a2e4 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -245,6 +245,7 @@ void SysCoreThread::DoCpuReset() void SysCoreThread::VsyncInThread() { ApplyLoadedPatches(PPT_CONTINUOUSLY); + ApplyLoadedPatches(PPT_COMBINED_0_1); } void SysCoreThread::GameStartingInThread() @@ -256,7 +257,7 @@ void SysCoreThread::GameStartingInThread() sApp.PostAppMethod(&Pcsx2App::resetDebugger); ApplyLoadedPatches(PPT_ONCE_ON_LOAD); - ApplyLoadedPatches(PPT_CONTINUOUSLY); + ApplyLoadedPatches(PPT_COMBINED_0_1); #ifdef USE_SAVESLOT_UI_UPDATES UI_UpdateSysControls(); #endif