Welcome! Log In Create A New Profile



Posted by iofthestorm 
February 10, 2009 04:08AM
Quick question, since I'm away from my Wii. If I use assert (from assert.h) what exactly happens? Does it return to loader or will it give me a chance to see what the assertion failure was? And if it was a non-console application, would it output anything anyway? Can you initialize the console and still have a graphical (eg. GX) application? I guess I could probably define my own assert macro if the regular assert does not work, but it seems like it would be a useful debugging tool for those of us without a USB gecko.
Re: Assert?
February 10, 2009 02:39PM
if you initiliaze it with "console_init" (CON_Init), console application (printf for example) are directly writing into the external framebuffer you have passed as argument for the init function

GX applications are usually copying the content of the internal framebuffer (EFB) into one external framebuffer but the principe is always similar, the Video Interface always display the content of an external framebuffer.

The user can always choose which external framebuffer should be displayed next by the Video Interface (VIDEO_SetNextFramebuffer)

So yes, you can use both the console and GX rendering simultaneously but it's up to you to properly handle framebuffer displaying.

I have no idea about "assert" but I doubt the application will return to the loader, it probably just hangs on a specifc exception screen, like when any other exception occurs. In that case, a console is indeed required to see any debug messages, stdout and stderr are handled the same way btw
Re: Assert?
February 10, 2009 09:51PM
assert does in fact call exit(), that is the defined behavior of assert(). Basically...that means assert isn't as valuable to you on the Wii - if you're wanted to see the error. But, considering all that assert does is check if what you passed it is true (and terminate the program if it's not), you could easily write your own "assert".
Re: Assert?
February 11, 2009 08:10AM
Yeah, that's what I was thinking. I'll probably whip up my own assert macro that doesn't exit, or something like that. It would be more useful than a code dump screen anyway.
Re: Assert?
February 11, 2009 08:23AM
Don't forget the _break function and the __LINE__ and __FILE__ magic defines.
Re: Assert?
February 12, 2009 05:02AM
Of course I'll be using __LINE__ and __FILE__, but what is _break? Hadn't heard of it before.
Re: Assert?
February 12, 2009 05:25PM
It is part of libdb, it will trigger a break in the debugger, if any is connected. If not, it's a no op. It's pretty useful for catching errors as they are about to happen.
Sorry, only registered users may post in this forum.

Click here to login