Skip to content

Commit 321ca44

Browse files
authored
Update SDL2 bindings to pre-release 2.23.1 (#240)
* Reorder controller tests to match bindings * Update everything except joystick * Reorder joystick tests to match header * Update joystick bindings and tests * Update news.rst
1 parent 310813b commit 321ca44

File tree

16 files changed

+594
-324
lines changed

16 files changed

+594
-324
lines changed

doc/news.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ New Features:
1212
* Updated to wrap new functions and constants in SDL2_image 2.6.0 (PR #238).
1313
* Added a new function :func:`sdl2.ext.load_svg` that allows loading simple SVG
1414
images at arbitrary resolutions with SDL2_image 2.6.0 or later (PR #238).
15+
* Added experimental bindings for the new functions and constants in the
16+
SDL2 2.23.1 pre-release (PR #240).
1517

1618

1719
0.9.12

sdl2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .filesystem import *
1313
from .gamecontroller import *
1414
from .gesture import *
15+
from .guid import *
1516
from .haptic import *
1617
from .hidapi import *
1718
from .hints import *

sdl2/cpuinfo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
SDLFunc("SDL_HasAVX512F", None, SDL_bool, added='2.0.9'),
3434
SDLFunc("SDL_HasARMSIMD", None, SDL_bool, added='2.0.12'),
3535
SDLFunc("SDL_HasNEON", None, SDL_bool, added='2.0.6'),
36+
SDLFunc("SDL_HasLSX", None, SDL_bool, added='2.23.1'),
37+
SDLFunc("SDL_HasLASX", None, SDL_bool, added='2.23.1'),
3638
SDLFunc("SDL_SIMDGetAlignment", None, c_size_t, added='2.0.10'),
3739
SDLFunc("SDL_SIMDAlloc", [c_size_t], c_void_p, added='2.0.10'),
3840
SDLFunc("SDL_SIMDRealloc", [c_void_p, c_size_t], c_void_p, added='2.0.14'),
@@ -63,6 +65,8 @@
6365
SDL_HasAVX512F = _ctypes["SDL_HasAVX512F"]
6466
SDL_HasARMSIMD = _ctypes["SDL_HasARMSIMD"]
6567
SDL_HasNEON = _ctypes["SDL_HasNEON"]
68+
SDL_HasLSX = _ctypes["SDL_HasLSX"]
69+
SDL_HasLASX = _ctypes["SDL_HasLASX"]
6670
SDL_SIMDGetAlignment = _ctypes["SDL_SIMDGetAlignment"]
6771
SDL_SIMDAlloc = _ctypes["SDL_SIMDAlloc"]
6872
SDL_SIMDRealloc = _ctypes["SDL_SIMDRealloc"]

sdl2/events.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .dll import _bind, SDLFunc, AttributeDict
77
from .stdinc import Sint16, Sint32, Uint8, Uint16, Uint32, SDL_bool
88
from .keyboard import SDL_Keysym
9-
from .joystick import SDL_JoystickID
9+
from .joystick import SDL_JoystickID, SDL_JoystickPowerLevel
1010
from .touch import SDL_FingerID, SDL_TouchID
1111
from .gesture import SDL_GestureID
1212
from .syswm import SDL_SysWMmsg
@@ -18,9 +18,10 @@
1818
"SDL_TextEditingExtEvent", "SDL_TextInputEvent",
1919
"SDL_MouseMotionEvent", "SDL_MouseButtonEvent", "SDL_MouseWheelEvent",
2020
"SDL_JoyAxisEvent", "SDL_JoyBallEvent", "SDL_JoyHatEvent",
21-
"SDL_JoyButtonEvent", "SDL_JoyDeviceEvent", "SDL_ControllerAxisEvent",
22-
"SDL_ControllerButtonEvent", "SDL_ControllerDeviceEvent",
23-
"SDL_ControllerTouchpadEvent", "SDL_ControllerSensorEvent",
21+
"SDL_JoyButtonEvent", "SDL_JoyDeviceEvent", "SDL_JoyBatteryEvent",
22+
"SDL_ControllerAxisEvent", "SDL_ControllerButtonEvent",
23+
"SDL_ControllerDeviceEvent", "SDL_ControllerTouchpadEvent",
24+
"SDL_ControllerSensorEvent",
2425
"SDL_AudioDeviceEvent",
2526
"SDL_TouchFingerEvent", "SDL_MultiGestureEvent", "SDL_DollarGestureEvent",
2627
"SDL_DropEvent", "SDL_QuitEvent", "SDL_OSEvent", "SDL_UserEvent",
@@ -44,7 +45,7 @@
4445
"SDL_MOUSEBUTTONUP", "SDL_MOUSEWHEEL",
4546
"SDL_JOYAXISMOTION", "SDL_JOYBALLMOTION",
4647
"SDL_JOYHATMOTION", "SDL_JOYBUTTONDOWN", "SDL_JOYBUTTONUP",
47-
"SDL_JOYDEVICEADDED", "SDL_JOYDEVICEREMOVED",
48+
"SDL_JOYDEVICEADDED", "SDL_JOYDEVICEREMOVED", "SDL_JOYBATTERYUPDATED",
4849
"SDL_CONTROLLERAXISMOTION", "SDL_CONTROLLERBUTTONDOWN",
4950
"SDL_CONTROLLERBUTTONUP", "SDL_CONTROLLERDEVICEADDED",
5051
"SDL_CONTROLLERDEVICEREMOVED", "SDL_CONTROLLERDEVICEREMAPPED",
@@ -104,6 +105,7 @@
104105
SDL_JOYBUTTONUP = 0x604
105106
SDL_JOYDEVICEADDED = 0x605
106107
SDL_JOYDEVICEREMOVED = 0x606
108+
SDL_JOYBATTERYUPDATED = 0x607
107109
SDL_CONTROLLERAXISMOTION = 0x650
108110
SDL_CONTROLLERBUTTONDOWN = 0x651
109111
SDL_CONTROLLERBUTTONUP = 0x652
@@ -320,6 +322,14 @@ class SDL_JoyDeviceEvent(Structure):
320322
("which", Sint32),
321323
]
322324

325+
class SDL_JoyBatteryEvent(Structure):
326+
_fields_ = [
327+
("type", Uint32),
328+
("timestamp", Uint32),
329+
("which", SDL_JoystickID),
330+
("level", SDL_JoystickPowerLevel),
331+
]
332+
323333
class SDL_ControllerAxisEvent(Structure):
324334
_fields_ = [
325335
("type", Uint32),
@@ -491,6 +501,7 @@ class SDL_Event(Union):
491501
("jhat", SDL_JoyHatEvent),
492502
("jbutton", SDL_JoyButtonEvent),
493503
("jdevice", SDL_JoyDeviceEvent),
504+
("jbattery", SDL_JoyBatteryEvent),
494505
("caxis", SDL_ControllerAxisEvent),
495506
("cbutton", SDL_ControllerButtonEvent),
496507
("cdevice", SDL_ControllerDeviceEvent),

sdl2/gamecontroller.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class SDL_GameController(c_void_p):
137137
SDLFunc("SDL_GameControllerMapping", [_P(SDL_GameController)], c_char_p),
138138
SDLFunc("SDL_IsGameController", [c_int], SDL_bool),
139139
SDLFunc("SDL_GameControllerNameForIndex", [c_int], c_char_p),
140+
SDLFunc("SDL_GameControllerPathForIndex", [c_int], c_char_p, added='2.23.1'),
140141
SDLFunc("SDL_GameControllerTypeForIndex", [c_int], SDL_GameControllerType, added='2.0.12'),
141142
SDLFunc("SDL_GameControllerMappingForDeviceIndex", [c_int], c_char_p, added='2.0.9'),
142143
SDLFunc("SDL_GameControllerOpen", [c_int], _P(SDL_GameController)),
@@ -146,6 +147,7 @@ class SDL_GameController(c_void_p):
146147
),
147148
SDLFunc("SDL_GameControllerFromPlayerIndex", [c_int], _P(SDL_GameController), added='2.0.12'),
148149
SDLFunc("SDL_GameControllerName", [_P(SDL_GameController)], c_char_p),
150+
SDLFunc("SDL_GameControllerPath", [_P(SDL_GameController)], c_char_p, added='2.23.1'),
149151
SDLFunc("SDL_GameControllerGetType",
150152
[_P(SDL_GameController)],
151153
returns = SDL_GameControllerType, added = '2.0.12'
@@ -158,6 +160,10 @@ class SDL_GameController(c_void_p):
158160
[_P(SDL_GameController)],
159161
returns = Uint16, added = '2.0.6'
160162
),
163+
SDLFunc("SDL_GameControllerGetFirmwareVersion",
164+
[_P(SDL_GameController)],
165+
returns = Uint16, added = '2.23.1'
166+
),
161167
SDLFunc("SDL_GameControllerGetSerial", [_P(SDL_GameController)], c_char_p, added='2.0.14'),
162168
SDLFunc("SDL_GameControllerGetAttached", [_P(SDL_GameController)], SDL_bool),
163169
SDLFunc("SDL_GameControllerGetJoystick", [_P(SDL_GameController)], _P(SDL_Joystick)),
@@ -262,9 +268,11 @@ class SDL_GameController(c_void_p):
262268
SDL_GameControllerMapping = _ctypes["SDL_GameControllerMapping"]
263269
SDL_IsGameController = _ctypes["SDL_IsGameController"]
264270
SDL_GameControllerNameForIndex = _ctypes["SDL_GameControllerNameForIndex"]
271+
SDL_GameControllerPathForIndex = _ctypes["SDL_GameControllerPathForIndex"]
265272
SDL_GameControllerTypeForIndex = _ctypes["SDL_GameControllerTypeForIndex"]
266273
SDL_GameControllerOpen = _ctypes["SDL_GameControllerOpen"]
267274
SDL_GameControllerName = _ctypes["SDL_GameControllerName"]
275+
SDL_GameControllerPath = _ctypes["SDL_GameControllerPath"]
268276
SDL_GameControllerGetType = _ctypes["SDL_GameControllerGetType"]
269277
SDL_GameControllerGetAttached = _ctypes["SDL_GameControllerGetAttached"]
270278
SDL_GameControllerGetJoystick = _ctypes["SDL_GameControllerGetJoystick"]
@@ -297,6 +305,7 @@ class SDL_GameController(c_void_p):
297305
SDL_GameControllerGetVendor = _ctypes["SDL_GameControllerGetVendor"]
298306
SDL_GameControllerGetProduct = _ctypes["SDL_GameControllerGetProduct"]
299307
SDL_GameControllerGetProductVersion = _ctypes["SDL_GameControllerGetProductVersion"]
308+
SDL_GameControllerGetFirmwareVersion = _ctypes["SDL_GameControllerGetFirmwareVersion"]
300309
SDL_GameControllerGetSerial = _ctypes["SDL_GameControllerGetSerial"]
301310
SDL_GameControllerNumMappings = _ctypes["SDL_GameControllerNumMappings"]
302311
SDL_GameControllerMappingForIndex = _ctypes["SDL_GameControllerMappingForIndex"]

sdl2/guid.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from ctypes import Structure, c_int, c_char, c_char_p
2+
from ctypes import POINTER as _P
3+
from .dll import _bind, SDLFunc, AttributeDict
4+
from .stdinc import Uint8
5+
6+
__all__ = [
7+
# Defines
8+
"SDL_GUID",
9+
]
10+
11+
12+
# Constants & typedefs
13+
14+
class SDL_GUID(Structure):
15+
_fields_ = [("data", (Uint8 * 16))]
16+
17+
18+
# Raw ctypes function definitions
19+
20+
_funcdefs = [
21+
SDLFunc("SDL_GUIDToString", [SDL_GUID, _P(c_char), c_int], None, added='2.23.1'),
22+
SDLFunc("SDL_GUIDFromString", [c_char_p], SDL_GUID, added='2.23.1'),
23+
]
24+
_ctypes = AttributeDict()
25+
for f in _funcdefs:
26+
_ctypes[f.name] = _bind(f.name, f.args, f.returns, f.added)
27+
__all__.append(f.name) # Add all bound functions to module namespace
28+
29+
30+
# Aliases for ctypes bindings
31+
32+
def SDL_GUIDToString(guid, pszGUID, cbGUID):
33+
return _ctypes["SDL_GUIDToString"](guid, pszGUID, cbGUID)
34+
35+
def SDL_GUIDFromString(pchGUID):
36+
return _ctypes["SDL_GUIDFromString"](pchGUID)

sdl2/hints.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"SDL_HINT_JOYSTICK_THREAD",
6767
"SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER",
6868
"SDL_HINT_JOYSTICK_DEVICE",
69+
"SDL_HINT_LINUX_DIGITAL_HATS",
70+
"SDL_HINT_LINUX_HAT_DEADZONES",
6971
"SDL_HINT_LINUX_JOYSTICK_CLASSIC",
7072
"SDL_HINT_LINUX_JOYSTICK_DEADZONES",
7173
"SDL_HINT_MAC_BACKGROUND_APP",
@@ -115,6 +117,7 @@
115117
"SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS",
116118
"SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR",
117119
"SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR",
120+
"SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION",
118121
"SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT",
119122
"SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL",
120123
"SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN",
@@ -137,6 +140,8 @@
137140
"SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL",
138141
"SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4",
139142
"SDL_HINT_WINDOWS_USE_D3D9EX",
143+
"SDL_HINT_WINDOWS_DPI_AWARENESS",
144+
"SDL_HINT_WINDOWS_DPI_SCALING",
140145
"SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN",
141146
"SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN",
142147
"SDL_HINT_WINRT_HANDLE_BACK_BUTTON",
@@ -196,6 +201,7 @@
196201
SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN = b"SDL_VIDEO_FOREIGN_WINDOW_VULKAN"
197202
SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = b"SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR"
198203
SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = b"SDL_VIDEO_WAYLAND_PREFER_LIBDECOR"
204+
SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION = b"SDL_VIDEO_WAYLAND_MODE_EMULATION"
199205
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = b"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
200206
SDL_HINT_VIDEO_X11_FORCE_EGL = b"SDL_VIDEO_X11_FORCE_EGL"
201207
SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = b"SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
@@ -295,6 +301,8 @@
295301
SDL_HINT_EMSCRIPTEN_ASYNCIFY = b"SDL_EMSCRIPTEN_ASYNCIFY"
296302
SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = b"SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
297303
SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER = b"SDL_KMSDRM_REQUIRE_DRM_MASTER"
304+
SDL_HINT_LINUX_DIGITAL_HATS = b"SDL_LINUX_DIGITAL_HATS"
305+
SDL_HINT_LINUX_HAT_DEADZONES = b"SDL_LINUX_HAT_DEADZONES"
298306
SDL_HINT_LINUX_JOYSTICK_CLASSIC = b"SDL_LINUX_JOYSTICK_CLASSIC"
299307
SDL_HINT_LINUX_JOYSTICK_DEADZONES = b"SDL_LINUX_JOYSTICK_DEADZONES"
300308
SDL_HINT_MAC_BACKGROUND_APP = b"SDL_MAC_BACKGROUND_APP"
@@ -312,6 +320,8 @@
312320
SDL_HINT_WINDOWS_INTRESOURCE_ICON = b"SDL_WINDOWS_INTRESOURCE_ICON"
313321
SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = b"SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
314322
SDL_HINT_WINDOWS_USE_D3D9EX = b"SDL_WINDOWS_USE_D3D9EX"
323+
SDL_HINT_WINDOWS_DPI_AWARENESS = b"SDL_WINDOWS_DPI_AWARENESS"
324+
SDL_HINT_WINDOWS_DPI_SCALING = b"SDL_WINDOWS_DPI_SCALING"
315325
SDL_HINT_XINPUT_ENABLED = b"SDL_XINPUT_ENABLED"
316326
SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = b"SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
317327

sdl2/joystick.py

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import sys
2-
from ctypes import Structure, c_int, c_char_p, c_void_p
2+
from ctypes import Structure, c_int, c_char_p, c_void_p, CFUNCTYPE
33
from ctypes import POINTER as _P
44
from .dll import _bind, SDLFunc, AttributeDict
55
from .stdinc import Sint16, Sint32, Uint32, Uint16, Uint8, SDL_bool
6+
from .guid import SDL_GUID
67

78
__all__ = [
89
# Structs & Opaque Types
9-
"SDL_Joystick", "SDL_JoystickGUID",
10+
"SDL_Joystick", "SDL_JoystickGUID", "SDL_VirtualJoystickDesc",
1011

1112
# Defines
1213
"SDL_JoystickID", "SDL_HAT_CENTERED", "SDL_HAT_UP", "SDL_HAT_RIGHT",
1314
"SDL_HAT_DOWN", "SDL_HAT_LEFT", "SDL_HAT_RIGHTUP", "SDL_HAT_RIGHTDOWN",
1415
"SDL_HAT_LEFTUP", "SDL_HAT_LEFTDOWN", "SDL_IPHONE_MAX_GFORCE",
16+
"SDL_VIRTUAL_JOYSTICK_DESC_VERSION",
1517

1618
# Enums
1719
"SDL_JoystickType",
@@ -64,16 +66,46 @@
6466
SDL_HAT_LEFTUP = SDL_HAT_LEFT | SDL_HAT_UP
6567
SDL_HAT_LEFTDOWN = SDL_HAT_LEFT | SDL_HAT_DOWN
6668

69+
SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1
70+
6771

6872
# Structs & typedefs
6973

7074
SDL_JoystickID = Sint32
75+
SDL_JoystickGUID = SDL_GUID
7176

7277
class SDL_Joystick(c_void_p):
7378
pass
7479

75-
class SDL_JoystickGUID(Structure):
76-
_fields_ = [("data", (Uint8 * 16))]
80+
# TODO: Document these somewhere
81+
CFUNC_Update = CFUNCTYPE(None, c_void_p)
82+
CFUNC_SetPlayerIndex = CFUNCTYPE(None, c_void_p, c_int)
83+
CFUNC_Rumble = CFUNCTYPE(c_int, c_void_p, Uint16, Uint16)
84+
CFUNC_RumbleTriggers = CFUNCTYPE(c_int, c_void_p, Uint16, Uint16)
85+
CFUNC_SetLED = CFUNCTYPE(c_int, c_void_p, Uint8, Uint8, Uint8)
86+
CFUNC_SendEffect = CFUNCTYPE(c_int, c_void_p, c_void_p, c_int)
87+
88+
class SDL_VirtualJoystickDesc(Structure):
89+
_fields_ = [
90+
("version", Uint16),
91+
("type", Uint16),
92+
("naxes", Uint16),
93+
("nbuttons", Uint16),
94+
("nhats", Uint16),
95+
("vendor_id", Uint16),
96+
("product_id", Uint16),
97+
("padding", Uint16),
98+
("button_mask", Uint32),
99+
("axis_mask", Uint32),
100+
("name", c_char_p),
101+
("userdata", c_void_p),
102+
("Update", CFUNC_Update),
103+
("SetPlayerIndex", CFUNC_SetPlayerIndex),
104+
("Rumble", CFUNC_Rumble),
105+
("RumbleTriggers", CFUNC_RumbleTriggers),
106+
("SetLED", CFUNC_SetLED),
107+
("SendEffect", CFUNC_SendEffect),
108+
]
77109

78110

79111
# Raw ctypes function definitions
@@ -83,6 +115,7 @@ class SDL_JoystickGUID(Structure):
83115
SDLFunc("SDL_UnlockJoysticks", None, None, added='2.0.7'),
84116
SDLFunc("SDL_NumJoysticks", None, c_int),
85117
SDLFunc("SDL_JoystickNameForIndex", [c_int], c_char_p),
118+
SDLFunc("SDL_JoystickPathForIndex", [c_int], c_char_p, added='2.23.1'),
86119
SDLFunc("SDL_JoystickGetDevicePlayerIndex", [c_int], c_int, added='2.0.9'),
87120
SDLFunc("SDL_JoystickGetDeviceGUID", [c_int], SDL_JoystickGUID),
88121
SDLFunc("SDL_JoystickGetDeviceVendor", [c_int], Uint16, added='2.0.6'),
@@ -97,6 +130,7 @@ class SDL_JoystickGUID(Structure):
97130
[SDL_JoystickType, c_int, c_int, c_int],
98131
returns = c_int, added = '2.0.14'
99132
),
133+
SDLFunc("SDL_JoystickAttachVirtualEx", [_P(SDL_VirtualJoystickDesc)], c_int, added='2.23.1'),
100134
SDLFunc("SDL_JoystickDetachVirtual", [c_int], c_int, added='2.0.14'),
101135
SDLFunc("SDL_JoystickIsVirtual", [c_int], SDL_bool, added='2.0.14'),
102136
SDLFunc("SDL_JoystickSetVirtualAxis",
@@ -108,13 +142,15 @@ class SDL_JoystickGUID(Structure):
108142
returns = c_int, added = '2.0.14'
109143
),
110144
SDLFunc("SDL_JoystickSetVirtualHat", [_P(SDL_Joystick), c_int, Uint8], c_int, added='2.0.14'),
111-
SDLFunc("SDL_JoystickName", [_P(SDL_Joystick)], c_char_p),
145+
SDLFunc("SDL_JoystickName", [_P(SDL_Joystick)], c_char_p),
146+
SDLFunc("SDL_JoystickPath", [_P(SDL_Joystick)], c_char_p, added='2.23.1'),
112147
SDLFunc("SDL_JoystickGetPlayerIndex", [_P(SDL_Joystick)], c_int, added='2.0.9'),
113148
SDLFunc("SDL_JoystickSetPlayerIndex", [_P(SDL_Joystick), c_int], added='2.0.12'),
114149
SDLFunc("SDL_JoystickGetGUID", [_P(SDL_Joystick)], SDL_JoystickGUID),
115150
SDLFunc("SDL_JoystickGetVendor", [_P(SDL_Joystick)], Uint16, added='2.0.6'),
116151
SDLFunc("SDL_JoystickGetProduct", [_P(SDL_Joystick)], Uint16, added='2.0.6'),
117152
SDLFunc("SDL_JoystickGetProductVersion", [_P(SDL_Joystick)], Uint16, added='2.0.6'),
153+
SDLFunc("SDL_JoystickGetFirmwareVersion", [_P(SDL_Joystick)], Uint16, added='2.23.1'),
118154
SDLFunc("SDL_JoystickGetSerial", [_P(SDL_Joystick)], c_char_p, added='2.0.14'),
119155
SDLFunc("SDL_JoystickGetType", [_P(SDL_Joystick)], SDL_JoystickType, added='2.0.6'),
120156
SDLFunc("SDL_JoystickGetGUIDString", [SDL_JoystickGUID, c_char_p, c_int]),
@@ -164,8 +200,10 @@ class SDL_JoystickGUID(Structure):
164200

165201
SDL_NumJoysticks = _ctypes["SDL_NumJoysticks"]
166202
SDL_JoystickNameForIndex = _ctypes["SDL_JoystickNameForIndex"]
203+
SDL_JoystickPathForIndex = _ctypes["SDL_JoystickPathForIndex"]
167204
SDL_JoystickOpen = _ctypes["SDL_JoystickOpen"]
168205
SDL_JoystickName = _ctypes["SDL_JoystickName"]
206+
SDL_JoystickPath = _ctypes["SDL_JoystickPath"]
169207
SDL_JoystickGetDeviceGUID = _ctypes["SDL_JoystickGetDeviceGUID"]
170208
SDL_JoystickGetGUID = _ctypes["SDL_JoystickGetGUID"]
171209
SDL_JoystickGetGUIDFromString = _ctypes["SDL_JoystickGetGUIDFromString"]
@@ -186,6 +224,7 @@ class SDL_JoystickGUID(Structure):
186224
SDL_JoystickFromInstanceID = _ctypes["SDL_JoystickFromInstanceID"]
187225
SDL_JoystickFromPlayerIndex = _ctypes["SDL_JoystickFromPlayerIndex"]
188226
SDL_JoystickAttachVirtual = _ctypes["SDL_JoystickAttachVirtual"]
227+
SDL_JoystickAttachVirtualEx = _ctypes["SDL_JoystickAttachVirtualEx"]
189228
SDL_JoystickDetachVirtual = _ctypes["SDL_JoystickDetachVirtual"]
190229
SDL_JoystickIsVirtual = _ctypes["SDL_JoystickIsVirtual"]
191230
SDL_JoystickSetVirtualAxis = _ctypes["SDL_JoystickSetVirtualAxis"]
@@ -194,6 +233,7 @@ class SDL_JoystickGUID(Structure):
194233
SDL_JoystickGetVendor = _ctypes["SDL_JoystickGetVendor"]
195234
SDL_JoystickGetProduct = _ctypes["SDL_JoystickGetProduct"]
196235
SDL_JoystickGetProductVersion = _ctypes["SDL_JoystickGetProductVersion"]
236+
SDL_JoystickGetFirmwareVersion = _ctypes["SDL_JoystickGetFirmwareVersion"]
197237
SDL_JoystickGetSerial = _ctypes["SDL_JoystickGetSerial"]
198238
SDL_JoystickGetAxisInitialState = _ctypes["SDL_JoystickGetAxisInitialState"]
199239
SDL_JoystickGetType = _ctypes["SDL_JoystickGetType"]

sdl2/keycode.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,8 @@
296296

297297
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND)
298298
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
299+
300+
SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT)
301+
SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT)
302+
SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL)
303+
SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL)

sdl2/scancode.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,9 @@
269269
SDL_SCANCODE_AUDIOREWIND = 285
270270
SDL_SCANCODE_AUDIOFASTFORWARD = 286
271271

272+
SDL_SCANCODE_SOFTLEFT = 287
273+
SDL_SCANCODE_SOFTRIGHT = 288
274+
SDL_SCANCODE_CALL = 289
275+
SDL_SCANCODE_ENDCALL = 290
276+
272277
SDL_NUM_SCANCODES = 512

0 commit comments

Comments
 (0)