diff options
author | xyzz | 2016-09-27 17:40:54 +0200 |
---|---|---|
committer | GitHub | 2016-09-27 17:40:54 +0200 |
commit | 8629bcb3ba8a85414c4627524658d35faf4dbb13 (patch) | |
tree | 46c4d269db27689ec2df83ceb1f3c9832dd9ac1c | |
parent | Merge pull request #60 from DaveeFTW/master (diff) | |
parent | Add sceCtrlGetBatteryInfo and update SceCtrlData (diff) | |
download | vds-libraries-8629bcb3ba8a85414c4627524658d35faf4dbb13.tar.gz |
Merge pull request #56 from d3m3vilurr/patch-1
Add more SceCtrl NIDs
-rw-r--r-- | include/user/ctrl.h | 69 | ||||
-rw-r--r-- | nids/360/SceCtrl.yml | 10 |
2 files changed, 77 insertions, 2 deletions
diff --git a/include/user/ctrl.h b/include/user/ctrl.h index 0d15dfc..90eb4d8 100644 --- a/include/user/ctrl.h +++ b/include/user/ctrl.h @@ -14,9 +14,12 @@ enum { SCE_CTRL_ERROR_FATAL = 0x803400FF }; -/** Enumeration for the digital controller buttons. */ +/** Enumeration for the digital controller buttons. + * L1/R1/L3/R3 only can bind using sceCtrlReadBufferPositiveExt2 */ enum { SCE_CTRL_SELECT = 0x000001, //!< Select button. + SCE_CTRL_L3 = 0x000002, //!< L3 button. + SCE_CTRL_R3 = 0x000004, //!< R3 button. SCE_CTRL_START = 0x000008, //!< Start button. SCE_CTRL_UP = 0x000010, //!< Up D-Pad button. SCE_CTRL_RIGHT = 0x000020, //!< Right D-Pad button. @@ -24,6 +27,8 @@ enum { SCE_CTRL_LEFT = 0x000080, //!< Left D-Pad button. SCE_CTRL_LTRIGGER = 0x000100, //!< Left trigger. SCE_CTRL_RTRIGGER = 0x000200, //!< Right trigger. + SCE_CTRL_L1 = 0x000400, //!< L1 button. + SCE_CTRL_R1 = 0x000800, //!< R1 button. SCE_CTRL_TRIANGLE = 0x001000, //!< Triangle button. SCE_CTRL_CIRCLE = 0x002000, //!< Circle button. SCE_CTRL_CROSS = 0x004000, //!< Cross button. @@ -31,6 +36,15 @@ enum { SCE_CTRL_ANY = 0x010000 //!< Any input intercepted. }; +/** Enumeration for the controller types. */ +enum { + SCE_CTRL_TYPE_UNPAIRED = 0, + SCE_CTRL_TYPE_PHY = 1, //!< Physical controller for VITA + SCE_CTRL_TYPE_VIRT = 2, //!< Virtual controller for PSTV + SCE_CTRL_TYPE_DS3 = 4, //!< DualShock 3 + SCE_CTRL_TYPE_DS4 = 8 //!< DualShock 4 +}; + /** Controller mode. */ enum { /** Digitial buttons only. */ @@ -56,7 +70,13 @@ typedef struct SceCtrlData { /** Right analogue stick, Y axis. */ unsigned char ry; /** Reserved. */ - uint8_t reserved[16]; + uint8_t reserved0[4]; + /** Left trigger (L2) */ + unsigned char lt; + /** Right trigger (R2) */ + unsigned char rt; + /** Reserved. */ + uint8_t reserved1[10]; } SceCtrlData; /** Structure to pass as argument to ::sceCtrlSetRapidFire */ @@ -75,6 +95,12 @@ typedef struct SceCtrlActuator { int unk; //!< Unknown } SceCtrlActuator; +/** Structure to pass as argument to ::sceCtrlGetControllerPortInfo */ +typedef struct SceCtrlPortInfo { + uint8_t port[5]; //!< Controller type of each ports + uint8_t unk[11]; //!< Unknown +} SceCtrlPortInfo; + /** * Set the controller mode. * @@ -85,6 +111,15 @@ typedef struct SceCtrlActuator { int sceCtrlSetSamplingMode(int mode); /** + * Set the controller extend mode. + * + * @param[in] mode - One of ::CtrlMode. + * + * @return The previous mode, <0 on error. + */ +int sceCtrlSetSamplingModeExt(int mode); + +/** * Get the current controller mode. * * @param[out] pMode - Return value, see ::CtrlMode. @@ -127,6 +162,19 @@ int sceCtrlPeekBufferNegative(int port, SceCtrlData *pad_data, int count); int sceCtrlReadBufferPositive(int port, SceCtrlData *pad_data, int count); /** + * Get the controller extended state information (blocking, positive logic). + * + * This function will bind L/R tringger value to L1/R1 instead of LTRIGGER/RTRIGGER + * + * @param[in] port - use 0. + * @param[out] *pad_data - see ::SceCtrlData. + * @param[in] count - Buffers count. + * + * @return Buffers count, between 1 and 'count'. <0 on error. + */ +int sceCtrlReadBufferPositiveExt2(int port, SceCtrlData *pad_data, int count); + +/** * Get the controller state information (blocking, negative logic). * * @param[in] port - use 0. @@ -180,6 +228,23 @@ int sceCtrlSetActuator(int port, const SceCtrlActuator* pState); */ int sceCtrlSetLightBar(int port, SceUInt8 r, SceUInt8 g, SceUInt8 b); +/** + * Get controller port information. + * + * @param[out] info - see ::SceCtrlPortInfo + * @return 0, <0 on error + */ +int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info); + +/** + * Get controller battery information. + * + * @param[in] port - use 1 for the first paired controller, etc. + * @param[out] batt - battery level, between 0-5, 0xEE charging, 0xEF charged + * + * @return 0, <0 on error. + */ +int sceCtrlGetBatteryInfo(int port, SceUInt8 *batt); #ifdef __cplusplus } #endif diff --git a/nids/360/SceCtrl.yml b/nids/360/SceCtrl.yml index 51e10bf..ae1bcfd 100644 --- a/nids/360/SceCtrl.yml +++ b/nids/360/SceCtrl.yml @@ -6,14 +6,24 @@ modules: nid: 0xD197E3C7 functions: sceCtrlClearRapidFire: 0xD8294C9C + sceCtrlDisconnect: 0x16D26DC7 + sceCtrlGetBatteryInfo: 0x8F9B1CE5 + sceCtrlGetButtonIntercept: 0x6FAFAD05 + sceCtrlGetControllerPortInfo: 0x324F1B66 sceCtrlGetSamplingMode: 0xEC752AAF sceCtrlPeekBufferNegative: 0x104ED1A7 sceCtrlPeekBufferPositive: 0xA9C3CED6 sceCtrlPeekBufferPositive2: 0x15F81E8C + sceCtrlPeekBufferPositiveExt: 0xA59454D3 + sceCtrlPeekBufferPositiveExt2: 0x860BF292 sceCtrlReadBufferNegative: 0x15F96FB0 sceCtrlReadBufferPositive: 0x67E7AB83 + sceCtrlReadBufferPositive2: 0xC4226A3E + sceCtrlReadBufferPositiveExt2: 0xA7178860 sceCtrlSetActuator: 0xDBCAA0C9 sceCtrlSetButtonIntercept: 0x433D71F4 sceCtrlSetLightBar: 0xDA11D433 sceCtrlSetRapidFire: 0xE9CB69C8 sceCtrlSetSamplingMode: 0xA497B150 + sceCtrlSetSamplingModeExt: 0xB1DC4378 + sceCtrlSingleControllerMode: 0x031BE396 |