10-12-2023, 06:34 PM
(02-09-2021, 04:39 PM)Melg Wrote: Yes you can change it to display anything really. For example this is a debug panel code I made for CT authors and testers:
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.
I cannot find this cheat code anywhere online. Do you still have it?