diff --git a/.gitignore b/.gitignore index e08224536f31e..d52f0cd58634a 100644 --- a/.gitignore +++ b/.gitignore @@ -74,7 +74,7 @@ oprofile_data/ /bin/bios /bin/cache /bin/cheats -/bin/patches +#/bin/patches /bin/covers /bin/dumps /bin/gamesettings diff --git a/README.md b/README.md index 8121fbaa9784a..4282364acc41c 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,17 @@ If you have any changes that you think would improve the emulator but would get - Included 'Sanity' in the application's name at most places. - Reworked the auto-updater. It no longer relies on the PCSX2 website, instead it now relies only on GitHub. This gives us full independence. - Integrated memory-increasing changes from the [128MB Build](https://github.com/xTVaser/pcsx2-rr/tree/128mb-build) of PCSX2, which means that we have 128MB EE memory now. This shouldn't impact games that don't use it. -- If a 'DRIVERS\FIREWIRE.IRX' or a 'DISKINFO.BIN' file exists on the disc, then it will be treated as the main ELF for booting and CRC purposes. If neither are found, the old behaviour will be used (looking up 'SYSTEM.CNF' and getting ELF path from there). This had to be done because in Jak pre-release builds, the "official" ELF is just a loader for these files, and this loader is usually fully identical between different pre-release builds of the same Jak game, which means they also have same CRC, making patches and everything impossible. But the FIREWIRE.IRX and DISKINFO.BIN files are (almost always) unique, allowing us to uniquely identify these builds. +- If a 'DRIVERS\FIREWIRE.IRX' or a 'DISKINFO.BIN' file exists on the disc, then it will be treated as the main ELF for booting and CRC purposes. If neither are found, the old behaviour will be used (looking up 'SYSTEM.CNF' and getting ELF path from there). This had to be done because in Jak pre-release builds, the "official" ELF is just a loader for these files, and this loader is usually fully identical between different pre-release builds of the same Jak game, which means they also have same CRC, making patches and everything impossible. But the FIREWIRE.IRX and DISKINFO.BIN files are (almost always) unique, allowing us to uniquely identify these builds. A nice side-effect of booting these files directly is that we completely avoid the WIBU protection. - Assign serial code 'X' to ISOs where we treat FIREWIRE.IRX or DISKINFO.BIN as the main ELF. Because per-game settings for some reason don't work if the serial is empty. - GitHub releases for the project are no longer automatic. I think manual is better for a project like this. +- Each release can now have a message that will appear for users in the auto updater window. The commit list will still be there as well. +- Added a 'Enable TOOL Mode' toggle. Basically patch segregation. When a Jak game is booted in Debug Mode, the memory changes significantly. This means that patches made for the game running in normal mode corrupt the game when running in debug mode. When TOOL Mode is enabled, the emulator will auto-load patches with 'TOOL' label. It will also attempt to load patches with 'Widescreen 16:9 TOOL' and 'No-Interlacing TOOL' labels instead of their TOOL-less counterparts, but only if all other conditions are met (for example the setting that force-loads widescreen patches). +- When you look at the patches of a game, normally it doesn't indicate whether a patch would get auto-loaded due to global settings or not. Now there is an indicator for this - if a patch will get loaded due to global settings, it will be highlighted in green in the list. This is especially useful if you want to have a clear picture when you are using the patch segregation features. +- Imported and reworked the Jak Debug Mode patches from the [128MB Build](https://github.com/xTVaser/pcsx2-rr/tree/128mb-build) (the author field was filled where it was determinable, otherwise it was left empty - please contact me if there are any mistakes in this), and also added some new ones. These will automatically load when TOOL Mode is enabled. ### Plans/TODO: -- Invent a way to quickly toggle between "TOOL Mode" and normal mode, and maybe also separate the patches somehow. When a Jak game is booted in Debug Mode, the memory changes significantly. So patches made for the game running in normal mode would likely corrupt the game when running in debug mode. -- Add the Jak debug mode pnach files. Need to rework them a bit for the new pnach format. - Properly get the serial even if we use FIREWIRE.IRX or DISKINFO.BIN as main ELF for an ISO. - Prevent non-labelled patches. This is PCSX2-Sanity, we can expect our users to adapt their pnach files. In most cases they just have to add one line to the top of the file. -- Make the release notes of the repository customizable, instead of always using the last commit description. And here is the parent's README: diff --git a/bin/patches/.gitignore b/bin/patches/.gitignore new file mode 100644 index 0000000000000..13b659c1b7c4e --- /dev/null +++ b/bin/patches/.gitignore @@ -0,0 +1,2 @@ +*3A84D099* +*C20596DB* \ No newline at end of file diff --git a/bin/patches/SCED-51700_F41C1B29_Jak2junedemoPAL_DebugMode.pnach b/bin/patches/SCED-51700_F41C1B29_Jak2junedemoPAL_DebugMode.pnach new file mode 100644 index 0000000000000..320648bba3c2d --- /dev/null +++ b/bin/patches/SCED-51700_F41C1B29_Jak2junedemoPAL_DebugMode.pnach @@ -0,0 +1,32 @@ +[TOOL] +gametitle=Jak II: Renegade [Demo] - (PAL)(SCED-51700) +author=Luminar +description=Makes the game boot in Debug Mode. You will spawn in the void. Use the Debug Menu to escape. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making this pnach. +comment=You will spawn in the void. Use the Debug Menu to escape. + +// NOP Disabling MasterDebug +patch=0,EE,00100400,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100408,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108930,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,001031dc,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 + +// Change DebugBootMessage from `demo` to `play`. +patch=0,EE,00127610,word,79616c70 + +// The level that the game wants to load on startup with 'play' DebugBootMessage is missing. Getting around this problem with DebugBootLevel is not a correct solution, since it modifies how the game looks for DGO files - making most levels unreachable. +// It is possible to tell the game to load a different DGO instead of the missing one. The patches below will make the game load 'DEMO.DGO' instead of 'PRI.DGO'. +// This is the only level that it wants on startup - the game will work fine now, but you will spawn in the void. Just use the Debug Menu to escape. +patch=1,EE,0087AB78,word,6f6d6564 \ No newline at end of file diff --git a/bin/patches/SCES-50361_9C712FF0_JakTPLpal_DebugMode.pnach b/bin/patches/SCES-50361_9C712FF0_JakTPLpal_DebugMode.pnach new file mode 100644 index 0000000000000..364a657fe0d72 --- /dev/null +++ b/bin/patches/SCES-50361_9C712FF0_JakTPLpal_DebugMode.pnach @@ -0,0 +1,11 @@ +[TOOL] +gametitle=Jak and Daxter: The Precursor Legacy - (PAL-M6) - (SCES-50361) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making the patch for this game build. + +// NOP Disabling DebugSegment +patch=0,EE,00100290,word,00000000 +// NOP Disabling MasterDebug +patch=0,EE,0010029c,word,00000000 diff --git a/bin/patches/SCES-51608_2479F4A9_Jak2pal_DebugMode.pnach b/bin/patches/SCES-51608_2479F4A9_Jak2pal_DebugMode.pnach new file mode 100644 index 0000000000000..43f35008d483a --- /dev/null +++ b/bin/patches/SCES-51608_2479F4A9_Jak2pal_DebugMode.pnach @@ -0,0 +1,23 @@ +[TOOL] +gametitle=Jak II: Renegade - (PAL-M7)(SCES-51608) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making the patch for this game build. + +// NOP Disabling MasterDebug +patch=0,EE,001003f8,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100400,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108d88,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,00103364,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 \ No newline at end of file diff --git a/bin/patches/SCES-52460_12804727_Jak3pal_DebugMode.pnach b/bin/patches/SCES-52460_12804727_Jak3pal_DebugMode.pnach new file mode 100644 index 0000000000000..e0a0d97921f02 --- /dev/null +++ b/bin/patches/SCES-52460_12804727_Jak3pal_DebugMode.pnach @@ -0,0 +1,23 @@ +[TOOL] +gametitle=Jak 3 - (PAL-M7)(SCES-52460) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits in Jak 1/2. ELF edits for Jak 3 figured out by xTVaser. +comment=Credits to Luminar Light for making the patch for this game build. + +// NOP Disabling MasterDebug +patch=0,EE,00100404,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100408,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00109998,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,0010372c,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 diff --git a/bin/patches/SCES_53286_DF659E77_JakXpal_DebugMode.pnach b/bin/patches/SCES_53286_DF659E77_JakXpal_DebugMode.pnach new file mode 100644 index 0000000000000..1bbc8e41d3624 --- /dev/null +++ b/bin/patches/SCES_53286_DF659E77_JakXpal_DebugMode.pnach @@ -0,0 +1,68 @@ +[TOOL] +gametitle=Jak X (PAL)(SCES-53286) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to Luminar for making the patch for this build. +comment=Special thanks to water111 and Vaser for their relevant research done for earlier Jak games. It helped make this possible. + +//---// The following patches are on the "ELF side". //---// +// The ELF of Jak X is encrypted/packed/compressed (not sure which). It unpacks itself while booting. So analyzing it is a bit more difficult, but doable if you use a memory dump. +// If you want to patch the "early part" of memory, you should add condition (E-type extended) patches to ensure you only write after the unpacking is done. + +// nop the disabling of MasterDebug, this will make MasterDebug stay 1 +// Edit: We don't actually need this, and I couldn't find a way to make the game work with MasterDebug on. So this patch is commented out for now, but kept here for reference. +//patch=1,EE,00266884,word,00000000 + +// nop the disabling of DebugSegment, this will make DebugSegment stay 1 +patch=1,EE,0026688c,word,00000000 +// nop the disabling of DebugSymbols, this will make DebugSymbols stay 1 +patch=1,EE,00266898,word,00000000 + +// The following patch was copied from Jak 3's patches (found the same thing in Jak X), but since it only matters with MasterDebug, we can comment it out. +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +//patch=1,EE,00270470,word,00000000 + +// Extra console logs. Very useful. +// The E-type patch is needed because writing the patch too early causes weird problems, preventing us from booting the game. +patch=1,EE,E00027D2,extended,00282EC1 +patch=1,EE,001EDA00,extended,00000001 + +// nop the weird function call in InitMachine that returns something but we don't use it because I rewrote the init heap function calls. +patch=1,EE,0026a054,word,00000000 + +// Change malloc param to 0x10, because it is like that in Jak 3 and it works. +patch=1,EE,0026a064,word,24040010 + +// Rewrite init heap function call for global heap. +patch=1,EE,0026a0d4,word,8e04bb40 +patch=1,EE,0026a0d8,word,3c0604d2 +patch=1,EE,0026a0dc,word,34c609a0 +patch=1,EE,0026a0e0,word,00402825 +patch=1,EE,0026a0e4,word,0c096e30 +patch=1,EE,0026a0e8,word,00000000 + +// Rewrite init heap function call for debug heap. +patch=1,EE,0026a10c,word,3c0f0026 +patch=1,EE,0026a110,word,3c0602f0 +patch=1,EE,0026a114,word,8de4bb44 +patch=1,EE,0026a118,word,00000000 +patch=1,EE,0026a11c,word,0c096e30 +patch=1,EE,0026a120,word,3c050500 + +// This was copied straight from the Jak 3 patches (I found the same place in Jak X). +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=1,EE,002665d4,word,3c1d0800 + +//---// The following patches are on the "GOAL side". //---// + +// Make 'read-sound-info-tweaks' unable to get stuck in a while loop, by ruining the loop itself. +// This is needed to be able to boot the game in "debug mode". Without this patch, the game will get stuck forever, after printing "reading sound info ..." twice. +patch=1,EE,067a69b4,word,00000000 + +// Make 'set-blackout-frames' always act as if the parameter was 0. The other branch will never be called. +// This gets rid of the (sometimes infinite) blackout you get when using Game... Continue... to warp to a continue-point. +patch=1,EE,00ad3834,word,00000000 \ No newline at end of file diff --git a/bin/patches/SCPS-15021_EDE4FE64_JakTPLntscj_DebugMode.pnach b/bin/patches/SCPS-15021_EDE4FE64_JakTPLntscj_DebugMode.pnach new file mode 100644 index 0000000000000..4ea61c10c1655 --- /dev/null +++ b/bin/patches/SCPS-15021_EDE4FE64_JakTPLntscj_DebugMode.pnach @@ -0,0 +1,11 @@ +[TOOL] +gametitle=Jak x Daxter: Kyuusekai no Isan - (NTSC-J) - (SCPS-15021) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making the patch for this game build. + +// NOP Disabling DebugSegment +patch=0,EE,0010028c,word,00000000 +// NOP Disabling MasterDebug +patch=0,EE,00100298,word,00000000 diff --git a/bin/patches/SCPS-15057_B4976DAF_Jak2ntscj_DebugMode.pnach b/bin/patches/SCPS-15057_B4976DAF_Jak2ntscj_DebugMode.pnach new file mode 100644 index 0000000000000..fb6100ce591d7 --- /dev/null +++ b/bin/patches/SCPS-15057_B4976DAF_Jak2ntscj_DebugMode.pnach @@ -0,0 +1,28 @@ +[TOOL] +gametitle=Jak II - (NTSC-J)(SCPS-15057) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits + +// NOP Disabling MasterDebug +patch=0,EE,001003f8,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100400,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108cd0,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,001032bc,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 + +// Example - Changing the Starting Level, Disabled by Default +// Load halfpipe level by default - "halfpipe" BigEndian - 68 61 6c 66 | 70 69 70 65 +// LittleEndian: +//patch=0,EE,00127f10,word,666C6168 +//patch=0,EE,00127f14,word,65706970 \ No newline at end of file diff --git a/bin/patches/SCUS-97124_1B3976AB_JakTPLntscv1_DebugMode.pnach b/bin/patches/SCUS-97124_1B3976AB_JakTPLntscv1_DebugMode.pnach new file mode 100644 index 0000000000000..4dca58f19caab --- /dev/null +++ b/bin/patches/SCUS-97124_1B3976AB_JakTPLntscv1_DebugMode.pnach @@ -0,0 +1,10 @@ +[TOOL] +gametitle=Jak and Daxter - The Precursor Legacy - (U) - (SCUS-97124) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits + +// NOP Disabling DebugSegment +patch=0,EE,00100290,word,00000000 +// NOP Disabling MasterDebug +patch=0,EE,0010029c,word,00000000 diff --git a/bin/patches/SCUS-97124_472E7699_JakTPLntscv2_DebugMode.pnach b/bin/patches/SCUS-97124_472E7699_JakTPLntscv2_DebugMode.pnach new file mode 100644 index 0000000000000..4dca58f19caab --- /dev/null +++ b/bin/patches/SCUS-97124_472E7699_JakTPLntscv2_DebugMode.pnach @@ -0,0 +1,10 @@ +[TOOL] +gametitle=Jak and Daxter - The Precursor Legacy - (U) - (SCUS-97124) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits + +// NOP Disabling DebugSegment +patch=0,EE,00100290,word,00000000 +// NOP Disabling MasterDebug +patch=0,EE,0010029c,word,00000000 diff --git a/bin/patches/SCUS-97265_9184AAF1_Jak2ntsc_DebugMode.pnach b/bin/patches/SCUS-97265_9184AAF1_Jak2ntsc_DebugMode.pnach new file mode 100644 index 0000000000000..012026dba8ea1 --- /dev/null +++ b/bin/patches/SCUS-97265_9184AAF1_Jak2ntsc_DebugMode.pnach @@ -0,0 +1,28 @@ +[TOOL] +gametitle=Jak II - (U)(SCUS-97265) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits + +// NOP Disabling MasterDebug +patch=0,EE,001003f8,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100400,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108cd0,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,001032bc,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 + +// Example - Changing the Starting Level, Disabled by Default +// Load halfpipe level by default - "halfpipe" BigEndian - 68 61 6c 66 | 70 69 70 65 +// LittleEndian: +//patch=0,EE,00127f10,word,666C6168 +//patch=0,EE,00127f14,word,65706970 \ No newline at end of file diff --git a/bin/patches/SCUS-97273_A2034C69_Jak2marchdemoNTSC_DebugMode.pnach b/bin/patches/SCUS-97273_A2034C69_Jak2marchdemoNTSC_DebugMode.pnach new file mode 100644 index 0000000000000..ce91b99dc8f26 --- /dev/null +++ b/bin/patches/SCUS-97273_A2034C69_Jak2marchdemoNTSC_DebugMode.pnach @@ -0,0 +1,33 @@ +[TOOL] +gametitle=Jak II [Demo] - (U)(SCUS-97273) +author=Luminar +description=Makes the game boot in Debug Mode. You will spawn in the void. Use the Debug Menu to escape. +comment=Enables Developer/Debug Mode - Credit to water111 and Vaser for discovering / documenting the required ELF edits for the Jak 2 Demo. +comment=Thanks to Luminar Light for figuring out how to get around the missing level problem. +comment=You will spawn in the void. Use the Debug Menu to escape. + +// NOP Disabling MasterDebug +patch=0,EE,001002ec,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,001002f4,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108660,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,00102fac,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,00100068,word,3c1d0800 + +// This changes the DebugBootMessage from `demo` to `play`. +patch=0,EE,00126e10,word,79616c70 + +// The levels that the game wants to load on startup with 'play' DebugBootMessage are missing. Getting around this problem with DebugBootLevel is not a correct solution, since it modifies how the game looks for DGO files - making most levels unreachable. +// It is possible to tell the game to load a different DGO instead of the missing ones. The patches below will make the game load 'DEMO.DGO' instead of 'FEA.DGO' and 'PRI.DGO'. +// These are the only two levels that it wants on startup - the game will work fine now, but you will spawn in the void. Just use the Debug Menu to escape. +patch=1,EE,0077BB18,word,6f6d6564 +patch=1,EE,0077C1B8,word,6f6d6564 \ No newline at end of file diff --git a/bin/patches/SCUS-97330_644CFD03_Jak3ntsc_DebugMode.pnach b/bin/patches/SCUS-97330_644CFD03_Jak3ntsc_DebugMode.pnach new file mode 100644 index 0000000000000..9d145573bca03 --- /dev/null +++ b/bin/patches/SCUS-97330_644CFD03_Jak3ntsc_DebugMode.pnach @@ -0,0 +1,22 @@ +[TOOL] +gametitle=Jak 3 - (U)(SCUS-97330) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits in Jak 1/2. ELF edits for Jak 3 figured out by xTVaser. + +// NOP Disabling MasterDebug +patch=0,EE,00100404,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100408,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,001098f0,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,00103694,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 diff --git a/bin/patches/SCUS-97429_3091E6FB_JakXntscv1_DebugMode.pnach b/bin/patches/SCUS-97429_3091E6FB_JakXntscv1_DebugMode.pnach new file mode 100644 index 0000000000000..a16057a530fcc --- /dev/null +++ b/bin/patches/SCUS-97429_3091E6FB_JakXntscv1_DebugMode.pnach @@ -0,0 +1,68 @@ +[TOOL] +gametitle=Jak X: Combat Racing (NTSC)(SCES-53286) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to Luminar for making the patch for this build. +comment=Special thanks to water111 and Vaser for their relevant research done for earlier Jak games. It helped make this possible. + +//---// The following patches are on the "ELF side". //---// +// The ELF of Jak X is encrypted/packed/compressed (not sure which). It unpacks itself while booting. So analyzing it is a bit more difficult, but doable if you use a memory dump. +// If you want to patch the "early part" of memory, you should add condition (E-type extended) patches to ensure you only write after the unpacking is done. + +// nop the disabling of MasterDebug, this will make MasterDebug stay 1 +// Edit: We don't actually need this, and I couldn't find a way to make the game work with MasterDebug on. So this patch is commented out for now, but kept here for reference. +//patch=1,EE,00266884,word,00000000 + +// nop the disabling of DebugSegment, this will make DebugSegment stay 1 +patch=1,EE,0026688c,word,00000000 +// nop the disabling of DebugSymbols, this will make DebugSymbols stay 1 +patch=1,EE,00266898,word,00000000 + +// The following patch was copied from Jak 3's patches (found the same thing in Jak X), but since it only matters with MasterDebug, we can comment it out. +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +//patch=1,EE,002703e0,word,00000000 + +// Extra console logs. Very useful. +// The E-type patch is recommended because writing the patch too early can cause weird problems in other builds, so it is safe to have it in this one as well (though not essential). +patch=1,EE,E00027D1,extended,00282DC1 +patch=1,EE,001EDA00,extended,00000001 + +// nop the weird function call in InitMachine that returns something but we don't use it because I rewrote the init heap function calls. +patch=1,EE,00269fd0,word,00000000 + +// Change malloc param to 0x10, because it is like that in Jak 3 and it works. +patch=1,EE,00269fe0,word,24040010 + +// Rewrite init heap function call for global heap. +patch=1,EE,0026a050,word,8e04bb40 +patch=1,EE,0026a054,word,3c0604d2 +patch=1,EE,0026a058,word,34c60aa0 +patch=1,EE,0026a05c,word,00402825 +patch=1,EE,0026a060,word,0c096e30 +patch=1,EE,0026a064,word,00000000 + +// Rewrite init heap function call for debug heap. +patch=1,EE,0026a088,word,3c0f0026 +patch=1,EE,0026a08c,word,3c0602f0 +patch=1,EE,0026a090,word,8de4bb44 +patch=1,EE,0026a094,word,00000000 +patch=1,EE,0026a098,word,0c096e30 +patch=1,EE,0026a09c,word,3c050500 + +// This was copied straight from the Jak 3 patches (I found the same place in Jak X). +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=1,EE,002665d4,word,3c1d0800 + +//---// The following patches are on the "GOAL side". //---// + +// Make 'read-sound-info-tweaks' unable to get stuck in a while loop, by ruining the loop itself. +// This is needed to be able to boot the game in "debug mode". Without this patch, the game will get stuck forever, after printing "reading sound info ..." twice. +patch=1,EE,067a67a4,word,00000000 + +// Make 'set-blackout-frames' always act as if the parameter was 0. The other branch will never be called. +// This gets rid of the (sometimes infinite) blackout you get when using Game... Continue... to warp to a continue-point. +patch=1,EE,00ad36b4,word,00000000 \ No newline at end of file diff --git a/bin/patches/SCUS-97429_DBA28C59_JakXntscv2_DebugMode.pnach b/bin/patches/SCUS-97429_DBA28C59_JakXntscv2_DebugMode.pnach new file mode 100644 index 0000000000000..665d7667dd808 --- /dev/null +++ b/bin/patches/SCUS-97429_DBA28C59_JakXntscv2_DebugMode.pnach @@ -0,0 +1,68 @@ +[TOOL] +gametitle=Jak X: Combat Racing [Greatest Hits] (NTSC)(SCUS-97429) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to Luminar for making the patch for this build. +comment=Special thanks to water111 and Vaser for their relevant research done for earlier Jak games. It helped make this possible. + +//---// The following patches are on the "ELF side". //---// +// The ELF of Jak X is encrypted/packed/compressed (not sure which). It unpacks itself while booting. So analyzing it is a bit more difficult, but doable if you use a memory dump. +// If you want to patch the "early part" of memory, you should add condition (E-type extended) patches to ensure you only write after the unpacking is done. + +// nop the disabling of MasterDebug, this will make MasterDebug stay 1 +// Edit: We don't actually need this, and I couldn't find a way to make the game work with MasterDebug on. So this patch is commented out for now, but kept here for reference. +//patch=1,EE,00266b04,word,00000000 + +// nop the disabling of DebugSegment, this will make DebugSegment stay 1 +patch=1,EE,00266b0c,word,00000000 +// nop the disabling of DebugSymbols, this will make DebugSymbols stay 1 +patch=1,EE,00266b18,word,00000000 + +// The following patch was copied from Jak 3's patches (found the same thing in Jak X), but since it only matters with MasterDebug, we can comment it out. +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +//patch=1,EE,00270660,word,00000000 + +// Extra console logs. Very useful. +// The E-type patch is recommended because writing the patch too early can cause weird problems in other builds, so it is safe to have it in this one as well (though not essential). +patch=1,EE,E00027D4,extended,00283041 +patch=1,EE,001EDC80,extended,00000001 + +// nop the weird function call in InitMachine that returns something but we don't use it because I rewrote the init heap function calls. +patch=1,EE,0026a250,word,00000000 + +// Change malloc param to 0x10, because it is like that in Jak 3 and it works. +patch=1,EE,0026a260,word,24040010 + +// Rewrite init heap function call for global heap. +patch=1,EE,0026a2d0,word,8e04bdc0 +patch=1,EE,0026a2d4,word,3c0604d2 +patch=1,EE,0026a2d8,word,34c60820 +patch=1,EE,0026a2dc,word,00402825 +patch=1,EE,0026a2e0,word,0c096ed0 +patch=1,EE,0026a2e4,word,00000000 + +// Rewrite init heap function call for debug heap. +patch=1,EE,0026a308,word,3c0f0026 +patch=1,EE,0026a30c,word,3c0602f0 +patch=1,EE,0026a310,word,8de4bdc4 +patch=1,EE,0026a314,word,00000000 +patch=1,EE,0026a318,word,0c096ed0 +patch=1,EE,0026a31c,word,3c050500 + +// This was copied straight from the Jak 3 patches (I found the same place in Jak X). +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=1,EE,00266854,word,3c1d0800 + +//---// The following patches are on the "GOAL side". //---// + +// Make 'read-sound-info-tweaks' unable to get stuck in a while loop, by ruining the loop itself. +// This is needed to be able to boot the game in "debug mode". Without this patch, the game will get stuck forever, after printing "reading sound info ..." twice. +patch=1,EE,067a69b4,word,00000000 + +// Make 'set-blackout-frames' always act as if the parameter was 0. The other branch will never be called. +// This gets rid of the (sometimes infinite) blackout you get when using Game... Continue... to warp to a continue-point. +patch=1,EE,00ad39b4,word,00000000 \ No newline at end of file diff --git a/bin/patches/X_3828BB66_Jak3internalNTSC_DebugMode.pnach b/bin/patches/X_3828BB66_Jak3internalNTSC_DebugMode.pnach new file mode 100644 index 0000000000000..a056afaaedc1b --- /dev/null +++ b/bin/patches/X_3828BB66_Jak3internalNTSC_DebugMode.pnach @@ -0,0 +1,24 @@ +[TOOL] +gametitle=Jak 3 - (U)(SCUS-97330) +//author= +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 and xTVaser for discovering / documenting the required ELF edits +comment=This patch is only intended for the DISKINFO.BIN found in the game prototype folder + +// NOP Disabling MasterDebug +patch=0,EE,001003f4,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,001003f8,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,0010a440,word,00000000 + + +//0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,0010372c,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 \ No newline at end of file diff --git a/bin/patches/X_4FF025AF_Jak2previewPAL_DebugMode.pnach b/bin/patches/X_4FF025AF_Jak2previewPAL_DebugMode.pnach new file mode 100644 index 0000000000000..7442c62d558b8 --- /dev/null +++ b/bin/patches/X_4FF025AF_Jak2previewPAL_DebugMode.pnach @@ -0,0 +1,24 @@ +[TOOL] +gametitle=Jak II: Renegade [July 2003 Preview] (PAL)(SCES-51608) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making the patch for this game build. +comment=You must run FIREWIRE.IRX (DRIVERS folder) for this patch to work. + +// NOP Disabling MasterDebug +patch=0,EE,001003f8,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100400,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108a90,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,0010333c,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 \ No newline at end of file diff --git a/bin/patches/X_A6630572_Jak3previewPAL_DebugMode.pnach b/bin/patches/X_A6630572_Jak3previewPAL_DebugMode.pnach new file mode 100644 index 0000000000000..b815cf47920c2 --- /dev/null +++ b/bin/patches/X_A6630572_Jak3previewPAL_DebugMode.pnach @@ -0,0 +1,24 @@ +[TOOL] +gametitle=Jak 3 [September 2004 Preview] (PAL)(SCES-51608) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits in Jak 1/2. ELF edits for Jak 3 figured out by xTVaser. +comment=Credits to Luminar Light for making the patch for this game build. +comment=You must run DISKINFO.BIN for this patch to work. + +// NOP Disabling MasterDebug +patch=0,EE,00100404,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100408,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00109998,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,0010372c,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 diff --git a/bin/patches/X_C6124FF2_JakTPLoctober19NTSC_DebugMode.pnach b/bin/patches/X_C6124FF2_JakTPLoctober19NTSC_DebugMode.pnach new file mode 100644 index 0000000000000..51e75ac7f43cb --- /dev/null +++ b/bin/patches/X_C6124FF2_JakTPLoctober19NTSC_DebugMode.pnach @@ -0,0 +1,11 @@ +[TOOL] +gametitle=Jak and Daxter: The Precursor Legacy [October 19 2001 Build] (NTSC)(SCUS-97124) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credit to Luminar Light for making the pnach for this build. + +// NOP Disabling DebugSegment +patch=0,EE,00100250,word,00000000 +// NOP Disabling MasterDebug +patch=0,EE,0010025c,word,00000000 diff --git a/bin/patches/X_C71BAB1E_Jak2reviewPAL_DebugMode.pnach b/bin/patches/X_C71BAB1E_Jak2reviewPAL_DebugMode.pnach new file mode 100644 index 0000000000000..a6bbcfb02b32b --- /dev/null +++ b/bin/patches/X_C71BAB1E_Jak2reviewPAL_DebugMode.pnach @@ -0,0 +1,24 @@ +[TOOL] +gametitle=Jak II: Renegade [August 2003 Review] (PAL)(SCES-51608) +author=Luminar +description=Makes the game boot in Debug Mode. +comment=Enables Developer/Debug Mode - Credit to water111 for discovering / documenting the required ELF edits +comment=Credits to Luminar Light for making the patch for this game build. +comment=You must run FIREWIRE.IRX (DRIVERS folder) for this patch to work. + +// NOP Disabling MasterDebug +patch=0,EE,001003f8,word,00000000 +// NOP Disabling DebugSegment +patch=0,EE,00100400,word,00000000 +// NOP SendFromBufferD call in InitListener - This is called only when MasterDebug is on +patch=0,EE,00108d60,word,00000000 + +// 0x4ff0000 for global heap initialization - Set in InitMachine +patch=0,EE,0010333c,word,3c0604ff + +// This is about changing the stack pointer +// Shoves a MIPS instruction into near the very top of the entry point +// Ghidra blows up here, but binary ninja can handle it +// Orginally at this position there is `2D E8 40 00` - `daddu $sp, $v0, $zero` +// This changes it to - `lui sp, 0x0800` Which loads the value 0x0800 to the stackpointer register, modifying it. +patch=0,EE,0010017c,word,3c1d0800 \ No newline at end of file diff --git a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp index d3e0a6600dc69..2473edd659a5f 100644 --- a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp +++ b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp @@ -92,6 +92,8 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsWindow* dialog, QWidget SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hostFilesystem, "EmuCore", "HostFs", false); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.toolMode, "EmuCore", "EnableToolMode", false); + dialog->registerWidgetHelp(m_ui.normalSpeed, tr("Normal Speed"), tr("100%"), tr("Sets the target emulation speed. It is not guaranteed that this speed will be reached, " "and if not, the emulator will run as fast as it can manage.")); @@ -140,6 +142,9 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsWindow* dialog, QWidget "the console's refresh rate is too far from the host's refresh rate. Users with variable refresh rate displays " "should disable this option.")); + dialog->registerWidgetHelp(m_ui.toolMode, tr("Enable TOOL Mode"), tr("Unchecked"), + tr("Will load TOOL patches, but all other patches will be disabled while this is active.")); + updateOptimalFramePacing(); } diff --git a/pcsx2-qt/Settings/EmulationSettingsWidget.ui b/pcsx2-qt/Settings/EmulationSettingsWidget.ui index bea268cbb158c..f0aa3aed0f199 100644 --- a/pcsx2-qt/Settings/EmulationSettingsWidget.ui +++ b/pcsx2-qt/Settings/EmulationSettingsWidget.ui @@ -91,6 +91,13 @@ + + + + Enable TOOL Mode + + + diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp index d10b84a3b125f..eee5b0dcd6ebe 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp @@ -120,9 +120,27 @@ void GamePatchSettingsWidget::reloadList() first = false; } + bool highlight = false; + + // Look at Patch.cpp for the strings manually before changing it here. I am too fool. + if ((pi.name == "Widescreen 16:9" && (EmuConfig.EnableWideScreenPatches && !EmuConfig.EnableToolMode)) || + (pi.name == "Widescreen 16:9 TOOL" && (EmuConfig.EnableWideScreenPatches && EmuConfig.EnableToolMode)) || + (pi.name == "No-Interlacing" && (EmuConfig.EnableNoInterlacingPatches && !EmuConfig.EnableToolMode)) || + (pi.name == "No-Interlacing TOOL" && (EmuConfig.EnableNoInterlacingPatches && EmuConfig.EnableToolMode)) || + (pi.name == "TOOL" && EmuConfig.EnableToolMode)) + { + highlight = true; + } + const bool enabled = (std::find(enabled_list.begin(), enabled_list.end(), pi.name) != enabled_list.end()); GamePatchDetailsWidget* it = new GamePatchDetailsWidget(std::move(pi.name), pi.author, pi.description, enabled, m_dialog, container); + + if (highlight) + { + it->setStyleSheet("background-color:green;"); + } + layout->addWidget(it); } } diff --git a/pcsx2/Config.h b/pcsx2/Config.h index c9b47ed2f88ed..84a20731cc1b8 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -1130,6 +1130,7 @@ struct Pcsx2Config EnablePINE : 1, // enables inter-process communication EnableWideScreenPatches : 1, EnableNoInterlacingPatches : 1, + EnableToolMode : 1, EnableFastBoot : 1, EnableFastBootFastForward : 1, EnablePerGameSettings : 1, diff --git a/pcsx2/ImGui/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp index 7cc24e5d5fe62..b7e66a04283fe 100644 --- a/pcsx2/ImGui/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -3276,6 +3276,8 @@ void FullscreenUI::DrawGraphicsSettingsPage() "EmuCore", "EnableWideScreenPatches", false); DrawToggleSetting(bsi, FSUI_CSTR("Enable No-Interlacing Patches"), FSUI_CSTR("Enables loading no-interlacing patches from pnach files."), "EmuCore", "EnableNoInterlacingPatches", false); + DrawToggleSetting(bsi, FSUI_CSTR("Enable TOOL Mode"), + FSUI_CSTR("Will load TOOL patches, but all other patches will be disabled while this is active."), "EmuCore", "EnableToolMode", false); DrawIntListSetting(bsi, FSUI_CSTR("Bilinear Upscaling"), FSUI_CSTR("Smooths out the image when upscaling the console to the screen."), "EmuCore/GS", "linear_present_mode", static_cast(GSPostBilinearMode::BilinearSharp), s_bilinear_present_options, std::size(s_bilinear_present_options), true); diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 44bb3127e36b7..1c8f111ad99c3 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -164,7 +164,11 @@ namespace Patch // Name of patches which will be auto-enabled based on global options. static constexpr std::string_view WS_PATCH_NAME = "Widescreen 16:9"; static constexpr std::string_view NI_PATCH_NAME = "No-Interlacing"; + static constexpr std::string_view TOOL_PATCH_NAME = "TOOL"; + static constexpr std::string_view TOOL_WS_PATCH_NAME = "Widescreen 16:9 TOOL"; + static constexpr std::string_view TOOL_NI_PATCH_NAME = "No-Interlacing TOOL"; static constexpr std::string_view PATCHES_ZIP_NAME = "patches.zip"; + // These are also in GamePatchSettingsWidget.cpp because I am stupid, please keep in mind. const char* PATCHES_CONFIG_SECTION = "Patches"; const char* CHEATS_CONFIG_SECTION = "Cheats"; @@ -583,7 +587,9 @@ void Patch::ReloadEnabledLists() s_enabled_patches = Host::GetStringListSetting(PATCHES_CONFIG_SECTION, PATCH_ENABLE_CONFIG_KEY); // Name based matching for widescreen/NI settings. - if (EmuConfig.EnableWideScreenPatches) + + // Widescreen patches + if (EmuConfig.EnableWideScreenPatches && !EmuConfig.EnableToolMode) { if (std::none_of(s_enabled_patches.begin(), s_enabled_patches.end(), [](const std::string& it) { return (it == WS_PATCH_NAME); })) @@ -591,7 +597,17 @@ void Patch::ReloadEnabledLists() s_enabled_patches.emplace_back(WS_PATCH_NAME); } } - if (EmuConfig.EnableNoInterlacingPatches) + else if (EmuConfig.EnableWideScreenPatches && EmuConfig.EnableToolMode) + { + if (std::none_of(s_enabled_patches.begin(), s_enabled_patches.end(), + [](const std::string& it) { return (it == TOOL_WS_PATCH_NAME); })) + { + s_enabled_patches.emplace_back(TOOL_WS_PATCH_NAME); + } + } + + // No-interlacing patches + if (EmuConfig.EnableNoInterlacingPatches && !EmuConfig.EnableToolMode) { if (std::none_of(s_enabled_patches.begin(), s_enabled_patches.end(), [](const std::string& it) { return (it == NI_PATCH_NAME); })) @@ -599,6 +615,24 @@ void Patch::ReloadEnabledLists() s_enabled_patches.emplace_back(NI_PATCH_NAME); } } + else if (EmuConfig.EnableNoInterlacingPatches && EmuConfig.EnableToolMode) + { + if (std::none_of(s_enabled_patches.begin(), s_enabled_patches.end(), + [](const std::string& it) { return (it == TOOL_NI_PATCH_NAME); })) + { + s_enabled_patches.emplace_back(TOOL_NI_PATCH_NAME); + } + } + + // TOOL patches + if (EmuConfig.EnableToolMode) + { + if (std::none_of(s_enabled_patches.begin(), s_enabled_patches.end(), + [](const std::string& it) { return (it == TOOL_PATCH_NAME); })) + { + s_enabled_patches.emplace_back(TOOL_PATCH_NAME); + } + } } u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable_list) diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index c25949fb762c6..08e1a03460cfc 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -1730,6 +1730,7 @@ void Pcsx2Config::LoadSaveCore(SettingsWrapper& wrap) SettingsWrapBitBool(EnablePINE); SettingsWrapBitBool(EnableWideScreenPatches); SettingsWrapBitBool(EnableNoInterlacingPatches); + SettingsWrapBitBool(EnableToolMode); SettingsWrapBitBool(EnableFastBoot); SettingsWrapBitBool(EnableFastBootFastForward); SettingsWrapBitBool(EnablePerGameSettings); diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 08923894a76ef..e8cd3960126b0 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -2563,7 +2563,8 @@ void VMManager::CheckForPatchConfigChanges(const Pcsx2Config& old_config) if (EmuConfig.EnableCheats == old_config.EnableCheats && EmuConfig.EnableWideScreenPatches == old_config.EnableWideScreenPatches && EmuConfig.EnableNoInterlacingPatches == old_config.EnableNoInterlacingPatches && - EmuConfig.EnablePatches == old_config.EnablePatches) + EmuConfig.EnablePatches == old_config.EnablePatches && + EmuConfig.EnableToolMode == old_config.EnableToolMode) { return; }