diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h')
| -rw-r--r-- | contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h b/contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h new file mode 100644 index 0000000..16b9184 --- /dev/null +++ b/contrib/SDL-3.2.8/src/joystick/windows/SDL_windowsjoystick_c.h | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 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 | ||
| 31 | extern "C" { | ||
| 32 | #endif | ||
| 33 | |||
| 34 | typedef struct JoyStick_DeviceData | ||
| 35 | { | ||
| 36 | SDL_GUID guid; | ||
| 37 | char *joystickname; | ||
| 38 | Uint8 send_add_event; | ||
| 39 | SDL_JoystickID nInstanceID; | ||
| 40 | bool bXInputDevice; | ||
| 41 | BYTE SubType; | ||
| 42 | Uint8 XInputUserId; | ||
| 43 | DIDEVICEINSTANCE dxdevice; | ||
| 44 | char path[MAX_PATH]; | ||
| 45 | int steam_virtual_gamepad_slot; | ||
| 46 | struct JoyStick_DeviceData *pNext; | ||
| 47 | } JoyStick_DeviceData; | ||
| 48 | |||
| 49 | extern JoyStick_DeviceData *SYS_Joystick; // array to hold joystick ID values | ||
| 50 | |||
| 51 | typedef enum Type | ||
| 52 | { | ||
| 53 | BUTTON, | ||
| 54 | AXIS, | ||
| 55 | HAT | ||
| 56 | } Type; | ||
| 57 | |||
| 58 | typedef struct input_t | ||
| 59 | { | ||
| 60 | // DirectInput offset for this input type: | ||
| 61 | DWORD ofs; | ||
| 62 | |||
| 63 | // Button, axis or hat: | ||
| 64 | Type type; | ||
| 65 | |||
| 66 | // SDL input offset: | ||
| 67 | Uint8 num; | ||
| 68 | } input_t; | ||
| 69 | |||
| 70 | // The private structure used to keep track of a joystick | ||
| 71 | struct joystick_hwdata | ||
| 72 | { | ||
| 73 | SDL_GUID guid; | ||
| 74 | |||
| 75 | #ifdef SDL_JOYSTICK_DINPUT | ||
| 76 | LPDIRECTINPUTDEVICE8 InputDevice; | ||
| 77 | DIDEVCAPS Capabilities; | ||
| 78 | bool buffered; | ||
| 79 | bool first_update; | ||
| 80 | input_t Inputs[MAX_INPUTS]; | ||
| 81 | int NumInputs; | ||
| 82 | int NumSliders; | ||
| 83 | bool ff_initialized; | ||
| 84 | DIEFFECT *ffeffect; | ||
| 85 | LPDIRECTINPUTEFFECT ffeffect_ref; | ||
| 86 | #endif | ||
| 87 | |||
| 88 | bool bXInputDevice; // true if this device supports using the xinput API rather than DirectInput | ||
| 89 | bool bXInputHaptic; // Supports force feedback via XInput. | ||
| 90 | Uint8 userid; // XInput userid index for this joystick | ||
| 91 | DWORD dwPacketNumber; | ||
| 92 | }; | ||
| 93 | |||
| 94 | #ifdef SDL_JOYSTICK_DINPUT | ||
| 95 | extern const DIDATAFORMAT SDL_c_dfDIJoystick2; | ||
| 96 | #endif | ||
| 97 | |||
| 98 | extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device); | ||
| 99 | |||
| 100 | // Ends C function definitions when using C++ | ||
| 101 | #ifdef __cplusplus | ||
| 102 | } | ||
| 103 | #endif | ||
