Skip to content

Commit 79a3be1

Browse files
authored
Include HIDAPI functions in SDL2 port (#26297)
This pull request updates the SDL2 port to include the stub implementations for SDL_hid_init() and related functions in SDL_hidapi.c that were added in SDL 2.0.18. These functions are built for Emscritpen using the official SDL2 build systems. Including them in Emscripten's SDL2 port solves linker errors for software that use them. Fixes: #26282
1 parent b035570 commit 79a3be1

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ See docs/process.md for more on how version tagging works.
3939
C `bool` type rather than `int`. For example `emscripten_proxy_sync` and
4040
`emscripten_is_main_runtime_thread`. (#26316)
4141
- SDL2 port updated from 2.32.8 to 2.32.10. (#26298)
42+
- SDL2 port updated to include stub functions for `SDL_hid_init()` and related
43+
functions. (#26297)
4244
- The remaining launcher scripts (e.g. `emcc.bat`) were removed from the git
4345
repository. These scripts are created by the `./bootstrap` script which
4446
must be run before the toolchain is usable (for folks using a git checkout of

test/browser/test_sdl2_misc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ int main(int argc, char *argv[]) {
4545
assert(document.title === 'a custom window title');
4646
});
4747

48+
// Check if linking works with some of the HIDAPI functions added in SDL 2.0.18.
49+
SDL_hid_init();
50+
SDL_hid_exit();
51+
4852
SDL_DestroyWindow(window);
4953
SDL_Quit();
5054

tools/ports/sdl2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def create(final):
5353
dynapi/SDL_dynapi.c events/SDL_clipboardevents.c events/SDL_displayevents.c events/SDL_dropevents.c
5454
events/SDL_events.c events/SDL_gesture.c events/SDL_keyboard.c events/SDL_keysym_to_scancode.c
5555
events/SDL_scancode_tables.c events/SDL_mouse.c events/SDL_quit.c
56-
events/SDL_touch.c events/SDL_windowevents.c file/SDL_rwops.c haptic/SDL_haptic.c
56+
events/SDL_touch.c events/SDL_windowevents.c file/SDL_rwops.c haptic/SDL_haptic.c hidapi/SDL_hidapi.c
5757
joystick/controller_type.c joystick/SDL_gamecontroller.c joystick/SDL_joystick.c
5858
joystick/SDL_steam_virtual_gamepad.c
5959
power/SDL_power.c render/SDL_d3dmath.c render/SDL_render.c

0 commit comments

Comments
 (0)