SDL_xinputjoystick.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "../../SDL_internal.h"
  19. #include "../SDL_sysjoystick.h"
  20. #ifdef SDL_JOYSTICK_XINPUT
  21. #include "SDL_hints.h"
  22. #include "SDL_timer.h"
  23. #include "SDL_windowsjoystick_c.h"
  24. #include "SDL_xinputjoystick_c.h"
  25. #include "SDL_rawinputjoystick_c.h"
  26. #include "../hidapi/SDL_hidapijoystick_c.h"
  27. /* Set up for C function definitions, even when using C++ */
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /*
  32. * Internal stuff.
  33. */
  34. static SDL_bool s_bXInputEnabled = SDL_TRUE;
  35. static SDL_bool SDL_XInputUseOldJoystickMapping(void)
  36. {
  37. #ifdef __WINRT__
  38. /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
  39. /* FIXME: Why are Win8/10 different here? -flibit */
  40. return NTDDI_VERSION < NTDDI_WIN10;
  41. #elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
  42. return SDL_FALSE;
  43. #else
  44. static int s_XInputUseOldJoystickMapping = -1;
  45. if (s_XInputUseOldJoystickMapping < 0) {
  46. s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
  47. }
  48. return s_XInputUseOldJoystickMapping > 0;
  49. #endif
  50. }
  51. SDL_bool SDL_XINPUT_Enabled(void)
  52. {
  53. return s_bXInputEnabled;
  54. }
  55. int SDL_XINPUT_JoystickInit(void)
  56. {
  57. s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
  58. if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) {
  59. s_bXInputEnabled = SDL_FALSE; /* oh well. */
  60. }
  61. return 0;
  62. }
  63. static const char *GetXInputName(const Uint8 userid, BYTE SubType)
  64. {
  65. static char name[32];
  66. if (SDL_XInputUseOldJoystickMapping()) {
  67. (void)SDL_snprintf(name, sizeof(name), "X360 Controller #%u", 1 + userid);
  68. } else {
  69. switch (SubType) {
  70. case XINPUT_DEVSUBTYPE_GAMEPAD:
  71. (void)SDL_snprintf(name, sizeof(name), "XInput Controller #%u", 1 + userid);
  72. break;
  73. case XINPUT_DEVSUBTYPE_WHEEL:
  74. (void)SDL_snprintf(name, sizeof(name), "XInput Wheel #%u", 1 + userid);
  75. break;
  76. case XINPUT_DEVSUBTYPE_ARCADE_STICK:
  77. (void)SDL_snprintf(name, sizeof(name), "XInput ArcadeStick #%u", 1 + userid);
  78. break;
  79. case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
  80. (void)SDL_snprintf(name, sizeof(name), "XInput FlightStick #%u", 1 + userid);
  81. break;
  82. case XINPUT_DEVSUBTYPE_DANCE_PAD:
  83. (void)SDL_snprintf(name, sizeof(name), "XInput DancePad #%u", 1 + userid);
  84. break;
  85. case XINPUT_DEVSUBTYPE_GUITAR:
  86. case XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE:
  87. case XINPUT_DEVSUBTYPE_GUITAR_BASS:
  88. (void)SDL_snprintf(name, sizeof(name), "XInput Guitar #%u", 1 + userid);
  89. break;
  90. case XINPUT_DEVSUBTYPE_DRUM_KIT:
  91. (void)SDL_snprintf(name, sizeof(name), "XInput DrumKit #%u", 1 + userid);
  92. break;
  93. case XINPUT_DEVSUBTYPE_ARCADE_PAD:
  94. (void)SDL_snprintf(name, sizeof(name), "XInput ArcadePad #%u", 1 + userid);
  95. break;
  96. default:
  97. (void)SDL_snprintf(name, sizeof(name), "XInput Device #%u", 1 + userid);
  98. break;
  99. }
  100. }
  101. return name;
  102. }
  103. static SDL_bool GetXInputDeviceInfo(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
  104. {
  105. SDL_XINPUT_CAPABILITIES_EX capabilities;
  106. if (!XINPUTGETCAPABILITIESEX || XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) != ERROR_SUCCESS) {
  107. return SDL_FALSE;
  108. }
  109. /* Fixup for Wireless Xbox 360 Controller */
  110. if (capabilities.ProductId == 0 && capabilities.Capabilities.Flags & XINPUT_CAPS_WIRELESS) {
  111. capabilities.VendorId = USB_VENDOR_MICROSOFT;
  112. capabilities.ProductId = USB_PRODUCT_XBOX360_XUSB_CONTROLLER;
  113. }
  114. if (pVID) {
  115. *pVID = capabilities.VendorId;
  116. }
  117. if (pPID) {
  118. *pPID = capabilities.ProductId;
  119. }
  120. if (pVersion) {
  121. *pVersion = capabilities.ProductVersion;
  122. }
  123. return SDL_TRUE;
  124. }
  125. int SDL_XINPUT_GetSteamVirtualGamepadSlot(Uint8 userid)
  126. {
  127. SDL_XINPUT_CAPABILITIES_EX capabilities;
  128. if (XINPUTGETCAPABILITIESEX &&
  129. XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) == ERROR_SUCCESS &&
  130. capabilities.VendorId == USB_VENDOR_VALVE &&
  131. capabilities.ProductId == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) {
  132. return (int)capabilities.unk2;
  133. }
  134. return -1;
  135. }
  136. static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
  137. {
  138. const char *name = NULL;
  139. Uint16 vendor = 0;
  140. Uint16 product = 0;
  141. Uint16 version = 0;
  142. JoyStick_DeviceData *pPrevJoystick = NULL;
  143. JoyStick_DeviceData *pNewJoystick = *pContext;
  144. #ifdef SDL_JOYSTICK_RAWINPUT
  145. if (RAWINPUT_IsEnabled()) {
  146. /* The raw input driver handles more than 4 controllers, so prefer that when available */
  147. /* We do this check here rather than at the top of SDL_XINPUT_JoystickDetect() because
  148. we need to check XInput state before RAWINPUT gets a hold of the device, otherwise
  149. when a controller is connected via the wireless adapter, it will shut down at the
  150. first subsequent XInput call. This seems like a driver stack bug?
  151. Reference: https://github.com/libsdl-org/SDL/issues/3468
  152. */
  153. return;
  154. }
  155. #endif
  156. if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD) {
  157. return;
  158. }
  159. if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN) {
  160. return;
  161. }
  162. while (pNewJoystick) {
  163. if (pNewJoystick->bXInputDevice && (pNewJoystick->XInputUserId == userid) && (pNewJoystick->SubType == SubType)) {
  164. /* if we are replacing the front of the list then update it */
  165. if (pNewJoystick == *pContext) {
  166. *pContext = pNewJoystick->pNext;
  167. } else if (pPrevJoystick) {
  168. pPrevJoystick->pNext = pNewJoystick->pNext;
  169. }
  170. pNewJoystick->pNext = SYS_Joystick;
  171. SYS_Joystick = pNewJoystick;
  172. return; /* already in the list. */
  173. }
  174. pPrevJoystick = pNewJoystick;
  175. pNewJoystick = pNewJoystick->pNext;
  176. }
  177. pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData));
  178. if (!pNewJoystick) {
  179. return; /* better luck next time? */
  180. }
  181. name = GetXInputName(userid, SubType);
  182. GetXInputDeviceInfo(userid, &vendor, &product, &version);
  183. pNewJoystick->bXInputDevice = SDL_TRUE;
  184. pNewJoystick->joystickname = SDL_CreateJoystickName(vendor, product, NULL, name);
  185. if (!pNewJoystick->joystickname) {
  186. SDL_free(pNewJoystick);
  187. return; /* better luck next time? */
  188. }
  189. (void)SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid);
  190. if (!SDL_XInputUseOldJoystickMapping()) {
  191. pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, NULL, name, 'x', SubType);
  192. }
  193. pNewJoystick->SubType = SubType;
  194. pNewJoystick->XInputUserId = userid;
  195. if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) {
  196. SDL_free(pNewJoystick);
  197. return;
  198. }
  199. #ifdef SDL_JOYSTICK_HIDAPI
  200. /* Since we're guessing about the VID/PID, use a hard-coded VID/PID to represent XInput */
  201. if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX360_XUSB_CONTROLLER, version, pNewJoystick->joystickname)) {
  202. /* The HIDAPI driver is taking care of this device */
  203. SDL_free(pNewJoystick);
  204. return;
  205. }
  206. #endif
  207. #ifdef SDL_JOYSTICK_RAWINPUT
  208. if (RAWINPUT_IsDevicePresent(vendor, product, version, pNewJoystick->joystickname)) {
  209. /* The RAWINPUT driver is taking care of this device */
  210. SDL_free(pNewJoystick);
  211. return;
  212. }
  213. #endif
  214. WINDOWS_AddJoystickDevice(pNewJoystick);
  215. }
  216. void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
  217. {
  218. int iuserid;
  219. if (!s_bXInputEnabled) {
  220. return;
  221. }
  222. /* iterate in reverse, so these are in the final list in ascending numeric order. */
  223. for (iuserid = XUSER_MAX_COUNT - 1; iuserid >= 0; iuserid--) {
  224. const Uint8 userid = (Uint8)iuserid;
  225. XINPUT_CAPABILITIES capabilities;
  226. if (XINPUTGETCAPABILITIES(userid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS) {
  227. AddXInputDevice(userid, capabilities.SubType, pContext);
  228. }
  229. }
  230. }
  231. int SDL_XINPUT_JoystickOpen(SDL_Joystick *joystick, JoyStick_DeviceData *joystickdevice)
  232. {
  233. const Uint8 userId = joystickdevice->XInputUserId;
  234. XINPUT_CAPABILITIES capabilities;
  235. XINPUT_VIBRATION state;
  236. SDL_assert(s_bXInputEnabled);
  237. SDL_assert(XINPUTGETCAPABILITIES);
  238. SDL_assert(XINPUTSETSTATE);
  239. SDL_assert(userId < XUSER_MAX_COUNT);
  240. joystick->hwdata->bXInputDevice = SDL_TRUE;
  241. if (XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities) != ERROR_SUCCESS) {
  242. SDL_free(joystick->hwdata);
  243. joystick->hwdata = NULL;
  244. return SDL_SetError("Failed to obtain XInput device capabilities. Device disconnected?");
  245. }
  246. SDL_zero(state);
  247. joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS) ? SDL_TRUE : SDL_FALSE;
  248. joystick->hwdata->userid = userId;
  249. /* The XInput API has a hard coded button/axis mapping, so we just match it */
  250. if (SDL_XInputUseOldJoystickMapping()) {
  251. joystick->naxes = 6;
  252. joystick->nbuttons = 15;
  253. } else {
  254. joystick->naxes = 6;
  255. joystick->nbuttons = 11;
  256. joystick->nhats = 1;
  257. }
  258. return 0;
  259. }
  260. static void UpdateXInputJoystickBatteryInformation(SDL_Joystick *joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
  261. {
  262. if (pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN) {
  263. SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN;
  264. if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) {
  265. ePowerLevel = SDL_JOYSTICK_POWER_WIRED;
  266. } else {
  267. switch (pBatteryInformation->BatteryLevel) {
  268. case BATTERY_LEVEL_EMPTY:
  269. ePowerLevel = SDL_JOYSTICK_POWER_EMPTY;
  270. break;
  271. case BATTERY_LEVEL_LOW:
  272. ePowerLevel = SDL_JOYSTICK_POWER_LOW;
  273. break;
  274. case BATTERY_LEVEL_MEDIUM:
  275. ePowerLevel = SDL_JOYSTICK_POWER_MEDIUM;
  276. break;
  277. default:
  278. case BATTERY_LEVEL_FULL:
  279. ePowerLevel = SDL_JOYSTICK_POWER_FULL;
  280. break;
  281. }
  282. }
  283. SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel);
  284. }
  285. }
  286. static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
  287. {
  288. static WORD s_XInputButtons[] = {
  289. XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT,
  290. XINPUT_GAMEPAD_START, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB,
  291. XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER,
  292. XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
  293. XINPUT_GAMEPAD_GUIDE
  294. };
  295. WORD wButtons = pXInputState->Gamepad.wButtons;
  296. Uint8 button;
  297. SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX);
  298. SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbLY)));
  299. SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX);
  300. SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-SDL_max(-32767, pXInputState->Gamepad.sThumbRY)));
  301. SDL_PrivateJoystickAxis(joystick, 4, (Sint16)(((int)pXInputState->Gamepad.bLeftTrigger * 65535 / 255) - 32768));
  302. SDL_PrivateJoystickAxis(joystick, 5, (Sint16)(((int)pXInputState->Gamepad.bRightTrigger * 65535 / 255) - 32768));
  303. for (button = 0; button < (Uint8)SDL_arraysize(s_XInputButtons); ++button) {
  304. SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED);
  305. }
  306. UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation);
  307. }
  308. static void UpdateXInputJoystickState(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation)
  309. {
  310. static WORD s_XInputButtons[] = {
  311. XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y,
  312. XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_START,
  313. XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB,
  314. XINPUT_GAMEPAD_GUIDE
  315. };
  316. WORD wButtons = pXInputState->Gamepad.wButtons;
  317. Uint8 button;
  318. Uint8 hat = SDL_HAT_CENTERED;
  319. SDL_PrivateJoystickAxis(joystick, 0, pXInputState->Gamepad.sThumbLX);
  320. SDL_PrivateJoystickAxis(joystick, 1, ~pXInputState->Gamepad.sThumbLY);
  321. SDL_PrivateJoystickAxis(joystick, 2, ((int)pXInputState->Gamepad.bLeftTrigger * 257) - 32768);
  322. SDL_PrivateJoystickAxis(joystick, 3, pXInputState->Gamepad.sThumbRX);
  323. SDL_PrivateJoystickAxis(joystick, 4, ~pXInputState->Gamepad.sThumbRY);
  324. SDL_PrivateJoystickAxis(joystick, 5, ((int)pXInputState->Gamepad.bRightTrigger * 257) - 32768);
  325. for (button = 0; button < (Uint8)SDL_arraysize(s_XInputButtons); ++button) {
  326. SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED);
  327. }
  328. if (wButtons & XINPUT_GAMEPAD_DPAD_UP) {
  329. hat |= SDL_HAT_UP;
  330. }
  331. if (wButtons & XINPUT_GAMEPAD_DPAD_DOWN) {
  332. hat |= SDL_HAT_DOWN;
  333. }
  334. if (wButtons & XINPUT_GAMEPAD_DPAD_LEFT) {
  335. hat |= SDL_HAT_LEFT;
  336. }
  337. if (wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) {
  338. hat |= SDL_HAT_RIGHT;
  339. }
  340. SDL_PrivateJoystickHat(joystick, 0, hat);
  341. UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation);
  342. }
  343. int SDL_XINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
  344. {
  345. XINPUT_VIBRATION XVibration;
  346. if (!XINPUTSETSTATE) {
  347. return SDL_Unsupported();
  348. }
  349. XVibration.wLeftMotorSpeed = low_frequency_rumble;
  350. XVibration.wRightMotorSpeed = high_frequency_rumble;
  351. if (XINPUTSETSTATE(joystick->hwdata->userid, &XVibration) != ERROR_SUCCESS) {
  352. return SDL_SetError("XInputSetState() failed");
  353. }
  354. return 0;
  355. }
  356. Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick *joystick)
  357. {
  358. return SDL_JOYCAP_RUMBLE;
  359. }
  360. void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick)
  361. {
  362. HRESULT result;
  363. XINPUT_STATE XInputState;
  364. XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
  365. if (!XINPUTGETSTATE) {
  366. return;
  367. }
  368. result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState);
  369. if (result == ERROR_DEVICE_NOT_CONNECTED) {
  370. return;
  371. }
  372. SDL_zero(XBatteryInformation);
  373. if (XINPUTGETBATTERYINFORMATION) {
  374. result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation);
  375. }
  376. #if defined(__XBOXONE__) || defined(__XBOXSERIES__)
  377. /* XInputOnGameInput doesn't ever change dwPacketNumber, so have to just update every frame */
  378. UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation);
  379. #else
  380. /* only fire events if the data changed from last time */
  381. if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) {
  382. if (SDL_XInputUseOldJoystickMapping()) {
  383. UpdateXInputJoystickState_OLD(joystick, &XInputState, &XBatteryInformation);
  384. } else {
  385. UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation);
  386. }
  387. joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber;
  388. }
  389. #endif
  390. }
  391. void SDL_XINPUT_JoystickClose(SDL_Joystick *joystick)
  392. {
  393. }
  394. void SDL_XINPUT_JoystickQuit(void)
  395. {
  396. if (s_bXInputEnabled) {
  397. s_bXInputEnabled = SDL_FALSE;
  398. WIN_UnloadXInputDLL();
  399. }
  400. }
  401. /* Ends C function definitions when using C++ */
  402. #ifdef __cplusplus
  403. }
  404. #endif
  405. #else /* !SDL_JOYSTICK_XINPUT */
  406. typedef struct JoyStick_DeviceData JoyStick_DeviceData;
  407. SDL_bool SDL_XINPUT_Enabled(void)
  408. {
  409. return SDL_FALSE;
  410. }
  411. int SDL_XINPUT_JoystickInit(void)
  412. {
  413. return 0;
  414. }
  415. void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
  416. {
  417. }
  418. int SDL_XINPUT_JoystickOpen(SDL_Joystick *joystick, JoyStick_DeviceData *joystickdevice)
  419. {
  420. return SDL_Unsupported();
  421. }
  422. int SDL_XINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
  423. {
  424. return SDL_Unsupported();
  425. }
  426. Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick *joystick)
  427. {
  428. return 0;
  429. }
  430. void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick)
  431. {
  432. }
  433. void SDL_XINPUT_JoystickClose(SDL_Joystick *joystick)
  434. {
  435. }
  436. void SDL_XINPUT_JoystickQuit(void)
  437. {
  438. }
  439. #endif /* SDL_JOYSTICK_XINPUT */
  440. /* vi: set ts=4 sw=4 expandtab: */