Atlas - SDL_windowsjoystick_c.h

Home / ext / SDL / src / joystick / windows Lines: 1 | Size: 2893 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21#include "SDL_internal.h" 22 23#include "../SDL_sysjoystick.h" 24#include "../../core/windows/SDL_windows.h" 25#include "../../core/windows/SDL_directx.h" 26 27#define MAX_INPUTS 256 // each joystick can have up to 256 inputs 28 29// Set up for C function definitions, even when using C++ 30#ifdef __cplusplus 31extern "C" { 32#endif 33 34typedef struct JoyStick_DeviceData 35{ 36 SDL_GUID guid; 37 char *joystickname; 38 Uint8 send_add_event; 39 SDL_JoystickID nInstanceID; 40#ifdef SDL_JOYSTICK_XINPUT 41 bool bXInputDevice; 42 BYTE SubType; 43 Uint8 XInputUserId; 44#endif 45 DIDEVICEINSTANCE dxdevice; 46 char path[MAX_PATH]; 47 int steam_virtual_gamepad_slot; 48 struct JoyStick_DeviceData *pNext; 49} JoyStick_DeviceData; 50 51extern JoyStick_DeviceData *SYS_Joystick; // array to hold joystick ID values 52 53typedef enum Type 54{ 55 BUTTON, 56 AXIS, 57 HAT 58} Type; 59 60typedef struct input_t 61{ 62 // DirectInput offset for this input type: 63 DWORD ofs; 64 65 // Button, axis or hat: 66 Type type; 67 68 // SDL input offset: 69 Uint8 num; 70} input_t; 71 72// The private structure used to keep track of a joystick 73struct joystick_hwdata 74{ 75 SDL_GUID guid; 76 77#ifdef SDL_JOYSTICK_DINPUT 78 LPDIRECTINPUTDEVICE8 InputDevice; 79 DIDEVCAPS Capabilities; 80 bool buffered; 81 bool first_update; 82 input_t Inputs[MAX_INPUTS]; 83 int NumInputs; 84 int NumSliders; 85 bool ff_initialized; 86 DIEFFECT *ffeffect; 87 LPDIRECTINPUTEFFECT ffeffect_ref; 88#endif 89 90#ifdef SDL_JOYSTICK_XINPUT 91 bool bXInputDevice; // true if this device supports using the xinput API rather than DirectInput 92 bool bXInputHaptic; // Supports force feedback via XInput. 93 Uint8 userid; // XInput userid index for this joystick 94 DWORD dwPacketNumber; 95#endif 96}; 97 98#ifdef SDL_JOYSTICK_DINPUT 99extern const DIDATAFORMAT SDL_c_dfDIJoystick2; 100#endif 101 102extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device); 103 104// Ends C function definitions when using C++ 105#ifdef __cplusplus 106} 107#endif 108
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.