Vpad.rpl: Difference between revisions
Jump to navigation
Jump to search
m →Keys |
Marionumber1 (talk | contribs) →Keys: Convert button bitflags into C defines |
||
| Line 106: | Line 106: | ||
== Defines == | == Defines == | ||
=== | === Buttons === | ||
<syntaxhighlight lang="C"> | |||
#define BUTTON_A 0x8000 | |||
#define BUTTON_B 0x4000 | |||
#define BUTTON_X 0x2000 | |||
#define BUTTON_Y 0x1000 | |||
#define BUTTON_LEFT 0x0800 | |||
#define BUTTON_RIGHT 0x0400 | |||
#define BUTTON_UP 0x0200 | |||
#define BUTTON_DOWN 0x0100 | |||
#define BUTTON_ZL 0x0080 | |||
#define BUTTON_ZR 0x0040 | |||
#define BUTTON_L 0x0020 | |||
#define BUTTON_R 0x0010 | |||
#define BUTTON_PLUS 0x0008 | |||
#define BUTTON_MINUS 0x0004 | |||
#define BUTTON_HOME 0x0002 | |||
#define BUTTON_SYNC 0x0001 | |||
</syntaxhighlight> | |||
Revision as of 20:52, 9 April 2015
This controls communication with the Gamepad, internally called VPAD by this library. It uses the VPADBASE library internally.
Functions
| Name | Prototype | Description |
|---|---|---|
| VPADRead | int VPADRead(int padnum, void *buffer, int length, int *err); | Stores raw controller data in buffer for the specified Gamepad |
Structures
VPAD Data
Can be gotten using VPADRead(), length seems to control the max amount of "datasets" to keep. A single dataset containing raw controller data is 0xAC bytes.
| Offset | Length | Description |
|---|---|---|
| 2 | 2 | Buttons, ABXY, Left, Right, Up, Down in that order (bits) |
| 3 | 1 | Buttons, ZL, ZR, L, R, +, -, Power/Home, Sync in that order (bits) |
| 12 | 8 | Left Joystick, vectors for X and Y |
| 20 | 8 | Right Joystick, vectors for X and Y |
| Touchscreen Input | ||
| 82 | 2 | Touchscreen X |
| 84 | 2 | Touchscreen Y |
| 86 | 2 | Flag for if touchscreen is currently being touched (1 = Yes, 0 = No) |
| 88 | 2 | Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid) |
| 90 | 2 | Modified Touchscreen X? |
| 92 | 2 | Modified Touchscreen Y? |
| 94 | 2 | Modified Flag for if touchscreen is currently being touched (1 = Yes, 0 = No)? |
| 96 | 2 | Modified Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid)? |
| 98 | 2 | Modified Touchscreen X? |
| 100 | 2 | Modified Touchscreen Y? |
| 102 | 2 | Modified Flag for if touchscreen is currently being touched (1 = Yes, 0 = No)? |
| 104 | 2 | Modified Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid)? |
| Other Data | ||
| 160 | 1 | Something related to volume slider |
| 161 | 1 | Battery related. Charge level? out of 6 |
| 163 | 1 | Something related to volume slider(one less than 0xA0) |
| 164 | 8 | Padding? |
Defines
Buttons
#define BUTTON_A 0x8000
#define BUTTON_B 0x4000
#define BUTTON_X 0x2000
#define BUTTON_Y 0x1000
#define BUTTON_LEFT 0x0800
#define BUTTON_RIGHT 0x0400
#define BUTTON_UP 0x0200
#define BUTTON_DOWN 0x0100
#define BUTTON_ZL 0x0080
#define BUTTON_ZR 0x0040
#define BUTTON_L 0x0020
#define BUTTON_R 0x0010
#define BUTTON_PLUS 0x0008
#define BUTTON_MINUS 0x0004
#define BUTTON_HOME 0x0002
#define BUTTON_SYNC 0x0001