summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorxyzz2016-09-27 17:40:54 +0200
committerGitHub2016-09-27 17:40:54 +0200
commit8629bcb3ba8a85414c4627524658d35faf4dbb13 (patch)
tree46c4d269db27689ec2df83ceb1f3c9832dd9ac1c /include
parentMerge pull request #60 from DaveeFTW/master (diff)
parentAdd sceCtrlGetBatteryInfo and update SceCtrlData (diff)
downloadvds-libraries-8629bcb3ba8a85414c4627524658d35faf4dbb13.tar.gz
Merge pull request #56 from d3m3vilurr/patch-1
Add more SceCtrl NIDs
Diffstat (limited to 'include')
-rw-r--r--include/user/ctrl.h69
1 files changed, 67 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