Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix controller support #36

Open
nightmareci opened this issue Jul 31, 2024 · 0 comments
Open

Fix controller support #36

nightmareci opened this issue Jul 31, 2024 · 0 comments

Comments

@nightmareci
Copy link
Owner

nightmareci commented Jul 31, 2024

The present system of handling controllers is incorrect with respect to the conventions established for how controllers are handled in most current games. A single controller device should be assigned to a player; the present system of allowing inputs of multiple controllers to be assigned to one player should be entirely replaced. Joystick handling can remain unchanged, though; because joysticks are pretty much a "wild west" of how they work in the real world, users should have complete freedom in configuring them, even being able to use multiple devices for one player.

Looking into how to properly handle controllers, it seems that, for games with 2P versus, which have fixed player number slots, you should use SDL's "controller player index" APIs. You assign one of the controller player indices to a game player number, another index to another player number. And, there should be an in-game UI for assigning controllers to players, that's always accessible regardless of saved assignments, with a sensible defaults reset when the currently-attached controllers mismatch the saved assignments, index 0 assigned to player 1, index 1 assigned to player 2. There should be some means to reset the assignments to the default assignment, as a simple selectable menu option with a confirmation dialog. If assignments automatically change, they're also automatically saved.

Saved controller assignments should exclusively be based on controller player indices, not device GUIDs or anything like that.

Also, add an option that swaps menu confirm/cancel; swapped is the default for Nintendo controllers, unswapped the default for Xinput and PlayStation. The option is saved per player number. If the controller type is changed from what it was when the swapped setting was last saved, the current controller type's default setting is applied (the "types" are Nintendo, Xinput, and PlayStation, at least. If other NESW face button labelings are ever available in SDL in the future, they would get their own types). So, that would require introducing new input APIs that the game uses, "confirm/cancel pressed" instead of "South/East button pressed", the confirm/cancel swap option controlling what actual button is assigned to confirm/cancel. Swapping confirm/cancel is an option in the game to accommodate players that would like to use the opposite conventional layout of their device, as a player might only use a Nintendo controller with PC games, not even with any Nintendo systems, but prefer to use the non-Nintendo layout, or a player only uses PlayStation controllers, but prefers the pre-PS5 Japanese layout.

nightmareci added a commit that referenced this issue Dec 27, 2024
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

No branches or pull requests

1 participant