Utility - Basic Utilities for PSP

Utility provides a few basic, low-level utilities for the PlayStation Portable.

Functions

ASSERT

#define ASSERT(condition, failureMessage)

Evaluates condition as a Boolean expression. If condition is false, utlOops is called with failureMessage.

SAFE_FREE

#define SAFE_FREE(ptr)

If ptr is NULL, does nothing. Otherwise, frees ptr and sets it to NULL.

SAFE_STR

#define SAFE_STR(str)

If str is NULL, returns "". Otherwise, returns str. Shorthand for (str ? str : "").

utlOops

void utlOops(const char *message, const char *file, int line)

Terminates the GU, initializes the debug screen, and displays message. file and line are displayed at the bottom of the screen to indicate where the problem occurred. This function is best called with the __FILE__ and __LINE__ macros, like so:

utlOops("Out of memory", __FILE__, __LINE__);

This function never returns.

utlSetupCallbacks

int utlSetupCallbacks()

Sets up a basic exit callback, which allows the kernel to terminate the program. Returns the callback thread's ID.