Nn hpad.rpl

From WiiUBrew
Jump to navigation Jump to search

hpad.rpl (HID Pad) is the library for communication with the Nintendo GameCube Controller Adapter and GameCube controllers. It is only used in Super Smash Bros. for Wii U and was not included in the SDK for use by third parties. It contains left-in debug functions from when the library was still in its beta phase of development.

Functions

HPAD

Name Prototype Description
HPADInit int32_t HPADInit(void) Initialises the HPAD library.
HPADShutdown int32_t HPADShutdown(void) Shuts down the HPAD library.
HPADRead int32_t HPADRead(HPADChan chan, HPADStatus *samplingBufs, int32_t count) Reads status buffers from a specified HPAD channel.
HPADControlMotor int32_t HPADControlMotor(HPADChan chan, HPADMotorCommand command) Sends a motor/rumble command to the specified HPAD channel.
HPADRecalibrate int32_t HPADRecalibrate(HPADChan chan) Invalidates calibration data of the specified HPAD channel.
HPADSetConnectCallback HPADConnectCallback HPADSetConnectCallback(HPADChan chan, HPADConnectCallback callback) Sets a callback for once the specified HPAD channel is connected.
HPADGetGGGGStatus int32_t HPADGetGGGGStatus(HPADGGGGChan chan, HPADGGGGStatus *status) Get the status of the specified GGGG channel (GC Adapter).
HPADSetGgggConnectCallback HPADGGGGConnectCallback HPADSetGgggConnectCallback(HPADGGGGChan chan, HPADGGGGConnectCallback callback) Sets a callback for once the specified GGGG Adapter is connected.
HPADSetPowerSupplyCallback HPADPowerSupplyCallback HPADSetPowerSupplyCallback(HPADGGGGChan chan, HPADPowerSupplyCallback callback) Sets a callback for once the power supply of the specified GGGG Adapter is connected.
HPADSetSamplingCallback HPADSamplingCallback HPADSetSamplingCallback(HPADGGGGChan chan, HPADSamplingCallback callback) Sets a callback for once a sample is received from the specified GGGG Adapter.
HPADResetDevice int32_t HPADResetDevice(HPADGGGGChan chan, HPADResetCallback callback) Resets the specified GGGG Adapter.

BETA_DEBUG

Name Prototype Description
BETA_DEBUG_DUMP void BETA_DEBUG_DUMP(void) Prints internal state info to the COS shell.
BETA_DEBUG_GET_QUEUE_SIZE int32_t BETA_DEBUG_GET_QUEUE_SIZE(HPADGGGGChan chan) Gets the command queue size of the specified adapter.
BETA_DEBUG_SEND_REPT_ID void BETA_DEBUG_SEND_REPT_ID(HPADGGGGChan chan, uint32_t reptId) Sends a report to the specified adapter.
BETA_DEBUG_GET_RAW_DATA void BETA_DEBUG_GET_RAW_DATA(void) Returns immediately.
BETA_DEBUG_SET_DUMP_MODE void BETA_DEBUG_SET_DUMP_MODE(void) Returns immediately.

Internal

__hpad

Name Prototype Description Address
__hpad_OnAcquiredForeground void __hpad_OnAcquiredForeground(void) Handles an HPAD foreground acquisition event. 0x020017cc
__hpadAcquiredForeground void __hpadAcquiredForeground(void) Performs HPAD setup when when the driver aquires the foreground. 0x02001580
__hpadAssignGGGG void __hpadAssignGGGG(uint32_t hidHandle, void *userContext) Attaches and configures a GGGG HID device for a specified slot. 0x02000ea8
__hpadAttatchCallback HID attach event handler callback for GGGG devices. 0x02001280
__hpadDriver_AutoDone void __hpadDriver_AutoDone(void) Notifies that the HPAD library has completed automatic initialisation. (?) 0x0200193c
__hpadDriver_AutoInit void __hpadDriver_AutoInit(void) Notifies that the HPAD library is undergoing automatic initialisation. (?) 0x020018ec
__hpadDriver_OnReleaseForeground void __hpadDriver_OnReleaseForeground(void) Handles the HPAD driver releasing foreground. 0x02001884
__hpadForceSendMotorCommand Forces sending a motor/rumble command for a given HPAD slot. (?) 0x02001028
__hpadHidIsBusy BOOL __hpadHidIsBusy(void) Checks whether any assigned HID slot is currently busy. 0x020004c8
__hpadManageHandler void __hpadManageHandler(void) Periodic HPAD management handler invoked by an OSAlarm. (?) 0x020009f4
__hpadPrintCurrentTime Logs the current system calendar time and the current symbol by some functions. 0x02003b54
__hpadPushCommand Pushes a command into the HPAD command queue. 0x020000ec
__hpadReadCallback Callback function for HIDRead. 0x02000b34
__hpadReleaseForeground void __hpadReleaseForeground(void) Performs cleanup when the HPAD driver releases the foreground. 0x020016ec
__hpadSelectAssignedIdx Selects a slot index for assigning a newly attached HID. 0x02000d68
__hpadSendReq Sends an HPAD request for a given HID slot. (?) 0x02000614
__hpadWriteCallback Callback function for HIDWrite. 0x02000568
__hpadDetachResetCallback 0x02000780

