Pretty Speedometer [stebler]
#67
(11-28-2021, 09:51 PM)jawa Wrote: Does this cap the max string size at 8? cus if i try to change the text from "%.2f" to "VEHICLE SPEED: %.2f" the game only renders the first 8 characters

In the 5th source which you are editing. You can see Stebler calls the swprintf function. It's similar to sprintf but uses 16-bit ASCII and the args are slightly different. https://www.cplusplus.com/reference/cwchar/swprintf/

Code:
lis r12, swprintf@h
ori r12, r12, swprintf@l
mtctr r12
bctrl

swprintf requires 3 'main' args
r3 = Where to output the completed C wide string (format strings are replaced with appropriate data)
r4 = Amount of wide characters (including the null halfword at end) of r3; simply put the length of r3 in halfwords
r5 = Where non-completed C wide string is at (contains format strings: i.e. %.2f)

Since r4 is the amount of wide characters of the output, you will need to do a tiny bit of work to figure out what the length of the completed C wide string will be. However, you don't need to do this, you can just set this to an amount that you know will exceed the length of completed string. So you can set r4 to something like 0x50, lol.

But another issue is that if you look at r3 in the source that's for the arg of swprintf. It's sp + 0x8. You would need to allocate more stack space. However since Stebler hooked the Assembly at an epilogue of a function, it appears you have some wiggle room.

0x8 thru 0xD7 in reference to sp appears to be free to use from just looking at the address in Code View. So that would be 0xD0 bytes of free space. As long as your output string (including the null halfword at end) isn't over 0x68 halfwords, you should be fine.

So you shouldn't need to do anything but edit r4 to cover the halfword size of r3.
Reply


