From 9df3831707e32052386ecaf9d7c4be863f0d749a Mon Sep 17 00:00:00 2001 From: Sunguk Lee Date: Sun, 18 Sep 2016 03:05:01 +0900 Subject: Add more button defines, and more SceCtrl function defines - sceCtrlReadBufferPositiveExt2 - sceCtrlSetSamplingModeExt - sceCtrlGetControllerPortInfo --- include/user/ctrl.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/user/ctrl.h b/include/user/ctrl.h index 0d15dfc..7e06a41 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. @@ -84,6 +89,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. * @@ -126,6 +140,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). * @@ -180,6 +207,13 @@ int sceCtrlSetActuator(int port, const SceCtrlActuator* pState); */ int sceCtrlSetLightBar(int port, SceUInt8 r, SceUInt8 g, SceUInt8 b); +/** + * Get controller port information. + * + * @param[out] info - Return value, use char[16] buffer + * @return 0, <0 on error + */ +int sceCtrlGetControllerPortInfo(void *info); #ifdef __cplusplus } #endif -- cgit v1.2.3 From f73809db10503255b4f5da379a6838e586855a1d Mon Sep 17 00:00:00 2001 From: Sunguk Lee Date: Fri, 23 Sep 2016 22:57:27 +0900 Subject: Add SceCtrlPortInfo structure --- include/user/ctrl.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/user/ctrl.h b/include/user/ctrl.h index 7e06a41..062329c 100644 --- a/include/user/ctrl.h +++ b/include/user/ctrl.h @@ -36,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. */ @@ -80,6 +89,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. * @@ -210,10 +225,10 @@ int sceCtrlSetLightBar(int port, SceUInt8 r, SceUInt8 g, SceUInt8 b); /** * Get controller port information. * - * @param[out] info - Return value, use char[16] buffer + * @param[out] info - see ::SceCtrlPortInfo * @return 0, <0 on error */ -int sceCtrlGetControllerPortInfo(void *info); +int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info); #ifdef __cplusplus } #endif -- cgit v1.2.3 From 7f1828871707e9976235a0946187bbaae2efb520 Mon Sep 17 00:00:00 2001 From: Sunguk Lee Date: Tue, 27 Sep 2016 22:41:13 +0900 Subject: Add sceCtrlGetBatteryInfo and update SceCtrlData - Add function define - Update LT/RT field of SceCtrlData --- include/user/ctrl.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/user/ctrl.h b/include/user/ctrl.h index 062329c..90eb4d8 100644 --- a/include/user/ctrl.h +++ b/include/user/ctrl.h @@ -70,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 */ @@ -229,6 +235,16 @@ int sceCtrlSetLightBar(int port, SceUInt8 r, SceUInt8 g, SceUInt8 b); * @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 -- cgit v1.2.3