Skip to content

Calling print()

Tom Sherman edited this page Mar 7, 2017 · 6 revisions

Example

One of the coolest features of this library is the ability to print text in the game. This allows for error reporting, unit testing, and more tools for debugging your code. Perhaps the most important thing is that debugging tools are now available on the Wii/GameCube. Previously, all of the debugging had to be done in Dolphin, and if your mod didn't work in the Wii is was all up to guesswork to diagnose the problem.

Let's go over some specifics with calling print. First thing to notice is that print takes one argument - const char*. Currently there are no formatting options and so the user must do all formatting before calling print. This can be accomplished with the functions in string.h. print also has a limited number of lines to work with. If print only has 5 lines available it will display the last 5 lines that we're sent to it.

The next important thing is the branch structure for setting up the display. The DOL mod for "debug menu replaces tournament mode" is necessary. On top of that we overwrite the debug menu with the print stream. Your config file should have:

...
[Static Overwrites]

; debug menu replaces tournament mode - needed for test output

8022d638 = 38000006

...

FIXED_SYMBOLS = 

    display 801a633c 7c7f1b78

display should never be called directly.

After all of that is done, any time you select "Tournament Mode" in the game, you will be redirected to the print stream, just like in the example at the top of the page.