mirror of https://github.com/PCSX2/pcsx2.git
patches/cheats: document "place" value and use it explicitly
This commit doesn't change any behavior, but documents the "places" value of the patch structure ("place" is 1 in patch=1,... and 0 in patch=0,...) and also uses an enum to make its use explicit.
This commit is contained in:
parent
67aee8a19c
commit
eb1e890278
|
@ -362,7 +362,7 @@ namespace PatchFunc
|
|||
}
|
||||
|
||||
// This is for applying patches directly to memory
|
||||
void ApplyPatch(int place)
|
||||
void ApplyPatch(patch_place_type place)
|
||||
{
|
||||
for (int i = 0; i < patchnumber; i++)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ void ApplyPatch(int place)
|
|||
}
|
||||
|
||||
// This is for applying cheats directly to memory
|
||||
void ApplyCheat(int place)
|
||||
void ApplyCheat(patch_place_type place)
|
||||
{
|
||||
for (int i = 0; i < cheatnumber; i++)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,28 @@ enum patch_data_type {
|
|||
EXTENDED_T
|
||||
};
|
||||
|
||||
// "place" is the first number at a pnach line (patch=<place>,...), e.g.:
|
||||
// - patch=1,EE,001110e0,word,00000000 <-- place is 1
|
||||
// - patch=0,EE,0010BC88,word,48468800 <-- place is 0
|
||||
// In PCSX2 it indicates how/when/where the patch line should be applied. If
|
||||
// place is not one of the supported values then the patch line is never applied.
|
||||
// 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)
|
||||
// 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
|
||||
};
|
||||
|
||||
typedef void PATCHTABLEFUNC( const wxString& text1, const wxString& text2 );
|
||||
|
||||
struct IniPatch
|
||||
|
@ -67,8 +89,8 @@ extern void inifile_trim(wxString& buffer);
|
|||
extern int InitPatches(const wxString& name, const Game_Data& game);
|
||||
extern int AddPatch(int Mode, int Place, int Address, int Size, u64 data);
|
||||
extern void ResetPatch(void);
|
||||
extern void ApplyPatch(int place = 1);
|
||||
extern void ApplyCheat(int place = 1);
|
||||
extern void ApplyPatch(patch_place_type place);
|
||||
extern void ApplyCheat(patch_place_type place);
|
||||
extern void _ApplyPatch(IniPatch *p);
|
||||
|
||||
extern const IConsoleWriter *PatchesCon;
|
||||
|
|
|
@ -147,7 +147,7 @@ void SysCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
if( src == EmuConfig ) return;
|
||||
|
||||
if( !pxAssertDev( IsPaused(), "CoreThread is not paused; settings cannot be applied." ) ) return;
|
||||
|
||||
|
||||
m_resetRecompilers = ( src.Cpu != EmuConfig.Cpu ) || ( src.Gamefixes != EmuConfig.Gamefixes ) || ( src.Speedhacks != EmuConfig.Speedhacks );
|
||||
m_resetProfilers = ( src.Profiler != EmuConfig.Profiler );
|
||||
m_resetVsyncTimers = ( src.GS != EmuConfig.GS );
|
||||
|
@ -228,9 +228,9 @@ void SysCoreThread::DoCpuReset()
|
|||
//
|
||||
void SysCoreThread::VsyncInThread()
|
||||
{
|
||||
if (EmuConfig.EnablePatches) ApplyPatch();
|
||||
if (EmuConfig.EnableCheats) ApplyCheat();
|
||||
if (EmuConfig.EnableWideScreenPatches) ApplyCheat();
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(PPT_CONTINUOUSLY);
|
||||
if (EmuConfig.EnableCheats) ApplyCheat(PPT_CONTINUOUSLY);
|
||||
if (EmuConfig.EnableWideScreenPatches) ApplyCheat(PPT_CONTINUOUSLY);
|
||||
}
|
||||
|
||||
void SysCoreThread::GameStartingInThread()
|
||||
|
@ -241,8 +241,8 @@ void SysCoreThread::GameStartingInThread()
|
|||
symbolMap.UpdateActiveSymbols();
|
||||
sApp.PostAppMethod(&Pcsx2App::resetDebugger);
|
||||
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(0);
|
||||
if (EmuConfig.EnableCheats) ApplyCheat(0);
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(PPT_ONCE_ON_LOAD);
|
||||
if (EmuConfig.EnableCheats) ApplyCheat(PPT_ONCE_ON_LOAD);
|
||||
}
|
||||
|
||||
bool SysCoreThread::StateCheckInThread()
|
||||
|
|
|
@ -483,7 +483,7 @@ static void recReserveCache()
|
|||
if (m_ConfiguredCacheReserve < 16) break;
|
||||
m_ConfiguredCacheReserve /= 2;
|
||||
}
|
||||
|
||||
|
||||
recMem->ThrowIfNotOk();
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ static void recAlloc()
|
|||
{
|
||||
recRAMCopy = (u8*)_aligned_malloc(Ps2MemSize::MainRam, 4096);
|
||||
}
|
||||
|
||||
|
||||
if (!recRAM)
|
||||
{
|
||||
recLutReserve_RAM = (u8*)_aligned_malloc(recLutSize, 4096);
|
||||
|
@ -1618,8 +1618,8 @@ static void __fastcall recRecompile( const u32 startpc )
|
|||
// First tentative was to call eeGameStarting directly (not through the
|
||||
// recompiler) but it crashes some games (GT4, DMC3). It is either a
|
||||
// thread issue or linked to the various components reset.
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(0);
|
||||
if (EmuConfig.EnableCheats) ApplyCheat(0);
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(PPT_ONCE_ON_LOAD);
|
||||
if (EmuConfig.EnableCheats) ApplyCheat(PPT_ONCE_ON_LOAD);
|
||||
}
|
||||
|
||||
g_branch = 0;
|
||||
|
@ -2099,7 +2099,7 @@ R5900cpu recCpu =
|
|||
recThrowException,
|
||||
recThrowException,
|
||||
recClear,
|
||||
|
||||
|
||||
recGetCacheReserve,
|
||||
recSetCacheReserve,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue