Files
pcsx2-patches/patches/SLUS-20443_7AACBFD4.pnach
2025-11-18 14:20:05 -07:00

75 lines
4.2 KiB
Plaintext

gametitle=Rugrats: Royal Ransom (U)(SLUS-20443)
[Widescreen 16:9]
gsaspectratio=16:9
author=ICUP321
description=Widescreen hack
patch=1,EE,002D6EF0,word,3c013fe3 //3c013faa
patch=1,EE,002D6EF4,word,34218e38 //3421aaab
[60 FPS]
author=asasega and Souzooka
description=Unlocks internal FPS. Might need EE Overclock at 130%.
// ------------
// Change framerate divisor 2 -> 1
patch=1,EE,2041A4A0,extended,00000001 //00000002
// ------------
// Fix gravity so jump heights are the same as in 30fps
// The issue with gravity at 60fps is that it's a fixed update, with a function (@ 0x00119DF8) processing gravity in 1/60th second chunks
// (0.0166667f). The function iterates gravity until it's greater than the delta time provided to the function which, for some reason,
// is rounded to the nearest thousandth (so for 60fps, this will be 0.017f). This means that gravity will always be processed twice a
// frame at 60fps. We'll correct this by hooking at the end of the function to save the remaining time, and hooking at the beginning of the function
// to start iterating from the remaining time rather than 0. This means that on most frames, gravity should only be processed once at 60fps, and will
// make framerates which aren't divisors of 60 also more accurate.
// Grab the extra time from the last time gravity was processed
patch=0,EE,20119E58,extended,0C0ABAE6 // jal 0x2AEB98 // was mtc1 zero, f21
// Save the extra time at end of function
patch=0,EE,2011A280,extended,080ABAEA // j 0x002AEBA8 ($ra is already restored here) // was lwc1 f27, 0xE8(sp)
// Now set up some code to handle the extra time left over from processing gravity
// (This area seems to be junk code, just "sqc2 vf06,0x0(a0)" then "nop" over and over)
// read extra time
patch=0,EE,202AEB98,extended,3C01002B // lui at,0x002B
patch=0,EE,202AEB9C,extended,03E00008 // jr ra
patch=0,EE,202AEBA0,extended,C435EBA4 // lwc1 f21,-0x145C(at) // Read from 0x2AEBA4
// initialize extra time
patch=0,EE,202AEBA4,extended,00000000
// write extra time
patch=0,EE,202AEBA8,extended,C7BB00E8 // lwc1 f27,0xE8(sp) // Restore part of the epilogue we overwrote
patch=0,EE,202AEBAC,extended,4619A801 // sub.s f00,f21,f25 // f0 = (sum of 1/60 second chunks) - deltatime
patch=0,EE,202AEBB0,extended,3C01002B // lui at,0x002B
patch=0,EE,202AEBB4,extended,080468A2 // j 0x0011A288 // Jump back to original function
patch=0,EE,202AEBB8,extended,E420EBA4 // swc1 f00,-0x145C(at)
// ------------
// Fix horizontal camera speed (delta-time is applied twice by accident; vertical is fine)
// Overwrite dt access for second application to a jump to a code cave
// (we unfortunately can't just overwrite the pointer+access getting loaded,
// as the pointer is used later in the function)
patch=0,EE,202B61CC,extended,080ADA78 // j z_un_002b69e0; overwrites dt access
// Code cave where we load (1f/30) into f0, where the dt access would have ended up
// (These were just the instructions addiu sp, 0x80; nop; nop; nop; presumably junk)
patch=0,EE,202B69E0,extended,3C013D08 // lui at,0x3D08
patch=0,EE,202B69E4,extended,34218889 // ori at,at,0x8889
patch=0,EE,202B69E8,extended,080AD875 // j 0x002B61D4
patch=0,EE,202B69EC,extended,44810000 // mtc1 at,f00
// The game dampens horizontal camera movement by subtracting the result of the 2nd dt application
// from the movement speed. As such unchanged now the horizontal movement is dampened twice as fast at 60fps after above fix.
// Optimize away an instruction to create a gap of two instructions
patch=0,EE,202B61E4,extended,00831024 // and v0,a0,v1 ; combines a "daddu v0,a0,zero" and "and v0,v0,v1" instruction
patch=0,EE,202B61E8,extended,C6A0001C // lwc1 f00,0x1C(s5) ; load dt
patch=0,EE,202B61F0,extended,46000942 // mul.s f05,f01,f00 ; recreate dampen value in f5
patch=0,EE,202B6234,extended,46051081 // sub.s f02,f02,f05 ; apply dampen value
[Normal Camera]
author=Souzooka
description=Uninverts horizontal and vertical camera axes. Setting "Aiming" to Reversed inverts horizontal axis.
patch=0,EE,002602E8,word,46006307 // neg.s f12,f12 ; horizontal axis
patch=0,EE,002602CC,word,460C0301 // sub.s f12,f00,f12 ; vertical axis
patch=0,EE,0025DD4C,word,00000000 // nop ; vertical axis (first-person); removes existing inversion
// NOTE: First-person horizontal axis is already normal by default, regardless of "Aiming" setting.