Racer XYZ Size Modifier [JoshuaMK]
#1
Racer XYZ Size Modifier [JoshuaMK]

This code is set to allow independent manipulation of each axis as is desired, but you can also scale all the axis at the same time too. You can even press a button conditional to automatically reset the size back to default.

Negative values are possible for x/z axis, but negative values in the y axis (vertical) crash the game.

(NTSC-U)
C257ADF4 0000001F
C045006C ECC3182A
ECC601B2 ECC601B2
ECC33024 3D808034
618CAAAA A18C0000
718BRRRR 2C0BRRRR
41820084 718BYYYY
2C0BYYYY 41820098
718Byyyy 2C0Byyyy
41820094 718BXXXX
2C0BXXXX 41820070
718Bxxxx 2C0Bxxxx
4182006C 718BZZZZ
2C0BZZZZ 41820078
718Bzzzz 2C0Bzzzz
41820074 718BEEEE
2C0BEEEE 41820020
718Beeee 2C0Beeee
40A2006C EC003028
EC213028 EC423028
48000050 EC00302A
EC21302A EC42302A
48000040 FC001890
FC201890 FC401890
48000030 EC42302A
48000028 EC423028
48000020 EC21302A
48000018 EC213028
48000010 EC00302A
48000008 EC003028
D0050074 D0250070
D045006C 00000000

(PAL)
C2581658 0000001F
C045006C ECC3182A
ECC601B2 ECC601B2
ECC33024 3D808034
618CAAAA A18C0000
718BRRRR 2C0BRRRR
41820084 718BYYYY
2C0BYYYY 41820098
718Byyyy 2C0Byyyy
41820094 718BXXXX
2C0BXXXX 41820070
718Bxxxx 2C0Bxxxx
4182006C 718BZZZZ
2C0BZZZZ 41820078
718Bzzzz 2C0Bzzzz
41820074 718BEEEE
2C0BEEEE 41820020
718Beeee 2C0Beeee
40A2006C EC003028
EC213028 EC423028
48000050 EC00302A
EC21302A EC42302A
48000040 FC001890
FC201890 FC401890
48000030 EC42302A
48000028 EC423028
48000020 EC21302A
48000018 EC213028
48000010 EC00302A
48000008 EC003028
D0050074 D0250070
D045006C 00000000

(NTSC-J)
C2580FD8 0000001F
C045006C ECC3182A
ECC601B2 ECC601B2
ECC33024 3D808034
618CAAAA A18C0000
718BRRRR 2C0BRRRR
41820084 718BYYYY
2C0BYYYY 41820098
718Byyyy 2C0Byyyy
41820094 718BXXXX
2C0BXXXX 41820070
718Bxxxx 2C0Bxxxx
4182006C 718BZZZZ
2C0BZZZZ 41820078
718Bzzzz 2C0Bzzzz
41820074 718BEEEE
2C0BEEEE 41820020
718Beeee 2C0Beeee
40A2006C EC003028
EC213028 EC423028
48000050 EC00302A
EC21302A EC42302A
48000040 FC001890
FC201890 FC401890
48000030 EC42302A
48000028 EC423028
48000020 EC21302A
48000018 EC213028
48000010 EC00302A
48000008 EC003028
D0050074 D0250070
D045006C 00000000

(NTSC-K)
C256F6B0 0000001F
C045006C ECC3182A
ECC601B2 ECC601B2
ECC33024 3D808033
618CAAAA A18C0000
718BRRRR 2C0BRRRR
41820084 718BYYYY
2C0BYYYY 41820098
718Byyyy 2C0Byyyy
41820094 718BXXXX
2C0BXXXX 41820070
718Bxxxx 2C0Bxxxx
4182006C 718BZZZZ
2C0BZZZZ 41820078
718Bzzzz 2C0Bzzzz
41820074 718BEEEE
2C0BEEEE 41820020
718Beeee 2C0Beeee
40A2006C EC003028
EC213028 EC423028
48000050 EC00302A
EC21302A EC42302A
48000040 FC001890
FC201890 FC401890
48000030 EC42302A
48000028 EC423028
48000020 EC21302A
48000018 EC213028
48000010 EC00302A
48000008 EC003028
D0050074 D0250070
D045006C 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

