Skip to content

Instantly share code, notes, and snippets.

@AltimorTASDK
Last active September 28, 2018 11:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AltimorTASDK/01fa1725aeed7db62ec9 to your computer and use it in GitHub Desktop.
Save AltimorTASDK/01fa1725aeed7db62ec9 to your computer and use it in GitHub Desktop.
// "processInput" jump to patch code
patch=1,EE,001E05B0,word,08140d17 // j $50345C Jump to custom code that restores turn rate
// "processInput" fix sticks being offset by 128 instead of 127
patch=1,EE,001E073C,word,3c0242fe // lui v0, $42FE
patch=1,EE,001E07C4,word,3c0342fe // lui v1, $42FE
patch=1,EE,001E0844,word,3c0342fe // lui v1, $42FE
patch=1,EE,001E0898,word,3c0342fe // lui v1, $42FE
// "processInput" right stick left turn check, jump to patch code
patch=1,EE,001E09DC,word,3c03c120 // lui v1, $C120 Change deadzone to -10.0
patch=1,EE,001E09EC,word,08140d10 // j $503440 Jump to custom code that adjusts turn rate
// "processInput" right stick right turn check, jump to patch code
patch=1,EE,001E08B8,word,3c034120 // lui v1, $4120 Change deadzone to 10.0
patch=1,EE,001E08C8,word,08140cfc // j $5033F0 Jump to custom code that adjusts turn rate
// Patch custom turn code over some unused syscall wrappers
// Left turn hook
// $v1, $a0, $f0 and $f20 are free to use
// $f1 contains the right stick X axis as [-127, 128]
// -0x4AC4($gp) aka $B53C(gp) is turn rate
// Check if out of deadzone
patch=1,EE,00503440,word,45000005 // bc1f $5
// $f0 = $f1 / 64.0
patch=1,EE,00503444,word,3c03c1c0 // lui v1, $C1C0 $v1 = -24.0
patch=1,EE,00503448,word,44830000 // mtc1 v1, $f0 $f0 = v1
patch=1,EE,0050344C,word,46000803 // div.s $f0, $f1, $f0 $f0 = $f1 / $f0
// $B53C(gp) *= f0
patch=1,EE,00503450,word,0807827d // j $1E09F4 return
patch=1,EE,00503454,word,e780b53c // swc1 $f0, $B53C(gp) $B53C(gp) = $f0
// outside of deadzone
patch=1,EE,00503458,word,080782ba // j $1E0AE8 return
patch=1,EE,0050345C,word,00000000 // nop
// Restore turn rate at the beginning of processInput
// $B53C(gp) = 4.0
patch=1,EE,0050345C,word,3c034080 // lui v1, $4080 $v1 = 4.0
patch=1,EE,00503460,word,af83b53c // sw v1, $B53C(gp) $B53C(gp) = v1
patch=1,EE,00503464,word,0807816d // j $1E05B4 return
patch=1,EE,00503468,word,27bdfed0 // Overwritten instruction
// Right turn hook
// $v1, $a0, $f0 and $f20 are free to use
// $f1 contains the right stick X axis as [-127, 128]
// -0x4AC4($gp) aka $B53C(gp) is turn rate
// Check if out of deadzone
patch=1,EE,005033F0,word,45010005 // bc1t $5
// $f0 = $f1 / 64.0
patch=1,EE,005033F4,word,3c0341c0 // lui v1, $41C0 $v1 = 24.0
patch=1,EE,005033F8,word,44830000 // mtc1 v1, $f0 $f0 = v1
patch=1,EE,005033FC,word,46000803 // div.s $f0, $f1, $f0 $f0 = $f1 / $f0
// $B53C(gp) *= f0
patch=1,EE,00503400,word,08078234 // j $1E08D0 return
patch=1,EE,00503404,word,e780b53c // swc1 $f0, $B53C(gp) $B53C(gp) = $f0
// outside of deadzone
patch=1,EE,00503408,word,08078274 // j $1E09D0 return
patch=1,EE,0050340C,word,00000000 // nop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment