Pretty Speedometer [stebler]
#31
(02-08-2021, 03:24 PM)NOKKY Wrote: How do I add km/h text in the customized version?

Replace

c2QQQQQQ 0000002e
48000019 001a0800
000100RR 0025002e
003S0066 00000000

with

c2QQQQQQ 0000002f
48000021 001a0800
000100RR 0025002e
003S0066 0020006b
006d002f 00680000

where QQQQQQ is region dependent.
Reply
#32
Thanks! Personally, this is the best way to go.
S:1
TTTT:c3fa(-500)
VVVV:c36e(-238)
[Image: Yg3i4jN.png]
Reply
#33
Hello, This may be an off question but would there be a way to have it display a different value besides Speed? I have a value within the EV that I think having display would be useful!
~MarioKartWii.com #1~
Reply
#34
Yes you can change it to display anything really. For example this is a debug panel code I made for CT authors and testers:
[Image: debug.png]

This code essentially patches setTextsrc to display any arbitrary string if you call it with r4=0.
The easy way (but not the shortest) to do it is just to change the ASM contents of the last code. You need to call swprintf with the string of your choice. It uses the standard C printf formatting. 

The arguments for swprintf are:
r6 through r10 are your integer/pointer to char arguments (%d %c in the string)
f1 through f8 are your float arguments (%f in the string)

So you'd replace the original string by the one of your choice, eg:
Code:
.string16 "Integer1 %3d  Integer2 %1d \a Float1 %3.0f"

And there before swprintf gets called, you load your arguments:
Code:
lwz r6, 0x21 (r3)
lbz r7, 0x30 (r3)
lfs f1, 0x90 (r3)

This specific example would draw on the screen
Code:
Integer1 r6  Integer2 r7
Float1 f1

You can also hook at a different instruction, format your string (by calling swprintf and then making any modification to the string you'd want) there and then call setTxtsrc there, if your arguments loading is easier at that instruction.
Reply
#35
So, I should load my value into the registers provided?
~MarioKartWii.com #1~
Reply
#36
Change the UTF-16 string to the text you want to display and then load the relevant register/floating-point register.
If your value is an integer:
.string16 "InterestingInteger %d" 
+ load the integer into r6

If it's a float
.string16 "InterestingFloat %f" 
+ load the float into f1

It functions very similarly to how the old graphical codes did (see Vega's graphical speedometer for example).
Reply
#37
Got it, so if I wanted lets say a value from address 0x800001b0, I would load its contents to r6
~MarioKartWii.com #1~
Reply
#38
(02-09-2021, 05:45 PM)TheNinjaKingOW Wrote: Got it, so if I wanted lets say a value from address 0x800001b0, I would load its contents to r6

Yes, and you'd have an integer parameter (%d) in your string
Reply
#39
(02-09-2021, 06:30 PM)Melg Wrote: Yes, and you'd have an integer parameter (%d) in your string

So, I should remove how its loading the speed in and replace it with my value?
~MarioKartWii.com #1~
Reply
#40
Is it possible to make this fade-out along with the other HUD elements? Currently when you press Plus to pause the game, this display stays on-screen and doesn't disappear like the "legit" HUD elements.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)