Created
July 3, 2014 19:26
-
-
Save cynthia/93f4719694b82fe45485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* dualshock4.h - DualShock 4 USB HID Report Helper | |
* | |
* NOTE: Do not use this for production purposes, it's far from complete and is my | |
* initial attempt at working with USB HID. If it doesn't work, too bad. | |
* (Hoping to put this into content/browser/gamepad someday. If I ever finish.) | |
** | |
* Copyright (c) 2014 Sangwhan Moon | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in | |
* all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
* THE SOFTWARE. | |
**/ | |
#pragma pack(push, 1) | |
struct DualShock4 { | |
uint8_t bullshit_always_1; | |
uint8_t stick_left_x; | |
uint8_t stick_left_y; | |
uint8_t stick_right_x; | |
uint8_t stick_right_y; | |
unsigned int hat : 4; | |
bool square : 1; | |
bool cross : 1; | |
bool circle : 1; | |
bool triangle : 1; | |
bool l1_or_ps : 1; | |
bool r1_or_click : 1; | |
bool l2 : 1; | |
bool r2 : 1; | |
bool shr : 1; | |
bool opt : 1; | |
bool l3 : 1; | |
bool r3 : 1; | |
bool bullshit_or_ps : 1; | |
bool bullshit_or_click : 1; | |
unsigned int counter : 6; | |
uint8_t primary_trigger; | |
uint8_t secondary_trigger; | |
uint16_t i_16_10; | |
uint8_t i_8_12; | |
int16_t axis_a_1; | |
int16_t axis_a_2; | |
int16_t axis_a_3; | |
int16_t axis_b_1; | |
int16_t axis_b_2; | |
int16_t axis_b_3; | |
uint16_t i_16_25; | |
uint16_t i_16_27; | |
uint8_t i_8_29; | |
uint8_t i_8_30; | |
uint8_t i_8_31; | |
uint8_t i_8_32; | |
uint8_t i_8_33; | |
uint8_t i_8_34; | |
unsigned int touch_a_id: 7; | |
bool touch_a_on: 1; | |
unsigned int touch_a_x: 12; | |
unsigned int touch_a_y: 12; | |
unsigned int touch_b_id: 7; | |
bool touch_b_on: 1; | |
unsigned int touch_b_x: 12; | |
unsigned int touch_b_y: 12; | |
uint8_t i_25; | |
uint8_t i_26; | |
uint8_t i_27; | |
uint8_t i_28; | |
uint8_t i_29; | |
uint8_t i_30; | |
uint8_t i_31; | |
uint8_t i_32; | |
uint8_t i_33; | |
uint8_t i_34; | |
uint8_t i_35; | |
uint8_t i_36; | |
uint8_t i_37; | |
uint8_t i_38; | |
uint8_t i_39; | |
uint8_t i_40; | |
uint8_t i_41; | |
uint8_t i_42; | |
uint8_t i_43; | |
uint8_t i_44; | |
uint8_t i_45; | |
uint8_t i_46; | |
uint8_t i_47; | |
uint8_t i_48; | |
uint8_t i_49; | |
uint8_t i_50; | |
uint8_t i_51; | |
uint8_t i_52; | |
uint8_t i_53; | |
uint8_t i_54; | |
uint8_t i_55; | |
uint8_t i_56; | |
uint8_t i_57; | |
uint8_t i_58; | |
uint8_t i_59; | |
uint8_t i_60; | |
uint8_t i_61; | |
uint8_t i_62; | |
uint8_t i_63; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment