src/joystick/darwin/SDL_sysjoystick_c.h
author Sylvain Becker <sylvain.becker@gmail.com>
Sat, 24 Aug 2019 20:40:37 +0200
changeset 13034 7693573f862d
parent 12503 806492103856
permissions -rw-r--r--
Fixed bug 1663 - SDL_EventState(SDL_DOLLARGESTURE,SDL_IGNORE) etc. has no effect
slouken@2713
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@12503
     3
  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
slouken@2713
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@2713
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@2713
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@2713
    20
*/
icculus@8093
    21
#include "../../SDL_internal.h"
slouken@2713
    22
slouken@2713
    23
#ifndef SDL_JOYSTICK_IOKIT_H
slime73@9864
    24
#define SDL_JOYSTICK_IOKIT_H
slouken@2713
    25
slouken@2713
    26
#include <IOKit/hid/IOHIDLib.h>
slouken@12088
    27
#include <ForceFeedback/ForceFeedback.h>
slouken@12088
    28
#include <ForceFeedback/ForceFeedbackConstants.h>
slouken@2713
    29
slouken@2713
    30
struct recElement
slouken@2713
    31
{
icculus@8230
    32
    IOHIDElementRef elementRef;
icculus@8242
    33
    IOHIDElementCookie cookie;
icculus@8230
    34
    uint32_t usagePage, usage;      /* HID usage */
icculus@8230
    35
    SInt32 min;                   /* reported min value possible */
icculus@8230
    36
    SInt32 max;                   /* reported max value possible */
slouken@2713
    37
slouken@2713
    38
    /* runtime variables used for auto-calibration */
icculus@8230
    39
    SInt32 minReport;             /* min returned value */
icculus@8230
    40
    SInt32 maxReport;             /* max returned value */
slouken@2713
    41
slouken@2713
    42
    struct recElement *pNext;   /* next element in list */
slouken@2713
    43
};
slouken@2713
    44
typedef struct recElement recElement;
slouken@2713
    45
slouken@2713
    46
struct joystick_hwdata
slouken@2713
    47
{
icculus@8230
    48
    IOHIDDeviceRef deviceRef;   /* HIDManager device handle */
slouken@2713
    49
    io_service_t ffservice;     /* Interface for force feedback, 0 = no ff */
slouken@12088
    50
    FFDeviceObjectReference ffdevice;
slouken@12088
    51
    FFEFFECT *ffeffect;
slouken@12088
    52
    FFEffectObjectReference ffeffect_ref;
slouken@12088
    53
    SDL_bool ff_initialized;
slouken@7191
    54
slouken@2713
    55
    char product[256];          /* name of product */
icculus@8230
    56
    uint32_t usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
icculus@8230
    57
    uint32_t usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
slouken@2713
    58
icculus@8230
    59
    int axes;                  /* number of axis (calculated, not reported by device) */
icculus@8230
    60
    int buttons;               /* number of buttons (calculated, not reported by device) */
icculus@8230
    61
    int hats;                  /* number of hat switches (calculated, not reported by device) */
icculus@8230
    62
    int elements;              /* number of total elements (should be total of above) (calculated, not reported by device) */
slouken@2713
    63
slouken@2713
    64
    recElement *firstAxis;
slouken@2713
    65
    recElement *firstButton;
slouken@2713
    66
    recElement *firstHat;
slouken@2713
    67
icculus@9433
    68
    SDL_bool removed;
slouken@7191
    69
slouken@7191
    70
    int instance_id;
slouken@7191
    71
    SDL_JoystickGUID guid;
slouken@2713
    72
slouken@2713
    73
    struct joystick_hwdata *pNext;      /* next device */
slouken@2713
    74
};
slouken@2713
    75
typedef struct joystick_hwdata recDevice;
slouken@2713
    76
slouken@10595
    77
#endif /* SDL_JOYSTICK_IOKIT_H */
slouken@2713
    78
slouken@10595
    79
/* vi: set ts=4 sw=4 expandtab: */