diff options
Diffstat (limited to '')
-rw-r--r-- | include/common/ctrl.h | 94 | ||||
-rw-r--r-- | include/kernel/ctrl.h | 59 | ||||
-rw-r--r-- | include/user/ctrl.h | 59 |
3 files changed, 94 insertions, 118 deletions
diff --git a/include/common/ctrl.h b/include/common/ctrl.h new file mode 100644 index 0000000..98c717d --- /dev/null +++ b/include/common/ctrl.h @@ -0,0 +1,94 @@ +/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; -*- */ +/* + * + * + * + * + * + * + * Controller Service + * + * ctrl.h + */ + + +#ifndef _VDSUITE_COMMON_CTRL_H +#define _VDSUITE_COMMON_CTRL_H + +#include_next <ctrl.h> + +#include <stdint.h> + + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +extern "C" { +#endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */ + +#define SCE_CTRL_PSBUTTON SCE_CTRL_INTERCEPTED //!< Playstation (Home) button. +#define SCE_CTRL_HEADPHONE 0x00080000 //!< Headphone plugged in. +#define SCE_CTRL_VOLUP 0x00100000 //!< Volume up button. +#define SCE_CTRL_VOLDOWN 0x00200000 //!< Volume down button. +#define SCE_CTRL_POWER 0x40000000 //!< Power button. + +/** Enumeration for the controller types. */ +typedef enum SceCtrlExternalInputMode { + SCE_CTRL_TYPE_UNPAIRED = 0, //!< Unpaired controller + 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 +} SceCtrlExternalInputMode; + +/** Structure to pass as argument to ::sceCtrlSetActuator */ +typedef struct SceCtrlActuator { + unsigned char small; //!< Vibration strength of the small motor + unsigned char large; //!< Vibration strength of the large motor + uint8_t unk[6]; //!< Unknown +} SceCtrlActuator; + +/** Structure to pass as argument to ::sceCtrlGetControllerPortInfo */ +typedef struct SceCtrlPortInfo { + uint8_t port[5]; //!< Controller type of each port (See ::SceCtrlExternalInputMode) + uint8_t unk[11]; //!< Unknown +} SceCtrlPortInfo; + +/** + * Get controller port information. + * + * @param[out] info - see ::SceCtrlPortInfo + * @return 0, <0 on error + */ +int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info); + +/** + * Sets intercept + * + * If true, allows the current thread to intercept controls. The use case + * might be, for example, a game plugin that wishes to capture input without + * having the input sent to the game thread. + * @param[in] intercept Boolean value + * + * @return 0, < 0 on error + */ +int sceCtrlSetButtonIntercept(int intercept); + +/** + * Gets intercept + * + * @param[out] intercept Boolean value + * + * @return 0, < 0 on error + */ +int sceCtrlGetButtonIntercept(int *intercept); + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +} +#endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */ + +#endif /* _VDSUITE_COMMON_CTRL_H */ + + +/* Local variables: */ +/* tab-width: 4 */ +/* End: */ +/* vi:set tabstop=4: */ diff --git a/include/kernel/ctrl.h b/include/kernel/ctrl.h index d18fa6e..f201d40 100644 --- a/include/kernel/ctrl.h +++ b/include/kernel/ctrl.h @@ -3,40 +3,10 @@ #include_next <ctrl.h> -#include <stdint.h> - #ifdef __cplusplus extern "C" { #endif -#define SCE_CTRL_PSBUTTON SCE_CTRL_INTERCEPTED //!< Playstation (Home) button. -#define SCE_CTRL_HEADPHONE 0x00080000 //!< Headphone plugged in. -#define SCE_CTRL_VOLUP 0x00100000 //!< Volume up button. -#define SCE_CTRL_VOLDOWN 0x00200000 //!< Volume down button. -#define SCE_CTRL_POWER 0x40000000 //!< Power button. - -/** Enumeration for the controller types. */ -typedef enum SceCtrlExternalInputMode { - SCE_CTRL_TYPE_UNPAIRED = 0, //!< Unpaired controller - 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 -} SceCtrlExternalInputMode; - -/** Structure to pass as argument to ::sceCtrlSetActuator */ -typedef struct SceCtrlActuator { - unsigned char small; //!< Vibration strength of the small motor - unsigned char large; //!< Vibration strength of the large motor - uint8_t unk[6]; //!< 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; - /** Structure to pass as argument to ::sceCtrlRegisterVirtualControllerDriver */ typedef struct SceCtrlVirtualControllerDriver { int (*readButtons)(int port, SceCtrlData *pad_data, int count); @@ -55,35 +25,6 @@ typedef struct SceCtrlVirtualControllerDriver { } SceCtrlVirtualControllerDriver; /** - * Get controller port information. - * - * @param[out] info - see ::SceCtrlPortInfo - * @return 0, <0 on error - */ -int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info); - -/** - * Sets intercept - * - * If true, allows the current thread to intercept controls. The use case - * might be, for example, a game plugin that wishes to capture input without - * having the input sent to the game thread. - * @param[in] intercept Boolean value - * - * @return 0, < 0 on error - */ -int sceCtrlSetButtonIntercept(int intercept); - -/** - * Gets intercept - * - * @param[out] intercept Boolean value - * - * @return 0, < 0 on error - */ -int sceCtrlGetButtonIntercept(int *intercept); - -/** * Emulate buttons for the digital pad. * @param port Use 0 * @param slot The slot used to set the custom values. Between 0 - 3. If multiple slots are used, diff --git a/include/user/ctrl.h b/include/user/ctrl.h index 8ba4a53..d7251d5 100644 --- a/include/user/ctrl.h +++ b/include/user/ctrl.h @@ -3,40 +3,10 @@ #include_next <ctrl.h> -#include <stdint.h> - #ifdef __cplusplus extern "C" { #endif -#define SCE_CTRL_PSBUTTON SCE_CTRL_INTERCEPTED //!< Playstation (Home) button. -#define SCE_CTRL_HEADPHONE 0x00080000 //!< Headphone plugged in. -#define SCE_CTRL_VOLUP 0x00100000 //!< Volume up button. -#define SCE_CTRL_VOLDOWN 0x00200000 //!< Volume down button. -#define SCE_CTRL_POWER 0x40000000 //!< Power button. - -/** Enumeration for the controller types. */ -typedef enum SceCtrlExternalInputMode { - SCE_CTRL_TYPE_UNPAIRED = 0, //!< Unpaired controller - 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 -} SceCtrlExternalInputMode; - -/** Structure to pass as argument to ::sceCtrlSetActuator */ -typedef struct SceCtrlActuator { - unsigned char small; //!< Vibration strength of the small motor - unsigned char large; //!< Vibration strength of the large motor - uint8_t unk[6]; //!< Unknown -} SceCtrlActuator; - -/** Structure to pass as argument to ::sceCtrlGetControllerPortInfo */ -typedef struct SceCtrlPortInfo { - uint8_t port[5]; //!< Controller type of each port (See ::SceCtrlExternalInputMode) - uint8_t unk[11]; //!< Unknown -} SceCtrlPortInfo; - /** * Set the controller extend mode. * @@ -95,14 +65,6 @@ 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. @@ -112,27 +74,6 @@ int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info); */ int sceCtrlGetBatteryInfo(int port, SceUInt8 *batt); -/** - * Sets intercept - * - * If true, allows the current thread to intercept controls. The use case - * might be, for example, a game plugin that wishes to capture input without - * having the input sent to the game thread. - * @param[in] intercept Boolean value - * - * @return 0, < 0 on error - */ -int sceCtrlSetButtonIntercept(int intercept); - -/** - * Gets intercept - * - * @param[out] intercept Boolean value - * - * @return 0, < 0 on error - */ -int sceCtrlGetButtonIntercept(int *intercept); - #ifdef __cplusplus } #endif |