Mini Turbo Charge Meter [Vega]
#1
Mini Turbo Charge Meter [Vega]

Works everywhere.

This code will read the output value of your MT charge (including Orange MT for Karts) on the millisecond section of your timer. Works for all vehicles.

For Bike Usage: A reading of '270' indicates MT is fully charged ready for boost.
For Kart Usage: Once the first/initial reading reaches 270 (blue MT is fully charged), the milliseconds recycle. Then a reading of '300' indicates the Orange MT is fully charged ready for boost.

NTSC-U
C27ED9F8 00000006
3F80809C 839CD110
839C0020 541A103A
7F9CD02E 839C0010
835C0010 A39A0100
2C1C0000 40820008
A39A00FE 00000000

PAL
C27F84F8 00000006
3F80809C 839C18F8
839C0020 541A103A
7F9CD02E 839C0010
835C0010 A39A0100
2C1C0000 40820008
A39A00FE 00000000

NTSC-J
C27F7B64 00000006
3F80809C 839C0958
839C0020 541A103A
7F9CD02E 839C0010
835C0010 A39A0100
2C1C0000 40820008
A39A00FE 00000000

NTSC-K
C27E68B8 00000006
3F80809B 839CFF38
839C0020 541A103A
7F9CD02E 839C0010
835C0010 A39A0100
2C1C0000 40820008
A39A00FE 00000000



Code creator: Vega
Code credits: JoshuaMK (millisecond display modifier that works everywhere), SwareJonge (universal meter), mdmwii (original pointer loads), Chadderz (fixes to mdmwii's original pointer loads)



Source:
#START ASSEMBLY

#Address Ports
#807ED9F8 NTSC-U
#807F84F8 PAL
#807F7B64 NTSC-J
#807E68B8 NTSC-K

#Source Compilation Region
.set region, '' #Use E/P/J/K. Lowercase letters work too.

#Macros & Statements
.if (region == 'E' || region == 'e') # RMCE
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0xFFFFD110 (r28)
.endm
.elseif (region == 'P' || region == 'p') # RMCP
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0x18F8 (r28)
.endm
.elseif (region == 'J' || region == 'j') # RMCJ
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0x0958 (r28)
.endm
.elseif (region == 'K' || region == 'k') # RMCK
.macro set_playerbase
lis r28, 0x809B
lwz r28, 0xFFFFFF38 (r28)
.endm
.else # Invalid Region
.err
.endif

.set _mtc , 0xFE #MT Charge
.set _omtc, 0x100 #Kart Only Orange MT Charge
.set _mtb, 0x102 #Boost from MT Release
.set _ssmtb, 0x10C #Boost from both Stand Still Charge & MT's
.set _mushb, 0x110 #Mushroom/Zipper Boost
.set _trikb, 0x114 #Trick Boost
.set _ssc, 0x14C #Stand Still Charge
.set _air, 0x21A #Air Time

#Register Notes
#r26 = safe
#r28 = safe

#Set Region-Specific Player-Base
set_playerbase

#Pointer Level Loading
lwz r28, 0x0020 (r28) #Load Word from 1st Level Pointer
slwi r26, r0, 2 #Shift the bits of r0 by 2 to the left, result in r11. This is the same as multiplying by 0x4. r0 is current player slot.
lwzx r28, r28, r26 #Load into 2nd Level Pointer
lwz r28, 0x0010 (r28) #Load into 3rd Level Pointer
lwz r26, 0x0010 (r28) #Load into 4th Level Pointer

#Load & Check Orange MT. If Zero, Load Blue MT Instead; Replace Default Instruction (set r28's value to modify timer)
lhz r28, _omtc (r26) #Load Orange MT
cmpwi r28, 0
bne- skip_blue

lhz r28, _mtc (r26) #Load Blue MT

skip_blue:

#END ASSEMBLY
Reply


Messages In This Thread
Mini Turbo Charge Meter [Vega] - by Vega - 03-21-2019, 11:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)