Scalable Speed (GCN) [JoshuaMK]
#1
Scalable Speed (GCN) [JoshuaMK]

For GCN Port 1 Only. Code only effects you. CPUs are left alone.

Like my Scalable Gravity code, this lets you freely scale your speed. Negative values have some interesting effects.
To control your speed simply tilt the c-stick up to increase speed, and tilt the c-stick down to decrease speed. I designed the controls to be compatible with most other codes.

PAL
C257AC2C 00000012
D01D0020 819D0000
818C0000 898C0010
3D60809C 816BD728
896B0B84 7C0C5800
40A2006C 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D608035
896B0585 280B00C0
41810014 280B0040
4181002C EC210028
48000024 EC21002A
4800001C 3CE042AB
38E73333 90FD0014
3CE042F0 90FD002C
4800000C D03D0014
D03D002C 00000000

NTSC-U
C25743C8 00000012
D01D0020 819D0000
818C0000 898C0010
3D60809C 816B8F68
896B0B84 7C0C5800
40A2006C 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D608035
896BC205 280B00C0
41810014 280B0040
4181002C EC210028
48000024 EC21002A
4800001C 3CE042AB
38E73333 90FD0014
3CE042F0 90FD002C
4800000C D03D0014
D03D002C 00000000

NTSC-J
C257A5AC 00000012
D01D0020 819D0000
818C0000 898C0010
3D60809C 816BC788
896B0B84 7C0C5800
40A2006C 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D608035
896BFF05 280B00C0
41810014 280B0040
4181002C EC210028
48000024 EC21002A
4800001C 3CE042AB
38E73333 90FD0014
3CE042F0 90FD002C
4800000C D03D0014
D03D002C 00000000

NTSC-K
C2568C84 00000012
D01D0020 819D0000
818C0000 898C0010
3D60809B 816BBD68
896B0B84 7C0C5800
40A2006C 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D608034
896BE585 280B00C0
41810014 280B0040
4181002C EC210028
48000024 EC21002A
4800001C 3CE042AB
38E73333 90FD0014
3CE042F0 90FD002C
4800000C D03D0014
D03D002C 00000000

Code creator: JoshuaMK
Code credits: Volderbeek (Speed Address), Vega (don't effect CPUs), Stebler (Racedata ptr code)

Code:
#PAL 8057AC2C
#NTSC-U 805743C8
#NTSC-J 8057A5AC
#NTSC-K 80568C84

.set region, '' #Fill in p, e, j, or k (case sensitive)

.if (region == 'p')
        .set ptr_raceData, 0x809bd728
        .set gcn_button, 0x80348200
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'e')
        .set ptr_raceData, 0x809b8f68
        .set gcn_button, 0x80343E80
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'j')
        .set ptr_raceData, 0x809bc788
        .set gcn_button, 0x80347B80
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'k')
        .set ptr_raceData, 0x809abd68
        .set gcn_button, 0x80336200
        .set gcn_cstick, gcn_button + 0x8385
.else
        .err
.endif

#Params
#r11 = C-Stick Vertical Axis
#r12 = Controller Button Value
#r3 = Mem81 Address
#r7 = Value Set
#r10 = Flag
#f0 = Original Instruction, Value to be Added
#f1 = Value to be Added to

#OG instruction
stfs f0, 0x0020 (r29)

#Load slot code is hooked on
lwz r12, 0 (r29)
lwz r12, 0 (r12)
lbz r12, 0x10 (r12)

#Load your slot (this may be needed for online, need to test if hook only gets executed for you if online)
lis r11, ptr_raceData@ha
lwz r11, ptr_raceData@l (r11)
lbz r11, 0xb84 (r11)

#Check slots
cmpw r12, r11
bne+ past_end

#Execute Code
lis r3, 0x8153
lwz r10, 0x0C00 (r3)
cmpwi r10, 0
bne+ already_set_values
lis r7, 0x3FC0
stw r7, 0x0C00 (r3)
already_set_values:
lfs f0, 0x0C00 (r3)
lfs f1, 0x0014 (r29)

#Check Stick
lis r11, gcn_cstick@ha
lbz r11, gcn_cstick@l (r11)

cmplwi r11, 0xC0
bgt- grow_speed
cmplwi r11, 0x40
bgt- the_end
fsubs f1, f1, f0
b the_end
grow_speed:
fadds f1, f1, f0
b the_end
reset:
lis r7, 0x42AB
addi r7, r7, 0x3333
stw r7, 0x0014 (r29)
lis r7, 0x42F0
stw r7, 0x002C (r29)
b past_end
the_end:
stfs f1, 0x0014 (r29)
stfs f1, 0x002C (r29)
past_end:
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#2
Does this work like a gear shift thing? Like, tilting up increases and returning to neutral keeps that speed unless you tilt down?

EDIT: yes, it's like a gear shift!! But now I have another question, is there a way for it to ONLY effect the player? :o
Reply
#3
Try this.... (NTSC-U listed second btw)

btw the ports (P,J,K) on his original code are wrong. So if this works ill update his OP with this

also im not sure why theres a check to see if both Y+Z (0x890) buttons are at least pressed (if pressed then abort code?)

