Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
7.8 KiB

  1. //========= Copyright � 1996-2004, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose: Win32 replacements for Xbox code
  4. //
  5. //=============================================================================
  6. #ifndef PS3STUBS_H
  7. #define PS3STUBS_H
  8. #include "ps3_platform.h"
  9. #include "tier0/platform.h"
  10. // Content creation/open flags
  11. #define XCONTENTFLAG_NONE 0x00
  12. #define XCONTENTFLAG_CREATENEW 0x00
  13. #define XCONTENTFLAG_CREATEALWAYS 0x00
  14. #define XCONTENTFLAG_OPENEXISTING 0x00
  15. #define XCONTENTFLAG_OPENALWAYS 0x00
  16. #define XCONTENTFLAG_TRUNCATEEXISTING 0x00
  17. // Content attributes
  18. #define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
  19. #define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
  20. #define XCONTENTFLAG_STRONG_SIGNED 0x00
  21. #define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
  22. #define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
  23. #define XDEVICE_TYPE_GAMEPAD 0
  24. #define XDEVICE_TYPE_MEMORY_UNIT 1
  25. #define XDEVICE_TYPE_VOICE_MICROPHONE 2
  26. #define XDEVICE_TYPE_VOICE_HEADPHONE 3
  27. #define XDEVICE_TYPE_HIGHFIDELITY_MICROPHONE 4
  28. // Constants for gamepad buttons
  29. #define XINPUT_GAMEPAD_DPAD_UP 0x0001
  30. #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
  31. #define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
  32. #define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
  33. #define XINPUT_GAMEPAD_START 0x0010
  34. #define XINPUT_GAMEPAD_BACK 0x0020
  35. #define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
  36. #define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
  37. #define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 // AG - Shoudler buttons should correspond to BLACK and WHITE in xboxStubs.h, but they don't seem to have proper bitfield values
  38. #define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
  39. #define XINPUT_GAMEPAD_LEFT_TRIGGER 0x0400
  40. #define XINPUT_GAMEPAD_RIGHT_TRIGGER 0x0800
  41. #define XINPUT_GAMEPAD_A 0x1000
  42. #define XINPUT_GAMEPAD_B 0x2000
  43. #define XINPUT_GAMEPAD_X 0x4000
  44. #define XINPUT_GAMEPAD_Y 0x8000
  45. #define XINPUT_LIGHTGUN_ONSCREEN 0x2000
  46. #define XINPUT_LIGHTGUN_FRAME_DOUBLER 0x4000
  47. #define XINPUT_LIGHTGUN_LINE_DOUBLER 0x8000
  48. //#define XINPUT_GAMEPAD_LEFT_TRIGGER 6
  49. //#define XINPUT_GAMEPAD_RIGHT_TRIGGER 7
  50. #define XDEVICE_PORT0 0
  51. #define XDEVICE_PORT1 1
  52. #define XDEVICE_PORT2 2
  53. #define XDEVICE_PORT3 3
  54. #ifdef CONTROLLER2_CHEATS_ENABLED
  55. #define XBX_MAX_DPORTS 2
  56. #else
  57. #define XBX_MAX_DPORTS 1
  58. #endif // CONTROLLER2_CHEATS_ENABLED
  59. #define XDEVICE_NO_SLOT 0
  60. #define XDEVICE_TOP_SLOT 0
  61. #define XDEVICE_BOTTOM_SLOT 1
  62. #define CLR_DEFAULT 0xFF000000
  63. #define CLR_WARNING 0x0000FFFF
  64. #define CLR_ERROR 0x000000FF
  65. // Device types available in XINPUT_CAPABILITIES
  66. #define XINPUT_DEVTYPE_GAMEPAD 0x01
  67. #define XINPUT_DEVTYPE_USB_KEYBOARD 0x02
  68. // Device subtypes available in XINPUT_CAPABILITIES
  69. #define XINPUT_DEVSUBTYPE_UNKNOWN 0x00
  70. #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
  71. #define XINPUT_DEVSUBTYPE_WHEEL 0x02
  72. #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
  73. #define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04
  74. #define XINPUT_DEVSUBTYPE_DANCEPAD 0x05
  75. // Flags for XINPUT_CAPABILITIES
  76. #define XINPUT_CAPS_FFB_SUPPORTED 0x0001
  77. #define XINPUT_CAPS_WIRELESS 0x0002
  78. #define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
  79. #define XINPUT_CAPS_PMD_SUPPORTED 0x0008
  80. // Flags for XInputGetCapabilities
  81. #define XINPUT_FLAG_GAMEPAD 0x00000001
  82. #define XINPUT_FLAG_KEYBOARD 0x00000002
  83. #define XINPUT_FLAG_REMOTE 0x00000004
  84. #define XINPUT_FLAG_ANYDEVICE 0x000000FF
  85. // Gamepad thresholds
  86. #define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
  87. #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
  88. #define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
  89. // Wind
  90. // Structures used by XInput APIs
  91. typedef struct _XINPUT_GAMEPAD
  92. {
  93. WORD wButtons;
  94. BYTE bLeftTrigger;
  95. BYTE bRightTrigger;
  96. short sThumbLX;
  97. short sThumbLY;
  98. short sThumbRX;
  99. short sThumbRY;
  100. } XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
  101. typedef struct _XINPUT_STATE
  102. {
  103. DWORD dwPacketNumber;
  104. XINPUT_GAMEPAD Gamepad;
  105. } XINPUT_STATE, *PXINPUT_STATE;
  106. typedef struct _XINPUT_VIBRATION
  107. {
  108. WORD wLeftMotorSpeed;
  109. WORD wRightMotorSpeed;
  110. } XINPUT_VIBRATION, *PXINPUT_VIBRATION;
  111. typedef struct _XINPUT_CAPABILITIES
  112. {
  113. BYTE Type;
  114. BYTE SubType;
  115. WORD Flags;
  116. XINPUT_GAMEPAD Gamepad;
  117. XINPUT_VIBRATION Vibration;
  118. } XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
  119. //typedef enum
  120. //{
  121. // XK_NULL,
  122. // XK_BUTTON_UP,
  123. // XK_BUTTON_DOWN,
  124. // XK_BUTTON_LEFT,
  125. // XK_BUTTON_RIGHT,
  126. // XK_BUTTON_START,
  127. // XK_BUTTON_BACK,
  128. // XK_BUTTON_STICK1,
  129. // XK_BUTTON_STICK2,
  130. // XK_BUTTON_A,
  131. // XK_BUTTON_B,
  132. // XK_BUTTON_X,
  133. // XK_BUTTON_Y,
  134. // XK_BUTTON_BLACK,
  135. // XK_BUTTON_WHITE,
  136. // XK_BUTTON_LTRIGGER,
  137. // XK_BUTTON_RTRIGGER,
  138. // XK_STICK1_UP,
  139. // XK_STICK1_DOWN,
  140. // XK_STICK1_LEFT,
  141. // XK_STICK1_RIGHT,
  142. // XK_STICK2_UP,
  143. // XK_STICK2_DOWN,
  144. // XK_STICK2_LEFT,
  145. // XK_STICK2_RIGHT,
  146. // XK_MAX_KEYS,
  147. //} xKey_t;
  148. //
  149. //typedef enum
  150. //{
  151. // XVRB_NONE, // off
  152. // XVRB_ERROR, // fatal error
  153. // XVRB_ALWAYS, // no matter what
  154. // XVRB_WARNING, // non-fatal warnings
  155. // XVRB_STATUS, // status reports
  156. // XVRB_ALL,
  157. //} xverbose_e;
  158. typedef struct _XINPUT_RUMBLE
  159. {
  160. WORD wLeftMotorSpeed;
  161. WORD wRightMotorSpeed;
  162. } XINPUT_RUMBLE, *PXINPUT_RUMBLE;
  163. #define XINPUT_FEEDBACK_HEADER_INTERNAL_SIZE 58
  164. typedef struct _XINPUT_FEEDBACK_HEADER
  165. {
  166. DWORD dwStatus;
  167. void* hEvent;
  168. BYTE Reserved[XINPUT_FEEDBACK_HEADER_INTERNAL_SIZE];
  169. } XINPUT_FEEDBACK_HEADER, *PXINPUT_FEEDBACK_HEADER;
  170. typedef struct _XINPUT_FEEDBACK
  171. {
  172. XINPUT_FEEDBACK_HEADER Header;
  173. union
  174. {
  175. XINPUT_RUMBLE Rumble;
  176. };
  177. } XINPUT_FEEDBACK, *PXINPUT_FEEDBACK;
  178. //typedef struct _XINPUT_GAMEPAD
  179. //{
  180. // WORD wButtons;
  181. // BYTE bAnalogButtons[8];
  182. // short sThumbLX;
  183. // short sThumbLY;
  184. // short sThumbRX;
  185. // short sThumbRY;
  186. //} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
  187. typedef struct _XPP_DEVICE_TYPE
  188. {
  189. unsigned long Reserved[3];
  190. } XPP_DEVICE_TYPE, *PXPP_DEVICE_TYPE;
  191. typedef struct _XDEVICE_PREALLOC_TYPE
  192. {
  193. PXPP_DEVICE_TYPE DeviceType;
  194. DWORD dwPreallocCount;
  195. } XDEVICE_PREALLOC_TYPE, *PXDEVICE_PREALLOC_TYPE;
  196. //typedef struct _XINPUT_STATE
  197. //{
  198. // DWORD dwPacketNumber;
  199. // XINPUT_GAMEPAD Gamepad;
  200. //} XINPUT_STATE, *PXINPUT_STATE;
  201. typedef struct _XINPUT_POLLING_PARAMETERS
  202. {
  203. BYTE fAutoPoll:1;
  204. BYTE fInterruptOut:1;
  205. BYTE ReservedMBZ1:6;
  206. BYTE bInputInterval;
  207. BYTE bOutputInterval;
  208. BYTE ReservedMBZ2;
  209. } XINPUT_POLLING_PARAMETERS, *PXINPUT_POLLING_PARAMETERS;
  210. /*EAPS3
  211. void XBX_DebugString(xverbose_e verbose, COLORREF color, const char* format, ...);
  212. void XBX_ProcessEvents(void);
  213. void XInitDevices(DWORD dwPreallocTypeCount, PXDEVICE_PREALLOC_TYPE PreallocTypes);
  214. DWORD XGetDevices(PXPP_DEVICE_TYPE DeviceType);
  215. bool XGetDeviceChanges(PXPP_DEVICE_TYPE DeviceType, DWORD *pdwInsertions, DWORD *pdwRemovals);
  216. HANDLE XInputOpen(PXPP_DEVICE_TYPE DeviceType, DWORD dwPort, DWORD dwSlot, PXINPUT_POLLING_PARAMETERS pPollingParameters);
  217. void XInputClose(HANDLE hDevice);
  218. DWORD XInputSetState(HANDLE hDevice, PXINPUT_FEEDBACK pFeedback);
  219. DWORD XInputGetState(HANDLE hDevice, PXINPUT_STATE pState);
  220. DWORD XInputPoll(HANDLE hDevice);
  221. unsigned int XBX_GetSystemTime(void);
  222. */
  223. #endif // XBOXSTUBS_H