11-02-2020, 11:24 AM
(10-30-2020, 04:41 PM)stebler Wrote: Brake drifting POC
NTSC-U:
c251bea0 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251b1ec 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c258e1cc 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
045776e8 60000000
04575a40 60000000
ASM patch 1: set the brake drifting bit when both B and R are pressed and the player is drifting (GCN controller)
# inject at 8051bea0
rlwinm. r4, r8, 0, 28, 28
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 26, 26
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 22, 22
beq end
ori r8, r8, 0x10
end:
sth r8, 0x4 (r29)
ASM patch 2: set the brake drifting bit when both B and R are pressed and the player is drifting (classic controller)
# inject at 8051b1ec
rlwinm. r4, r6, 0, 28, 28
beq end
rlwinm. r4, r3, 0, 25, 25
beq end
rlwinm. r4, r3, 0, 22, 22
beq end
ori r6, r6, 0x10
end:
rlwinm. r4, r3, 0, 28, 29
ASM patch 3: do not accelerate when the brake drifting bit is set
# inject at 8058e1cc
rlwinm r3, r0, 0, 31, 31
rlwinm r0, r0, 28, 31, 31
xori r0, r0, 1
and. r0, r0, r3
ASM patch 4: do not cancel the drifting when the player is no longer accelerating
# replace at 805776e8
nop
ASM patch 5: allow breaking while drifting
# replace at 80575a40
nop
Note: just like CTGP, this code uses bit 4 of the button input variable for brake drifting (0 = accelerate, 1 = brake or drift, 2 = use item, 3 = drift, 5 = look backwards).
TODO:
* nunchuk
* wii wheel
* other regions
* test on real Wii
* check that it works online
* check that time trials are saved/loaded correctly
* work on perfect CTGP compatibility (using ghost replay)
This is my first time working on a code for MKW, so any feedback is welcome!
Wow this is amazing! I was wondering if it would be possible to have the PAL version of the code too. Thank you anyway!