Custom Laps (Full)
#1
So far I have everything "done", except for a functionality I plan to add once the code is finished, and this ONE issue I came across last night.

It seems that when a race is over 10 laps long, the game will crash when it tries to pull up the lap times at the end of the race. I went to find the cause of the crash, and it seems to be a failed pointer that pulls a value from invalid RAM. 

Normally in a situation like this, it is just an unsafe register, but the fact that 10 or less laps DOES work tells me that this isn't the case. My best guess is that either I'm missing a bit of code that needs to overwritten like with other patches I came across, or in the worst case, It is hard coded to only allow up to 10 laps. (A lot like MrBean being limited to 4 ghosts for the Multighost Comparison code)

So with all that said, here is the code itself.



Custom Laps (Full) [JoshuaMK]

Laps set to anything lower than 1 will set the lap counter to 3 automatically to prevent game crashes. If laps are set higher than 8, then the code will print the lap info to the bottom left of the screen during races. Playing in 2P will have it always print the lap info. Playing in 3P-4P doesn't print lap info since game lag causes flickering to become unbearable.

(NTSC-U)
C0000000 00000004
3D808000 3960XXXX
2C0B0000 41810008
39600003 B16C05B0
4E800020 00000000
C200A3F0 00000007
9421FF80 BC610008
806DA358 80630044
80630000 3D808002
618C23E0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009640 0000001A
9421FF70 D8210008
BC610010 3D808140
3D608000 886B06FF
A10B05B0 896C1799
280B0000 41820098
816C17A2 A8EB0025
28030002 41A00028
41810084 A92B00E7
48000035 4C617020
50312C20 25642050
322C2025 64000000
4800001C 2C080008
4081005C 48000011
4C617020 25642F25
64000000 7CC802A6
28030002 41800014
3860003C 3880006F
38A00001 48000010
38600009 388000DC
38A00001 3D808002
618C1DF0 7D8803A6
4E800021 3D808002
618C1DD0 7D8803A6
4E800021 B8610010
C8210008 38210090
81830000 00000000
C252DD68 00000002
3D808000 A00C05B0
B0040B8D 00000000
C25309C0 00000004
A87E0023 3D808140
816C17A2 280B0000
40820008 93CC17A2
60000000 00000000
C27120F8 00000007
4800002D 00000000
00000000 00000000
3F800000 40000000
40400000 40800000
40A00000 40C00000
40E00000 7CA802A6
38800003 00000000
C2791674 00000002
3D808140 8B84F0B0
9B8C1799 00000000
C283B9BC 00000002
3D808000 80030124
980C06FF 00000000
0652DD6C 00000010
A0A40B8D 3805FFFF
60000000 28007FFE
0652EB70 00000014
60000000 A0640B8D
3803FFFF 60000000
28007FFE 00000000
06530074 00000024
60000000 A0850B8D
3804FFFF 60000000
28007FFE 40810008
38800003 A07D0025
7C802378 00000000
0652F808 00000014
60000000 A0A60B8D
3805FFFF 60000000
28007FFE 00000000
0452FEB0 A8830023
0452FEB8 B0A30023
0452FECC A8030025
04530110 A81D0023
04530114 B01D0025
04530684 A87A0023
04530690 B01A0023
0471F8E0 281D7FFF
0471F910 3BA07FFF



#ASM

#~~~~~~~~~~~~#
#Inject > 8052DD68#
#~~~~~~~~~~~~#

lis r12, 0x8000
lhz r0, 0x05B0 (r12) #load new lap amount
sth r0, 0x0B8D (r4)

#~~~~~~~~~#
#C0 Type Inject#
#~~~~~~~~~#

lis r12, 0x8000
li r11, X #new lap amount
cmpwi r11, 0
bgt valid #if greater than 0 don't reset to 3
li r11, 3
valid:
sth r11, 0x05B0 (r12)

#~~~~~~~~~~~~#
#Inject > 8083b9bc#
#~~~~~~~~~~~#

lis r12, 0x8000
lwz r0, 0x0124 (r3) 
stb r0, 0x06FF (r12) #Store number of players to memory

#~~~~~~~~~~~~#
#Inject > 805309C0#
#~~~~~~~~~~~#

lhz r3, 0x0023 (r30)
lis r12, 0x8140
lwz r11, 0x17a2 (r12)
cmplwi r11, 0
bne normal_code
stw r30, 0x17a2 (r12) #Grab P1 Address (I will add logic for P2 address later)
normal_code:



I know it's not all the ASM, but I hadn't documented it yet. Just throw each segment of code into PyiiASMH and turn it into readable ASM.
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#2
This is a monstrous code. Wow. Hell at this point, if that one bug is blocking you, you should probably just rig something up to not read the lap times or null them.

When comparing this to your current full-version in codes forum, what are all the advantages with this one?
Reply
#3
This version doesn't have certain bugs I was aware of with the old version, because this version uses MrBean's code as a base, it is far more stable. It also prints lap info to the screen, which the old one did not. Positions are also handled automatically, and laps count everytime meaning it actually feels like a transition into the next lap.
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#4
This code has many issues. First of all, it has heavy screen flickering, second, it crashes sometimes and the 3rd big issue: its showing lap 4445 / 50.

Update: It was just Dolphin having a stroke
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)