Universal Meter [SwareJonge]
#1
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)



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
Reply
#2
Thread approved, nice work!! This is currently outdated by my version i posted today in main codes forum so I moved this thread to the incomplete/outdated subforum.

I'm pretty sure this won't work with karts since you are using Mdmwii's original speedometer address utilizing the pointer method in your asm.

If you can make a version shorter in length of compiled code than the one in the codes forum, or get yours to work in more modes such as Battle, I'll move mines to outdated, and yours will be in the main forum.
Reply
#3
(12-17-2018, 01:07 AM)Vega Wrote: Thread approved, nice work!! This is currently outdated by my version i posted today in main codes forum so I moved this thread to the incomplete/outdated subforum.

I'm pretty sure this won't work with karts since you are using Mdmwii's original speedometer address utilizing the pointer method in your asm.

If you can make a version shorter in length of compiled code than the one in the codes forum, or get yours to work in more modes such as Battle, I'll move mines to outdated, and yours will be in the main forum.

mdmwii used the wrong offset(0x260 instead of 0x20) for speed in his code, this one does work with karts
Reply
#4
all air/trik/boost meters combined to one thread. major revisions done to source. renamed code to universal meter
Reply
#5
okkko
Reply
#6
i'm wondering if anyone has the a gct that displays analog input x and y values in the lower left (or right or wherever) that sware jonge used in conjunction with star's speedometer gct.
Reply
#7
not here currently
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#8
Hey I noticed you updated the thread, nice usage of the various branches. Got around to testing the new versions. Only version not working is Japan (blackscreens once race is loaded).

Your updates reminded me that I needed to update the speedometer and mt charge meter codes using JoshuaMK's millisecnod hook address. so I updated them all.

They are still using the old style of pointer loading which is incorrect, but it does result in a shorter code using just the C2 type.

EDIT: Noticed the 04 RAM Write (NTSC-J) address port is incorrect, still blackscreens though using correct port.
Reply
#9
(01-02-2021, 03:54 PM)Vega Wrote: Hey I noticed you updated the thread, nice usage of the various branches. Got around to testing the new versions. Only version not working is Japan (blackscreens once race is loaded).

Your updates reminded me that I needed to update the speedometer and mt charge meter codes using JoshuaMK's millisecnod hook address. so I updated them all.

They are still using the old style of pointer loading which is incorrect, but it does result in a shorter code using just the C2 type.

EDIT: Noticed the 04 RAM Write (NTSC-J) address port is incorrect, still blackscreens though using correct port.

i see the patterns of me releasing codes that don't work for regions besides PAL, however i just found a really good hook address for the PlayerSub10 class, i've no idea how to apply it in this code but it can be used really easy with my new Draw text to screen code
Reply
#10
Got NTSC-J working, my dumbself forgot to update the 04 RAM Write branching to 0x81500000 after updating the right address.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)