Custom Laps [JoshuaMK]
#1
Custom Laps [JoshuaMK]

This code lets you add extra laps to each race, ranging from 1 extra lap to 65535 extra laps.

(NTSC-U)
C252FEB4 00000011
3D808140 80AC179A
28050000 6000XXXX
41820010 80A30044
38A50001 90A30044
38A40001 40820008
90A30044 B0A30024
28050001 4182000C
7C040040 40810048
8B830023 3B9C0001
9B830023 838C179A
281C0000 40820030
28040000 40820028
894C1799 7D4903A6
838C17A2 A95C0024
7D405050 915C0044
3B9C00C4 4200FFF0
938C179A 00000000
C27AE78C 00000002
3D808140 98050000
980C1799 00000000
C27E4C9C 00000002
3D808140 807FEE20
906C179E 00000000
C27ED9F8 00000003
3D808140 838C17A2
2C1C0000 41820008
A39C0024 00000000
C25309C0 0000000A
807E0044 3D808140
816C179E 280B0000
41820038 896C17D2
280B0000 4082002C
888C1799 7C8903A6
618B179E 97CB0004
3BDE00C4 4200FFF8
396000C4 7D6B21D6
7FCBF050 9B0C17D2
60000000 00000000
C253068C 00000004
817A0044 899A0023
3803FFFF 398CFFFF
396BFFFF 917A0044
999A0023 00000000
04530110 A81D0022

(PAL)
C25349FC 00000011
3D808140 80AC179A
28050000 6000XXXX
41820010 80A30044
38A50001 90A30044
38A40001 40820008
90A30044 B0A30024
28050001 4182000C
7C040040 40810048
8B830023 3B9C0001
9B830023 838C179A
281C0000 40820030
28040000 40820028
894C1799 7D4903A6
838C17A2 A95C0024
7D405050 915C0044
3B9C00C4 4200FFF0
938C179A 00000000
C27BD1EC 00000002
3D808140 98050000
980C1799 00000000
C27EEFAC 00000002
3D808140 807F3618
906C179E 00000000
C27F84F8 00000003
3D808140 838C17A2
2C1C0000 41820008
A39C0024 00000000
C2535508 0000000A
807E0044 3D808140
816C179E 280B0000
41820038 896C17D2
280B0000 4082002C
888C1799 7C8903A6
618B179E 97CB0004
3BDE00C4 4200FFF8
396000C4 7D6B21D6
7FCBF050 9B0C17D2
60000000 00000000
C25351D4 00000004
817A0044 899A0023
3803FFFF 398CFFFF
396BFFFF 917A0044
999A0023 00000000
04534C58 A81D0022

(NTSC-J)
C253437C 00000011
3D808140 80AC179A
28050000 6000XXXX
41820010 80A30044
38A50001 90A30044
38A40001 40820008
90A30044 B0A30024
28050001 4182000C
7C040040 40810048
8B830023 3B9C0001
9B830023 838C179A
281C0000 40820030
28040000 40820028
894C1799 7D4903A6
838C17A2 A95C0024
7D405050 915C0044
3B9C00C4 4200FFF0
938C179A 00000000
C27BC858 00000002
3D808140 98050000
980C1799 00000000
C27EE618 00000002
3D808140 807F2678
906C179E 00000000
C27F7B64 00000003
3D808140 838C17A2
2C1C0000 41820008
A39C0024 00000000
C2534E88 0000000A
807E0044 3D808140
816C179E 280B0000
41820038 896C17D2
280B0000 4082002C
888C1799 7C8903A6
618B179E 97CB0004
3BDE00C4 4200FFF8
396000C4 7D6B21D6
7FCBF050 9B0C17D2
60000000 00000000
C2534B54 00000004
817A0044 899A0023
3803FFFF 398CFFFF
396BFFFF 917A0044
999A0023 00000000
045345D8 A81D0022

(NTSC-K)
C2522A58 00000011
3D808140 80AC179A
28050000 6000XXXX
41820010 80A30044
38A50001 90A30044
38A40001 40820008
90A30044 B0A30024
28050001 4182000C
7C040040 40810048
8B830023 3B9C0001
9B830023 838C179A
281C0000 40820030
28040000 40820028
894C1799 7D4903A6
838C17A2 A95C0024
7D405050 915C0044
3B9C00C4 4200FFF0
938C179A 00000000
C27AB5AC 00000002
3D808140 98050000
980C1799 00000000
C27DD36C 00000002
3D808140 807F1C58
906C179E 00000000
C27E68B8 00000003
3D808140 838C17A2
2C1C0000 41820008
A39C0024 00000000
C2523560 0000000A
807E0044 3D808140
816C179E 280B0000
41820038 896C17D2
280B0000 4082002C
888C1799 7C8903A6
618B179E 97CB0004
3BDE00C4 4200FFF8
396000C4 7D6B21D6
7FCBF050 9B0C17D2
60000000 00000000
C252322C 00000004
817A0044 899A0023
3803FFFF 398CFFFF
396BFFFF 917A0044
999A0023 00000000
04522CB0 A81D0022



XXXX = Number of Extra Laps. (0000 = 3 lap race, 0001 = 4 lap race, FFFF = 65538 lap race.)



#########
#Source ASM#
#########

#############
#Inject > 8052FEB4#
#############

lis r12, 0x8140
lwz r5, 0x179a (r12)
cmplwi r5, 0
ori r0, r0, 0xFFFF
beq normal
lwz r5, 0x0044 (r3)
addi r5, r5, 1
stw r5, 0x0044 (r3)
normal:
addi r5, r4, 1    #Add 1 and Compare To Wanted Lap Amount
bne store
stw r5, 0x0044 (r3)    #Store Lap to Custom Position Tracker
store:
sth r5, 0x0024 (r3)    #Store to Custom Lap Tracker
cmplwi r5, 1
beq lap_one    #Branch If Crossing Onto Lap 1
cmplw r4, r0  
ble the_end    #Branch if Less Than Wanted Lap Amount
lap_one:
lbz r28, 0x0023 (r3)    #Load Vanilla Lap Into Memory
addi r28, r28, 1    #Add 1 to Lap Amount
stb r28, 0x0023 (r3)    #Store Lap Into Vanilla Lap Tracker
lwz r28, 0x179a (r12)
cmplwi r28, 0
bne the_end
cmplwi r4, 0
bne the_end
lbz r10, 0x1799 (r12)    #Set CTR to Amount of Racers
mtctr r10
lwz r28, 0x17a2 (r12)
loop:    #This Loop Sets the Position Lap Tracker of all racers to be where it hits 3 when race ends to Fix Position Issues.
lha r10, 0x0024 (r28)
sub r10, r10, r0
stw r10, 0x0044 (r28)
addi r28, r28, 0x00c4 
bdnz+ loop
stw r28, 0x179a (r12)
the_end:

##############
#Inject > 8053068C#
#############

lwz r11, 0x0044 (r26)
lbz r12, 0x0023 (r26)
subi r0, r3, 1
subi r12, r12, 1
subi r11, r11, 1
stw r11, 0x0044 (r26)
stb r12, 0x0023 (r26)

#############
#Inject > 805909C0#
#############

lwz r3, 0x0044 (r30)
lis r12, 0x8140
lwz r11, 0x179e (r12)
cmplwi r11, 0
beq normal_code
lbz r11, 0x17d2 (r12)
cmplwi r11, 0
bne normal_code
lbz r4, 0x1799 (r12)
mtctr r4
ori r11, r12, 0x179e
loop_back:
stwu r30, 0x0004 (r11)
addi r30, r30, 0x00c4
bdnz+ loop_back
li r11, 0x00c4
mullw r11, r11, r4
sub r30, r30, r11
stb r24, 0x17d2 (r12)
normal_code:

##############
#Inject > 807E4C9C#
#############

lis r12, 0x8140
lwz r3, -0x1130 (r31)
stw r3, 0x179e (r12)

##############
#Inject > 807ED9F8#
#############

lis r12, 0x8140
lwz r28, 0x17a2 (r12)
cmpwi r28, 0
beq the_end
lhz r28, 0x0024 (r28)
the_end:



Code Creator: JoshuaMK
Code Contributor: Mdmwii (Universal Meter address)
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply


Messages In This Thread
Custom Laps [JoshuaMK] - by JoshuaMK - 07-21-2019, 02:04 AM
RE: Custom Laps - by Vega - 07-21-2019, 07:50 PM
RE: Custom Laps - by JoshuaMK - 07-21-2019, 08:25 PM
RE: Custom Laps - by Vega - 07-22-2019, 01:41 PM
RE: Custom Laps - by JoshuaMK - 07-22-2019, 04:57 PM
RE: Custom Laps [JoshuaMK] - by Zeraora - 06-19-2021, 10:28 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)