Skip to content

ogc: use embedded-game-controller as input backend - #131

Open
mardy wants to merge 1 commit into
devkitPro:ogc-sdl-2.28from
mardy:egc
Open

ogc: use embedded-game-controller as input backend#131
mardy wants to merge 1 commit into
devkitPro:ogc-sdl-2.28from
mardy:egc

Conversation

@mardy

@mardy mardy commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Description

Switch the joystick / gamecontroller / mouse backend to embedded-game-controller.

This greatly simplify handling of different controllers, since EGC input reports are designed after SDL's GameController API. Unfortunately, due to the need to support applications using the older SDL joystick API, we map the D-pad buttons to a joystick hat, and this makes the code not as linear as it could be. For more information about this issue, see libsdl-org#8754

The switch to EGC brings some other changes:

  • Removed support for the split-controller feature, which has not been used in any applications yet; it might come back, but then it would be most likely implemented in EGC itself.
  • Added support for USB and Bluetooth controllers (see EGC's hid-drivers folder for a list of supported devices).
  • If the SDL_WII_JOYSTICK_SIDEWAYS environment variable is set, now not only the D-pad is rotated, but the accelerometer too.
  • Support for the Wiimote+ gyroscope.

Benefits

  • This brings support to all controllers supported by EGC: besides GameCube controllers and Wiimotes, there are a handful of USB and bluetooth ones (like the Nintendo Switch, as shown in this video).
  • For accessing bluetooth-connected controllers EGC uses bt-embedded, which is written to allow concurrent access to the bluetooth chip from different clients running in the same process. This allows applications to use the bluetooth chip for various goals simultaneously (for example, transferring a file while handling HID devices).
  • Simplified code: this change will make it simpler to port SDL3 to the Wii/GameCube.

Limitations

  • The Wii Balance Board and the Wii U Pro controller have not been tested with EGC, since I don't have them. But even in the case they don't work, it won't be hard to fix them with the help of a tester.

This greatly simplify handling of different controllers, since EGC input
reports are designed after SDL's GameController API. Unfortunately, due
to the need to support applications using the older SDL joystick API,
we map the D-pad buttons to a joystick hat, and this makes the code not
as linear as it could be. For more information about this issue, see
libsdl-org#8754

The switch to EGC brings some other changes:
- Removed support for the split-controller feature, which has not been
  used in any applications yet; it might come back, but then it would be
  most likely implemented in EGC itself.
- Added support for USB and Bluetooth controllers (see EGC's
  `hid-drivers` folder for a list of supported devices).
- If the SDL_WII_JOYSTICK_SIDEWAYS environment variable is set, now not
  only the D-pad is rotated, but the accelerometer too.
- Support for the Wiimote+ gyroscope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant