CTRDG_SetPulledOutCallback

C Specification

#include <nitro/ctrdg.h>
void CTRDG_SetPulledOutCallback( CTRDGPulledOutCallback callback );
  

Arguments

callback The callback function that is called when Game Pak removal is detected.

Return Values

None.

Description

This function sets the callback function that is called when a Game Pak removal is detected.

CTRDGPulledOutCallback is callback function.

The callback type is defined as:

typedef BOOL ( *CTRDGPulledOutCallback )( void );

This function does not call the callback if a NULL value is specified in the callback argument.




About Callbacks

If a value of TRUE is specified in the callback return value, the function will stop after it exits from the callback. If a value of FALSE is specified in the callback return value, the function will not stop after it exits from the callback. When you stop the function after necessary processing, call the CTRDG_TerminateForPulledOut afterward. However, the stop process notifies the ARM7 processor using PXI. You cannot call this function from inside the callback while interrupts are prohibited.

For example, enter the following statements to display the "DON'T PULL OUT CARTRIDGE" message and to stop the function when a Game Pak removal is detected. (Many lines, such as init process, are abridged.)

Example:

BOOL isPulledOut = FALSE;

void NitroMain( void )
{
 initializeRoutine();
 CTRDG_Init(); // maybe called in OS_Init()
 CTRDG_SetPulledOutCallback( myCallback ); // set callback

 while(1)
 {
   usualGameProcedure();
   if ( isPulledOut == TRUE ) // check if cartridge is pulled out
   {
     drawMessageRoutine( "DON'T PULL OUT CARTRIDGE" );
     CTRDG_TerminateForPulledOut(); // termination
     // program halted. never reached.

 }
}

//---- callback for cartridge pulled out
BOOL myCallback( void )
{
 isPulledOut = TRUE; // remember that cartridge is pulled out
 return FALSE; // means not to terminate
}

See Also

CTRDG_Init, CTRDG_TerminateForPulledOut

Revision History

09/15/2004 Initial version.