mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 19:42:00 +00:00
Add support for SDL_GameControllerDB
This adds support for importing and applying mappings from the SDL_GameControllerDB database. Related to #900.
This commit is contained in:
parent
07bf2b166b
commit
953106e74d
@ -127,6 +127,14 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
- Added `glfwGetError` function for querying the last error code and its
|
- Added `glfwGetError` function for querying the last error code and its
|
||||||
description (#970)
|
description (#970)
|
||||||
|
- Added `glfwUpdateGamepadMappings` function for importing gamepad mappings in
|
||||||
|
SDL\_GameControllerDB format (#900)
|
||||||
|
- Added `glfwJoystickIsGamepad` function for querying whether a joystick has
|
||||||
|
a gamepad mapping (#900)
|
||||||
|
- Added `glfwGetGamepadName` function for querying the name provided by the
|
||||||
|
gamepad mapping (#900)
|
||||||
|
- Added `glfwGetGamepadState` function, `GLFW_GAMEPAD_*` and `GLFWgamepadstate`
|
||||||
|
for retrieving gamepad input state (#900)
|
||||||
- Added `glfwRequestWindowAttention` function for requesting attention from the
|
- Added `glfwRequestWindowAttention` function for requesting attention from the
|
||||||
user (#732,#988)
|
user (#732,#988)
|
||||||
- Added `glfwGetKeyScancode` function that allows retrieving platform dependent
|
- Added `glfwGetKeyScancode` function that allows retrieving platform dependent
|
||||||
|
@ -476,7 +476,7 @@ SORT_MEMBER_DOCS = NO
|
|||||||
# by member name. If set to NO (the default) the members will appear in
|
# by member name. If set to NO (the default) the members will appear in
|
||||||
# declaration order.
|
# declaration order.
|
||||||
|
|
||||||
SORT_BRIEF_DOCS = YES
|
SORT_BRIEF_DOCS = NO
|
||||||
|
|
||||||
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
|
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
|
||||||
# will sort the (brief and detailed) documentation of class members so that
|
# will sort the (brief and detailed) documentation of class members so that
|
||||||
|
137
docs/input.dox
137
docs/input.dox
@ -653,6 +653,143 @@ called by joystick functions. The function will then return whatever it
|
|||||||
returns for a disconnected joystick.
|
returns for a disconnected joystick.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection gamepad Gamepad input
|
||||||
|
|
||||||
|
The joystick functions provide unlabeled axes, buttons and hats, with no
|
||||||
|
indication of where they are located on the device. Their order may also vary
|
||||||
|
between platforms even with the same device.
|
||||||
|
|
||||||
|
To solve this problem the SDL community crowdsourced the
|
||||||
|
[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project,
|
||||||
|
a database of mappings from many different devices to an Xbox-like gamepad.
|
||||||
|
|
||||||
|
GLFW supports this mapping format and contains a copy of the mappings
|
||||||
|
available at the time of release. See @ref gamepad_mapping for how to update
|
||||||
|
this at runtime. Mappings will be assigned to joysticks automatically any time
|
||||||
|
a joystick is connected or the mappings are updated.
|
||||||
|
|
||||||
|
You can check whether a joystick is both present and has a gamepad mapping with
|
||||||
|
@ref glfwJoystickIsGamepad.
|
||||||
|
|
||||||
|
@code
|
||||||
|
if (glfwJoystickIsGamepad(GLFW_JOYSTICK_2))
|
||||||
|
{
|
||||||
|
// Use as gamepad
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
If you are only interested in gamepad input you can use this function instead of
|
||||||
|
@ref glfwJoystickPresent.
|
||||||
|
|
||||||
|
You can query the human-readable name provided by the gamepad mapping with @ref
|
||||||
|
glfwGetGamepadName. This may or may not be the same as the
|
||||||
|
[joystick name](@ref joystick_name).
|
||||||
|
|
||||||
|
@code
|
||||||
|
const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
To retrieve the gamepad state of a joystick, call @ref glfwGetGamepadState.
|
||||||
|
|
||||||
|
@code
|
||||||
|
GLFWgamepadstate state;
|
||||||
|
|
||||||
|
if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state))
|
||||||
|
{
|
||||||
|
if (state.buttons[GLFW_GAMEPAD_BUTTON_A])
|
||||||
|
{
|
||||||
|
input_jump();
|
||||||
|
}
|
||||||
|
|
||||||
|
input_speed(state.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER]);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
The @ref GLFWgamepadstate struct has two arrays; one for button states and one
|
||||||
|
for axis states. The values for each button and axis are the same as for the
|
||||||
|
@ref glfwGetJoystickButtons and @ref glfwGetJoystickAxes functions, i.e.
|
||||||
|
`GLFW_PRESS` or `GLFW_RELEASE` for buttons and -1.0 to 1.0 inclusive for axes.
|
||||||
|
|
||||||
|
The sizes of the arrays and the positions within each array are fixed.
|
||||||
|
|
||||||
|
The [button indices](@ref gamepad_buttons) are `GLFW_GAMEPAD_BUTTON_A`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_B`, `GLFW_GAMEPAD_BUTTON_X`, `GLFW_GAMEPAD_BUTTON_Y`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_LEFT_BUMPER`, `GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_BACK`, `GLFW_GAMEPAD_BUTTON_START`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_GUIDE`, `GLFW_GAMEPAD_BUTTON_LEFT_THUMB`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_RIGHT_THUMB`, `GLFW_GAMEPAD_BUTTON_DPAD_UP`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_DPAD_RIGHT`, `GLFW_GAMEPAD_BUTTON_DPAD_DOWN` and
|
||||||
|
`GLFW_GAMEPAD_BUTTON_DPAD_LEFT`.
|
||||||
|
|
||||||
|
For those who prefer, there are also the `GLFW_GAMEPAD_BUTTON_CROSS`,
|
||||||
|
`GLFW_GAMEPAD_BUTTON_CIRCLE`, `GLFW_GAMEPAD_BUTTON_SQUARE` and
|
||||||
|
`GLFW_GAMEPAD_BUTTON_TRIANGLE` aliases for the A, B, X and Y button indices.
|
||||||
|
|
||||||
|
The [axis indices](@ref gamepad_axes) are `GLFW_GAMEPAD_AXIS_LEFT_X`,
|
||||||
|
`GLFW_GAMEPAD_AXIS_LEFT_Y`, `GLFW_GAMEPAD_AXIS_RIGHT_X`,
|
||||||
|
`GLFW_GAMEPAD_AXIS_RIGHT_Y`, `GLFW_GAMEPAD_AXIS_LEFT_TRIGGER` and
|
||||||
|
`GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER`.
|
||||||
|
|
||||||
|
The `GLFW_GAMEPAD_BUTTON_LAST` and `GLFW_GAMEPAD_AXIS_LAST` constants equal
|
||||||
|
the largest available index for each array.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection gamepad_mapping Gamepad mappings
|
||||||
|
|
||||||
|
Newer ones can be added with @ref glfwUpdateGamepadMappings. This function
|
||||||
|
supports everything from single lines up to the entire unmodified contents of
|
||||||
|
the `gamecontrollerdb.txt` file.
|
||||||
|
|
||||||
|
@code
|
||||||
|
const char* mappings = load_file_contents("gamecontrollerdb.txt");
|
||||||
|
|
||||||
|
glfwUpdateGamepadMappings(mappings);
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Below is a description of the mapping format. Please keep in mind that __this
|
||||||
|
description is not authoritative__. The format is defined by the SDL and
|
||||||
|
SDL_GameControllerDB projects and their documentation and code takes precedence.
|
||||||
|
|
||||||
|
Each mapping is a single line of comma-separated values describing the GUID,
|
||||||
|
name and layout of the gamepad. Lines that do not begin with a hexadecimal
|
||||||
|
digit are ignored.
|
||||||
|
|
||||||
|
The first value is always the gamepad GUID, a 32 character long hexadecimal
|
||||||
|
string that typically identifies its make, model, revision and the type of
|
||||||
|
connection to the computer. When this information is not available, the GUID is
|
||||||
|
generated using the gamepad name. GLFW uses the SDL 2.0.5+ GUID format but can
|
||||||
|
convert from the older formats.
|
||||||
|
|
||||||
|
The second value is always the human-readable name of the gamepad.
|
||||||
|
|
||||||
|
All subsequent values are in the form `<field>:<value>` and describe the layout
|
||||||
|
of the mapping. These fields may not all be present and may occur in any order.
|
||||||
|
|
||||||
|
The button fields are `a`, `b`, `c`, `d`, `back`, `start`, `guide`, `dpup`,
|
||||||
|
`dpright`, `dpdown`, `dpleft`, `leftshoulder`, `rightshoulder`, `leftstick` and
|
||||||
|
`rightstick`.
|
||||||
|
|
||||||
|
The axis fields are `leftx`, `lefty`, `rightx`, `righty`, `lefttrigger` and
|
||||||
|
`righttrigger`.
|
||||||
|
|
||||||
|
The value of an axis or button field can be a joystick button, a joystick axis,
|
||||||
|
a hat bitmask or empty. Joystick buttons are specified as `bN`, for example
|
||||||
|
`b2` for the third button. Joystick axes are specified as `aN`, for example
|
||||||
|
`a7` for the eighth button. Joystick hat bit masks are specified as `hN.N`, for
|
||||||
|
example `h0.8` for left on the first hat. More than one bit may be set in the
|
||||||
|
mask.
|
||||||
|
|
||||||
|
The hat bit mask match the [hat states](@ref hat_state) in the joystick
|
||||||
|
functions.
|
||||||
|
|
||||||
|
There is also the special `platform` field that specifies which platform the
|
||||||
|
mapping is valid for. Possible values are `Windows`, `Mac OS X` and `Linux`.
|
||||||
|
Mappings without this field will always be considered valid.
|
||||||
|
|
||||||
|
@note GLFW does not yet support the range and inversion modifiers `+`, `-` and
|
||||||
|
`~`.
|
||||||
|
|
||||||
|
|
||||||
@section time Time input
|
@section time Time input
|
||||||
|
|
||||||
GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
|
GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
|
||||||
|
@ -13,6 +13,16 @@ human-readable description with @ref glfwGetError.
|
|||||||
@see @ref error_handling
|
@see @ref error_handling
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_33_gamepad SDL_GameControllerDB support and gamepad input
|
||||||
|
|
||||||
|
GLFW now supports remapping of gamepads and controllers to a 360-like controller
|
||||||
|
layout with @ref glfwJoystickIsGamepad, @ref glfwGetGamepadName, @ref
|
||||||
|
glfwGetGamepadState and @ref glfwUpdateGamepadMappings, and the input state
|
||||||
|
struct @ref GLFWgamepadstate.
|
||||||
|
|
||||||
|
@sa @ref gamepad
|
||||||
|
|
||||||
|
|
||||||
@subsection news_33_attention User attention request
|
@subsection news_33_attention User attention request
|
||||||
|
|
||||||
GLFW now supports requesting user attention to a specific window (on macOS to
|
GLFW now supports requesting user attention to a specific window (on macOS to
|
||||||
|
@ -559,6 +559,52 @@ extern "C" {
|
|||||||
#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
|
#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
|
/*! @defgroup gamepad_buttons Gamepad buttons
|
||||||
|
* @brief Gamepad buttons.
|
||||||
|
*
|
||||||
|
* See @ref gamepad for how these are used.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
* @{ */
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_A 0
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_B 1
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_X 2
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_Y 3
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_BACK 6
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_START 7
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_GUIDE 8
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_DPAD_UP 11
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
|
||||||
|
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X
|
||||||
|
#define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y
|
||||||
|
/*! @} */
|
||||||
|
|
||||||
|
/*! @defgroup gamepad_axes Gamepad axes
|
||||||
|
* @brief Gamepad axes.
|
||||||
|
*
|
||||||
|
* See @ref gamepad for how these are used.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
* @{ */
|
||||||
|
#define GLFW_GAMEPAD_AXIS_LEFT_X 0
|
||||||
|
#define GLFW_GAMEPAD_AXIS_LEFT_Y 1
|
||||||
|
#define GLFW_GAMEPAD_AXIS_RIGHT_X 2
|
||||||
|
#define GLFW_GAMEPAD_AXIS_RIGHT_Y 3
|
||||||
|
#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4
|
||||||
|
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
|
||||||
|
#define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||||
|
/*! @} */
|
||||||
|
|
||||||
/*! @defgroup errors Error codes
|
/*! @defgroup errors Error codes
|
||||||
* @brief Error codes.
|
* @brief Error codes.
|
||||||
*
|
*
|
||||||
@ -1475,6 +1521,27 @@ typedef struct GLFWimage
|
|||||||
unsigned char* pixels;
|
unsigned char* pixels;
|
||||||
} GLFWimage;
|
} GLFWimage;
|
||||||
|
|
||||||
|
/*! @brief Gamepad input state
|
||||||
|
*
|
||||||
|
* This describes the input state of a gamepad.
|
||||||
|
*
|
||||||
|
* @sa @ref gamepad
|
||||||
|
* @sa @ref glfwGetGamepadState
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*/
|
||||||
|
typedef struct GLFWgamepadstate
|
||||||
|
{
|
||||||
|
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
||||||
|
* or `GLFW_RELEASE`.
|
||||||
|
*/
|
||||||
|
char buttons[15];
|
||||||
|
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
||||||
|
* to 1.0 inclusive.
|
||||||
|
*/
|
||||||
|
float axes[6];
|
||||||
|
} GLFWgamepadstate;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW API functions
|
* GLFW API functions
|
||||||
@ -4118,9 +4185,9 @@ GLFWAPI int glfwJoystickPresent(int jid);
|
|||||||
* This function returns the values of all axes of the specified joystick.
|
* This function returns the values of all axes of the specified joystick.
|
||||||
* Each element in the array is a value between -1.0 and 1.0.
|
* Each element in the array is a value between -1.0 and 1.0.
|
||||||
*
|
*
|
||||||
* Querying a joystick ID with no device present is not an error, but will
|
* If the specified joystick is not present this function will return `NULL`
|
||||||
* cause this function to return `NULL`. Call @ref glfwJoystickPresent to
|
* but will not generate an error. Call @ref glfwJoystickPresent to check
|
||||||
* check device presence.
|
* device presence.
|
||||||
*
|
*
|
||||||
* @param[in] jid The [joystick](@ref joysticks) to query.
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
* @param[out] count Where to store the number of axis values in the returned
|
* @param[out] count Where to store the number of axis values in the returned
|
||||||
@ -4158,9 +4225,9 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
|
|||||||
* _left_. To disable these extra buttons, set the @ref
|
* _left_. To disable these extra buttons, set the @ref
|
||||||
* GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
|
* GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
|
||||||
*
|
*
|
||||||
* Querying a joystick ID with no device present is not an error, but will
|
* If the specified joystick is not present this function will return `NULL`
|
||||||
* cause this function to return `NULL`. Call @ref glfwJoystickPresent to
|
* but will not generate an error. Call @ref glfwJoystickPresent to check
|
||||||
* check device presence.
|
* device presence.
|
||||||
*
|
*
|
||||||
* @param[in] jid The [joystick](@ref joysticks) to query.
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
* @param[out] count Where to store the number of button states in the returned
|
* @param[out] count Where to store the number of button states in the returned
|
||||||
@ -4215,9 +4282,9 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
|
|||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* Querying a joystick ID with no device present is not an error, but will
|
* If the specified joystick is not present this function will return `NULL`
|
||||||
* cause this function to return `NULL`. Call @ref glfwJoystickPresent to
|
* but will not generate an error. Call @ref glfwJoystickPresent to check
|
||||||
* check device presence.
|
* device presence.
|
||||||
*
|
*
|
||||||
* @param[in] jid The [joystick](@ref joysticks) to query.
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
* @param[out] count Where to store the number of hat states in the returned
|
* @param[out] count Where to store the number of hat states in the returned
|
||||||
@ -4250,9 +4317,9 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
|
|||||||
* The returned string is allocated and freed by GLFW. You should not free it
|
* The returned string is allocated and freed by GLFW. You should not free it
|
||||||
* yourself.
|
* yourself.
|
||||||
*
|
*
|
||||||
* Querying a joystick ID with no device present is not an error, but will
|
* If the specified joystick is not present this function will return `NULL`
|
||||||
* cause this function to return `NULL`. Call @ref glfwJoystickPresent to
|
* but will not generate an error. Call @ref glfwJoystickPresent to check
|
||||||
* check device presence.
|
* device presence.
|
||||||
*
|
*
|
||||||
* @param[in] jid The [joystick](@ref joysticks) to query.
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
* @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
|
* @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
|
||||||
@ -4275,6 +4342,33 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetJoystickName(int jid);
|
GLFWAPI const char* glfwGetJoystickName(int jid);
|
||||||
|
|
||||||
|
/*! @brief Returns whether the specified joystick has a gamepad mapping.
|
||||||
|
*
|
||||||
|
* This function returns whether the specified joystick is both present and has
|
||||||
|
* a gamepad mapping.
|
||||||
|
*
|
||||||
|
* If the specified joystick is present but does not have a gamepad mapping
|
||||||
|
* this function will return `GLFW_FALSE` but will not generate an error. Call
|
||||||
|
* @ref glfwJoystickPresent to only check device presence.
|
||||||
|
*
|
||||||
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
|
* @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,
|
||||||
|
* or `GLFW_FALSE` otherwise.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_INVALID_ENUM.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref gamepad
|
||||||
|
* @sa @ref glfwGetGamepadState
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI int glfwJoystickIsGamepad(int jid);
|
||||||
|
|
||||||
/*! @brief Sets the joystick configuration callback.
|
/*! @brief Sets the joystick configuration callback.
|
||||||
*
|
*
|
||||||
* This function sets the joystick configuration callback, or removes the
|
* This function sets the joystick configuration callback, or removes the
|
||||||
@ -4285,7 +4379,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid);
|
|||||||
* platforms, you need to call one of the [event processing](@ref events)
|
* platforms, you need to call one of the [event processing](@ref events)
|
||||||
* functions. Joystick disconnection may also be detected and the callback
|
* functions. Joystick disconnection may also be detected and the callback
|
||||||
* called by joystick functions. The function will then return whatever it
|
* called by joystick functions. The function will then return whatever it
|
||||||
* returns for a disconnected joystick.
|
* returns if the joystick is not present.
|
||||||
*
|
*
|
||||||
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
@ -4304,6 +4398,105 @@ GLFWAPI const char* glfwGetJoystickName(int jid);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
|
GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
|
||||||
|
|
||||||
|
/*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.
|
||||||
|
*
|
||||||
|
* This function parses the specified ASCII encoded string and updates the
|
||||||
|
* internal list with any gamepad mappings it finds. This string may
|
||||||
|
* contain either a single gamepad mapping or many mappings separated by
|
||||||
|
* newlines. The parser supports the full format of the `gamecontrollerdb.txt`
|
||||||
|
* source file including empty lines and comments.
|
||||||
|
*
|
||||||
|
* See @ref gamepad_mapping for a description of the format.
|
||||||
|
*
|
||||||
|
* If there is already a gamepad mapping for a given GUID in the internal list,
|
||||||
|
* it will be replaced by the one passed to this function. If the library is
|
||||||
|
* terminated and re-initialized the internal list will revert to the built-in
|
||||||
|
* default.
|
||||||
|
*
|
||||||
|
* @param[in] string The string containing the gamepad mappings.
|
||||||
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_INVALID_VALUE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref gamepad
|
||||||
|
* @sa @ref glfwJoystickIsGamepad
|
||||||
|
* @sa @ref glfwGetGamepadName
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI int glfwUpdateGamepadMappings(const char* string);
|
||||||
|
|
||||||
|
/*! @brief Returns the human-readable gamepad name for the specified joystick.
|
||||||
|
*
|
||||||
|
* This function returns the human-readable name of the gamepad from the
|
||||||
|
* gamepad mapping assigned to the specified joystick.
|
||||||
|
*
|
||||||
|
* If the specified joystick is not present or does not have a gamepad mapping
|
||||||
|
* this function will return `NULL` but will not generate an error. Call @ref
|
||||||
|
* glfwJoystickIsGamepad to check whether it is present and has a gamepad mapping.
|
||||||
|
*
|
||||||
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
|
* @return The UTF-8 encoded name of the gamepad, or `NULL` if the
|
||||||
|
* joystick is not present, does not have a mapping or an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
|
* should not free it yourself. It is valid until the specified joystick is
|
||||||
|
* disconnected, the gamepad mappings are updated or the library is terminated.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref gamepad
|
||||||
|
* @sa @ref glfwJoystickIsGamepad
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetGamepadName(int jid);
|
||||||
|
|
||||||
|
/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
|
||||||
|
*
|
||||||
|
* This function retrives the state of the specified joystick remapped to
|
||||||
|
* an Xbox-like gamepad.
|
||||||
|
*
|
||||||
|
* If the specified joystick is not present this function will return
|
||||||
|
* `GLFW_FALSE` but will not generate an error. Call @ref
|
||||||
|
* glfwJoystickIsGamepad to check whether it is present and has a gamepad
|
||||||
|
* mapping.
|
||||||
|
*
|
||||||
|
* The Guide button may not be available for input as it is often hooked by the
|
||||||
|
* system or the Steam client.
|
||||||
|
*
|
||||||
|
* Not all devices have all the buttons or axes provided by @ref
|
||||||
|
* GLFWgamepadstate. Unavailable buttons and axes will always report
|
||||||
|
* `GLFW_RELEASE` and 1.0 respectively.
|
||||||
|
*
|
||||||
|
* @param[in] jid The [joystick](@ref joysticks) to query.
|
||||||
|
* @param[out] state The gamepad input state of the joystick.
|
||||||
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
|
||||||
|
* connected, it has no gamepad mapping or an [error](@ref error_handling)
|
||||||
|
* occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_INVALID_ENUM.
|
||||||
|
*
|
||||||
|
* @sa @ref gamepad
|
||||||
|
* @sa @ref glfwUpdateGamepadMappings
|
||||||
|
* @sa @ref glfwJoystickIsGamepad
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||||
|
|
||||||
/*! @brief Sets the clipboard to the specified string.
|
/*! @brief Sets the clipboard to the specified string.
|
||||||
*
|
*
|
||||||
* This function sets the system clipboard to the specified, UTF-8 encoded
|
* This function sets the system clipboard to the specified, UTF-8 encoded
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(common_HEADERS internal.h
|
set(common_HEADERS internal.h mappings.h
|
||||||
"${GLFW_BINARY_DIR}/src/glfw_config.h"
|
"${GLFW_BINARY_DIR}/src/glfw_config.h"
|
||||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
||||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns
|
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
||||||
|
|
||||||
// Cocoa-specific per-joystick data
|
// Cocoa-specific per-joystick data
|
||||||
//
|
//
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
typedef struct _GLFWjoyelementNS
|
typedef struct _GLFWjoyelementNS
|
||||||
{
|
{
|
||||||
IOHIDElementRef native;
|
IOHIDElementRef native;
|
||||||
|
uint32_t usage;
|
||||||
|
int index;
|
||||||
long minimum;
|
long minimum;
|
||||||
long maximum;
|
long maximum;
|
||||||
|
|
||||||
@ -69,6 +71,23 @@ static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comparison function for matching the SDL element order
|
||||||
|
//
|
||||||
|
static CFComparisonResult compareElements(const void* fp, const void* sp, void* user)
|
||||||
|
{
|
||||||
|
const _GLFWjoyelementNS* fe = fp;
|
||||||
|
const _GLFWjoyelementNS* se = sp;
|
||||||
|
if (fe->usage < se->usage)
|
||||||
|
return kCFCompareLessThan;
|
||||||
|
if (fe->usage > se->usage)
|
||||||
|
return kCFCompareGreaterThan;
|
||||||
|
if (fe->index < se->index)
|
||||||
|
return kCFCompareLessThan;
|
||||||
|
if (fe->index > se->index)
|
||||||
|
return kCFCompareGreaterThan;
|
||||||
|
return kCFCompareEqualTo;
|
||||||
|
}
|
||||||
|
|
||||||
// Removes the specified joystick
|
// Removes the specified joystick
|
||||||
//
|
//
|
||||||
static void closeJoystick(_GLFWjoystick* js)
|
static void closeJoystick(_GLFWjoystick* js)
|
||||||
@ -103,8 +122,10 @@ static void matchCallback(void* context,
|
|||||||
{
|
{
|
||||||
int jid;
|
int jid;
|
||||||
char name[256];
|
char name[256];
|
||||||
|
char guid[33];
|
||||||
CFIndex i;
|
CFIndex i;
|
||||||
CFStringRef productKey;
|
CFTypeRef property;
|
||||||
|
uint32_t vendor = 0, product = 0, version = 0;
|
||||||
_GLFWjoystick* js;
|
_GLFWjoystick* js;
|
||||||
CFMutableArrayRef axes, buttons, hats;
|
CFMutableArrayRef axes, buttons, hats;
|
||||||
|
|
||||||
@ -118,10 +139,10 @@ static void matchCallback(void* context,
|
|||||||
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
|
||||||
productKey = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
||||||
if (productKey)
|
if (property)
|
||||||
{
|
{
|
||||||
CFStringGetCString(productKey,
|
CFStringGetCString(property,
|
||||||
name,
|
name,
|
||||||
sizeof(name),
|
sizeof(name),
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
@ -129,6 +150,34 @@ static void matchCallback(void* context,
|
|||||||
else
|
else
|
||||||
strncpy(name, "Unknown", sizeof(name));
|
strncpy(name, "Unknown", sizeof(name));
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &vendor);
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &product);
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVersionNumberKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &version);
|
||||||
|
|
||||||
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
if (vendor && product)
|
||||||
|
{
|
||||||
|
sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
|
||||||
|
(uint8_t) vendor, (uint8_t) (vendor >> 8),
|
||||||
|
(uint8_t) product, (uint8_t) (product >> 8),
|
||||||
|
(uint8_t) version, (uint8_t) (version >> 8));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
|
name[0], name[1], name[2], name[3],
|
||||||
|
name[4], name[5], name[6], name[7],
|
||||||
|
name[8], name[9], name[10]);
|
||||||
|
}
|
||||||
|
|
||||||
CFArrayRef elements =
|
CFArrayRef elements =
|
||||||
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
@ -147,12 +196,13 @@ static void matchCallback(void* context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFMutableArrayRef target = NULL;
|
CFMutableArrayRef target = NULL;
|
||||||
|
const uint32_t usage = IOHIDElementGetUsage(native);
|
||||||
|
|
||||||
switch (IOHIDElementGetUsagePage(native))
|
switch (IOHIDElementGetUsagePage(native))
|
||||||
{
|
{
|
||||||
case kHIDPage_GenericDesktop:
|
case kHIDPage_GenericDesktop:
|
||||||
{
|
{
|
||||||
switch (IOHIDElementGetUsage(native))
|
switch (usage)
|
||||||
{
|
{
|
||||||
case kHIDUsage_GD_X:
|
case kHIDUsage_GD_X:
|
||||||
case kHIDUsage_GD_Y:
|
case kHIDUsage_GD_Y:
|
||||||
@ -184,6 +234,8 @@ static void matchCallback(void* context,
|
|||||||
{
|
{
|
||||||
_GLFWjoyelementNS* element = calloc(1, sizeof(_GLFWjoyelementNS));
|
_GLFWjoyelementNS* element = calloc(1, sizeof(_GLFWjoyelementNS));
|
||||||
element->native = native;
|
element->native = native;
|
||||||
|
element->usage = usage;
|
||||||
|
element->index = (int) CFArrayGetCount(target);
|
||||||
element->minimum = IOHIDElementGetLogicalMin(native);
|
element->minimum = IOHIDElementGetLogicalMin(native);
|
||||||
element->maximum = IOHIDElementGetLogicalMax(native);
|
element->maximum = IOHIDElementGetLogicalMax(native);
|
||||||
CFArrayAppendValue(target, element);
|
CFArrayAppendValue(target, element);
|
||||||
@ -192,7 +244,14 @@ static void matchCallback(void* context,
|
|||||||
|
|
||||||
CFRelease(elements);
|
CFRelease(elements);
|
||||||
|
|
||||||
js = _glfwAllocJoystick(name,
|
CFArraySortValues(axes, CFRangeMake(0, CFArrayGetCount(axes)),
|
||||||
|
compareElements, NULL);
|
||||||
|
CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)),
|
||||||
|
compareElements, NULL);
|
||||||
|
CFArraySortValues(hats, CFRangeMake(0, CFArrayGetCount(hats)),
|
||||||
|
compareElements, NULL);
|
||||||
|
|
||||||
|
js = _glfwAllocJoystick(name, guid,
|
||||||
CFArrayGetCount(axes),
|
CFArrayGetCount(axes),
|
||||||
CFArrayGetCount(buttons),
|
CFArrayGetCount(buttons),
|
||||||
CFArrayGetCount(hats));
|
CFArrayGetCount(hats));
|
||||||
@ -329,7 +388,7 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
{
|
{
|
||||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
|
|
||||||
if (mode == _GLFW_POLL_AXES)
|
if (mode & _GLFW_POLL_AXES)
|
||||||
{
|
{
|
||||||
CFIndex i;
|
CFIndex i;
|
||||||
|
|
||||||
@ -355,7 +414,8 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == _GLFW_POLL_BUTTONS)
|
|
||||||
|
if (mode & _GLFW_POLL_BUTTONS)
|
||||||
{
|
{
|
||||||
CFIndex i;
|
CFIndex i;
|
||||||
|
|
||||||
@ -395,3 +455,15 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
return js->present;
|
return js->present;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
{
|
||||||
|
if ((strncmp(guid + 4, "000000000000", 12) == 0) &&
|
||||||
|
(strncmp(guid + 20, "000000000000", 12) == 0))
|
||||||
|
{
|
||||||
|
char original[33];
|
||||||
|
strcpy(original, guid);
|
||||||
|
sprintf(guid, "03000000%.4s0000%.4s000000000000",
|
||||||
|
original, original + 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "mappings.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -111,6 +112,10 @@ static void terminate(void)
|
|||||||
_glfw.monitors = NULL;
|
_glfw.monitors = NULL;
|
||||||
_glfw.monitorCount = 0;
|
_glfw.monitorCount = 0;
|
||||||
|
|
||||||
|
free(_glfw.mappings);
|
||||||
|
_glfw.mappings = NULL;
|
||||||
|
_glfw.mappingCount = 0;
|
||||||
|
|
||||||
_glfwTerminateVulkan();
|
_glfwTerminateVulkan();
|
||||||
_glfwPlatformTerminate();
|
_glfwPlatformTerminate();
|
||||||
|
|
||||||
@ -209,8 +214,8 @@ GLFWAPI int glfwInit(void)
|
|||||||
_glfw.initialized = GLFW_TRUE;
|
_glfw.initialized = GLFW_TRUE;
|
||||||
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
// Not all window hints have zero as their default value
|
|
||||||
glfwDefaultWindowHints();
|
glfwDefaultWindowHints();
|
||||||
|
glfwUpdateGamepadMappings(_glfwDefaultMappings);
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
307
src/input.c
307
src/input.c
@ -29,12 +29,144 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
// Internal key state used for sticky keys
|
// Internal key state used for sticky keys
|
||||||
#define _GLFW_STICK 3
|
#define _GLFW_STICK 3
|
||||||
|
|
||||||
|
// Internal constants for gamepad mapping source types
|
||||||
|
#define _GLFW_JOYSTICK_AXIS 1
|
||||||
|
#define _GLFW_JOYSTICK_BUTTON 2
|
||||||
|
#define _GLFW_JOYSTICK_HATBIT 3
|
||||||
|
|
||||||
|
// Finds a mapping based on joystick GUID
|
||||||
|
//
|
||||||
|
static _GLFWmapping* findMapping(const char* guid)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < _glfw.mappingCount; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(_glfw.mappings[i].guid, guid) == 0)
|
||||||
|
return _glfw.mappings + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses an SDL_GameControllerDB line and adds it to the mapping list
|
||||||
|
//
|
||||||
|
static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string)
|
||||||
|
{
|
||||||
|
const char* c = string;
|
||||||
|
size_t i, length;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
_GLFWmapelement* element;
|
||||||
|
} fields[] =
|
||||||
|
{
|
||||||
|
{ "platform", NULL },
|
||||||
|
{ "a", mapping->buttons + GLFW_GAMEPAD_BUTTON_A },
|
||||||
|
{ "b", mapping->buttons + GLFW_GAMEPAD_BUTTON_B },
|
||||||
|
{ "x", mapping->buttons + GLFW_GAMEPAD_BUTTON_X },
|
||||||
|
{ "y", mapping->buttons + GLFW_GAMEPAD_BUTTON_Y },
|
||||||
|
{ "back", mapping->buttons + GLFW_GAMEPAD_BUTTON_BACK },
|
||||||
|
{ "start", mapping->buttons + GLFW_GAMEPAD_BUTTON_START },
|
||||||
|
{ "guide", mapping->buttons + GLFW_GAMEPAD_BUTTON_GUIDE },
|
||||||
|
{ "leftshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_BUMPER },
|
||||||
|
{ "rightshoulder", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER },
|
||||||
|
{ "leftstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_LEFT_THUMB },
|
||||||
|
{ "rightstick", mapping->buttons + GLFW_GAMEPAD_BUTTON_RIGHT_THUMB },
|
||||||
|
{ "dpup", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_UP },
|
||||||
|
{ "dpright", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_RIGHT },
|
||||||
|
{ "dpdown", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_DOWN },
|
||||||
|
{ "dpleft", mapping->buttons + GLFW_GAMEPAD_BUTTON_DPAD_LEFT },
|
||||||
|
{ "lefttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_TRIGGER },
|
||||||
|
{ "righttrigger", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER },
|
||||||
|
{ "leftx", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_X },
|
||||||
|
{ "lefty", mapping->axes + GLFW_GAMEPAD_AXIS_LEFT_Y },
|
||||||
|
{ "rightx", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_X },
|
||||||
|
{ "righty", mapping->axes + GLFW_GAMEPAD_AXIS_RIGHT_Y }
|
||||||
|
};
|
||||||
|
|
||||||
|
length = strcspn(c, ",");
|
||||||
|
if (length != 32 || c[length] != ',')
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(mapping->guid, c, length);
|
||||||
|
c += length + 1;
|
||||||
|
|
||||||
|
length = strcspn(c, ",");
|
||||||
|
if (length >= sizeof(mapping->name) || c[length] != ',')
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(mapping->name, c, length);
|
||||||
|
c += length + 1;
|
||||||
|
|
||||||
|
while (*c)
|
||||||
|
{
|
||||||
|
for (i = 0; i < sizeof(fields) / sizeof(fields[0]); i++)
|
||||||
|
{
|
||||||
|
length = strlen(fields[i].name);
|
||||||
|
if (strncmp(c, fields[i].name, length) != 0 || c[length] != ':')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
c += length + 1;
|
||||||
|
|
||||||
|
if (fields[i].element)
|
||||||
|
{
|
||||||
|
if (*c == 'a')
|
||||||
|
fields[i].element->type = _GLFW_JOYSTICK_AXIS;
|
||||||
|
else if (*c == 'b')
|
||||||
|
fields[i].element->type = _GLFW_JOYSTICK_BUTTON;
|
||||||
|
else if (*c == 'h')
|
||||||
|
fields[i].element->type = _GLFW_JOYSTICK_HATBIT;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (fields[i].element->type == _GLFW_JOYSTICK_HATBIT)
|
||||||
|
{
|
||||||
|
const unsigned int hat = strtoul(c + 1, (char**) &c, 10);
|
||||||
|
const unsigned int bit = strtoul(c + 1, (char**) &c, 10);
|
||||||
|
fields[i].element->value = (hat << 4) | bit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fields[i].element->value = (uint8_t) strtoul(c + 1, (char**) &c, 10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = strlen(_GLFW_PLATFORM_MAPPING_NAME);
|
||||||
|
if (strncmp(c, _GLFW_PLATFORM_MAPPING_NAME, length) != 0)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
c += strcspn(c, ",");
|
||||||
|
c += strspn(c, ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
if (mapping->guid[i] >= 'A' && mapping->guid[i] <= 'F')
|
||||||
|
mapping->guid[i] += 'a' - 'A';
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformUpdateGamepadGUID(mapping->guid);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW event API //////
|
////// GLFW event API //////
|
||||||
@ -166,6 +298,7 @@ GLFWbool _glfwIsPrintable(int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||||
|
const char* guid,
|
||||||
int axisCount,
|
int axisCount,
|
||||||
int buttonCount,
|
int buttonCount,
|
||||||
int hatCount)
|
int hatCount)
|
||||||
@ -191,6 +324,9 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
js->axisCount = axisCount;
|
js->axisCount = axisCount;
|
||||||
js->buttonCount = buttonCount;
|
js->buttonCount = buttonCount;
|
||||||
js->hatCount = hatCount;
|
js->hatCount = hatCount;
|
||||||
|
js->mapping = findMapping(guid);
|
||||||
|
|
||||||
|
strcpy(js->guid, guid);
|
||||||
|
|
||||||
return js;
|
return js;
|
||||||
}
|
}
|
||||||
@ -748,6 +884,177 @@ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun)
|
|||||||
return cbfun;
|
return cbfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwUpdateGamepadMappings(const char* string)
|
||||||
|
{
|
||||||
|
int jid;
|
||||||
|
const char* c = string;
|
||||||
|
|
||||||
|
assert(string != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
|
while (*c)
|
||||||
|
{
|
||||||
|
if (isxdigit(*c))
|
||||||
|
{
|
||||||
|
char line[1024];
|
||||||
|
|
||||||
|
const size_t length = strcspn(c, "\r\n");
|
||||||
|
if (length < sizeof(line))
|
||||||
|
{
|
||||||
|
_GLFWmapping mapping = {{0}};
|
||||||
|
|
||||||
|
memcpy(line, c, length);
|
||||||
|
line[length] = '\0';
|
||||||
|
|
||||||
|
if (parseMapping(&mapping, line))
|
||||||
|
{
|
||||||
|
_GLFWmapping* previous = findMapping(mapping.guid);
|
||||||
|
if (previous)
|
||||||
|
*previous = mapping;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfw.mappingCount++;
|
||||||
|
_glfw.mappings =
|
||||||
|
realloc(_glfw.mappings,
|
||||||
|
sizeof(_GLFWmapping) * _glfw.mappingCount);
|
||||||
|
_glfw.mappings[_glfw.mappingCount - 1] = mapping;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c += length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c += strcspn(c, "\r\n");
|
||||||
|
c += strspn(c, "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
|
if (js->present)
|
||||||
|
js->mapping = findMapping(js->guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwJoystickIsGamepad(int jid)
|
||||||
|
{
|
||||||
|
assert(jid >= GLFW_JOYSTICK_1);
|
||||||
|
assert(jid <= GLFW_JOYSTICK_LAST);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
|
if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfw.joysticks[jid].present)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (!_glfwPlatformPollJoystick(jid, _GLFW_POLL_PRESENCE))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
return _glfw.joysticks[jid].mapping != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetGamepadName(int jid)
|
||||||
|
{
|
||||||
|
assert(jid >= GLFW_JOYSTICK_1);
|
||||||
|
assert(jid <= GLFW_JOYSTICK_LAST);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfw.joysticks[jid].present)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!_glfwPlatformPollJoystick(jid, _GLFW_POLL_PRESENCE))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!_glfw.joysticks[jid].mapping)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return _glfw.joysticks[jid].mapping->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
_GLFWjoystick* js;
|
||||||
|
|
||||||
|
assert(jid >= GLFW_JOYSTICK_1);
|
||||||
|
assert(jid <= GLFW_JOYSTICK_LAST);
|
||||||
|
assert(state != NULL);
|
||||||
|
|
||||||
|
memset(state, 0, sizeof(GLFWgamepadstate));
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
|
if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
js = _glfw.joysticks + jid;
|
||||||
|
|
||||||
|
if (!js->present)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (!_glfwPlatformPollJoystick(jid, _GLFW_POLL_ALL))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (!js->mapping)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
|
||||||
|
{
|
||||||
|
if (js->mapping->buttons[i].type == _GLFW_JOYSTICK_AXIS)
|
||||||
|
{
|
||||||
|
if (fabs(js->axes[js->mapping->buttons[i].value]) > 0.5)
|
||||||
|
state->buttons[i] = GLFW_PRESS;
|
||||||
|
}
|
||||||
|
else if (js->mapping->buttons[i].type == _GLFW_JOYSTICK_HATBIT)
|
||||||
|
{
|
||||||
|
const unsigned int hat = js->mapping->buttons[i].value >> 4;
|
||||||
|
const unsigned int bit = js->mapping->buttons[i].value & 0xf;
|
||||||
|
if (js->hats[hat] & bit)
|
||||||
|
state->buttons[i] = GLFW_PRESS;
|
||||||
|
}
|
||||||
|
else if (js->mapping->buttons[i].type == _GLFW_JOYSTICK_BUTTON)
|
||||||
|
state->buttons[i] = js->buttons[js->mapping->buttons[i].value];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
|
||||||
|
{
|
||||||
|
if (js->mapping->axes[i].type == _GLFW_JOYSTICK_AXIS)
|
||||||
|
state->axes[i] = js->axes[js->mapping->axes[i].value];
|
||||||
|
else if (js->mapping->buttons[i].type == _GLFW_JOYSTICK_HATBIT)
|
||||||
|
{
|
||||||
|
const unsigned int hat = js->mapping->buttons[i].value >> 4;
|
||||||
|
const unsigned int bit = js->mapping->buttons[i].value & 0xf;
|
||||||
|
if (js->hats[hat] & bit)
|
||||||
|
state->axes[i] = 1.f;
|
||||||
|
}
|
||||||
|
else if (js->mapping->buttons[i].type == _GLFW_JOYSTICK_BUTTON)
|
||||||
|
state->axes[i] = (float) js->buttons[js->mapping->axes[i].value];
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#define _GLFW_POLL_PRESENCE 0
|
#define _GLFW_POLL_PRESENCE 0
|
||||||
#define _GLFW_POLL_AXES 1
|
#define _GLFW_POLL_AXES 1
|
||||||
#define _GLFW_POLL_BUTTONS 2
|
#define _GLFW_POLL_BUTTONS 2
|
||||||
|
#define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS)
|
||||||
|
|
||||||
typedef int GLFWbool;
|
typedef int GLFWbool;
|
||||||
|
|
||||||
@ -65,6 +66,8 @@ typedef struct _GLFWwindow _GLFWwindow;
|
|||||||
typedef struct _GLFWlibrary _GLFWlibrary;
|
typedef struct _GLFWlibrary _GLFWlibrary;
|
||||||
typedef struct _GLFWmonitor _GLFWmonitor;
|
typedef struct _GLFWmonitor _GLFWmonitor;
|
||||||
typedef struct _GLFWcursor _GLFWcursor;
|
typedef struct _GLFWcursor _GLFWcursor;
|
||||||
|
typedef struct _GLFWmapelement _GLFWmapelement;
|
||||||
|
typedef struct _GLFWmapping _GLFWmapping;
|
||||||
typedef struct _GLFWjoystick _GLFWjoystick;
|
typedef struct _GLFWjoystick _GLFWjoystick;
|
||||||
typedef struct _GLFWtls _GLFWtls;
|
typedef struct _GLFWtls _GLFWtls;
|
||||||
typedef struct _GLFWmutex _GLFWmutex;
|
typedef struct _GLFWmutex _GLFWmutex;
|
||||||
@ -474,6 +477,24 @@ struct _GLFWcursor
|
|||||||
_GLFW_PLATFORM_CURSOR_STATE;
|
_GLFW_PLATFORM_CURSOR_STATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! @brief Gamepad mapping element structure
|
||||||
|
*/
|
||||||
|
struct _GLFWmapelement
|
||||||
|
{
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t value;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! @brief Gamepad mapping structure
|
||||||
|
*/
|
||||||
|
struct _GLFWmapping
|
||||||
|
{
|
||||||
|
char name[128];
|
||||||
|
char guid[33];
|
||||||
|
_GLFWmapelement buttons[15];
|
||||||
|
_GLFWmapelement axes[6];
|
||||||
|
};
|
||||||
|
|
||||||
/*! @brief Joystick structure
|
/*! @brief Joystick structure
|
||||||
*/
|
*/
|
||||||
struct _GLFWjoystick
|
struct _GLFWjoystick
|
||||||
@ -486,6 +507,8 @@ struct _GLFWjoystick
|
|||||||
unsigned char* hats;
|
unsigned char* hats;
|
||||||
int hatCount;
|
int hatCount;
|
||||||
char* name;
|
char* name;
|
||||||
|
char guid[33];
|
||||||
|
_GLFWmapping* mapping;
|
||||||
|
|
||||||
// This is defined in the joystick API's joystick.h
|
// This is defined in the joystick API's joystick.h
|
||||||
_GLFW_PLATFORM_JOYSTICK_STATE;
|
_GLFW_PLATFORM_JOYSTICK_STATE;
|
||||||
@ -529,6 +552,8 @@ struct _GLFWlibrary
|
|||||||
int monitorCount;
|
int monitorCount;
|
||||||
|
|
||||||
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1];
|
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1];
|
||||||
|
_GLFWmapping* mappings;
|
||||||
|
int mappingCount;
|
||||||
|
|
||||||
_GLFWtls errorSlot;
|
_GLFWtls errorSlot;
|
||||||
_GLFWtls contextSlot;
|
_GLFWtls contextSlot;
|
||||||
@ -621,6 +646,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string);
|
|||||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
|
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
|
||||||
|
|
||||||
int _glfwPlatformPollJoystick(int jid, int mode);
|
int _glfwPlatformPollJoystick(int jid, int mode);
|
||||||
|
void _glfwPlatformUpdateGamepadGUID(char* guid);
|
||||||
|
|
||||||
uint64_t _glfwPlatformGetTimerValue(void);
|
uint64_t _glfwPlatformGetTimerValue(void);
|
||||||
uint64_t _glfwPlatformGetTimerFrequency(void);
|
uint64_t _glfwPlatformGetTimerFrequency(void);
|
||||||
@ -956,7 +982,11 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor);
|
|||||||
/*! @brief Returns an available joystick object with arrays and name allocated.
|
/*! @brief Returns an available joystick object with arrays and name allocated.
|
||||||
* @ingroup utility
|
* @ingroup utility
|
||||||
*/
|
*/
|
||||||
_GLFWjoystick* _glfwAllocJoystick(const char* name, int axisCount, int buttonCount, int hatCount);
|
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||||
|
const char* guid,
|
||||||
|
int axisCount,
|
||||||
|
int buttonCount,
|
||||||
|
int hatCount);
|
||||||
|
|
||||||
/*! @brief Frees arrays and name and flags the joystick object as unused.
|
/*! @brief Frees arrays and name and flags the joystick object as unused.
|
||||||
* @ingroup utility
|
* @ingroup utility
|
||||||
|
@ -124,10 +124,12 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
{
|
{
|
||||||
int jid, code;
|
int jid, code;
|
||||||
char name[256] = "";
|
char name[256] = "";
|
||||||
|
char guid[33] = "";
|
||||||
char evBits[(EV_CNT + 7) / 8] = {0};
|
char evBits[(EV_CNT + 7) / 8] = {0};
|
||||||
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
||||||
char absBits[(ABS_CNT + 7) / 8] = {0};
|
char absBits[(ABS_CNT + 7) / 8] = {0};
|
||||||
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||||
|
struct input_id id;
|
||||||
_GLFWjoystickLinux linjs = {0};
|
_GLFWjoystickLinux linjs = {0};
|
||||||
_GLFWjoystick* js = NULL;
|
_GLFWjoystick* js = NULL;
|
||||||
|
|
||||||
@ -145,10 +147,11 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
|
|
||||||
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
|
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
|
||||||
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
|
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
|
||||||
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0)
|
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
|
||||||
|
ioctl(linjs.fd, EVIOCGID, &id) < 0)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Linux: Failed to query input device elements: %s",
|
"Linux: Failed to query input device: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
close(linjs.fd);
|
close(linjs.fd);
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
@ -164,6 +167,24 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
|
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
|
||||||
strncpy(name, "Unknown", sizeof(name));
|
strncpy(name, "Unknown", sizeof(name));
|
||||||
|
|
||||||
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
if (id.vendor && id.product && id.version)
|
||||||
|
{
|
||||||
|
sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
|
||||||
|
id.bustype & 0xff, id.bustype >> 8,
|
||||||
|
id.vendor & 0xff, id.vendor >> 8,
|
||||||
|
id.product & 0xff, id.product >> 8,
|
||||||
|
id.version & 0xff, id.version >> 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(guid, "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
|
id.bustype & 0xff, id.bustype >> 8,
|
||||||
|
name[0], name[1], name[2], name[3],
|
||||||
|
name[4], name[5], name[6], name[7],
|
||||||
|
name[8], name[9], name[10]);
|
||||||
|
}
|
||||||
|
|
||||||
for (code = BTN_MISC; code < KEY_CNT; code++)
|
for (code = BTN_MISC; code < KEY_CNT; code++)
|
||||||
{
|
{
|
||||||
if (!isBitSet(code, keyBits))
|
if (!isBitSet(code, keyBits))
|
||||||
@ -196,7 +217,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
js = _glfwAllocJoystick(name, axisCount, buttonCount, hatCount);
|
js = _glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||||
if (!js)
|
if (!js)
|
||||||
{
|
{
|
||||||
close(linjs.fd);
|
close(linjs.fd);
|
||||||
@ -419,3 +440,7 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
return js->present;
|
return js->present;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickLinux linjs
|
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickLinux linjs
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_MAPPING_NAME "Linux"
|
||||||
|
|
||||||
// Linux-specific joystick data
|
// Linux-specific joystick data
|
||||||
//
|
//
|
||||||
typedef struct _GLFWjoystickLinux
|
typedef struct _GLFWjoystickLinux
|
||||||
|
230
src/mappings.h
Normal file
230
src/mappings.h
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.3 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
// All gamepad mappings not labeled GLFW are copied from the
|
||||||
|
// SDL_GameControllerDB project under the following license:
|
||||||
|
//
|
||||||
|
// Simple DirectMedia Layer
|
||||||
|
// Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
|
// In no event will the authors be held liable for any damages arising from the
|
||||||
|
// use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
const char* _glfwDefaultMappings =
|
||||||
|
"8f0e1200000000000000504944564944,Acme,platform:Windows,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,\n"
|
||||||
|
"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,\n"
|
||||||
|
"ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,\n"
|
||||||
|
"6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,\n"
|
||||||
|
"0d0f6e00000000000000504944564944,HORIPAD 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,\n"
|
||||||
|
"88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,\n"
|
||||||
|
"4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,\n"
|
||||||
|
"25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,\n"
|
||||||
|
"4c05c405000000000000504944564944,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Windows,\n"
|
||||||
|
"4c05cc09000000000000504944564944,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Windows,\n"
|
||||||
|
"4c05a00b000000000000504944564944,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Windows,\n"
|
||||||
|
"6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,platform:Windows,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"36280100000000000000504944564944,OUYA Controller,platform:Windows,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13,\n"
|
||||||
|
"4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"00f00300000000000000504944564944,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows,\n"
|
||||||
|
"00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Windows,\n"
|
||||||
|
"28040140000000000000504944564944,GamePad Pro USB,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"ff113133000000000000504944564944,SVEN X-PAD,platform:Windows,a:b2,b:b3,y:b1,x:b0,start:b5,back:b4,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b8,righttrigger:b9,\n"
|
||||||
|
"8f0e0300000000000000504944564944,Piranha xtreme,platform:Windows,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,\n"
|
||||||
|
"8f0e0d31000000000000504944564944,Multilaser JS071 USB,platform:Windows,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"10080300000000000000504944564944,PS2 USB,platform:Windows,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a4,righty:a2,lefttrigger:b4,righttrigger:b5,\n"
|
||||||
|
"79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b10,start:b9,leftstick:a0,rightstick:a2,leftshoulder:a3,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:h0.6,lefty:h0.12,rightx:h0.9,righty:h0.4,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Windows,\n"
|
||||||
|
"4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,platform:Windows,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,\n"
|
||||||
|
"83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Windows,\n"
|
||||||
|
"10080100000000000000504944564944,PS1 USB,platform:Windows,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,\n"
|
||||||
|
"49190204000000000000504944564944,Ipega PG-9023,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b8,righttrigger:b9,platform:Windows,\n"
|
||||||
|
"4f0423b3000000000000504944564944,Dual Trigger 3-in-1,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"0d0f4900000000000000504944564944,Hatsune Miku Sho Controller,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"79004318000000000000504944564944,Mayflash GameCube Controller Adapter,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b0,start:b9,guide:b0,leftshoulder:b4,rightshoulder:b7,leftstick:b0,rightstick:b0,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,\n"
|
||||||
|
"79000018000000000000504944564944,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"2509e803000000000000504944564944,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"300f1001000000000000504944564944,Saitek P480 Rumble Pad,a:b2,b:b3,x:b0,y:b1,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b5,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,y:b3,x:b4,start:b11,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,platform:Windows,\n"
|
||||||
|
"63252305000000000000504944564944,USB Vibration Joystick (BM),platform:Windows,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"20380900000000000000504944564944,8Bitdo NES30 PRO Wireless,platform:Windows,a:b0,b:b1,x:b3,y:b4,leftshoulder:b6,rightshoulder:b7,lefttrigger:b8,righttrigger:b9,back:b10,start:b11,leftstick:b13,rightstick:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"02200090000000000000504944564944,8Bitdo NES30 PRO USB,platform:Windows,a:b0,b:b1,x:b3,y:b4,leftshoulder:b6,rightshoulder:b7,lefttrigger:b8,righttrigger:b9,back:b10,start:b11,leftstick:b13,rightstick:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"ff113133000000000000504944564944,Gembird JPD-DualForce,platform:Windows,a:b2,b:b3,x:b0,y:b1,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,leftstick:b10,rightstick:b11,\n"
|
||||||
|
"341a0108000000000000504944564944,EXEQ RF USB Gamepad 8206,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,leftstick:b8,rightstick:b7,back:b8,start:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Windows,\n"
|
||||||
|
"c0111352000000000000504944564944,Battalife Joystick,platform:Windows,x:b4,a:b6,b:b7,y:b5,back:b2,start:b3,leftshoulder:b0,rightshoulder:b1,leftx:a0,lefty:a1,\n"
|
||||||
|
"100801e5000000000000504944564944,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,start:b9,rightx:a2,righty:a3,leftx:a0,lefty:a1,platform:Windows,\n"
|
||||||
|
"79000600000000000000504944564944,NGS Phantom,a:b2,b:b3,y:b1,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Windows,\n"
|
||||||
|
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,\n"
|
||||||
|
"6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,\n"
|
||||||
|
"6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,\n"
|
||||||
|
"6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,\n"
|
||||||
|
"6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,\n"
|
||||||
|
"4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,\n"
|
||||||
|
"4c05000000000000c405000000000000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Mac OS X,\n"
|
||||||
|
"4c05000000000000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Mac OS X,\n"
|
||||||
|
"5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,\n"
|
||||||
|
"891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Mac OS X,\n"
|
||||||
|
"4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Mac OS X,\n"
|
||||||
|
"8f0e0000000000000300000000000000,Piranha xtreme,platform:Mac OS X,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,\n"
|
||||||
|
"0d0f0000000000004d00000000000000,HORI Gem Pad 3,platform:Mac OS X,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"79000000000000000600000000000000,G-Shark GP-702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Mac OS X,\n"
|
||||||
|
"4f0400000000000015b3000000000000,Thrustmaster Dual Analog 3.2,platform:Mac OS X,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"AD1B00000000000001F9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,\n"
|
||||||
|
"050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,y:b9,x:b10,start:b6,guide:b8,back:b7,dpup:b2,dpleft:b0,dpdown:b3,dpright:b1,leftx:a0,lefty:a1,lefttrigger:b12,righttrigger:,leftshoulder:b11,platform:Mac OS X,\n"
|
||||||
|
"83050000000000006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Mac OS X,\n"
|
||||||
|
"bd1200000000000015d0000000000000,Tomee SNES USB Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Mac OS X,\n"
|
||||||
|
"79000000000000001100000000000000,Retrolink Classic Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a3,lefty:a4,platform:Mac OS X,\n"
|
||||||
|
"5e04000000000000dd02000000000000,Xbox One Wired Controller,platform:Mac OS X,x:b2,a:b0,b:b1,y:b3,back:b9,guide:b10,start:b8,dpleft:b13,dpdown:b12,dpright:b14,dpup:b11,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"5e04000000000000ea02000000000000,Xbox Wireless Controller,platform:Mac OS X,x:b2,a:b0,b:b1,y:b3,back:b9,guide:b10,start:b8,dpleft:b13,dpdown:b12,dpright:b14,dpup:b11,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"5e04000000000000e002000000000000,Xbox Wireless Controller,platform:Mac OS X,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b10,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,x:b18,y:b17,back:b7,guide:b8,start:b6,leftstick:b23,rightstick:b24,leftshoulder:b19,rightshoulder:b20,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b21,righttrigger:b22,platform:Mac OS X,\n"
|
||||||
|
"79000000000000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,x:b0,y:b12,back:b32,start:b36,leftstick:b40,rightstick:b44,leftshoulder:b16,rightshoulder:b20,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a4,rightx:a8,righty:a12,lefttrigger:b24,righttrigger:b28,platform:Mac OS X,\n"
|
||||||
|
"2509000000000000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Mac OS X,\n"
|
||||||
|
"351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Mac OS X,\n"
|
||||||
|
"b4040000000000000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,x:b3,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Mac OS X,\n"
|
||||||
|
"81170000000000007e05000000000000,Sega Saturn,x:b0,a:b2,b:b4,y:b6,start:b13,dpleft:b15,dpdown:b16,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,lefttrigger:b10,rightshoulder:b9,righttrigger:a4,righttrigger:b11,leftx:a0,lefty:a2,platform:Mac OS X,\n"
|
||||||
|
"10280000000000000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Mac OS X,\n"
|
||||||
|
"d814000000000000cecf000000000000,MC Cthulhu,platform:Mac OS X,leftx:,lefty:,rightx:,righty:,lefttrigger:b6,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,righttrigger:b7,\n"
|
||||||
|
"0d0f0000000000006600000000000000,HORIPAD FPS PLUS 4,platform:Mac OS X,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:a4,\n"
|
||||||
|
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,\n"
|
||||||
|
"030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,\n"
|
||||||
|
"030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000006d04000016c2000011010000,Logitech F310 Gamepad (DInput),x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Linux,\n"
|
||||||
|
"030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,\n"
|
||||||
|
"030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,\n"
|
||||||
|
"030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Linux,\n"
|
||||||
|
"050000004c050000c405000000010000,Sony DualShock 4 BT,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,\n"
|
||||||
|
"030000004c050000cc09000011010000,Sony DualShock 4 V2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Linux,\n"
|
||||||
|
"050000004c050000cc09000000010000,Sony DualShock 4 V2 BT,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Linux,\n"
|
||||||
|
"030000004c050000a00b000011010000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Linux,\n"
|
||||||
|
"030000006f0e00003001000001010000,EA Sports PS3 Controller,platform:Linux,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\n"
|
||||||
|
"03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,y:b0,x:b3,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,platform:Linux,\n"
|
||||||
|
"03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,platform:Linux,\n"
|
||||||
|
"030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,y:b3,x:b1,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Linux,\n"
|
||||||
|
"030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,\n"
|
||||||
|
"030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,\n"
|
||||||
|
"030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,\n"
|
||||||
|
"030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,\n"
|
||||||
|
"030000006d04000016c2000010010000,Logitech Logitech Dual Action,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,y:b3,x:b1,start:b7,leftshoulder:,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,rightstick:,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Linux,\n"
|
||||||
|
"030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,y:b4,x:b3,start:b8,guide:b5,back:b2,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b9,righttrigger:b10,platform:Linux,\n"
|
||||||
|
"030000006d04000018c2000010010000,Logitech Logitech RumblePad 2 USB,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"05000000d6200000ad0d000001000000,Moga Pro,platform:Linux,a:b0,b:b1,y:b3,x:b2,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,\n"
|
||||||
|
"030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,platform:Linux,a:b1,b:b2,x:b0,y:b3,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,platform:Linux,a:b1,b:b2,x:b0,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"030000006f0e00001f01000000010000,Generic X-Box pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000280400000140000000010000,Gravis GamePad Pro USB ,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,\n"
|
||||||
|
"030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000005e0400008502000000010000,Microsoft X-Box pad (Japan),platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,platform:Linux,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,\n"
|
||||||
|
"03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,platform:Linux,a:b2,b:b1,y:b0,x:b3,start:b8,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,\n"
|
||||||
|
"030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,\n"
|
||||||
|
"030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Linux,\n"
|
||||||
|
"03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,\n"
|
||||||
|
"060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,platform:Linux,\n"
|
||||||
|
"050000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,platform:Linux,\n"
|
||||||
|
"03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick ,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a3,rightx:a1,righty:a4,\n"
|
||||||
|
"03000000666600000488000000010000,Super Joy Box 5 Pro,platform:Linux,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,\n"
|
||||||
|
"05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,\n"
|
||||||
|
"05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,platform:Linux,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,\n"
|
||||||
|
"030000008916000001fd000024010000,Razer Onza Classic Edition,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000005e040000d102000001010000,Microsoft X-Box One pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000005e040000dd02000003020000,Microsoft X-Box One pad v2,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,platform:Linux,\n"
|
||||||
|
"03000000790000001100000010010000,RetroLink Saturn Classic Controller,platform:Linux,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,\n"
|
||||||
|
"050000007e0500003003000001000000,Nintendo Wii U Pro Controller,platform:Linux,a:b0,b:b1,x:b3,y:b2,back:b8,start:b9,guide:b10,leftshoulder:b4,rightshoulder:b5,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,\n"
|
||||||
|
"030000005e0400008e02000004010000,Microsoft X-Box 360 pad,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,\n"
|
||||||
|
"030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,\n"
|
||||||
|
"030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7\n"
|
||||||
|
"03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),platform:Linux,a:b0,b:b1,x:b2,y:b3,start:b7,back:b6,guide:b8,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,lefttrigger:a5,righttrigger:a4,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux,\n"
|
||||||
|
"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000006f0e00001304000000010000,Generic X-Box pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:a0,rightstick:a3,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"03000000bd12000015d0000010010000,Tomee SNES USB Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"03000000790000001100000010010000,Retrolink Classic Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"03000000c9110000f055000011010000,HJC Game GAMEPAD,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:h0.8,lefttrigger:b6,x:b2,dpup:h0.1,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:h0.2,righttrigger:b7,b:b1,platform:Linux,\n"
|
||||||
|
"03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,platform:Linux,\n"
|
||||||
|
"03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,y:b3,x:b0,start:b9,guide:,back:,leftstick:,rightstick:,leftshoulder:,dpleft:b15,dpdown:b14,dpright:b13,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,rightshoulder:b7,dpup:b12,platform:Linux,\n"
|
||||||
|
"030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,platform:Linux,x:b0,a:b2,b:b3,y:b1,back:b10,guide:b12,start:b11,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,platform:Linux,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,guide:b8,leftstick:b9,rightstick:b10,lefttrigger:a2,righttrigger:a5,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,platform:Linux,\n"
|
||||||
|
"030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,platform:Linux,a:b0,b:b2,x:b1,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,\n"
|
||||||
|
"05000000102800000900000000010000,8Bitdo SFC30 GamePad,platform:Linux,x:b4,a:b1,b:b0,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,\n"
|
||||||
|
"03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,platform:Linux,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftshoulder:b4,rightshoulder:b5,lefttrigger:b6,righttrigger:b7,leftx:a0,lefty:a1,\n"
|
||||||
|
"030000000d0f00000d00000000010000,hori,platform:Linux,a:b0,b:b6,y:b2,x:b1,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,start:b9,guide:b10,back:b8,leftshoulder:b3,rightshoulder:b7,leftx:b4,lefty:b5,\n"
|
||||||
|
"03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,platform:Linux,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,\n"
|
||||||
|
"03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,platform:Linux,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),platform:Linux,a:b3,b:b4,y:b1,x:b0,start:b7,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,\n"
|
||||||
|
"05000000010000000100000003000000,Nintendo Wiimote,platform:Linux,a:b0,b:b1,y:b3,x:b2,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,\n"
|
||||||
|
"030000005e0400008e02000062230000,Microsoft X-Box 360 pad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,y:b1,x:b0,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b6,righttrigger:b7,platform:Linux,\n"
|
||||||
|
"030000006f0e00000103000000020000,Logic3 Controller,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"05000000380700006652000025010000,Mad Catz C.T.R.L.R ,platform:Linux,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,\n"
|
||||||
|
"030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,platform:Linux,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,\n"
|
||||||
|
"03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,platform:Linux,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,lefttrigger:a2,righttrigger:a5,\n"
|
||||||
|
"05000000a00500003232000001000000,8Bitdo Zero GamePad,platform:Linux,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,\n"
|
||||||
|
"030000001008000001e5000010010000,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,start:b9,rightx:a2,righty:a3,leftx:a0,lefty:a1,platform:Linux,\n"
|
||||||
|
"03000000100800000300000010010000,USB Gamepad,platform:Linux,a:b2,b:b1,x:b3,y:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,\n"
|
||||||
|
"05000000ac0500003232000001000000,VR-BOX,platform:Linux,a:b0,b:b1,x:b2,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,\n"
|
||||||
|
"03000000780000000600000010010000,Microntek USB Joystick,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftx:a0,lefty:a1,\n"
|
||||||
|
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n"
|
||||||
|
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,\n";
|
||||||
|
|
@ -36,3 +36,7 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,5 @@
|
|||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs
|
#define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_MAPPING_NAME ""
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define _GLFW_TYPE_AXIS 0
|
#define _GLFW_TYPE_AXIS 0
|
||||||
@ -155,9 +156,9 @@ static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
|
|||||||
case XINPUT_DEVSUBTYPE_GAMEPAD:
|
case XINPUT_DEVSUBTYPE_GAMEPAD:
|
||||||
{
|
{
|
||||||
if (xic->Flags & XINPUT_CAPS_WIRELESS)
|
if (xic->Flags & XINPUT_CAPS_WIRELESS)
|
||||||
return "Wireless Xbox 360 Controller";
|
return "Wireless Xbox Controller";
|
||||||
else
|
else
|
||||||
return "Xbox 360 Controller";
|
return "Xbox Controller";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +258,7 @@ static void closeJoystick(_GLFWjoystick* js)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DirectInput device object enumeration callback
|
// DirectInput device object enumeration callback
|
||||||
// Insights gleaned from SDL2
|
// Insights gleaned from SDL
|
||||||
//
|
//
|
||||||
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
|
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
|
||||||
void* user)
|
void* user)
|
||||||
@ -339,6 +340,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|||||||
IDirectInputDevice8* device;
|
IDirectInputDevice8* device;
|
||||||
_GLFWobjenumWin32 data;
|
_GLFWobjenumWin32 data;
|
||||||
_GLFWjoystick* js;
|
_GLFWjoystick* js;
|
||||||
|
char guid[33];
|
||||||
char name[256];
|
char name[256];
|
||||||
|
|
||||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
@ -434,7 +436,24 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|||||||
return DIENUM_STOP;
|
return DIENUM_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
js = _glfwAllocJoystick(name,
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
if (memcmp(&di->guidProduct.Data4[2], "PIDVID", 6) == 0)
|
||||||
|
{
|
||||||
|
sprintf(guid, "03000000%02x%02x0000%02x%02x000000000000",
|
||||||
|
(uint8_t) di->guidProduct.Data1,
|
||||||
|
(uint8_t) (di->guidProduct.Data1 >> 8),
|
||||||
|
(uint8_t) (di->guidProduct.Data1 >> 16),
|
||||||
|
(uint8_t) (di->guidProduct.Data1 >> 24));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
|
name[0], name[1], name[2], name[3],
|
||||||
|
name[4], name[5], name[6], name[7],
|
||||||
|
name[8], name[9], name[10]);
|
||||||
|
}
|
||||||
|
|
||||||
|
js = _glfwAllocJoystick(name, guid,
|
||||||
data.axisCount + data.sliderCount,
|
data.axisCount + data.sliderCount,
|
||||||
data.buttonCount,
|
data.buttonCount,
|
||||||
data.povCount);
|
data.povCount);
|
||||||
@ -503,6 +522,7 @@ void _glfwDetectJoystickConnectionWin32(void)
|
|||||||
for (index = 0; index < XUSER_MAX_COUNT; index++)
|
for (index = 0; index < XUSER_MAX_COUNT; index++)
|
||||||
{
|
{
|
||||||
int jid;
|
int jid;
|
||||||
|
char guid[33];
|
||||||
XINPUT_CAPABILITIES xic;
|
XINPUT_CAPABILITIES xic;
|
||||||
_GLFWjoystick* js;
|
_GLFWjoystick* js;
|
||||||
|
|
||||||
@ -522,7 +542,11 @@ void _glfwDetectJoystickConnectionWin32(void)
|
|||||||
if (XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
|
if (XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
js = _glfwAllocJoystick(getDeviceDescription(&xic), 6, 10, 1);
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
sprintf(guid, "78696e707574%02x000000000000000000",
|
||||||
|
xic.SubType & 0xff);
|
||||||
|
|
||||||
|
js = _glfwAllocJoystick(getDeviceDescription(&xic), guid, 6, 10, 1);
|
||||||
if (!js)
|
if (!js)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -727,3 +751,14 @@ int _glfwPlatformPollJoystick(int jid, int mode)
|
|||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
|
{
|
||||||
|
if (strcmp(guid + 20, "504944564944") == 0)
|
||||||
|
{
|
||||||
|
char original[33];
|
||||||
|
strcpy(original, guid);
|
||||||
|
sprintf(guid, "03000000%.4s0000%.4s000000000000",
|
||||||
|
original, original + 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32
|
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int dummy
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int dummy
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||||
|
|
||||||
// Joystick element (axis, button or slider)
|
// Joystick element (axis, button or slider)
|
||||||
//
|
//
|
||||||
|
@ -92,6 +92,55 @@ static const char* joystick_label(int jid)
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hat_widget(struct nk_context* nk, unsigned char state)
|
||||||
|
{
|
||||||
|
float radius;
|
||||||
|
struct nk_rect area;
|
||||||
|
struct nk_vec2 center;
|
||||||
|
|
||||||
|
if (nk_widget(&area, nk) != NK_WIDGET_VALID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
center = nk_vec2(area.x + area.w / 2.f, area.y + area.h / 2.f);
|
||||||
|
radius = NK_MIN(area.w, area.h) / 2.f;
|
||||||
|
|
||||||
|
nk_stroke_circle(nk_window_get_canvas(nk),
|
||||||
|
nk_rect(center.x - radius,
|
||||||
|
center.y - radius,
|
||||||
|
radius * 2.f,
|
||||||
|
radius * 2.f),
|
||||||
|
1.f,
|
||||||
|
nk_rgb(175, 175, 175));
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
const float angles[] =
|
||||||
|
{
|
||||||
|
0.f, 0.f,
|
||||||
|
NK_PI * 1.5f, NK_PI * 1.75f,
|
||||||
|
NK_PI, 0.f,
|
||||||
|
NK_PI * 1.25f, 0.f,
|
||||||
|
NK_PI * 0.5f, NK_PI * 0.25f,
|
||||||
|
0.f, 0.f,
|
||||||
|
NK_PI * 0.75f, 0.f,
|
||||||
|
};
|
||||||
|
const float cosa = nk_cos(angles[state]);
|
||||||
|
const float sina = nk_sin(angles[state]);
|
||||||
|
const struct nk_vec2 p0 = nk_vec2(0.f, -radius);
|
||||||
|
const struct nk_vec2 p1 = nk_vec2( radius / 2.f, -radius / 3.f);
|
||||||
|
const struct nk_vec2 p2 = nk_vec2(-radius / 2.f, -radius / 3.f);
|
||||||
|
|
||||||
|
nk_fill_triangle(nk_window_get_canvas(nk),
|
||||||
|
center.x + cosa * p0.x + sina * p0.y,
|
||||||
|
center.y + cosa * p0.y - sina * p0.x,
|
||||||
|
center.x + cosa * p1.x + sina * p1.y,
|
||||||
|
center.y + cosa * p1.y - sina * p1.x,
|
||||||
|
center.x + cosa * p2.x + sina * p2.y,
|
||||||
|
center.y + cosa * p2.y - sina * p2.x,
|
||||||
|
nk_rgb(175, 175, 175));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int jid, hat_buttons = GLFW_FALSE;
|
int jid, hat_buttons = GLFW_FALSE;
|
||||||
@ -105,7 +154,7 @@ int main(void)
|
|||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
window = glfwCreateWindow(640, 480, "Joystick Test", NULL, NULL);
|
window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@ -165,7 +214,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
if (nk_begin(nk,
|
if (nk_begin(nk,
|
||||||
joystick_label(joysticks[i]),
|
joystick_label(joysticks[i]),
|
||||||
nk_rect(i * 20.f, i * 20.f, 400.f, 400.f),
|
nk_rect(i * 20.f, i * 20.f, 550.f, 570.f),
|
||||||
NK_WINDOW_BORDER |
|
NK_WINDOW_BORDER |
|
||||||
NK_WINDOW_MOVABLE |
|
NK_WINDOW_MOVABLE |
|
||||||
NK_WINDOW_SCALABLE |
|
NK_WINDOW_SCALABLE |
|
||||||
@ -176,8 +225,10 @@ int main(void)
|
|||||||
const float* axes;
|
const float* axes;
|
||||||
const unsigned char* buttons;
|
const unsigned char* buttons;
|
||||||
const unsigned char* hats;
|
const unsigned char* hats;
|
||||||
|
GLFWgamepadstate state;
|
||||||
|
|
||||||
nk_layout_row_dynamic(nk, 30, 1);
|
nk_layout_row_dynamic(nk, 30, 1);
|
||||||
|
nk_label(nk, "Joystick state", NK_TEXT_LEFT);
|
||||||
|
|
||||||
axes = glfwGetJoystickAxes(joysticks[i], &axis_count);
|
axes = glfwGetJoystickAxes(joysticks[i], &axis_count);
|
||||||
buttons = glfwGetJoystickButtons(joysticks[i], &button_count);
|
buttons = glfwGetJoystickButtons(joysticks[i], &button_count);
|
||||||
@ -189,7 +240,7 @@ int main(void)
|
|||||||
for (j = 0; j < axis_count; j++)
|
for (j = 0; j < axis_count; j++)
|
||||||
nk_slide_float(nk, -1.f, axes[j], 1.f, 0.1f);
|
nk_slide_float(nk, -1.f, axes[j], 1.f, 0.1f);
|
||||||
|
|
||||||
nk_layout_row_dynamic(nk, 30, 8);
|
nk_layout_row_dynamic(nk, 30, 12);
|
||||||
|
|
||||||
for (j = 0; j < button_count; j++)
|
for (j = 0; j < button_count; j++)
|
||||||
{
|
{
|
||||||
@ -201,54 +252,47 @@ int main(void)
|
|||||||
nk_layout_row_dynamic(nk, 30, 8);
|
nk_layout_row_dynamic(nk, 30, 8);
|
||||||
|
|
||||||
for (j = 0; j < hat_count; j++)
|
for (j = 0; j < hat_count; j++)
|
||||||
|
hat_widget(nk, hats[j]);
|
||||||
|
|
||||||
|
nk_layout_row_dynamic(nk, 30, 1);
|
||||||
|
|
||||||
|
if (glfwGetGamepadState(joysticks[i], &state))
|
||||||
{
|
{
|
||||||
float radius;
|
int hat = 0;
|
||||||
struct nk_rect area;
|
const char* names[GLFW_GAMEPAD_BUTTON_LAST + 1 - 4] =
|
||||||
struct nk_vec2 center;
|
|
||||||
|
|
||||||
if (nk_widget(&area, nk) != NK_WIDGET_VALID)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
center = nk_vec2(area.x + area.w / 2.f,
|
|
||||||
area.y + area.h / 2.f);
|
|
||||||
radius = NK_MIN(area.w, area.h) / 2.f;
|
|
||||||
|
|
||||||
nk_stroke_circle(nk_window_get_canvas(nk),
|
|
||||||
nk_rect(center.x - radius,
|
|
||||||
center.y - radius,
|
|
||||||
radius * 2.f,
|
|
||||||
radius * 2.f),
|
|
||||||
1.f,
|
|
||||||
nk_rgb(175, 175, 175));
|
|
||||||
|
|
||||||
if (hats[j])
|
|
||||||
{
|
{
|
||||||
const float angles[] =
|
"A", "B", "X", "Y",
|
||||||
{
|
"LB", "RB",
|
||||||
0.f, 0.f,
|
"Back", "Start", "Guide",
|
||||||
NK_PI * 1.5f, NK_PI * 1.75f,
|
"LT", "RT",
|
||||||
NK_PI, 0.f,
|
};
|
||||||
NK_PI * 1.25f, 0.f,
|
|
||||||
NK_PI * 0.5f, NK_PI * 0.25f,
|
|
||||||
0.f, 0.f,
|
|
||||||
NK_PI * 0.75f, 0.f,
|
|
||||||
};
|
|
||||||
const float cosa = nk_cos(angles[hats[j]]);
|
|
||||||
const float sina = nk_sin(angles[hats[j]]);
|
|
||||||
const struct nk_vec2 p0 = nk_vec2(0.f, -radius);
|
|
||||||
const struct nk_vec2 p1 = nk_vec2( radius / 2.f, -radius / 3.f);
|
|
||||||
const struct nk_vec2 p2 = nk_vec2(-radius / 2.f, -radius / 3.f);
|
|
||||||
|
|
||||||
nk_fill_triangle(nk_window_get_canvas(nk),
|
nk_label(nk, "Gamepad state", NK_TEXT_LEFT);
|
||||||
center.x + cosa * p0.x + sina * p0.y,
|
|
||||||
center.y + cosa * p0.y - sina * p0.x,
|
nk_layout_row_dynamic(nk, 30, 2);
|
||||||
center.x + cosa * p1.x + sina * p1.y,
|
|
||||||
center.y + cosa * p1.y - sina * p1.x,
|
for (j = 0; j <= GLFW_GAMEPAD_AXIS_LAST; j++)
|
||||||
center.x + cosa * p2.x + sina * p2.y,
|
nk_slide_float(nk, -1.f, state.axes[j], 1.f, 0.1f);
|
||||||
center.y + cosa * p2.y - sina * p2.x,
|
|
||||||
nk_rgb(175, 175, 175));
|
nk_layout_row_dynamic(nk, 30, GLFW_GAMEPAD_BUTTON_LAST + 1 - 4);
|
||||||
}
|
|
||||||
|
for (j = 0; j <= GLFW_GAMEPAD_BUTTON_LAST - 4; j++)
|
||||||
|
nk_select_label(nk, names[j], NK_TEXT_CENTERED, state.buttons[j]);
|
||||||
|
|
||||||
|
if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_UP])
|
||||||
|
hat |= GLFW_HAT_UP;
|
||||||
|
if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_RIGHT])
|
||||||
|
hat |= GLFW_HAT_RIGHT;
|
||||||
|
if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_DOWN])
|
||||||
|
hat |= GLFW_HAT_DOWN;
|
||||||
|
if (state.buttons[GLFW_GAMEPAD_BUTTON_DPAD_LEFT])
|
||||||
|
hat |= GLFW_HAT_LEFT;
|
||||||
|
|
||||||
|
nk_layout_row_dynamic(nk, 30, 8);
|
||||||
|
hat_widget(nk, hat);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
nk_label(nk, "Joystick has no gamepad mapping", NK_TEXT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
nk_end(nk);
|
nk_end(nk);
|
||||||
|
Loading…
Reference in New Issue
Block a user