Pretty Speedometer [stebler]
#71
(03-14-2022, 10:29 PM)stebler Wrote: Yes, by replacing c3a6 for P1 and P3 and 43ac for P2 and P4. All values are the 2 upper bytes of 32-bit floating point (you can convert with https://www.h-schmidt.net/FloatConverter/IEEE754.html) and are listed in the 4th asm source.

Thank you for all !
Reply
#72
Is there any way to add the km/h text on version 2.0?
Reply
#73
Here you go. Replace the *4th* C2 Code with this new C2 code. I had to prepend the speed with null bytes when needed or else there is a dynamic vertical squishing effect on the km/h text when the amount of digits for the speed changes. This isn't an inssue in the old speedometer code. There may be a printf 'trick' to avoid this, idk. Or maybe this is an inherent property to the text itself. Maybe Stebler can chime in why.

@Stebler; Maybe it would be best to add a page on your mkw-sp website for a user to select/configure their own "version" of this code, and then they can download it as a gecko code or as a finished GCT.

Code:
PAL
C27ed1d8 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 8063D728
7C63FA14 88830B84
3C60809C 806318F8
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C7814 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A5D728 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808063
618CDDB4 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-U
C27e392c 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 80638F68
7C63FA14 88830B84
3C60809C 8063D110
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C6CB4 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A58F68 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808060
618CC994 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-J
C27ec844 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 8063C788
7C63FA14 88830B84
3C60809C 80630958
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C7738 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A5C788 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808063
618CD420 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-K
C27db598 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809B 8063BD68
7C63FA14 88830B84
3C60809B 8063FF38
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C787C 7D8903A6
4E800421 38810010
387F0030 3CA0809B
80A5BD68 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808062
618CC0CC 7D8903A6
4E800421 800100E4
60000000 00000000

If you want the km/h underneath, here's this (a slight horizontal squish on km/h can be seen)...

Code:
PAL
C27ed1d8 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 8063D728
7C63FA14 88830B84
3C60809C 806318F8
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C7814
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A5D728
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808063 618CDDB4
7D8903A6 4E800421
800100E4 00000000

NTSC-U
C27e392c 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 80638F68
7C63FA14 88830B84
3C60809C 8063D110
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C6CB4
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A58F68
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808060 618CC994
7D8903A6 4E800421
800100E4 00000000

NTSC-J
C27ec844 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 8063C788
7C63FA14 88830B84
3C60809C 80630958
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C7738
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A5C788
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808063 618CD420
7D8903A6 4E800421
800100E4 00000000

NTSC-K
C27dc844 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809B 8063BD68
7C63FA14 88830B84
3C60809B 8063FF38
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C787C
7D8903A6 4E800421
38810010 387F0030
3CA0809B 80A5BD68
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808062 618CC0CC
7D8903A6 4E800421
800100E4 00000000
Reply
#74
(11-01-2022, 01:07 AM)Vega Wrote: Here you go. Replace the *4th* C2 Code with this new C2 code. I had to prepend the speed with null bytes when needed or else there is a dynamic vertical squishing effect on the km/h text when the amount of digits for the speed changes. This isn't an inssue in the old speedometer code. There may be a printf 'trick' to avoid this, idk. Or maybe this is an inherent property to the text itself. Maybe Stebler can chime in why.

@Stebler; Maybe it would be best to add a page on your mkw-sp website for a user to select/configure their own "version" of this code, and then they can download it as a gecko code or as a finished GCT.

Code:
PAL
C27ed1d8 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 8063D728
7C63FA14 88830B84
3C60809C 806318F8
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C7814 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A5D728 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808063
618CDDB4 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-U
C27e392c 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 80638F68
7C63FA14 88830B84
3C60809C 8063D110
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C6CB4 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A58F68 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808060
618CC994 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-J
C27ec844 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809C 8063C788
7C63FA14 88830B84
3C60809C 80630958
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C7738 7D8903A6
4E800421 38810010
387F0030 3CA0809C
80A5C788 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808063
618CD420 7D8903A6
4E800421 800100E4
60000000 00000000

NTSC-K
C27db598 00000023
887E0081 2C030000
40820104 8BFE0190
3C60809B 8063BD68
7C63FA14 88830B84
3C60809B 8063FF38
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800020
48000025 001A0800
00010030 00250030
0036002E 00320066
0020006B 006D002F
00680000 7CA802A6
4CC63242 3D808001
618C787C 7D8903A6
4E800421 38810010
387F0030 3CA0809B
80A5BD68 1CDF00F0
7CA53214 80A500F4
2C050002 41820008
38650020 B064FFFE
A0640000 2C030000
41820038 2C03002D
40820008 3860246D
2C03002E 40820008
3860246B 38A3FFD0
28050009 41810008
38652460 B0640000
38840001 4BFFFFC4
7FC3F378 38810008
38A00000 3D808062
618CC0CC 7D8903A6
4E800421 800100E4
60000000 00000000

If you want the km/h underneath, here's this (a slight horizontal squish on km/h can be seen)...

Code:
PAL
C27ed1d8 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 8063D728
7C63FA14 88830B84
3C60809C 806318F8
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C7814
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A5D728
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808063 618CDDB4
7D8903A6 4E800421
800100E4 00000000

NTSC-U
C27e392c 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 80638F68
7C63FA14 88830B84
3C60809C 8063D110
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C6CB4
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A58F68
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808060 618CC994
7D8903A6 4E800421
800100E4 00000000

NTSC-J
C27ec844 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809C 8063C788
7C63FA14 88830B84
3C60809C 80630958
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C7738
7D8903A6 4E800421
38810010 387F0030
3CA0809C 80A5C788
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808063 618CD420
7D8903A6 4E800421
800100E4 00000000

NTSC-K
C27dc844 00000022
887E0081 2C030000
40820100 8BFE0190
3C60809B 8063BD68
7C63FA14 88830B84
3C60809B 8063FF38
80630020 5484103A
7C63202E 80630000
80630028 C0230020
38610008 38800014
48000021 001A0800
00010030 0025002E
00320066 000A006B
006D002F 00680000
7CA802A6 4CC63242
3D808001 618C787C
7D8903A6 4E800421
38810010 387F0030
3CA0809B 80A5BD68
1CDF00F0 7CA53214
80A500F4 2C050002
41820008 38650020
B064FFFE A0640000
2C030000 41820038
2C03002D 40820008
3860246D 2C03002E
40820008 3860246B
38A3FFD0 28050009
41810008 38652460
B0640000 38840001
4BFFFFC4 7FC3F378
38810008 38A00000
3D808062 618CC0CC
7D8903A6 4E800421
800100E4 00000000

Thank you!
Reply
#75
would it be possible to link a tpl to this code? such as inserting the kmh ui underneath the speedometer
Reply
#76
Due to recent demand on Discord and DMs, here is a customizable XYZ/XZ configuration of Version 1.1

V = Velocity Config (0 = XYZ Speed, 1 = XZ Speed)
XXXX = Widescreen X Position
xxxx = 4:3 X Position
YYYY = Y Position
WWWW = Scale (use 3F80 if unsure)
r = Number of Decimals
tt = Text Config (00 = omit km/h text, 20 = km/h text to right, 0A = km/h text underneath)
kk = Color (30 = Yellow, 31 = Blue, 32 = Red, 33 = Green, 34 = White)

X,x, Y, and W values are left-half single precision float values. (i.e. 3F80 = 3F800000 = 1)

Example XXXX xxxx YYYY values:
Bottom Right, kmh underneath - 42F0 41F0 C35C
Bottom Left, kmh underneath - C3FA C3CD C35C
Bottom Left, kmh to right - C3FA C3CD C36E

NTSC-U
c25ddb7c 00000008
80a30004 2c05000c
41820028 2c05000e
41820020 2c050012
41820018 2c050040
41820010 2c050042
41820008 48000008
38840001 7c852378
60000000 00000000
c2836a48 00000007
560004e7 40820030
806f0004 2c03000c
41820020 2c03000e
41820018 2c030012
41820010 2c030040
41820008 2c030042
4c421042 00000000
c25c1214 00000009
2c040000 4082003c
3d004330 91010070
91010078 7c721b78
3a600000 3f008089
3b18eed0 90a10020
38a00001 90a10010
3ca0805c 60a512e8
7ca803a6 4e800020
80040000 00000000
C2590FFC 0000003A
3980000V 3F40XXXX
3F60xxxx 3FC0YYYY
3FE0WWWW 807C0000
80630000 88630010
3C80809C 80848F68
88840B84 7C032000
40A20194 3C60809C
8063D508 80630000
83A30038 2C1D0000
40820040 83A3003C
2C1D0000 40820034
83A30040 2C1D0000
40820028 83A30050
2C1D0000 4082001C
83A30108 2C1D0000
40820010 83A30110
2C1D0000 41820140
48000021 001A0800
000100kk 0025002E
003r0066 00tt006B
006D002F 00680000
807C0000 80630008
80630090 80830004
E0630018 C0830020
E0240068 C0440070
2C0C0000 41820010
EC000028 10210460
10630460 10211828
EC422028 10210072
10210854 EC2208BA
FC200834 EC200830
3821FF00 4CC63242
38610008 38800100
7CA802A6 3D808001
618C6CB4 7D8903A6
4E800421 38A10008
3881000E A4640002
2C030000 41820040
2C03002D 41820024
2C03002E 41820024
28030030 41A0FFE0
28030039 41A1FFD8
38632430 48000010
3860246D 48000008
3860246B B0640000
4BFFFFBC 807D005C
3CC08038 80C61C80
80C60058 2C060001
93C30050 93E30058
41A2000C 9363004C
48000008 9343004C
38800000 98830080
38C00002 80630114
80E30000 98C70100
3D80805C 618C11E0
7D8903A6 4E800421
38210100 39610100
60000000 00000000

PAL
c260245c 00000008
80a30004 2c05000c
41820028 2c05000e
41820020 2c050012
41820018 2c050040
41820010 2c050042
41820008 48000008
38840001 7c852378
60000000 00000000
c28584d8 00000007
560004e7 40820030
806f0004 2c03000c
41820020 2c03000e
41820018 2c030012
41820010 2c030040
41820008 2c030042
4c421042 00000000
c25cdd34 00000009
2c040000 4082003c
3d004330 91010070
91010078 7c721b78
3a600000 3f008089
3b183e70 90a10020
38a00001 90a10010
3ca0805c 60a5de08
7ca803a6 4e800020
80040000 00000000
C2597820 0000003A
3980000V 3F40XXXX
3F60xxxx 3FC0YYYY
3FE0WWWW 807C0000
80630000 88630010
3C80809C 8084D728
88840B84 7C032000
40A20194 3C60809C
80631E38 80630000
83A30038 2C1D0000
40820040 83A3003C
2C1D0000 40820034
83A30040 2C1D0000
40820028 83A30050
2C1D0000 4082001C
83A30108 2C1D0000
40820010 83A30110
2C1D0000 41820140
48000021 001A0800
000100kk 0025002E
003r0066 00tt006B
006D002F 00680000
807C0000 80630008
80630090 80830004
E0630018 C0830020
E0240068 C0440070
2C0C0000 41820010
EC000028 10210460
10630460 10211828
EC422028 10210072
10210854 EC2208BA
FC200834 EC200830
3821FF00 4CC63242
38610008 38800100
7CA802A6 3D808001
618C7814 7D8903A6
4E800421 38A10008
3881000E A4640002
2C030000 41820040
2C03002D 41820024
2C03002E 41820024
28030030 41A0FFE0
28030039 41A1FFD8
38632430 48000010
3860246D 48000008
3860246B B0640000
4BFFFFBC 807D005C
3CC08038 80C66000
80C60058 2C060001
93C30050 93E30058
41A2000C 9363004C
48000008 9343004C
38800000 98830080
38C00002 80630114
80E30000 98C70100
3D80805C 618CDD00
7D8903A6 4E800421
38210100 39610100
60000000 00000000

NTSC-J
c2601bd0 00000008
80a30004 2c05000c
41820028 2c05000e
41820020 2c050012
41820018 2c050040
41820010 2c050042
41820008 48000008
38840001 7c852378
60000000 00000000
c2857b44 00000007
560004e7 40820030
806f0004 2c03000c
41820020 2c03000e
41820018 2c030012
41820010 2c030040
41820008 2c030042
4c421042 00000000
c25cd610 00000009
2c040000 4082003c
3d004330 91010070
91010078 7c721b78
3a600000 3f008089
3b1834c0 90a10020
38a00001 90a10010
3ca0805c 60a5d6e4
7ca803a6 4e800020
80040000 00000000
C25971A0 0000003A
3980000V 3F40XXXX
3F60xxxx 3FC0YYYY
3FE0WWWW 807C0000
80630000 88630010
3C80809C 8084C788
88840B84 7C032000
40A20194 3C60809C
80630E98 80630000
83A30038 2C1D0000
40820040 83A3003C
2C1D0000 40820034
83A30040 2C1D0000
40820028 83A30050
2C1D0000 4082001C
83A30108 2C1D0000
40820010 83A30110
2C1D0000 41820140
48000021 001A0800
000100kk 0025002E
003r0066 00tt006B
006D002F 00680000
807C0000 80630008
80630090 80830004
E0630018 C0830020
E0240068 C0440070
2C0C0000 41820010
EC000028 10210460
10630460 10211828
EC422028 10210072
10210854 EC2208BA
FC200834 EC200830
3821FF00 4CC63242
38610008 38800100
7CA802A6 3D808001
618C7738 7D8903A6
4E800421 38A10008
3881000E A4640002
2C030000 41820040
2C03002D 41820024
2C03002E 41820024
28030030 41A0FFE0
28030039 41A1FFD8
38632430 48000010
3860246D 48000008
3860246B B0640000
4BFFFFBC 807D005C
3CC08038 80C65980
80C60058 2C060001
93C30050 93E30058
41A2000C 9363004C
48000008 9343004C
38800000 98830080
38C00002 80630114
80E30000 98C70100
3D80805C 618CD5DC
7D8903A6 4E800421
38210100 39610100
60000000 00000000

NTSC-K
c25f087c 00000008
80a30004 2c05000c
41820028 2c05000e
41820020 2c050012
41820018 2c050040
41820010 2c050042
41820008 48000008
38840001 7c852378
60000000 00000000
c2846898 00000007
560004e7 40820030
806f0004 2c03000c
41820020 2c03000e
41820018 2c030012
41820010 2c030040
41820008 2c030042
4c421042 00000000
c25bbcf4 00000009
2c040000 4082003c
3d004330 91010070
91010078 7c721b78
3a600000 3f008088
3b182280 90a10020
38a00001 90a10010
3ca0805b 60a5bdc8
7ca803a6 4e800020
80040000 00000000
C2585878 0000003A
3980000V 3F40XXXX
3F60xxxx 3FC0YYYY
3FE0WWWW 807C0000
80630000 88630010
3C80809B 8084BD68
88840B84 7C032000
40A20194 3C60809B
80630478 80630000
83A30038 2C1D0000
40820040 83A3003C
2C1D0000 40820034
83A30040 2C1D0000
40820028 83A30050
2C1D0000 4082001C
83A30108 2C1D0000
40820010 83A30110
2C1D0000 41820140
48000021 001A0800
000100kk 0025002E
003r0066 00tt006B
006D002F 00680000
807C0000 80630008
80630090 80830004
E0630018 C0830020
E0240068 C0440070
2C0C0000 41820010
EC000028 10210460
10630460 10211828
EC422028 10210072
10210854 EC2208BA
FC200834 EC200830
3821FF00 4CC63242
38610008 38800100
7CA802A6 3D808001
618C787C 7D8903A6
4E800421 38A10008
3881000E A4640002
2C030000 41820040
2C03002D 41820024
2C03002E 41820024
28030030 41A0FFE0
28030039 41A1FFD8
38632430 48000010
3860246D 48000008
3860246B B0640000
4BFFFFBC 807D005C
3CC08037 80C64020
80C60058 2C060001
93C30050 93E30058
41A2000C 9363004C
48000008 9343004C
38800000 98830080
38C00002 80630114
80E30000 98C70100
3D80805B 618CBCC0
7D8903A6 4E800421
38210100 39610100
60000000 00000000

Here's the updated source for the Last ASM. Other ASM source's can be found in the OP.

Code:
#Address Ports
#Inject at 80597820 (PAL)
#Inject at 80590FFC (NTSC-U)
#Inject at 805971A0 (NTSC-J)
#Inject at 80585878 (NTSC-K)

#Region Compilation Setting & Assembler Directives
.set region, ''

.if (region == 'p')
        .set ptr_raceData, 0x809bd728
        .set ptr_menuData, 0x809c1e38
        .set swprintf, 0x80017814
        .set ptr_unk, 0x80386000
        .set ScreenElement_setTextSrc, 0x805cdd00
.elseif (region == 'e')
        .set ptr_raceData, 0x809b8f68
        .set ptr_menuData, 0x809bd508
        .set swprintf, 0x80016cb4
        .set ptr_unk, 0x80381c80
        .set ScreenElement_setTextSrc, 0x805c11e0
.elseif (region == 'j')
        .set ptr_raceData, 0x809bc788
        .set ptr_menuData, 0x809c0e98
        .set swprintf, 0x80017738
        .set ptr_unk, 0x80385980
        .set ScreenElement_setTextSrc, 0x805cd5dc
.elseif (region == 'k')
        .set ptr_raceData, 0x809abd68
        .set ptr_menuData, 0x809b0478
        .set swprintf, 0x8001787c
        .set ptr_unk, 0x80374020
        .set ScreenElement_setTextSrc, 0x805bbcc0
.else
        .err
.endif

#Register Safety Notes
#r0, r3 thru r12 safe, r26 thru r31 safe
#f0 thru 13, and f29 safe
#LR and CTR safe

#Set User config registers
li r12, 0 #0 = XYZ Speed, #1 = XY Speed
lis r26, 0x42F0 #Set widescreen X position
lis r27, 0x41F0 #Set 4:3 X position
lis r30, 0xC35C #Set Y position
lis r31, 0x3F80 #Set Scale

#Get Slot that code is currently hooked on. Then get your Slot value. Make sure they are equal
lwz r3, 0 (r28)
lwz r3, 0 (r3)
lbz r3, 0x10 (r3)
lis r4, ptr_raceData@ha
lwz r4, ptr_raceData@l (r4)
lbz r4, 0x0B84 (r4)
cmpw r3, r4 #If slots don't match, skip code
bne+ end

#Check if a single player gameplay screen is active, keep pointer in r29 for later use
lis r3, ptr_menuData@ha
lwz r3, ptr_menuData@l (r3)
lwz r3, 0 (r3)
lwz r29, 0x38 (r3) # grand prix
cmpwi r29, 0
bne- found
lwz r29, 0x3C (r3) # time trial
cmpwi r29, 0
bne- found
lwz r29, 0x40 (r3) # 1 player offline vs
cmpwi r29, 0
bne- found
lwz r29, 0x50 (r3) # 1 player battle
cmpwi r29, 0
bne- found
lwz r29, 0x108 (r3) # 1 player ww/regional vs
cmpwi r29, 0
bne- found
lwz r29, 0x110 (r3) # 1 player friend room vs
cmpwi r29, 0
beq- end

#Single Player screen is active!
#Create the string via BL Trick
found:
bl format

.short 0x001A, 0x0800, 0x0001, 0x0030 #Bmg escape sequence for yellow text
.short 0x0025, 0x002E, 0x0031, 0x0066 #16-bit ascii for %.1f
.short 0x000A, 0x006B, 0x006D, 0x002F #16-bit ascii for \nkm/h
.short 0x0068 #16-bit ascii for \nkm/h
.short 0
.align 2

format:

#Load current and previous XYZ values
lwz r3, 0 (r28)
lwz r3, 0x8 (r3)
lwz r3, 0x90 (r3) #r3 is base pointer nearby prev XYZ
lwz r4, 0x4 (r3) #r4 is base pointer nearby current XYZ
psq_l f3, 0x18 (r3), 0, 0 #old XY
lfs f4, 0x20 (r3) #old Z
psq_l f1, 0x68 (r4), 0, 0 #new XY
lfs f2, 0x70 (r4) #new Z

#Check for XYZ vs XZ
cmpwi r12, 0
beq- skip_xz_adjustments

#Null out both Y Values
#Merge old X with new Y values back together in their respective original FPRs
fsubs f0, f0, f0 #Subtract FPR by itself to make it Null
ps_merge01 f1, f1, f0 #Merge in nulled out Y value f1 ps1
ps_merge01 f3, f3, f0 #Merge in nulled out Y value to f3 ps1

#Do the formula: sqrt{[(x2 - x1)^2] + [(y2 - y1)^2] + [(z2 - z1)^2]}
#X2 = f1 ps0
#X1 = f3 ps0
#Y2 = f1 ps1
#Y1 = f3 ps1
#Z2 = f2 ps0
#Z1 = f2 ps0
skip_xz_adjustments:
ps_sub f1, f1, f3
fsubs f2, f2, f4
ps_mul f1, f1, f1
ps_sum0 f1, f1, f1, f1
fmadds f1, f2, f2, f1
frsqrte f1, f1
fres f1, f1

#Allocate stack memory, 0x100 should be enough, lol
#0x8 needed by swprintf
#rest for the formatted string
#Set non-float args of swprintf, call it
#f1 speed
#r3 where to dump (dest addr)
#r4 length
#r5 source addr (already set)
addi sp, sp, -0x100
crset 4*cr1+eq #Makes swprintf execute faster by providing an accurate branch route regarding float processing
addi r3, sp, 0x8
li r4, 0x100
mflr r5
lis r12, swprintf@h
ori r12, r12, swprintf@l
mtctr r12
bctrl

#Set r5 arg for last func call near end, and preset r4 for ascii conversion loop
addi r5, sp, 0x8 #Beginning of the formatted string
addi r4, sp, 0xE #We do not want to process the bmg escape sequence

#The Timer uses special 16-bit ascii symbols in place of typical 16-bit ascii symbols for digits, dashes, and dots. Adjust the symbols.
loop:
lhzu r3, 0x2 (r4)
cmpwi r3, 0
beq- out
cmpwi r3, 0x2D
beq- dash
cmpwi r3, 0x2E
beq- dot
cmplwi r3, 0x30
blt- loop
cmplwi r3, 0x39
bgt- loop
addi r3, r3, 0x2430 #Update digits (0 thru 9)
b write_new_ascii

dash:
li r3, 0x246D
b write_new_ascii

dot:
li r3, 0x246B

write_new_ascii:
sth r3, 0 (r4)
b loop

#Ascii symbol reformatting complete
out:
lwz r3, 0x5C (r29)

#Find out if widescreen or not, apply X and Y screen pos
lis r6, ptr_unk@ha
lwz r6, ptr_unk@l (r6)
lwz r6, 0x58 (r6)
cmpwi r6, 1
stw r30, 0x50 (r3) #Write Y pos
stw r31, 0x58 (r3) #Write Scale, fyi stmw is slow
beq+ widescreen
stw r27, 0x4C (r3) #Write 4:3 X pos
b make_visible
widescreen:
stw r26, 0x4C (r3) #Write 16:9 X pos

#Make the element visible, align text to right, call func to display it on screen
make_visible:
li r4, 0
stb r4, 0x80 (r3)
li r6, 2 #Side note: Use 0 to align left, be sure to update your X measurements correctly (neg/inverse them)
lwz r3, 0x114 (r3)
lwz r7, 0 (r3)
stb r6, 0x100 (r7)
lis r12, ScreenElement_setTextSrc@h
ori r12, r12, ScreenElement_setTextSrc@l
mtctr r12
bctrl

#Recover sp
addi sp, sp, 0x100

#The end (original instruction)
end:
addi r11, sp, 0x100
Reply
#77
i dont want to be that guy who asks twice in a row but can we expect to see a customizable code but for 2.0? specifically for changing the y position and the color ?
Reply
#78
I'll see if I get time later tonight.

Anyway on my previous post, there's a small patch you can add to the code to use a slightly different better looking Font for the km/h text (thank you to LowercaseLetters for giving me the code to look at it for disassembling). No idea who placed the "patch" in

So on the last C2 code (the big one)...
At the first line, change the "0000003A" to "0000003B"

At the 8th line change "40A20194" to "40A2019C"

At the 18th line change "41820140" to "41820148"

And at the bottom of the code, change the following...
80E30000 98C70100
3D80805C 618CDD00
7D8903A6 4E800421
38210100 39610100
60000000 00000000

To this..
80E30000 98C70100
398000C1 998700F0
3D80805C 618CDD00
7D8903A6 4E800421
38210100 39610100
60000000 00000000

As you can see, a new line is added in
Reply
#79
(07-14-2023, 08:52 PM)Vega Wrote: kk = Color (30 = Yellow, 31 = Blue, 32 = Red, 33 = Green, 34 = White)

You can also use these extra variations:

32 = Dark Red
30 = Red
40 = Light Red

21 = Blue
31 = Dark Blue
Reply
#80
Is there any way to change the X and Y positions in version 2.0?

[edit]
I didn't notice there is source code. (16:9 x pos, 16:9 y pos etc.)
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)