Mario Kart Wii Gecko Codes, Cheats, & Hacks
Scalable Gravity [JoshuaMK] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Offline Non-Item (https://mariokartwii.com/forumdisplay.php?fid=53)
+--- Thread: Scalable Gravity [JoshuaMK] (/showthread.php?tid=1157)



Scalable Gravity [JoshuaMK] - JoshuaMK - 07-06-2019

Scalable Gravity [JoshuaMK]

Allows you to make the gravity greater or lesser using the mapped buttons of your choice. Gravity grows and shrinks exponentially.

(NTSC-U)
C2590400 0000000D
819F0000 3D608034
616BXXXX A16B0000
716AUUUU 2C0AUUUU
41820038 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820028 716ADDDD
2C0ADDDD 40A20024
398CE000 48000018
3D8CFFFF 48000010
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000

(PAL)
C2596C24 0000000D
819F0000 3D608034
616BXXXX A16B0000
716AUUUU 2C0AUUUU
41820038 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820028 716ADDDD
2C0ADDDD 40A20024
398CE000 48000018
3D8CFFFF 48000010
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000

(NTSC-J)
C25965A4 0000000D
819F0000 3D608034
616BXXXX A16B0000
716AUUUU 2C0AUUUU
41820038 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820028 716ADDDD
2C0ADDDD 40A20024
398CE000 48000018
3D8CFFFF 48000010
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000

(NTSC-K)
C2584C7C 0000000D
819F0000 3D608033
616BXXXX A16B0000
716AUUUU 2C0AUUUU
41820038 716ADDDD
2C0ADDDD 41820024
716AUUUU 2C0AUUUU
41820028 716ADDDD
2C0ADDDD 40A20024
398CE000 48000018
3D8CFFFF 48000010
3D8C0001 48000008
398C2000 919F0000
C03F0000 00000000



Guide

Note: This code makes use of user input. See this guide for reference on filling in values: https://mkwii.com/showthread.php?tid=44

XXXX = Controller Address
UUUU = Button(s) that increase gravity rapidly
DDDD = Button(s) that decrease gravity rapidly
UUUU = Button(s) that increase gravity slowly
DDDD = Button(s) that decrease gravity slowly



Suggested Values:

(GCN) 
UUUU = 0882 - Y + D-Pad Right
DDDD = 0881 - Y + D-Pad Left
UUUU = 0082 - D-Pad Right
DDDD = 0081 - D-Pad Left
(Wavebird GCN) 
UUUU = 0802 - Y + D-Pad Right
DDDD = 0801 - Y + D-Pad Left
UUUU = 0002 - D-Pad Right
[b]DDDD = 0001 - D-Pad Left[/b]
(Classic Controller) 
UUUU = 8020 - Y + D-Pad Right
DDDD = 0022 - Y + D-Pad Left
UUUU = 8000 - D-Pad Right
DDDD = 0002 - D-Pad Left
(Wii Remote + Nunchuck) 
UUUU = 1002 - ( - ) + D-Pad Right
DDDD = 1001 - ( - ) + D-Pad Left
UUUU = 0002 - D-Pad Right
[b]DDDD = 0001 - D-Pad Left[/b]
(Wii Wheel) 
UUUU = 1004 - ( - ) + D-Pad Down
DDDD = 1008 - ( - ) + D-Pad Up
UUUU = 0004 - D-Pad Down
[b]DDDD = 0008 - D-Pad Up[/b]



#########
#Source ASM#
#########


#############
#Load Gravity Value#
#############

lwz r12, 0 (r31)

#######################
#Get Controller Address Value GCN#
#######################

lis r11, 0x8034
ori r11, r11, 0x8200
lhz r11, 0 (r11)

#################
#Compare Value and Beq#
#################

andi. r10, r11, 0x0882
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

######################################
#Add or Sub a Little Bit Of Gravity Each Frame Input is Held#
#####################################

subi r12, r12, 0x2000
b the_end
sub_lots_gravity:
subis r12, r12, 1
b the_end
add_lots_gravity:
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)



Code Creator: JoshuaMK
Code Contributors: Vega (Optimized source ASM), Hamster35000vr (Gravity RAM address used to find code that sets gravity value)


RE: Scalable Gravity - Vega - 07-06-2019

Once again, nice ASM!

I noticed your PAL code is structured differently to other versions (I'm guessing cuz 8200 on GCN controller address, if used by the player, exceeds 0x7FFF limit).

You might wanna structure the other versions like PAL so its easier for the code user to only have to fill in one XXXX value instead of multiple.


RE: Scalable Gravity - JoshuaMK - 07-06-2019

(07-06-2019, 01:19 PM)Vega Wrote: Once again, nice ASM!

I noticed your PAL code is structured differently to other versions (I'm guessing cuz 8200 on GCN controller address, if used by the player, exceeds 0x7FFF limit).

You might wanna structure the other versions like PAL so its easier for the code user to only have to fill in one XXXX value instead of multiple.
Yeah that's a good idea.

NTSC-K Fixed up


RE: Scalable Gravity - Vega - 07-06-2019

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


RE: Scalable Gravity - JoshuaMK - 07-06-2019

All Regions Fixed

(07-06-2019, 09:00 PM)Vega Wrote: 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
Okay I will check it out. The lhz commands were actually part of an older version of this code that some how made its way into this post. They are supposed to be lwz commands.

Updated the codes as your shortened source works, although I did take out the srwi instructions as they were unneeded. I put your name in the credits for optimizing the ASM. Honestly I can't believe I didn't think to store the andi. results into a separate register lol.  Rolleyes