Mario Kart Wii Gecko Codes, Cheats, & Hacks

Full Version: Key Remapper (GCN) [mdmwii]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Key Remapper (GCN) [mdmwii]

Code will swap button functions for desired keys on GCN controller only.

NTSC-U
C21AFB58 00000004
38C0XXXX 7C073039
41A20010 38E0YYYY
7C003278 7C003B78
B0040000 00000000

PAL
C21AFBF8 00000004
38C0XXXX 7C073039
41A20010 38E0YYYY
7C003278 7C003B78
B0040000 00000000

NTSC-J
C21AFB18 00000004
38C0XXXX 7C073039
41A20010 38E0YYYY
7C003278 7C003B78
B0040000 00000000

NTSC-K
C21AFF54 00000004
38C0XXXX 7C073039
41A20010 38E0YYYY
7C003278 7C003B78
B0040000 00000000

XXXX = key you want to change
YYYY = key assigned
Values:
0081 = D-Pad Left
0082 = D-Pad Right
0084 = D-Pad Down
0088 = D-Pad Up
0090 = Z
00A0 = R
00C0 = L
0180 = A
0280 = B
0480 = X
0880 = Y
1080 = Start

Source:
Code:
#inject(0x801AFBF8)\n\n (PAL)
#inject(0x801AFB58)\n\n (NTSC-U)
#inject(0x801AFB18)\n\n (NTSC-J)
#inject(0x801AFF54)\n\n (NTSC-K)

li r6, 0xXXXX
and. r7, r0, r6
beq+ end        #Small optimisation
li r7, 0xYYYY
xor r0, r0, r6  #A glorified sub
or r0, r0, r7   #Fix for the issue
end:
sth r0, 0x0(r4)

Code created by: mdmwii
Code credits: Melg (fixed bug when both keys pressed simultaneously, optimized source)
Sorry for the random thread bump, but I was going to use this code and I should mention that due to this source using an  add instruction, it can create undefined inputs if for some reason you press both the remapped and the assigned key. 
Let's say you remap Y (0x800) to D-Pad up (0x8), and you press both at the same time: your combined input will be 0x888, the code will retract 0x800 and then add 0x8 for a total of 0x90 (80+8+8), which is definitely not D-Pad up and actually not even a GCN key. 
Using or instead fixes the issue:

Code:
#inject(0x801AFBF8)\n\n (PAL)
#inject(0x801AFB58)\n\n (NTSC-U)
#inject(0x801AFB18)\n\n (NTSC-J)
#inject(0x801AFF54)\n\n (NTSC-K)

li r6, XXXX
and. r7, r0, r6
beq+ end        #Small optimisation
li r7, YYYY
xor r0, r0, r6  #A glorified sub
or r0, r0, r7   #Fix for the issue
end:
sth r0, 0x0(r4)
Thank you very much. Post updated.