PAL
C257AC2C 00000015
D01D0020 819D0000
818C0000 898C0010
3D60809C 816BD728
896B0B84 7C0C5800
40A20080 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D808035
A18C8200 718C0890
2C0C0890 4182002C
3D608035 896B0585
280B00C0 41810014
280B0040 4181002C
EC210028 48000024
EC21002A 4800001C
3CE042AB 38E73333
90FD0014 3CE042F0
90FD002C 4800000C
D03D0014 D03D002C
60000000 00000000

NTSC-U
C25743C8 00000015
D01D0020 819D0000
818C0000 898C0010
3D60809C 816B8F68
896B0B84 7C0C5800
40A20080 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D808034
A18C3E80 718C0890
2C0C0890 4182002C
3D608035 896BC205
280B00C0 41810014
280B0040 4181002C
EC210028 48000024
EC21002A 4800001C
3CE042AB 38E73333
90FD0014 3CE042F0
90FD002C 4800000C
D03D0014 D03D002C
60000000 00000000

NTSC-J
C257A5AC 00000015
D01D0020 819D0000
818C0000 898C0010
3D60809C 816BC788
896B0B84 7C0C5800
40A20080 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D808034
A18C7B80 718C0890
2C0C0890 4182002C
3D608035 896BFF05
280B00C0 41810014
280B0040 4181002C
EC210028 48000024
EC21002A 4800001C
3CE042AB 38E73333
90FD0014 3CE042F0
90FD002C 4800000C
D03D0014 D03D002C
60000000 00000000

NTSC-K
C2568C84 00000015
D01D0020 819D0000
818C0000 898C0010
3D60809B 816BBD68
896B0B84 7C0C5800
40A20080 3C608153
81430C00 2C0A0000
40A2000C 3CE03FC0
90E30C00 C0030C00
C03D0014 3D808033
A18C6200 718C0890
2C0C0890 4182002C
3D608034 896BE585
280B00C0 41810014
280B0040 4181002C
EC210028 48000024
EC21002A 4800001C
3CE042AB 38E73333
90FD0014 3CE042F0
90FD002C 4800000C
D03D0014 D03D002C
60000000 00000000

Code:
#PAL 8057AC2C
#NTSC-U 805743C8
#NTSC-J 8057A5AC
#NTSC-K 80568C84

.set region, '' #Fill in p, e, j, or k (case sensitive)

.if (region == 'p')
        .set ptr_raceData, 0x809bd728
        .set gcn_button, 0x80348200
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'e')
        .set ptr_raceData, 0x809b8f68
        .set gcn_button, 0x80343E80
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'j')
        .set ptr_raceData, 0x809bc788
        .set gcn_button, 0x80347B80
        .set gcn_cstick, gcn_button + 0x8385
.elseif (region == 'k')
        .set ptr_raceData, 0x809abd68
        .set gcn_button, 0x80336200
        .set gcn_cstick, gcn_button + 0x8385
.else
        .err
.endif

#Params
#r11 = C-Stick Vertical Axis
#r12 = Controller Button Value
#r3 = Mem81 Address
#r7 = Value Set
#r10 = Flag
#f0 = Original Instruction, Value to be Added
#f1 = Value to be Added to

#OG instruction
stfs f0, 0x0020 (r29)

#Load slot code is hooked on
lwz r12, 0 (r29)
lwz r12, 0 (r12)
lbz r12, 0x10 (r12)

#Load your slot (this may be needed for online, too lazy to test if hook only gets executed for you if online)
lis r11, ptr_raceData@ha
lwz r11, ptr_raceData@l (r11)
lbz r11, 0xb84 (r11)

#Check slots
cmpw r12, r11
bne+ past_end

#Execute Code
lis r3, 0x8153
lwz r10, 0x0C00 (r3)
cmpwi r10, 0
bne+ already_set_values
lis r7, 0x3FC0
stw r7, 0x0C00 (r3)
already_set_values:
lfs f0, 0x0C00 (r3)
lfs f1, 0x0014 (r29)
lis r12, gcn_button@ha
lhz r12, gcn_button@l (r12)

#Check Y+Z???? If pressed, abort?????
andi. r12, r12, 0x0890
cmpwi r12, 0x0890
beq- reset

#Check Stick
lis r11, gcn_cstick@ha
lbz r11, gcn_cstick@l (r11)

cmplwi r11, 0xC0
bgt- grow_speed
cmplwi r11, 0x40
bgt- the_end
fsubs f1, f1, f0
b the_end
grow_speed:
fadds f1, f1, f0
b the_end
reset:
lis r7, 0x42AB
addi r7, r7, 0x3333
stw r7, 0x0014 (r29)
lis r7, 0x42F0
stw r7, 0x002C (r29)
b past_end
the_end:
stfs f1, 0x0014 (r29)
stfs f1, 0x002C (r29)
past_end:
Reply
#4
I think it might be worth renaming this thread's title to "Scalable Speed (GCN) [JoshuaMK]" as well to match the code name listed in the thread's text. Plus, if you're viewing the forums and see the thread's title with "GCN" appended to it, you'll immediately understand that it's specifically for GCN controllers
Reply
#5
Thread Title updated
Reply
#6
Finally got time to test upgraded version of code. Works, thread updated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)