MKWii.org
Mini Turbo Charge Meter - Printable Version

+- MKWii.org (https://mkwii.org)
+-- Forum: Hacks/Modding (https://mkwii.org/forumdisplay.php?fid=14)
+--- Forum: Cheat Codes (https://mkwii.org/forumdisplay.php?fid=15)
+--- Thread: Mini Turbo Charge Meter (/showthread.php?tid=1109)



Mini Turbo Charge Meter - zak - 03-21-2019

Mini Turbo Charge Meter 

Works everywhere except Battle.

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
C27E4C9C 00000008
3D80809C 818CD110
818C0020 540B103A
7D8C582E 818C0010
818C0010 A16C0100
2C0B0000 40820008
A16C00FE 3D808053
3D6B38A0 916C10A0
807FEE20 00000000

PAL
C27EEFAC 00000008
3D80809C 818C18F8
818C0020 540B103A
7D8C582E 818C0010
818C0010 A16C0100
2C0B0000 40820008
A16C00FE 3D808053
3D6B38A0 916C5BE8
807F3618 00000000

NTSC-J
C27EE618 00000008
3D80809C 818C0958
818C0020 540B103A
7D8C582E 818C0010
818C0010 A16C0100
2C0B0000 40820008
A16C00FE 3D808053
3D6B38A0 916C5568
807F2678 00000000

NTSC-K
C27DD36C 00000008
3D80809B 818CFF38
818C0020 540B103A
7D8C582E 818C0010
818C0010 A16C0100
2C0B0000 40820008
A16C00FE 3D808052
3D6B38A0 916C3C40
807F1C58 00000000



Source:

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~#
# Macros & Statements #
#~~~~~~~~~~~~~~~~~~~~~#

.set region, ''

.if (region == 'E' || region == 'e') # RMCE
    .macro default_instruction
        lwz r3, -0x11E0 (r31)
    .endm
    .macro set_playerbase
        lis r12, 0x809C
    lwz r12, 0xFFFFD110 (r12)
    .endm
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x10A0
.elseif (region == 'P' || region == 'p') # RMCP
    .macro default_instruction
        lwz r3, 0x3618 (r31)
    .endm
    .macro set_playerbase
        lis r12, 0x809C
        lwz r12, 0x18F8 (f12)
    .endm
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5BE8
.elseif (region == 'J' || region == 'j') # RMCJ
    .macro default_instruction
        lwz r3, 0x2678 (r31)
    .endm
    .macro set_playerbase
        lis r12, 0x809C
        lwz r12, 0x0958 (r12)
    .endm
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5568
.elseif (region == 'K' || region == 'k') # RMCK
    .macro default_instruction
        lwz r3, 0x1C58 (r31)
    .endm
    .macro set_playerbase
        lis r12, 0x809B
        lwz r12, 0xFFFFFF38 (r12)
    .endm
    .set _1sthalf, 0x8052
    .set _2ndhalf, 0x3C40
.else # Invalid Region
    .abort
.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

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set Region-Specific Player-Base #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

set_playerbase

#~~~~~~~~~~~~~~~~~~~~~~~#
# Pointer Level Loading #
#~~~~~~~~~~~~~~~~~~~~~~~#

lwz r12, 0x0020 (r12) #Load Word from 1st Level Pointer

slwi r11, 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 r12, r12, r11 #Load into 2nd Level Pointer
lwz r12, 0x0010(r12) #Load into 3rd Level Pointer
lwz r12, 0x0010(r12) #Load into 4th Level Pointer

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Check Orange MT. If Zero, Load Blue MT Instead #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lhz r11, _omtc (r12) #Load Orange MT
cmpwi r11, 0x0
bne- skip_blue

lhz r11, _mtc (r12) #Load Blue MT

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Change Millisecond Display Code Instruction/Word #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

skip_blue:
lis r12, _1sthalf
addis r11, r11, 0x38A0 #Add 0x38A00000 to r11
stw r11, _2ndhalf (r12) #Store new instruction to Millisecond Display Address in Memory

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Default Instruction; Region-Specific #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

default_instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#



Code creator: zak
Code credits: SwareJonge (universal meter code), Chadderz (fixes to pointer loading), mdmwii (subroutine founder for Millisecond Display), Bully (Millisecond Display Modifier Code creator)