07-01-2019, 03:37 AM

Dynamic Gravity [JoshuaMK]

NOTE: Outdated by newer version.

Note: This code only works with GCN. It also only works with 1P's remote. This code utilizes memory region 0x80001790 of the Exception Vector Area. Make sure no other codes being used utilize this memory region.

This code changes gravity dynamically based on how much you hold up or down on the analog stick!

(NTSC-U)

C2576FC0 00000002

901D0218 3D808000

900C1790 00000000

C2590400 00000018

3D808000 816C1790

2C0B001E 41800040

3D808034 618CC203

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(PAL)

C257D824 00000002

901D0218 3D808000

900C1790 00000000

C2596C24 00000018

3D808000 816C1790

2C0B001E 41800040

3D808035 618C0583

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(NTSC-J)

C257D1A4 00000002

901D0218 3D808000

900C1790 00000000

C25965A4 00000018

3D808000 816C1790

2C0B001E 41800040

3D808034 618CFF03

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(NTSC-K)

C256B87C 00000002

901D0218 3D808000

900C1790 00000000

C2584C7C 00000018

3D808000 816C1790

2C0B001E 41800040

3D808033 618CE583

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

Gravity is a float value, so use a hex to floating point calculator for help.

XXXX = Gravity when not in air or neutral stick in air

MMMM = Gravity when holding slightly up on analog stick in air

hhhh = Gravity when holding moderately up on analog stick in air

HHHH = Gravity when holding all the way up on analog stick in air

LLLL = Gravity when holding slightly down on analog stick in air

UUUU = Gravity when holding moderately down on analog stick in air

YYYY = Gravity when holding all the way down on analog stick in air

General Chart:

0000 = x0 Gravity

3f00 = x0.5 Gravity

3f20 = x0.625 Gravity

3f40 = x0.75 Gravity

3f60 = x0.875 Gravity

3f80 = x1 Gravity

4000 = x2 Gravity

4040 = x3 Gravity

4080 = x4 Gravity

40a0 = x5 Gravity

4120 = x10 Gravity

#########

#Source ASM#

#########

#######################

#Store Air Timer Value Into Memory#

#######################

stw r0, 0x0218 (r29)

lis r12, 0x8000

stw r0, 0x1790 (r12)

#########################

#Load Air Timer Value Into Register 11 #

#########################

lis r12, 0x8000

lwz r11, 0x1790 (r12)

############################################

#Compare r11 to Set Value and Branch to Normal Gravity if Less Than #

############################################

cmpwi r11, 30

blt normal_value

############################

#Load Analog Stick Y Axis Byte Into Memory#

############################

lis r12, 0x8034

ori r12, r12, 0xc203

lbz r11, 0 (r12)

#####################################

#Compare Y axis Byte to set values and Branch Accordingly#

#####################################

cmpwi r11, 0xe4

bgt heaviest_value

cmpwi r11, 0xc9

bgt heavier_value

cmpwi r11, 0xae

bgt heavy_value

cmpwi r11, 0x20

blt lightest_value

cmpwi r11, 0x3b

blt lighter_value

cmpwi r11, 0x56

blt light_value

################################

#Set New Value for Gravity and Branch to the End #

################################

normal_value:

lis r12, 0x3f80

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heavy_value:

lis r12, 0x3f95

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heavier_value:

lis r12, 0x3fb0

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heaviest_value:

lis r12, 0x3fc5

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

light_value:

lis r12, 0x3f65

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

lighter_value:

lis r12, 0x3f50

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

lightest_value:

lis r12, 0x3f35

stw r12, 0 (r31)

lfs f1, 0 (r31)

the_end:

Code Creator: JoshuaMK

Code Contributors: Hamster35000vr (Gravity RAM address used to find code that sets gravity value)

NOTE: Outdated by newer version.

Note: This code only works with GCN. It also only works with 1P's remote. This code utilizes memory region 0x80001790 of the Exception Vector Area. Make sure no other codes being used utilize this memory region.

This code changes gravity dynamically based on how much you hold up or down on the analog stick!

(NTSC-U)

C2576FC0 00000002

