Changes

4,593 bytes added ,  14:17, 22 May 2016
no edit summary
Line 1: Line 1: −
This library handles communication with controllers other than the Gamepad. It includes functions for the Wii Remote (WPAD), the Wii Balance Board (WBC), and a higher-level abstraction (KPAD). Unlike [[vpad.rpl]] for the Gamepad, this library appears to be optional, being loaded much closer to the application binary.
+
This library handles communication with controllers other than the Gamepad. It includes functions for the Wii Remote (WPAD), the Wii Balance Board (WBC -or- WUD), and a higher-level abstraction (KPAD). Unlike [[vpad.rpl]] for the Gamepad, this library appears to be optional, being loaded much closer to the application binary.
    
==Functions==
 
==Functions==
Line 5: Line 5:  
{| class="wikitable"
 
{| class="wikitable"
 
!Name
 
!Name
!Prototype
+
! scope="col" style="width: 360px;" | Prototype
 
!Description
 
!Description
 +
|-
 +
|WPADInit
 +
|void WPADInit(void);
 +
|Initializes the library
 +
|-
 +
|WPADShutdown
 +
|void WPADShutdown(void);
 +
|Cleans up after the library
 +
|-
 +
|WPADProbe
 +
|int WPADProbe(int chan, void * buffer);
 +
|This function checks if there is a controller connected to chan (between 0 and 3 for four total controllers). Possible return values include 0 (connection success), -1 (remote not connnected) and -2 (remote is pairing with the console). The values will sometimes flicker due to connection issues with the controller. Be sure to call this BEFORE WPADRead so that you can avoid reading fake data from disconnected controllers.
 
|-
 
|-
 
|WPADRead
 
|WPADRead
 
|int WPADRead(int chan, void *buffer);
 
|int WPADRead(int chan, void *buffer);
 
|Stores raw controller data for the specified Wii Remote in ''buffer''
 
|Stores raw controller data for the specified Wii Remote in ''buffer''
 +
|-
 +
|WPADIsMotorEnabled
 +
|bool WPADIsMotorEnabled(void);
 +
|Get's the status of the WPAD motor
 +
|-
 +
|WPADGetAcceptConnection
 +
|bool WPADGetAcceptConnection(void);
 +
|Returns true if we allow new wpad's to connect
 +
|-
 +
|WPADSetAcceptConnection
 +
|bool WPADSetAcceptConnection(bool acceptConnections);
 +
|Set's whenever or not we allow new connections
 +
|-
 +
|WPADStartSyncDevice
 +
|bool WPADStartSyncDevice( void );
 +
|Begins the pairing process required to use the Wii remote
 +
|-
 +
|WPADStartSyncDeviceEx
 +
|bool WPADStartSyncDeviceEx( void );
 +
|Begins the pairing process required to use the Wii remote (Ex version)
 +
|-
 +
|WPADCancelSyncDevice
 +
|bool WPADCancelSyncDevice( void );
 +
|Cancels the current device sync function
 +
|-
 +
|WPADStartClearDevice
 +
|void WPADStartClearDevice( void );
 +
|Removes all traces of wii remote from wii-U
 +
|-
 +
|WPADClearDeviceCallback
 +
|void WPADClearDeviceCallback (  s32  );
 +
|Sets the callback to call if the device information is completely deleted.
 +
|-
 +
|WPADSyncDeviceCallback
 +
|void WPADSyncDeviceCallback( s32 result, s32 num );
 +
|Set the callback if the sync button is pressed
 
|}
 
|}
   Line 44: Line 92:  
#define WPAD_EXT_MPLUS_NUNCHUK 6
 
#define WPAD_EXT_MPLUS_NUNCHUK 6
 
#define WPAD_EXT_MPLUS_CLASSIC 7
 
#define WPAD_EXT_MPLUS_CLASSIC 7
 +
 +
#define WPAD_BATTERYLVL_CRIT  0
 +
#define WPAD_BATTERYLVL_LOW    1
 +
#define WPAD_BATTERYLVL_MEDIUM 2
 +
#define WPAD_BATTERYLVL_HIGH  3
 +
#define WPAD_BATTERYLVL_FULL  4
    
typedef struct {
 
typedef struct {
Line 93: Line 147:  
     uint16  roll;    /* WiiMotionPlus */
 
     uint16  roll;    /* WiiMotionPlus */
 
} WPADMPStatus; /* WiiMotionPlus */
 
} WPADMPStatus; /* WiiMotionPlus */
 +
 +
typedef struct {
 +
    uint16 WPADData[20]; /* Default WPAD data isn't used */
 +
    uint8  ext;          /* Extension, see WPAD_EXT */
 +
    uint8  err;          /* Error codes */
 +
    uint16 press[4];    /* 4 Pads for sensing balance */
 +
    uint8  temp;        /* Temperature */
 +
    uint8  battery;      /* Battery */
 +
} WPADBLStatus; /* Balance Board */
    
</syntaxhighlight>
 
</syntaxhighlight>
 
|}
 
|}
 +
 +
==Tables==
 +
=== List of Functions (Ioctl/Ioctlv/IoctlAsync/IoctlvAsync) ===
 +
{| class="wikitable sortable"
 +
! Command
 +
! Function
 +
! Ioctl
 +
! Ioctlv
 +
! IoctlAsync
 +
! IoctlvAsync
 +
! Notes
 +
|-
 +
| 0x00
 +
| Unknown
 +
|       
 +
|       
 +
|         
 +
|         X
 +
|
 +
|-
 +
| 0x01
 +
| Unknown
 +
|    X
 +
|       
 +
|       
 +
|         
 +
|
 +
|-
 +
| 0x02
 +
| Unknown
 +
|    X
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x03
 +
| Unknown
 +
|    X
 +
|       
 +
|       
 +
|         
 +
|
 +
|-
 +
| 0x04
 +
| WPADStartSyncDevice
 +
|       
 +
|       
 +
|       
 +
|         X        
 +
|
 +
|-
 +
| 0x06
 +
| WPADPurgeBtDb
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x07
 +
| Unknown
 +
|    X
 +
|       
 +
|       
 +
|         
 +
|
 +
|-
 +
| 0x08
 +
| WPADCancelSyncDevice
 +
|    X
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x09
 +
| WPADSetDisableChannelImm
 +
|    X
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x0A
 +
| WPADStartClearDevice
 +
|    X
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x0B
 +
| WUDSetVisibility
 +
|       
 +
|       
 +
|       
 +
|         X
 +
| WUD is Balance Board (aka WBC)
 +
|-
 +
| 0x0C
 +
| WUDSetSniffMode
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x0E
 +
| WPADSetClearDeviceCallback
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x11
 +
| WUDSerialFlashUpdate
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x12
 +
| WUDSerialFlashTestMode
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x13
 +
| WUDSerialFlashTestWrite
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x14
 +
| WUDSerialFlashTestRead
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|         
 +
|-
 +
| 0x17
 +
| WPADStartSyncDeviceEx
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x1A
 +
| WPADDeleteControllerOrder
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x1B
 +
| WPADSetSyncDeviceCallback
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
 +
|-
 +
| 0x1C
 +
| Unknown
 +
|       
 +
|       
 +
|       
 +
|         X
 +
|
53

edits