#include "../SDL_internal.h"
#ifndef SDL_sysjoystick_h_
#define SDL_sysjoystick_h_
#include "SDL_joystick.h"
#include "SDL_joystick_c.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SDL_JoystickAxisInfo
{
Sint16 initial_value;
Sint16 value;
Sint16 zero;
SDL_bool has_initial_value;
SDL_bool has_second_value;
SDL_bool sent_initial_value;
SDL_bool sending_initial_value;
} SDL_JoystickAxisInfo;
typedef struct _SDL_JoystickTouchpadFingerInfo
{
Uint8 state;
float x;
float y;
float pressure;
} SDL_JoystickTouchpadFingerInfo;
typedef struct _SDL_JoystickTouchpadInfo
{
int nfingers;
SDL_JoystickTouchpadFingerInfo *fingers;
} SDL_JoystickTouchpadInfo;
typedef struct _SDL_JoystickSensorInfo
{
SDL_SensorType type;
SDL_bool enabled;
float rate;
float data[3];
Uint64 timestamp_us;
} SDL_JoystickSensorInfo;
struct _SDL_Joystick
{
const void *magic;
SDL_JoystickID instance_id;
char *name;
char *path;
char *serial;
SDL_JoystickGUID guid;
Uint16 firmware_version;
int naxes;
SDL_JoystickAxisInfo *axes;
int nhats;
Uint8 *hats;
int nballs;
struct balldelta {
int dx;
int dy;
} *balls;
int nbuttons;
Uint8 *buttons;
int ntouchpads;
SDL_JoystickTouchpadInfo *touchpads;
int nsensors;
int nsensors_enabled;
SDL_JoystickSensorInfo *sensors;
Uint16 low_frequency_rumble;
Uint16 high_frequency_rumble;
Uint32 rumble_expiration;
Uint32 rumble_resend;
Uint16 left_trigger_rumble;
Uint16 right_trigger_rumble;
Uint32 trigger_rumble_expiration;
Uint8 led_red;
Uint8 led_green;
Uint8 led_blue;
Uint32 led_expiration;
SDL_bool attached;
SDL_bool is_game_controller;
SDL_bool delayed_guide_button;
SDL_JoystickPowerLevel epowerlevel;
struct _SDL_JoystickDriver *driver;
struct joystick_hwdata *hwdata;
int ref_count;
struct _SDL_Joystick *next;
};
#define SDL_HARDWARE_BUS_UNKNOWN 0x00
#define SDL_HARDWARE_BUS_USB 0x03
#define SDL_HARDWARE_BUS_BLUETOOTH 0x05
#define SDL_HARDWARE_BUS_VIRTUAL 0xFF
#define SDL_JOYCAP_LED 0x01
#define SDL_JOYCAP_RUMBLE 0x02
#define SDL_JOYCAP_RUMBLE_TRIGGERS 0x04
#define MAKE_VIDPID(VID, PID) (((Uint32)(VID))<<16|(PID))
typedef struct _SDL_JoystickDriver
{
int (*Init)(void);
int (*GetCount)(void);
void (*Detect)(void);
const char *(*GetDeviceName)(int device_index);
const char *(*GetDevicePath)(int device_index);
int (*GetDevicePlayerIndex)(int device_index);
void (*SetDevicePlayerIndex)(int device_index, int player_index);
SDL_JoystickGUID (*GetDeviceGUID)(int device_index);
SDL_JoystickID (*GetDeviceInstanceID)(int device_index);
int (*Open)(SDL_Joystick *joystick, int device_index);
int (*Rumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
int (*RumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble);
Uint32 (*GetCapabilities)(SDL_Joystick *joystick);
int (*SetLED)(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
int (*SendEffect)(SDL_Joystick *joystick, const void *data, int size);
int (*SetSensorsEnabled)(SDL_Joystick *joystick, SDL_bool enabled);
void (*Update)(SDL_Joystick *joystick);
void (*Close)(SDL_Joystick *joystick);
void (*Quit)(void);
SDL_bool (*GetGamepadMapping)(int device_index, SDL_GamepadMapping * out);
} SDL_JoystickDriver;
#define SDL_MAX_RUMBLE_DURATION_MS 0xFFFF
#define SDL_RUMBLE_RESEND_MS 2000
#define SDL_LED_MIN_REPEAT_MS 5000
extern SDL_JoystickDriver SDL_ANDROID_JoystickDriver;
extern SDL_JoystickDriver SDL_BSD_JoystickDriver;
extern SDL_JoystickDriver SDL_DARWIN_JoystickDriver;
extern SDL_JoystickDriver SDL_DUMMY_JoystickDriver;
extern SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver;
extern SDL_JoystickDriver SDL_HAIKU_JoystickDriver;
extern SDL_JoystickDriver SDL_HIDAPI_JoystickDriver;
extern SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver;
extern SDL_JoystickDriver SDL_IOS_JoystickDriver;
extern SDL_JoystickDriver SDL_LINUX_JoystickDriver;
extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver;
extern SDL_JoystickDriver SDL_WGI_JoystickDriver;
extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver;
extern SDL_JoystickDriver SDL_WINMM_JoystickDriver;
extern SDL_JoystickDriver SDL_OS2_JoystickDriver;
extern SDL_JoystickDriver SDL_PS2_JoystickDriver;
extern SDL_JoystickDriver SDL_PSP_JoystickDriver;
extern SDL_JoystickDriver SDL_VITA_JoystickDriver;
extern SDL_JoystickDriver SDL_N3DS_JoystickDriver;
#ifdef __cplusplus
}
#endif
#endif