Path: blob/master/thirdparty/sdl/joystick/darwin/SDL_iokitjoystick_c.h
9904 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#ifndef SDL_JOYSTICK_IOKIT_H23#define SDL_JOYSTICK_IOKIT_H2425#include <IOKit/hid/IOHIDLib.h>26#include <ForceFeedback/ForceFeedback.h>27#include <ForceFeedback/ForceFeedbackConstants.h>2829struct recElement30{31IOHIDElementRef elementRef;32IOHIDElementCookie cookie;33uint32_t usagePage, usage; // HID usage34SInt32 min; // reported min value possible35SInt32 max; // reported max value possible3637// runtime variables used for auto-calibration38SInt32 minReport; // min returned value39SInt32 maxReport; // max returned value4041struct recElement *pNext; // next element in list42};43typedef struct recElement recElement;4445struct joystick_hwdata46{47IOHIDDeviceRef deviceRef; // HIDManager device handle48io_service_t ffservice; // Interface for force feedback, 0 = no ff49FFDeviceObjectReference ffdevice;50FFEFFECT *ffeffect;51FFEffectObjectReference ffeffect_ref;52bool ff_initialized;5354char product[256]; // name of product55uint32_t usage; // usage page from IOUSBHID Parser.h which defines general usage56uint32_t usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage5758int axes; // number of axis (calculated, not reported by device)59int buttons; // number of buttons (calculated, not reported by device)60int hats; // number of hat switches (calculated, not reported by device)61int elements; // number of total elements (should be total of above) (calculated, not reported by device)6263recElement *firstAxis;64recElement *firstButton;65recElement *firstHat;6667bool removed;68SDL_Joystick *joystick;69bool runLoopAttached; // is 'deviceRef' attached to a CFRunLoop?7071int instance_id;72SDL_GUID guid;73int steam_virtual_gamepad_slot;7475struct joystick_hwdata *pNext; // next device76};77typedef struct joystick_hwdata recDevice;7879#endif // SDL_JOYSTICK_IOKIT_H808182