So I haven't stepped-by-stepped your code in Dolphin yet so I have no idea how your code really works. I'm not sure why 2 out of the 4 gravity destinations are loading the halfword while the other 2 are loading the whole word. I'm sure there's an obvious reason to it. Anyway, I noticed your code has some redundancy. Try this source out... let me know how it works...
lwz r12, 0 (r31) #Load whole word into r12
lis r11, 0x8034 #PAL GCN used for compilation
ori r11, r11, 0x8200
lhz r11, 0 (r11)
andi. r10, r11, 0x0882 #Example GCN button values used for compilation
cmpwi r10, 0x0882
beq- add_lots_gravity
andi. r10, r11, 0x0881
cmpwi r10, 0x0881
beq- sub_lots_gravity
andi. r10, r11, 0x0082
cmpwi r10, 0x0082
beq- add_gravity
andi. r10, r11, 0x0081
cmpwi r10, 0x0081
bne+ dont_touch
subi r12, r12, 0x2000
b the_end
sub_lots_gravity:
srwi r12, r12, 16 #This will simulate a lhz
subis r12, r12, 1
b the_end
add_lots_gravity:
srwi r12, r12, 16 #This will simulate a lhz
addis r12, r12, 1
b the_end
add_gravity:
addi r12, r12, 0x2000
the_end:
stw r12, 0 (r31)
dont_touch:
lfs f1, 0 (r31)
Compiled code, no address assigned:
C2000000 0000000E
819F0000 3D608034 #Replace 8034 with 8033 if korea ofc...
616BXXXX A16B0000
716AUUUU 2C0AUUUU
4182003C 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820030 716ADDDD
2C0ADDDD 40A2002C
398CE000 48000020
558C843E 3D8CFFFF
48000014 558C843E
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000
lwz r12, 0 (r31) #Load whole word into r12
lis r11, 0x8034 #PAL GCN used for compilation
ori r11, r11, 0x8200
lhz r11, 0 (r11)
andi. r10, r11, 0x0882 #Example GCN button values used for compilation
cmpwi r10, 0x0882
beq- add_lots_gravity
andi. r10, r11, 0x0881
cmpwi r10, 0x0881
beq- sub_lots_gravity
andi. r10, r11, 0x0082
cmpwi r10, 0x0082
beq- add_gravity
andi. r10, r11, 0x0081
cmpwi r10, 0x0081
bne+ dont_touch
subi r12, r12, 0x2000
b the_end
sub_lots_gravity:
srwi r12, r12, 16 #This will simulate a lhz
subis r12, r12, 1
b the_end
add_lots_gravity:
srwi r12, r12, 16 #This will simulate a lhz
addis r12, r12, 1
b the_end
add_gravity:
addi r12, r12, 0x2000
the_end:
stw r12, 0 (r31)
dont_touch:
lfs f1, 0 (r31)
Compiled code, no address assigned:
C2000000 0000000E
819F0000 3D608034 #Replace 8034 with 8033 if korea ofc...
616BXXXX A16B0000
716AUUUU 2C0AUUUU
4182003C 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820030 716ADDDD
2C0ADDDD 40A2002C
398CE000 48000020
558C843E 3D8CFFFF
48000014 558C843E
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000