libnds
Loading...
Searching...
No Matches
Macros | Functions
slot2.h File Reference

Slot-2 peripheral detection, external RAM. More...

#include <stdbool.h>
#include <stdint.h>

Macros

#define SLOT2_PERIPHERAL_EXTRAM   0x00000001
 External RAM.
 
#define SLOT2_PERIPHERAL_FACE_SCAN   0x00008000
 TODO: Facening Scan.
 
#define SLOT2_PERIPHERAL_GPS_RANGER   0x00001000
 TODO: Ranger GPS.
 
#define SLOT2_PERIPHERAL_GUITAR_GRIP   0x00000008
 Guitar grip.
 
#define SLOT2_PERIPHERAL_GYRO_GPIO   0x00000100
 Gyro sensor (GPIO; WarioWare)
 
#define SLOT2_PERIPHERAL_PADDLE   0x00000002
 Paddle controller (Taito)
 
#define SLOT2_PERIPHERAL_PIANO   0x00000004
 Piano keyboard (Easy Piano)
 
#define SLOT2_PERIPHERAL_RUMBLE_EZ   0x00000080
 Rumble (EZ)
 
#define SLOT2_PERIPHERAL_RUMBLE_GPIO   0x00000010
 Rumble (GPIO; WarioWare/Drill Dozer)
 
#define SLOT2_PERIPHERAL_RUMBLE_PAK   0x00000020
 DS Rumble Pak.
 
#define SLOT2_PERIPHERAL_SLIDE_MAGKID   0x00000040
 TODO: Slide controller (MagKid)
 
#define SLOT2_PERIPHERAL_SOLAR_GPIO   0x00000400
 Solar sensor (GPIO; Boktai)
 
#define SLOT2_PERIPHERAL_TILT   0x00000200
 Tilt sensor (Yoshi)
 

Functions

void peripheralSlot2Close (void)
 Close (lock) the detected Slot-2 peripheral.
 
void peripheralSlot2Exit (void)
 Un-initialize any previously detected peripheral.
 
const char * peripheralSlot2GetName (void)
 Get the name of the detected Slot-2 peripheral, or "None".
 
uint32_t peripheralSlot2GetSupportMask (void)
 Get the mask of SLOT2_PERIPHERALs supported by this device.
 
bool peripheralSlot2Init (uint32_t peripheral_mask)
 Initialize a Slot-2 peripheral.
 
static bool peripheralSlot2InitDefault (void)
 Initialize any Slot-2 peripheral.
 
bool peripheralSlot2IsDetected (void)
 Check if a Slot-2 peripheral has been detected.
 
bool peripheralSlot2Open (uint32_t peripheral_mask)
 Open (unlock) the specific Slot-2 peripheral.
 
uint32_t peripheralSlot2RamBanks (void)
 Return the number of Slot-2 RAM banks; 0 if not detected.
 
void peripheralSlot2RamSetBank (uint32_t bank)
 Switch to a different Slot-2 RAM bank.
 
uint32_t peripheralSlot2RamSize (void)
 Return the size, in bytes, of Slot-2 RAM space; 0 if not detected.
 
uint16_t * peripheralSlot2RamStart (void)
 Return the beginning of Slot-2 RAM space; NULL if not detected.
 

Detailed Description

Slot-2 peripheral detection, external RAM.

Function Documentation

◆ peripheralSlot2GetName()

const char * peripheralSlot2GetName ( void  )

Get the name of the detected Slot-2 peripheral, or "None".

Returns
Pointer to the string. Don't call free() with this pointer.

◆ peripheralSlot2GetSupportMask()

uint32_t peripheralSlot2GetSupportMask ( void  )

Get the mask of SLOT2_PERIPHERALs supported by this device.

Returns
The mask.

◆ peripheralSlot2Init()

bool peripheralSlot2Init ( uint32_t  peripheral_mask)

Initialize a Slot-2 peripheral.

Note that this method can take up to a few blocking frames to complete.

Parameters
peripheral_maskThe peripheral mask to use. This allows narrowing the cartridge search query down to specific cartridges for faster detection and minimizing false positives.
Returns
True if a peripheral was detected, false otherwise.

◆ peripheralSlot2InitDefault()

static bool peripheralSlot2InitDefault ( void  )
inlinestatic

Initialize any Slot-2 peripheral.

Returns
True if a peripheral was detected, false otherwise.

◆ peripheralSlot2IsDetected()

bool peripheralSlot2IsDetected ( void  )

Check if a Slot-2 peripheral has been detected.

Returns
True if a peripheral was detected, false otherwise.

◆ peripheralSlot2Open()

bool peripheralSlot2Open ( uint32_t  peripheral_mask)

Open (unlock) the specific Slot-2 peripheral.

This is necessary for some cartridges which may have multiple functions (for example, external RAM and rumble in a conflicting address space).

Parameters
peripheral_maskThe peripheral mask to unlock.
Returns
True on success, false on failure (no peripheral of type present).

◆ peripheralSlot2RamBanks()

uint32_t peripheralSlot2RamBanks ( void  )

Return the number of Slot-2 RAM banks; 0 if not detected.

Returns
The number of banks.

◆ peripheralSlot2RamSetBank()

void peripheralSlot2RamSetBank ( uint32_t  bank)

Switch to a different Slot-2 RAM bank.

Parameters
bankThe bank to switch to.

◆ peripheralSlot2RamSize()

uint32_t peripheralSlot2RamSize ( void  )

Return the size, in bytes, of Slot-2 RAM space; 0 if not detected.

Returns
The size in bytes.

◆ peripheralSlot2RamStart()

uint16_t * peripheralSlot2RamStart ( void  )

Return the beginning of Slot-2 RAM space; NULL if not detected.

Returns
A pointer to the start of the RAM space, or NULL.