12-16-2018, 10:47 PM
(This post was last modified: 01-03-2021, 02:20 AM by Vega.
Edit Reason: fixed japan port
)
Universal Meter [SwareJonge]
Works everywhere.
Instead of having separate codes/threads for Air, Mini-Turbo Charge, Shroom Boost, etc. This code will allow you to choose one of those options to use within one whole code. The Universal Meter can be broken up with the following...
Air-O-Meter
Boost from MT Release Meter
Boost from both MT & Stand Still Release Meter
Blue Mini Turbo Only Charge Meter**
Orange Mini Turbo Only Charge Meter**
Mushroom/Zipper Boost Meter
Stand Still Charge Meter
Trick Boost Meter
**If you are looking for the MT Charge Meter that reads both Blue & Orange levels, that is HERE.
***If you are looking for the Speed-O-Meter, that is HERE.
This code will read the output value of the selected option on the millisecond section of your timer.
XXX Values:
0FE = Blue Mini Turbo Only Charge Meter
100 = Orange Mini Turbo Only Charge Meter
102 = Boost from Mini Turbo Release Meter
10C = Boost from Both MT and Stand Still Release Meter
110 = Mushroom/Zipper Boost Meter
114 = Trick Boost Meter
14C = Stand Still Charge Meter
21A = Air Time Meter
There are more to find here: https://github.com/SeekyCt/mkw-structure...ayer.h#L16
(NTSC-U)
047ED9F8 48D12608
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 60638F68
38800000 4B02D415
7C641B78 3C60809C
8063D110 4B0898B9
4B089F31 A3830XXX
7D635B78 7D846378
4B2ED9C4 00000000
(PAL)
047F84F8 48D07B08
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063D728
38800000 4B031F5D
7C641B78 3C60809C
806318F8 4B0900DD
4B090755 A3830XXX
7D635B78 7D846378
4B2F84C4 00000000
(NTSC-J)
047F7B64 48D0849C
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063C788
38800000 4B0318DD
7C641B78 3C60809C
80630958 4B08FA5D
4B0900D5 A3830XXX
7D635B78 7D846378
4B2F7B30 00000000
(NTSC-K)
047E68B8 48D19748
07500000 00000040
7C6B1B78 7C8E2378
3C60809A 6063BD68
38800000 4B01FFB5
7C641B78 3C60809B
8063FF38 4B07E135
4B07E7AD A3830XXX
7D635B78 7D846378
4B2E6884 00000000
Code Creator: SwareJonge
Code Contributor: JoshuaMK(Miliseconds Display Modifier)
Code Credits: Seeky, Stebler, 1superchip(https://github.com/SeekyCt/mkw-structures)
TODO: perhaps find the function that returns raceData and PlayerHolder to save some lines of code
Works everywhere.
Instead of having separate codes/threads for Air, Mini-Turbo Charge, Shroom Boost, etc. This code will allow you to choose one of those options to use within one whole code. The Universal Meter can be broken up with the following...
Air-O-Meter
Boost from MT Release Meter
Boost from both MT & Stand Still Release Meter
Blue Mini Turbo Only Charge Meter**
Orange Mini Turbo Only Charge Meter**
Mushroom/Zipper Boost Meter
Stand Still Charge Meter
Trick Boost Meter
**If you are looking for the MT Charge Meter that reads both Blue & Orange levels, that is HERE.
***If you are looking for the Speed-O-Meter, that is HERE.
This code will read the output value of the selected option on the millisecond section of your timer.
XXX Values:
0FE = Blue Mini Turbo Only Charge Meter
100 = Orange Mini Turbo Only Charge Meter
102 = Boost from Mini Turbo Release Meter
10C = Boost from Both MT and Stand Still Release Meter
110 = Mushroom/Zipper Boost Meter
114 = Trick Boost Meter
14C = Stand Still Charge Meter
21A = Air Time Meter
There are more to find here: https://github.com/SeekyCt/mkw-structure...ayer.h#L16
(NTSC-U)
047ED9F8 48D12608
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 60638F68
38800000 4B02D415
7C641B78 3C60809C
8063D110 4B0898B9
4B089F31 A3830XXX
7D635B78 7D846378
4B2ED9C4 00000000
(PAL)
047F84F8 48D07B08
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063D728
38800000 4B031F5D
7C641B78 3C60809C
806318F8 4B0900DD
4B090755 A3830XXX
7D635B78 7D846378
4B2F84C4 00000000
(NTSC-J)
047F7B64 48D0849C
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063C788
38800000 4B0318DD
7C641B78 3C60809C
80630958 4B08FA5D
4B0900D5 A3830XXX
7D635B78 7D846378
4B2F7B30 00000000
(NTSC-K)
047E68B8 48D19748
07500000 00000040
7C6B1B78 7C8E2378
3C60809A 6063BD68
38800000 4B01FFB5
7C641B78 3C60809B
8063FF38 4B07E135
4B07E7AD A3830XXX
7D635B78 7D846378
4B2E6884 00000000
Code Creator: SwareJonge
Code Contributor: JoshuaMK(Miliseconds Display Modifier)
Code Credits: Seeky, Stebler, 1superchip(https://github.com/SeekyCt/mkw-structures)
Code:
# First ASM(04)
.set region, ' ' #Use E/P/J/K, lowercase letters can be used too.
.if (region == 'E' || region == 'e') # RMCE
.set miliSecondsModifier, 0x807ED9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set miliSecondsModifier, 0x807F84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set miliSecondsModifier, 0x807F7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set miliSecondsModifier, 0x807E68B8
.else # Invalid Region
.err
.endif
b (0x81500000 - miliSecondsModifier) # branch to the 06 code
Code:
# Second ASM(06)
.set region, ' ' #Use E/P/J/K, lowercase letters can be used too.
#~~~~~~~~~~~~~~~~~~~~~#
# Macros & Statements #
#~~~~~~~~~~~~~~~~~~~~~#
.set codePosition, 0x81500000
.if (region == 'E' || region == 'e') # RMCE
.set getHudSlotPlayerId, 0x8052D428
.set getPlayerByID, 0x805898DC # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x80589F58 # returns pointer to PlayerSub10
.set raceData, 0x809B8F68
.set PlayerHolder, 0x809BD110
.set returnBranch, 0x807ED9FC
.elseif (region == 'P' || region == 'p') # RMCP
.set getHudSlotPlayerId, 0x80531f70
.set getPlayerByID, 0x80590100 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x8059077c # returns pointer to PlayerSub10
.set raceData, 0x809BD728
.set PlayerHolder, 0x809C18F8
.set returnBranch, 0x807F84FC
.elseif (region == 'J' || region == 'j') # RMCJ
.set getHudSlotPlayerId, 0x805318F0
.set getPlayerByID, 0x8058FA80 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x805900FC # returns pointer to PlayerSub10
.set raceData, 0x809BC788
.set PlayerHolder, 0x809C0958
.set returnBranch, 0x807F7B68
.elseif (region == 'K' || region == 'k') # RMCK
.set getHudSlotPlayerId, 0x8051FFC8
.set getPlayerByID, 0x8057E158 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x8057E7D4 # returns pointer to PlayerSub10
.set raceData, 0x809ABD68
.set PlayerHolder, 0x809AFF38
.set returnBranch, 0x807E68BC
.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
mr r11, r3 # backup r3 and r4
mr r12, r4
lis r3, raceData@h
ori r3, r3, raceData@l
li r4, 0x0 # set Playerslot to 0
bl -((codePosition + 0x14) - getHudSlotPlayerId)
mr r4, r3 # copy r3 to r4 because we need the slot in the second argument
lis r3, PlayerHolder@ha
lwz r3, PlayerHolder@l(r3)
bl -((codePosition + 0x24) - getPlayerByID)
bl -((codePosition + 0x28) - getPlayerSub10)
lhz r28, _XXX(r3) # set this to one of the value mentioned above
mr r3, r11 # restore registers we've messed with
mr r4, r12
b -((codePosition + 0x38) - returnBranch)
TODO: perhaps find the function that returns raceData and PlayerHolder to save some lines of code