AAAA = Controller Address
RRRR = Reset Size to Normal
XXXX = X Axis Grow
xxxx = X Axis Shrink
YYYY = Y Axis Grow
yyyy = Y Axis Shrink
ZZZZ = Z Axis Grow
zzzz = Z Axis Shrink
EEEE = All Axis Grow
eeee = All Axis Shrink



#~~~~~~~#
#Source ASM#
#~~~~~~~#

.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE
.macro controller_address
lis r12, 0x8034
.endm
.elseif (region == 'P' || region == 'p') # RMCP
.macro controller_address
lis r12, 0x8034
.endm
.elseif (region == 'J' || region == 'j') # RMCJ
.macro controller_address
lis r12, 0x8034
.endm
.elseif (region == 'K' || region == 'k') # RMCK
.macro controller_address
lis r12, 0x8033
.endm
.else # Invalid Region
.abort
.endif

#~~~~~~~~~~~#
#Inject > 8057ADF4#
#~~~~~~~~~~~#

lfs f2, 0x006C (r5)
fadds f6, f3, f3
fmuls f6, f6, f6
fmuls f6, f6, f6
fdivs f6, f3, f6
controller_address
ori r12, r12, 0x3E80
lhz r12, 0 (r12)
andi. r11, r12, 0x0C90
cmpwi r11, 0x0C90
beq- reset
andi. r11, r12, 0x0882
cmpwi r11, 0x0882
beq- grow_y
andi. r11, r12, 0x0881
cmpwi r11, 0x0881
beq- shrink_y
andi. r11, r12, 0x0482
cmpwi r11, 0x0482
beq- grow_x
andi. r11, r12, 0x0481
cmpwi r11, 0x0481
beq- shrink_x
andi. r11, r12, 0x0092
cmpwi r11, 0x0092
beq- grow_z
andi. r11, r12, 0x0091
cmpwi r11, 0x0091
beq- shrink_z
andi. r11, r12, 0x0082
cmpwi r11, 0x0082
beq- grow_xyz
andi. r11, r12, 0x0081
cmpwi r11, 0x0081
bne+ the_end
fsubs f0, f0, f6
fsubs f1, f1, f6
fsubs f2, f2, f6
b store_float
grow_xyz:
fadds f0, f0, f6
fadds f1, f1, f6
fadds f2, f2, f6
b store_float
reset:
fmr f0, f3
fmr f1, f3
fmr f2, f3
b store_float
grow_x:
fadds f2, f2, f6
b store_float
shrink_x:
fsubs f2, f2, f6
b store_float
grow_y:
fadds f1, f1, f6
b store_float
shrink_y:
fsubs f1, f1, f6
b store_float
grow_z:
fadds f0, f0, f6
b store_float
shrink_z:
fsubs f0, f0, f6
store_float:
stfs f0, 0x0074 (r5)
stfs f1, 0x0070 (r5)
stfs f2, 0x006C (r5)
the_end:



Code Creator: JoshuaMK
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#2
I want to say Joshua that this is one of the best codes I've seen. A complex and at the same time, a useful plus fun code. It's rare to see other code creators bother with floating points. Because of other coders' lack of desire to work on floaters, you are definitely gonna find a lot of undiscovered stuff.

Code works perfectly, as expected. My only recommendation on this code, is to set it up where the user doesn't have to double-add every button activator/deactivator. That took awhile lmao.

Push the stack (https://mkwii.com/showthread.php?tid=1108) for however many extra registers you need...
Then setup something like this...
li r14, RRRR
li r15, XXXX
li r16, xxxx
li r17, YYYY
li r18, yyyy
li r19, ZZZZ
li r20, zzzz
li r21, EEEE
li r22, eeee

Then you do Logical ANDs using 'cmpw' instead of 'cmpwi.
Reply
#3
*Added source ASM
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)