Golden Mushroom Timer (Online only) [Vega]
#3
Here ya go

Try this in battle too. Also try losing your item via respawn.

#Code creator: Vega
#Code credits: JoshuaMK (timer), Xer (lose item hook)

#Ports
#80658828 NTSC-U
#80660764 PAL
#8065FDD0 NTSC-J
#8064EA7C NTSC-K

#Hook to reset timer in between races

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

.if (region == 'E' || region == 'e') # RMCE
.set _1sthalf, 0x807F
.set _2ndhalf, 0xFFFFD9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set _1sthalf, 0x8080
.set _2ndhalf, 0xFFFF84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set _1sthalf, 0x807F
.set _2ndhalf, 0x7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set _1sthalf, 0x807E
.set _2ndhalf, 0x68B8
.else # Invalid Region
.err
.endif

lis r12, _1sthalf
lis r11, 0xA384 #Default Word Value (instruction) at Millisecond Display Code Address
ori r11, r11, 0x0008
stw r11, _2ndhalf (r12)

stb r8, 0x001F (r3) #Default Instruction

##############################

#Ports
#807ADD30 NTSC-U
#807BC790 PAL
#807BBDFC NTSC-J
#807AAB50 NTSC-K

#Hook to modify timer

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

.if (region == 'E' || region == 'e') # RMCE
.set _1sthalf, 0x807F
.set _2ndhalf, 0xFFFFD9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set _1sthalf, 0x8080
.set _2ndhalf, 0xFFFF84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set _1sthalf, 0x807F
.set _2ndhalf, 0x7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set _1sthalf, 0x807E
.set _2ndhalf, 0x68B8
.else # Invalid Region
.err
.endif

subic. r0, r3, 1 #Default Instruction, Condition Register is now set

lis r12, _1sthalf #Set 1st half address for Millisecond Display Modifier address

beq- fix_timer #If value in r0 is equal to 0, we need to now set the timer back to normal, jump to fix_timer label

oris r11, r0, 0x3B80 #Or 0x3B800000 and r0 together to get finalized word value

b the_end #No need to fix timer ofc, jump to the_end label

fix_timer:
lis r11, 0xA384 #Set 1st half of default word value to write to Millisecond Display address
ori r11, r11, 0x0008 #Set 2nd half of default word value

the_end:
stw r11, _2ndhalf (r12) #Store word of r11 to 0x80523C40, 2nd half of address completed by offset

################################

#Ports
#807AD73C NTSC-U
#807BC19C PAL
#807BB808 NTSC-J
#807AA55C NTSC-K

#Hook to reset timer if you lose your item

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

.if (region == 'E' || region == 'e') # RMCE
.set _1sthalf, 0x807F
.set _2ndhalf, 0xFFFFD9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set _1sthalf, 0x8080
.set _2ndhalf, 0xFFFF84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set _1sthalf, 0x807F
.set _2ndhalf, 0x7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set _1sthalf, 0x807E
.set _2ndhalf, 0x68B8
.else # Invalid Region
.err
.endif

lis r12, _1sthalf
lis r11, 0xA384 #Default Word Value (instruction) at Millisecond Display Code Address
ori r11, r11, 0x0008
stw r11, _2ndhalf (r12)

stw r0, 0x0008 (r3) #Default Instruction
Reply


Messages In This Thread
RE: Golden Mushroom Timer (Online only) [Vega] - by Vega - 03-09-2020, 01:44 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)