Path: blob/master/thirdparty/sdl/joystick/windows/SDL_windowsjoystick_c.h
9905 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/20#include "SDL_internal.h"2122#include "../SDL_sysjoystick.h"23#include "../../core/windows/SDL_windows.h"24#include "../../core/windows/SDL_directx.h"2526#define MAX_INPUTS 256 // each joystick can have up to 256 inputs2728// Set up for C function definitions, even when using C++29#ifdef __cplusplus30extern "C" {31#endif3233typedef struct JoyStick_DeviceData34{35SDL_GUID guid;36char *joystickname;37Uint8 send_add_event;38SDL_JoystickID nInstanceID;39bool bXInputDevice;40BYTE SubType;41Uint8 XInputUserId;42DIDEVICEINSTANCE dxdevice;43char path[MAX_PATH];44int steam_virtual_gamepad_slot;45struct JoyStick_DeviceData *pNext;46} JoyStick_DeviceData;4748extern JoyStick_DeviceData *SYS_Joystick; // array to hold joystick ID values4950typedef enum Type51{52BUTTON,53AXIS,54HAT55} Type;5657typedef struct input_t58{59// DirectInput offset for this input type:60DWORD ofs;6162// Button, axis or hat:63Type type;6465// SDL input offset:66Uint8 num;67} input_t;6869// The private structure used to keep track of a joystick70struct joystick_hwdata71{72SDL_GUID guid;7374#ifdef SDL_JOYSTICK_DINPUT75LPDIRECTINPUTDEVICE8 InputDevice;76DIDEVCAPS Capabilities;77bool buffered;78bool first_update;79input_t Inputs[MAX_INPUTS];80int NumInputs;81int NumSliders;82bool ff_initialized;83DIEFFECT *ffeffect;84LPDIRECTINPUTEFFECT ffeffect_ref;85#endif8687bool bXInputDevice; // true if this device supports using the xinput API rather than DirectInput88bool bXInputHaptic; // Supports force feedback via XInput.89Uint8 userid; // XInput userid index for this joystick90DWORD dwPacketNumber;91};9293#ifdef SDL_JOYSTICK_DINPUT94extern const DIDATAFORMAT SDL_c_dfDIJoystick2;95#endif9697extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device);9899// Ends C function definitions when using C++100#ifdef __cplusplus101}102#endif103104105