Mario Kart Wii Gecko Codes, Cheats, & Hacks
Fix TC Glitch [CLF78] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Offline; Item (https://mariokartwii.com/forumdisplay.php?fid=58)
+--- Thread: Fix TC Glitch [CLF78] (/showthread.php?tid=1941)



Fix TC Glitch [CLF78] - CLF78 - 03-06-2022

Fixes the commonly known TC glitch.

NTSC-U
C27D83C0 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000

PAL
C27B096C 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000

NTSC-J
C27AFFD8 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000

NTSC-K
C279ED2C 0000000A
1C000248 80A40250
38A50001 7CA903A6
80A40244 38A5FFFC
80C301A0 84E50004
7C071800 41820010
80E701A0 7C073000
4182001C 4200FFE8
80C60000 80C60004
80E6000C 54E700C2
90E6000C 00000000

Source:
Code:
# Original instruction
mulli r0, r0, 0x248

# Note: the following loop is for mods where players can have multiple TCs on their heads

# Get active tc count (plus 1 to take the tc being deleted into account)
lwz r5, 0x250(r4)
addi r5, r5, 1
mtctr r5

# Get tc object array
lwz r5, 0x244(r4)
subi r5, r5, 4

# Get associated player
lwz r6, 0x1A0(r3)

# Check if the tc is the same as the one we're hooking in
loop:
lwzu r7, 0x4(r5)
cmpw r7, r3
beq skip

# Check if the tc's associated player is the same as the one we're checking
lwz r7, 0x1A0(r7)
cmpw r7, r6
beq exitLoop

# Continue loop
skip:
bdnz+ loop

# No other tcs found, mask tc flag in PlayerSub1c
lwz r6, 0(r6)
lwz r6, 0x4(r6)
lwz r7, 0xC(r6)
rlwinm r7, r7, 0, 3, 1
stw r7, 0xC(r6)

# Return
exitLoop:

Code created by: CLF78