HPADi

Name Prototype Description Address
HPADiConnectCallback Callback function for connection. 0x020010b8
HPADiPowerSupplyCallback Callback function for when there is a change in power supply. 0x020019e8
HPADiSetInactivePeriod void HPADiSetInactivePeriod(IMParameter parameter) Sets the inactive period as the current IM state. 0x02003be8


Defines

HPAD Specifications

//! The minimum value of the stick axis
#define HPAD_STICK_AXIS_MIN    -56
//! The maximum value of the stick axis
#define HPAD_STICK_AXIS_MAX    56
//! The minimum value of the substick axis
#define HPAD_SUBSTICK_AXIS_MIN -44
//! The maximum value of the substick axis
#define HPAD_SUBSTICK_AXIS_MAX 44
//! The minimum value of the trigger
#define HPAD_TRIGGER_MIN       0
//! The maximum value of the trigger
#define HPAD_TRIGGER_MAX       150

Enums

HPADChan

Name Value
HPAD_CHAN_0 0
HPAD_CHAN_1 1
HPAD_CHAN_2 2
HPAD_CHAN_3 3
HPAD_CHAN_4 4
HPAD_CHAN_5 5
HPAD_CHAN_6 6
HPAD_CHAN_7 7

HPADGGGGChan

Name Value
HPAD_GGGG_CHAN_0 0
HPAD_GGGG_CHAN_1 1

HPADButtons

Name Value
HPAD_BUTTON_A 0x0001
HPAD_BUTTON_B 0x0002
HPAD_BUTTON_X 0x0004
HPAD_BUTTON_Y 0x0008
HPAD_BUTTON_LEFT 0x0010
HPAD_BUTTON_RIGHT 0x0020
HPAD_BUTTON_DOWN 0x0040
HPAD_BUTTON_UP 0x0080
HPAD_BUTTON_START 0x0100
HPAD_TRIGGER_Z 0x0200
HPAD_TRIGGER_R 0x0400
HPAD_TRIGGER_L 0x0800
HPAD_STICK_EMULATION_LEFT 0x00001000
HPAD_STICK_EMULATION_RIGHT 0x00002000
HPAD_STICK_EMULATION_DOWN 0x00004000
HPAD_STICK_EMULATION_UP 0x00008000
HPAD_SUBSTICK_EMULATION_LEFT 0x00010000
HPAD_SUBSTICK_EMULATION_RIGHT 0x00020000
HPAD_SUBSTICK_EMULATION_DOWN 0x00040000
HPAD_SUBSTICK_EMULATION_UP 0x00080000

HPADMotorCommand

Name Value
HPAD_MOTOR_COMMAND_STOP 0
HPAD_MOTOR_COMMAND_RUMBLE 1
HPAD_MOTOR_COMMAND_STOP_HARD 2

Structs

HPADStatus

struct HPADStatus
{
   //! Indicates what HPADButtons are held down.
   int32_t hold;
   //! Indicates what HPADButtons have been pressed since last sample.
   int32_t trigger;
   //! Indicates what HPADButtons have been released since last sample.
   int32_t release;
   //! X-Position of the analog stick
   int8_t stickX;
   //! Y-Position of the analog stick
   int8_t stickY;
   //! X-Position of the analog substick/C-Stick
   int8_t substickX;
   //! Y-Position of the analog substick/C-Stick
   int8_t substickY;
   //! Position of the left analog trigger
   uint8_t triggerL;
   //! Position of the right analog trigger
   uint8_t triggerR;
   //! Status of the controller
   uint8_t status;
   WUT_PADDING_BYTES(0x1);
   //! Read error, 0 for success
   int32_t error;
}

HPADGGGGStatus

struct HPADGGGGStatus
{
   //! \c TRUE if the adapeter is connected
   BOOL connected;
   //! \c TRUE if the power supply is connected
   BOOL powerSupplyConnected;
   //! \c TRUE if the adapter is active/is sending samples
   BOOL active;
}