11-17-2023, 11:40 PM
Could be because I'm not restoring the new character and vehicle data back into Memory.
Try this~
NTSC-U
C261232C 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
PAL
C2643750 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
NTSC-J
C2642DB8 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
NTSC-K
C2631A64 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
Try this~
NTSC-U
C261232C 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
PAL
C2643750 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
NTSC-J
C2642DB8 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
NTSC-K
C2631A64 0000001C
3D808000 88AC04C0
38A50001 28050018
41A00008 38A00000
98AC04C0 896C04C1
396B0003 280B0024
41A00008 39600000
996C04C1 39200000
2C050001 41820084
2C050004 4182007C
2C050005 41820074
2C050006 4182006C
2C050008 41820064
2C05000C 4182005C
2C05000D 41820054
2C05000E 4182004C
39200001 2C050000
41820040 2C050007
41820038 2C05000A
41820030 2C05000F
41820028 2C050010
41820020 2C050011
41820018 2C050012
41820010 2C050014
41820008 39200002
7D6B4A14 280B0024
41A00008 7D2B4B78
90A80224 91680228
7D685B78 00000000
Code:
#Address's (C2)
#NTSC-U 8061232C
#PAL 80643750
#NTSC-J 80642DB8
#NTSC-K 80631A64
#Register Safety + Notes
#r0, r9 thru r12 safe
#r8 + 0x224 = Char Mem Spot
#r8 + 0x228 = Veh Mem Spot
#r5 = Char Value
#r11 (before end) = Veh Value
#r8 (at end) must = Veh Value
#Increment Character Byte
lis r12, 0x8000
lbz r5, 0x04C0 (r12)
addi r5, r5, 1
cmplwi r5, 0x18 #range 0 thru 0x17
blt+ store_char_byte
li r5, 0 #Reset cycle
store_char_byte:
stb r5, 0x04C0 (r12)
#Increment Vehicle Byte. Gaps of 3 due to how Game sorts Vehicle-to-Class Values #
lbz r11, 0x04C1 (r12)
addi r11, r11, 3
cmplwi r11, 0x24 #range 0 thru 0x23
blt+ store_veh_group_byte
li r11, 0 #Reset cycle
store_veh_group_byte:
stb r11, 0x04C1 (r12)
#Check Lightweight, then Middleweight. If not those, ofc its Heavy #
#The Vehicle values in the game as listed by weight class as L, M, W, L, M, W etc etc.
#This pattern of grouping helps a lot.
#If lightweight character for r5, then just add 0 to the loaded vehicle byte value
#If middleweight for r5, then just add 1
#If heavy, add 2
#This allows vehicle byte to always be aligned with the weight class, ofc there's a max check further down
#Set r9 to 0 add lightweight pattern add. Check for lightweight #
li r9, 0
cmpwi r5, 1
beq- add_values
cmpwi r5, 4
beq- add_values
cmpwi r5, 5
beq- add_values
cmpwi r5, 6
beq- add_values
cmpwi r5, 8
beq- add_values
cmpwi r5, 0xC
beq- add_values
cmpwi r5, 0xD
beq- add_values
cmpwi r5, 0xE
beq- add_values
#Set r9 to 1 add middleweight pattern add. Check for middleweight #
li r9, 1
cmpwi r5, 0
beq- add_values
cmpwi r5, 7
beq- add_values
cmpwi r5, 0xA
beq- add_values
cmpwi r5, 0xF
beq- add_values
cmpwi r5, 0x10
beq- add_values
cmpwi r5, 0x11
beq- add_values
cmpwi r5, 0x12
beq- add_values
cmpwi r5, 0x14
beq- add_values
#Character is heavyweight. Set r9 to add 2 for pattern #
li r9, 2
#Add the pattern (r9) amount to the loaded vehicle value #
add_values:
add r11, r11, r9
cmplwi r11, 0x24 #Make sure Max isn't exceeded
blt+ store_stuff
mr r11, r9 #Very rare for this to occur. Max was exceeded, use default 1st vehicle (standard kart) of weight class aka the pattern value
#Store Char and Veh bytes to Memory, then set r8 to Veh byte
store_stuff:
stw r5, 0x224 (r8)
stw r11, 0x228 (r8)
mr r8, r11
#End