diff --git a/bin/patches/.gitignore b/bin/patches/.gitignore index ca317d890009f..13b659c1b7c4e 100644 --- a/bin/patches/.gitignore +++ b/bin/patches/.gitignore @@ -1 +1,2 @@ -*3A84D099* \ No newline at end of file +*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