devkitPro / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
15 stars 12 forks source link

[joystick] Fix GameCube button mapping #29

Closed mardy closed 9 months ago

mardy commented 1 year ago

This commit partially reverts 662e60ec9306065ddf54061db88fdaed9d795edc by removing the dummy buttons that were introduced back then: some null entries were added to the sdl_buttons_gc array, defining buttons for which no event could ever be emitted. This caused an inconsistency, where SDL_JoystickNumButtons() would claim that the joystick had 8 buttons (given that the MAX_GC_BUTTONS definition was not updated to account for the null entries that were added), but as a matter of fact some buttons (X, Y, L and R) could only be read by passing an index greater or equal than 8.

I've been unable to contact the original author (tueidj seems to have disappeared from the internet in 2017), but I've written to the committer, @sergiou87, who told me that he added these changes trusting the original author, but does not know the rationale behind them.

The change proposed here does not exactly revert the buttons to their original layout, but rather aims to get the button order consistent with a typical gamepad layout (including that of the Wii classic controller), where "L" comes before "R", and both come immediately after X and Y.

mardy commented 11 months ago

Ping :-)

@WinterMute, I do have a branch for accelerated blitting on my fork are you accepting contributions?

WinterMute commented 11 months ago

Ping :-)

@WinterMute, I do have a branch for accelerated blitting on my fork are you accepting contributions?

We do accept contributions although typically a major port like this is going to need a fair bit of discussion. Generally I would prefer such questions be directed to forums or via email.

I'm honestly not sure what to do with this. It looks like tueidj may have intended to try and make wii & gamecube controllers look more similar from the application perspective. I think perhaps we should look at consolidating some of the wii & gamecube code. It might make more sense to have a single src/joystick/ogc/SDL_sysjoystick.c rather than separate files for wii & gamecube.

WinterMute commented 9 months ago

Adjusted & applied manually in https://github.com/devkitPro/SDL/commit/9e1b40e7b0b7f4d446c920d26e88f73028df262d