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

[Android] Joystick Button Mappings are strange #1319

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

[Android] Joystick Button Mappings are strange #1319

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Android (All), All

Comments on the original bug report:

On 2014-01-22 02:12:58 +0000, David Brady wrote:

Created attachment 1529
Patch to re-assign button IDs

The GameController API is very nice, but it would be great to fall back to the Joystick API if the GameController is not mapped. But sadly, the button IDs for SDL Android do not correspond even slightly to button mappings on other platforms. I would like to re-order the default button IDs to be somewhat reasonable, so that even unsupported controllers can be a little playable.

Patch is attached which reorders the basic joystick button IDs to match the GameController API (where applicable).

On 2014-01-22 02:36:04 +0000, David Brady wrote:

Created attachment 1530
Sort Joystick axes

Related to this bug... This isn't the best solution to the problem, but joystick axes can come in a semi-random order. This simply sorts them by axis ID, which works well for standard controllers (even more so if # 2229 were accepted). It might be better to explicitly reorder the left and right sticks to the first 4 axes, then sort the rest. But I wanted to keep it simple.

On 2014-01-22 02:47:07 +0000, David Brady wrote:

Created attachment 1531
Fix for typo in button ID patch

On 2014-01-22 23:30:57 +0000, Philipp Wiesemann wrote:

(In reply to David Brady from comment # 1)

Created attachment 1530 [details]
Sort Joystick axes

Related to this bug... This isn't the best solution to the problem, but
joystick axes can come in a semi-random order. This simply sorts them by
axis ID, which works well for standard controllers (even more so if # 2229
were accepted). It might be better to explicitly reorder the left and right
sticks to the first 4 axes, then sort the rest. But I wanted to keep it
simple.

The Comparator's compare() method could be simplified by just subtracting the two values. It does not have to be exactly -1/0/1 just negative/0/positive. [1]

[1] http://developer.android.com/reference/java/util/Comparator.html#compare(T, T)

On 2014-01-23 11:45:43 +0000, Gabriel Jacobo wrote:

Can you update your axis sorting patch with Philipp's recommendation (and fix spacing while you are at it :) )

Also, we don't use tabs, just four spaces, and comments use the old ANSI C style only (playing along with the fantasy that we are ANSI C compatible).

The button patch (with tabs fixed ;) ) is here: https://hg.libsdl.org/SDL/rev/7e01e3908f41

On 2014-01-23 18:22:53 +0000, David Brady wrote:

Created attachment 1534
Corrected sorting patch

Thank you Gabriel. My apologies for the style, I forgot to fix it up. I'll be better about that in the future. Here's the corrected patch.

On 2014-01-24 12:55:27 +0000, Gabriel Jacobo wrote:

There was a missing "import java.util.List;" :)

Fixed in https://hg.libsdl.org/SDL/rev/d7b7ec662687

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