Mario Kart Wii Gecko Codes, Cheats, & Hacks

Full Version: Hybrid Drift [Ismy]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been working on this code for a while. Basically, if you select Automatic Drift in the menu, you can both drift automatically and manually during the same race (one excludes the other, you can't do both at the exact same time, though). Whenever the player isn't drifting, the default mode is Automatic Drift, so wheelie nudging is possible without losing speed.

Only known issue is that the camera kinda freaks out when you release a manual drift, but it's not too distracting (on bikes it's worse than on karts).

Showcase on rDKM Time Trials:
https://cdn.discordapp.com/attachments/7...t_Clip.mp4

Shoutouts to CLF78 and stebler for helping me with Ghidra, documentation and with some ASM stuff.

NTSC-U
C2572568 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C2572AA8 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C2577744 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C25777B4 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C25778A4 00000003
540006F7 4082000C
38000000 900301C8
60000000 00000000
C2577B60 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C2577F54 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C25783F4 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C258E284 00000006
807E0004 70630084
4182001C 887E0017
706300EF 987E0017
887E0004 706300EF
987E0004 7FC3F378
60000000 00000000
0058DCEA 00000020
0458E23C 60000000

PAL
C2578dcc 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C257930c 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C257dfa8 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C257e018 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C257e108 00000003
540006F7 4082000C
38000000 900301C8
60000000 00000000
C257e3c4 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C257e7b8 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C257ec58 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C2594aa8 00000006
807E0004 70630084
4182001C 887E0017
706300EF 987E0017
887E0004 706300EF
987E0004 7FC3F378
60000000 00000000
0059450e 00000020
04594a60 60000000

NTSC-J
C257874C 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C2578C8C 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C257D928 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C257D998 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C257DA88 00000003
540006F7 4082000C
38000000 900301C8
60000000 00000000
C257DD44 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C257E138 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C257E5D8 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C2594428 00000006
807E0004 70630084
4182001C 887E0017
706300EF 987E0017
887E0004 706300EF
987E0004 7FC3F378
60000000 00000000
00593E8E 00000020
045943E0 60000000

NTSC-K
C2566E24 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C2567364 00000006
819C0000 818C0000
818C0014 818C0000
818C0004 2C0C0002
4182000C 38000000
48000008 80030014
60000000 00000000
C256C000 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C256C070 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C256C160 00000003
540006F7 4082000C
38000000 900301C8
60000000 00000000
C256C41C 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C256C810 00000004
80030014 540C04A5
4182000C 60000010
90030014 80030004
60000000 00000000
C256CCB0 00000004
80040014 540C04A5
4182000C 60000010
90040014 80040004
60000000 00000000
C2582B00 00000006
807E0004 70630084
4182001C 887E0017
706300EF 987E0017
887E0004 706300EF
987E0004 7FC3F378
60000000 00000000
00582566 00000020
04582AB8 60000000

Code:
################################
# [1] Always check drift input #
################################
# nop @0x80594a60 PAL


#############################
# [2] Manual Drift Enabling #
#############################
# Inject @0x80594aa8 PAL
# PlayerSub1c is in r30

# Load bitfield 0 and check if we're trying to hop/we're manually drifting already
lwz            r3, 0x4(r30)
andi.        r3, r3, 0x84
beq-        end

# If we are, then clear the drift mode bit in bitfield 4
lbz            r3, 0x17(r30)
andi.        r3, r3, 0xEF
stb            r3, 0x17(r30)

# And the automatic drift bit in bitfield 0
lbz            r3, 0x4(r30)
andi.        r3, r3, 0xEF
stb            r3, 0x4(r30)

# Original Instruction
end:
mr            r3, r30


##############################
# [3] Manual Drift Disabling #
##############################
# [3.1, 3.2] #
##############
# Inject @0x8057dfa8, @0x8057e7b8 PAL
# PlayerSub1c is in r3

# Check if we selected Manual Drift on the menu
lwz            r0, 0x14(r3)
rlwinm.        r12, r0, 0, 18, 18
beq            end

# Set the drift mode bit in bitfield 4
ori            r0, r0, 0x10
stw            r0, 0x14(r3)

# Original Instruction
end:
lwz            r0, 0x4(r3)

###################
# [3.3, 3.4, 3.5] #
###################
# Inject @0x8057e018, @0x8057e3c4, @0x8057ec58 PAL
# PlayerSub1c is in r4

# Check if we selected Manual Drift on the menu
lwz            r0, 0x14(r4)
rlwinm.        r12, r0, 0, 18, 18
beq            end

# Set the drift mode bit in bitfield 4
ori            r0, r0, 0x10
stw            r0, 0x14(r4)

# Original Instruction
end:
lwz            r0, 0x4(r4)


########################################
# [4] Do updateManual if outside drift #
########################################
# Inject @0x8057930c, @0x80578dcc PAL
# PlayerSub10 is in r28
# r12 is safe

# Check if we're an inside drifting bike or not
lwz            r12, 0(r28)
lwz            r12, 0(r12)
lwz            r12, 0x14(r12)
lwz            r12, 0(r12)
lwz            r12, 0x4(r12)
cmpwi        r12, 2
beq            end

# If we're not, load a dummy number to skip the next bne
li            r0, 0
b            end2

# Else, do the Original Instruction
end:
lwz            r0, 0x14(r3)
end2:


#########################
# [5] Outside Drift fix #
#########################
# Inject @0x8057e108 PAL
# PlayerSub10 is in r3

# Original Instruction
rlwinm.        r0, r0, 0x0, 0x1b, 0x1b
bne            end

# If we're on manual, fix our angle
li            r0, 0
stw            r0, 0x1C8(r3)

end:


################################################################
# [6] Set unused bit 13 in bitfield 4 for Manual Drift Support #
################################################################
# 00 @0x8059450e PAL 00000020
Neat :o