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

This code lets you freely change the size of all characters during a race, at any point in time.

A huge step up from davidevgen's code, which can only be modified when a race is loading. This code also allows higher values than his without causing issues.

XXXX = Controller Address
ZZZZ = Button to Grow
zzzz = Button to Shrink
q (PAL code only) = 5 for GCN, 4 for Wii-Remote
GGGGGGGG = Rate of growth/shrinkage; this is a 32-bit float value
GGGGGGGG recommended value = 3C000000
LL = Bool for Slot 0
NN = Bool for Slot 1
PP = Bool for Slot 2
etc etc..
ZZ = Bool for Slot 11

Bool value guide:
  • Set Bool to 01 for Code to take effect on particular Slot
  • Set Bool to 00 for Code to NOT take effect on particular Slot

NOTE: This code makes use of memory addresses 0x800015EC thru 0x800015FB. Make sure no other codes you have equipped are using those addresses.

PAL
040015EC GGGGGGGG
060015F0 0000000C
LLNNPPQQ RRSSTTUU
VVXXYYZZ 00000000
C2581630 0000000C
C07F0160 819F0000
818C0000 898C0010
3D408000 614915F0
7D6960AE 2C0B0001
4082003C 3D80803q
3960ZZZZ A18CXXXX
7D805838 7C005800
C04A15EC 41820018
3960zzzz 7D805838
7C005800 FC401050
40A2000C EC63102A
D07F0160 00000000

NTSC-U
040015EC GGGGGGGG
060015F0 0000000C
LLNNPPQQ RRSSTTUU
VVXXYYZZ 00000000
C257ADCC 0000000C
C07F0160 819F0000
818C0000 898C0010
3D408000 614915F0
7D6960AE 2C0B0001
4082003C 3D808034
3960ZZZZ A18CXXXX
7D805838 7C005800
C04A15EC 41820018
3960zzzz 7D805838
7C005800 FC401050
40A2000C EC63102A
D07F0160 00000000

NTSC-J
040015EC GGGGGGGG
060015F0 0000000C
LLNNPPQQ RRSSTTUU
VVXXYYZZ 00000000
C2580FB0 0000000C
C07F0160 819F0000
818C0000 898C0010
3D408000 614915F0
7D6960AE 2C0B0001
4082003C 3D808034
3960ZZZZ A18CXXXX
7D805838 7C005800
C04A15EC 41820018
3960zzzz 7D805838
7C005800 FC401050
40A2000C EC63102A
D07F0160 00000000

NTSC-K
040015EC GGGGGGGG
060015F0 0000000C
LLNNPPQQ RRSSTTUU
VVXXYYZZ 00000000
C256F688 0000000C
C07F0160 819F0000
818C0000 898C0010
3D408000 614915F0
7D6960AE 2C0B0001
4082003C 3D808033
3960ZZZZ A18CXXXX
7D805838 7C005800
C04A15EC 41820018
3960zzzz 7D805838
7C005800 FC401050
40A2000C EC63102A
D07F0160 00000000



Code creator: JoshuaMK
Code credits: Vega (added Slot Selectability, fixed inequal Growth vs Shrink value, optimized Source so code user doesn't have to fill in button values twice, optimized Source so Growth/Shrink rate is adjustable



RAM Write Source:
Write 32-bit float at 0x800015EC

String Write Source:
Code:
#Write Truth Table at 0x800015F0
#0 = fase
#1 = true
#Example source set to all false, adjust this to what you want
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0

ASM Source:
Code:
#C2 Hook Addresses
#PAL    80581630
#NTSC-U 8057ADCC
#NTSC-J 80580FB0
#NTSC-K 8056F688

#Original Hook Instruction, character size float
lfs f3, 0x0160 (r31)

#Grab Slot Code is hooked on (executes once per slot per frame)
lwz r12, 0 (r31)
lwz r12, 0 (r12)
lbz r12, 0x10 (r12)

#Grab respective slot's bool value from Truth Table
lis r10, 0x8000 #Yes it's faster to do an addis+lbzu code but we need r10 to keep EVA high bits for possible later float load
ori r9, r10, 0x15F0
lbzx r11, r9, r12

#Is bool True?
cmpwi r11, 1
bne- end

#Check controller
lis r12, 0x8035 #PAL GCN used for source, needs to be adjusted per controller and region
li r11, 0x0880 #Button to grow, GCN Y button used for source
lhz r12, 0xFFFF8200 (r12) #PAL GCN used for source
and r0, r12, r11
cmpw r0, r11
lfs f2, 0x15EC (r10) #f2 safe for use, load constant to grow/shrink by (0x3C000000 aka .0078125)
beq- adjust_xyz
li r11, 0x0090 #Button to shrink, GCN Z button used for source
and r0, r12, r11
cmpw r0, r11
fneg f2, f2 #Flip constant to negative to shrink
bne+ end

#Grow/shrink XYZ
adjust_xyz:
fadds f3, f3, f2

#Write new XYZ to memory
stfs f3, 0x00160 (r31)

#End
end:
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#2
Added some features to this code due to this request - https://mariokartwii.com/showthread.php?...5#pid16185
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)