901D0218 3D808000

900C1790 00000000

C2590400 00000018

3D808000 816C1790

2C0B001E 41800040

3D808034 618CC203

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(PAL)

C257D824 00000002

901D0218 3D808000

900C1790 00000000

C2596C24 00000018

3D808000 816C1790

2C0B001E 41800040

3D808035 618C0583

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(NTSC-J)

C257D1A4 00000002

901D0218 3D808000

900C1790 00000000

C25965A4 00000018

3D808000 816C1790

2C0B001E 41800040

3D808034 618CFF03

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

(NTSC-K)

C256B87C 00000002

901D0218 3D808000

900C1790 00000000

C2584C7C 00000018

3D808000 816C1790

2C0B001E 41800040

3D808033 618CE583

896C0000 2C0B00E4

4181005C 2C0B00C9

41810044 2C0B00AE

4181002C 2C0B0020

41800074 2C0B003B

4180005C 2C0B0056

41800044 3D80XXXX

919F0000 C03F0000

48000060 3D80MMMM

919F0000 C03F0000

48000050 3D80hhhh

919F0000 C03F0000

48000040 3D80HHHH

919F0000 C03F0000

48000030 3D80LLLL

919F0000 C03F0000

48000020 3D80UUUU

919F0000 C03F0000

48000010 3D80YYYY

919F0000 C03F0000

60000000 00000000

Gravity is a float value, so use a hex to floating point calculator for help.

XXXX = Gravity when not in air or neutral stick in air

MMMM = Gravity when holding slightly up on analog stick in air

hhhh = Gravity when holding moderately up on analog stick in air

HHHH = Gravity when holding all the way up on analog stick in air

LLLL = Gravity when holding slightly down on analog stick in air

UUUU = Gravity when holding moderately down on analog stick in air

YYYY = Gravity when holding all the way down on analog stick in air

General Chart:

0000 = x0 Gravity

3f00 = x0.5 Gravity

3f20 = x0.625 Gravity

3f40 = x0.75 Gravity

3f60 = x0.875 Gravity

3f80 = x1 Gravity

4000 = x2 Gravity

4040 = x3 Gravity

4080 = x4 Gravity

40a0 = x5 Gravity

4120 = x10 Gravity

#########

#Source ASM#

#########

#######################

#Store Air Timer Value Into Memory#

#######################

stw r0, 0x0218 (r29)

lis r12, 0x8000

stw r0, 0x1790 (r12)

#########################

#Load Air Timer Value Into Register 11 #

#########################

lis r12, 0x8000

lwz r11, 0x1790 (r12)

############################################

#Compare r11 to Set Value and Branch to Normal Gravity if Less Than #

############################################

cmpwi r11, 30

blt normal_value

############################

#Load Analog Stick Y Axis Byte Into Memory#

############################

lis r12, 0x8034

ori r12, r12, 0xc203

lbz r11, 0 (r12)

#####################################

#Compare Y axis Byte to set values and Branch Accordingly#

#####################################

cmpwi r11, 0xe4

bgt heaviest_value

cmpwi r11, 0xc9

bgt heavier_value

cmpwi r11, 0xae

bgt heavy_value

cmpwi r11, 0x20

blt lightest_value

cmpwi r11, 0x3b

blt lighter_value

cmpwi r11, 0x56

blt light_value

################################

#Set New Value for Gravity and Branch to the End #

################################

normal_value:

lis r12, 0x3f80

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heavy_value:

lis r12, 0x3f95

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heavier_value:

lis r12, 0x3fb0

stw r12, 0 (r31)

lfs f1, 0 (31)

b the_end

heaviest_value:

lis r12, 0x3fc5

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

light_value:

lis r12, 0x3f65

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

lighter_value:

lis r12, 0x3f50

stw r12, 0 (r31)

lfs f1, 0 (r31)

b the_end

lightest_value:

lis r12, 0x3f35

stw r12, 0 (r31)

lfs f1, 0 (r31)

the_end:

Code Creator: JoshuaMK

Code Contributors: Hamster35000vr (Gravity RAM address used to find code that sets gravity value)