CTRDG_SetPulledOutCallback

Syntax

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

Arguments

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

Return Values

None.

Description

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

CTRDGPulledOutCallback is defined below:

typedef BOOL ( *CTRDGPulledOutCallback )( void );

This defines the type of the callback function callback.

If NULL is specified in callback, no callback will be called.




About Callbacks

If a value of TRUE is specified in the callback return value, the program stops after it exits from the callback. If a value of FALSE is specified in the callback return value, the function does 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 disabled.

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 processing, 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

2004/09/15 Initial version.


CONFIDENTIAL