Messages In This Thread
Pretty Speedometer [stebler] - by stebler - 01-16-2021, 09:47 PM
RE: Pretty Speedometer [stebler] - by Melg - 01-16-2021, 09:58 PM
RE: Pretty Speedometer [stebler] - by Vega - 01-16-2021, 10:59 PM
RE: Pretty Speedometer [stebler] - by Jeffy/Wrath - 01-17-2021, 04:22 AM
RE: Pretty Speedometer [stebler] - by stebler - 01-17-2021, 05:12 PM
RE: Pretty Speedometer [stebler] - by Optllizer - 01-17-2021, 06:04 PM
RE: Pretty Speedometer [stebler] - by stebler - 01-17-2021, 07:25 PM
RE: Pretty Speedometer [stebler] - by Vega - 01-18-2021, 12:12 AM
RE: Pretty Speedometer [stebler] - by Again - 01-18-2021, 10:27 PM
RE: Pretty Speedometer [stebler] - by stebler - 01-18-2021, 11:27 PM
RE: Pretty Speedometer [stebler] - by Again - 01-18-2021, 11:31 PM
RE: Pretty Speedometer [stebler] - by Vega - 01-18-2021, 11:38 PM
RE: Pretty Speedometer [stebler] - by Joeblase - 01-20-2021, 01:20 AM
RE: Pretty Speedometer [stebler] - by stebler - 01-20-2021, 09:34 AM
RE: Pretty Speedometer [stebler] - by Mewmaster99 - 01-21-2021, 05:38 AM
RE: Pretty Speedometer [stebler] - by Zeraora - 01-21-2021, 12:04 PM
RE: Pretty Speedometer [stebler] - by stebler - 01-22-2021, 12:38 PM
RE: Pretty Speedometer [stebler] - by Hibyehello - 02-04-2021, 08:33 PM
RE: Pretty Speedometer [stebler] - by Mango Man - 01-25-2021, 06:35 PM
RE: Pretty Speedometer [stebler] - by WhatisLoaf - 01-26-2021, 09:34 PM
RE: Pretty Speedometer [stebler] - by JMM - 01-26-2021, 12:40 AM
RE: Pretty Speedometer [stebler] - by stebler - 01-27-2021, 10:21 PM
RE: Pretty Speedometer [stebler] - by NOKKY - 01-30-2021, 06:34 AM
RE: Pretty Speedometer [stebler] - by stebler - 02-04-2021, 03:19 PM
RE: Pretty Speedometer [stebler] - by Mango Man - 02-06-2021, 01:41 PM
RE: Pretty Speedometer [stebler] - by Renverse - 02-05-2021, 10:10 AM
RE: Pretty Speedometer [stebler] - by Again - 02-05-2021, 06:49 PM
RE: Pretty Speedometer [stebler] - by stebler - 02-06-2021, 11:37 AM
RE: Pretty Speedometer [stebler] - by NOKKY - 02-08-2021, 03:24 PM
RE: Pretty Speedometer [stebler] - by stebler - 02-08-2021, 09:07 PM
RE: Pretty Speedometer [stebler] - by NOKKY - 02-09-2021, 12:42 PM
RE: Pretty Speedometer [stebler] - by Zeraora - 02-09-2021, 04:07 PM
RE: Pretty Speedometer [stebler] - by Melg - 02-09-2021, 04:39 PM
RE: Pretty Speedometer [stebler] - by jawa - 10-12-2023, 06:34 PM
RE: Pretty Speedometer [stebler] - by Zeraora - 02-09-2021, 05:10 PM
RE: Pretty Speedometer [stebler] - by Melg - 02-09-2021, 05:43 PM
RE: Pretty Speedometer [stebler] - by Zeraora - 02-09-2021, 05:45 PM
RE: Pretty Speedometer [stebler] - by Melg - 02-09-2021, 06:30 PM
RE: Pretty Speedometer [stebler] - by Zeraora - 02-09-2021, 07:09 PM
RE: Pretty Speedometer [stebler] - by Leseratte10 - 02-10-2021, 02:25 PM
RE: Pretty Speedometer [stebler] - by stebler - 02-11-2021, 06:13 PM
RE: Pretty Speedometer [stebler] - by Lydeum - 03-13-2021, 12:51 PM
RE: Pretty Speedometer [stebler] - by 9Paran - 03-14-2021, 01:53 AM
RE: Pretty Speedometer [stebler] - by Lydeum - 03-14-2021, 03:46 AM
RE: Pretty Speedometer [stebler] - by Wiimm - 03-14-2021, 09:58 PM
RE: Pretty Speedometer [stebler] - by Hannna - 04-30-2021, 08:34 AM
RE: Pretty Speedometer [stebler] - by xMeap826 - 06-14-2021, 12:15 AM
RE: Pretty Speedometer [stebler] - by Vega - 06-20-2021, 11:53 PM
RE: Pretty Speedometer [stebler] - by xMeap826 - 06-22-2021, 08:43 AM
RE: Pretty Speedometer [stebler] - by Mewmaster99 - 06-22-2021, 10:00 AM
RE: Pretty Speedometer [stebler] - by xMeap826 - 06-22-2021, 08:38 PM
RE: Pretty Speedometer [stebler] - by Vega - 07-23-2021, 11:19 PM
RE: Pretty Speedometer [stebler] - by JMM - 08-04-2021, 06:08 PM
RE: Pretty Speedometer [stebler] - by Vega - 10-03-2021, 12:59 AM
RE: Pretty Speedometer [stebler] - by jawa - 11-10-2021, 03:18 PM
RE: Pretty Speedometer [stebler] - by Vega - 11-10-2021, 05:53 PM
RE: Pretty Speedometer [stebler] - by stebler - 11-20-2021, 04:33 PM
RE: Pretty Speedometer [stebler] - by Vega - 11-21-2021, 03:17 AM
RE: Pretty Speedometer [stebler] - by jawa - 11-21-2021, 03:46 PM
RE: Pretty Speedometer [stebler] - by Vega - 11-21-2021, 05:26 PM
RE: Pretty Speedometer [stebler] - by jawa - 11-21-2021, 05:39 PM
RE: Pretty Speedometer [stebler] - by Vega - 11-21-2021, 05:47 PM
RE: Pretty Speedometer [stebler] - by stebler - 11-21-2021, 06:05 PM
RE: Pretty Speedometer [stebler] - by jawa - 11-22-2021, 07:55 PM
RE: Pretty Speedometer [stebler] - by stebler - 11-23-2021, 07:03 AM
RE: Pretty Speedometer [stebler] - by jawa - 11-28-2021, 09:51 PM
RE: Pretty Speedometer [stebler] - by Vega - 11-29-2021, 01:06 AM
RE: Pretty Speedometer [stebler] - by stebler - 11-29-2021, 11:12 AM
RE: Pretty Speedometer [stebler] - by pakrett - 03-10-2022, 06:28 PM
RE: Pretty Speedometer [stebler] - by stebler - 03-14-2022, 10:29 PM
RE: Pretty Speedometer [stebler] - by pakrett - 03-16-2022, 01:54 PM
RE: Pretty Speedometer [stebler] - by fibes - 10-29-2022, 10:19 AM
RE: Pretty Speedometer [stebler] - by Vega - 11-01-2022, 01:07 AM
RE: Pretty Speedometer [stebler] - by fibes - 11-02-2022, 10:31 PM
RE: Pretty Speedometer [stebler] - by xMeap826 - 01-29-2023, 04:31 AM
RE: Pretty Speedometer [stebler] - by Vega - 07-14-2023, 08:52 PM
RE: Pretty Speedometer [stebler] - by xMeap826 - 07-15-2023, 07:11 AM
RE: Pretty Speedometer [stebler] - by Vega - 07-15-2023, 11:02 PM
extra colors for speedometer - by Fifty - 07-16-2023, 03:05 AM
RE: Pretty Speedometer [stebler] - by milky - 08-07-2023, 05:47 PM
RE: Pretty Speedometer [stebler] - by Cealgair - 10-13-2023, 08:57 AM
RE: Pretty Speedometer [stebler] - by Vega - 08-10-2024, 08:13 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)