Gamepad mapping messed up
I tried implementing gamepad support in my project but for some reason the mapping is all messed up.
Same thing happens in the official demo, so it's not my project.
I'm using an Xbox 360 controller.
It's weird because I remember at some point in the past the demo did work for me (perhaps it was a different HaxeFlixel version, I can't remember).
The test app for the drivers I'm using works just fine.
I've seen other people on the google group having this problem, but found no solution.
Is anyone else here having this problem?
Could you be a bit more specific than "all messed up"? :)
Does it happen on all targets (Flash, HTML5, Native...)?
For me it appears to work just fine.
I'm using Flash. Gamepad doesn't seem to work at all on HTML5.
Physical buttons are not mapped to the right IDs. On top of that, some buttons stay permanently in a pressed state.
Is there any specific information I can give you?
I'm using haxeflixel 4.2.0, openfl 3.6.1, lime 2.9.1.
Update: I tried on Windows and it works fine. Perhaps it's the X360 Mac drivers. Weird.
With native targets, it could be an issue with IDs not being correct for Mac (there's a different section for them in XInputID). There, it also matters whether you're using OpenFL Next or Legacy (the latter being the default).
FLX_GAMEINPUT_APIis for Next,
However, for both Flash and HTML5, the IDs should not depend on OS or Next vs Legacy (that distinction doesn't exist on those targets).
Unfortunately, I can't test this myself, as I don't own a Mac.
@Gama11 So I did some tests, and it turned out that the wrong mapping problem only occurred with Firefox, but only with an older version I was using, Firefox 48.0.2, on OSX Mountain Lion (an old OSX version now unsupported by Apple and most browsers). In the Haxeflixel demo, model would show up as UNKNOWN, and name as just "Controller", and the mapping problem persisted even if I changed the model manually to XINPUT. Also, on this same version of Firefox, sometimes the gamepad would only get detected if I touched a button or moved the sticks first (weird, I know).
With Google Chrome, both older Mountain Lion version and latest version on latest OSX, gamepad works fine. Shows up correctly as XINPUT, Xbox 360 Controller.
With Safari, even latest version on latest OSX, gamepad is NOT detected at all.
Same for the latest version of Firefox on latest OSX, gamepad not detected at all.
I'm not sure why Safari and latest Firefox don't detect the gamepad, but I think I'm fine with this, as long as it doesn't behave incorrectly. Again the wrong mapping thing only happens on an old obsolete version of Firefox, so it doesn't matter to me.
It's weird though that Flash behaviour changes from browser to browser. Only thing I can think of is that Chrome uses its own built-in Flash plugin, whereas Firefox and Safari use the one installed with the Adobe Installer. But they are both the same latest version, 126.96.36.199.
Also a few others things I found:
mapping messed up on stand-alone Flash player app (latest version) too on OSX Mountain Lion.
on OSX El Capitan (the newer version of OSX on which I tested the Firefox and Safari versions that don't detect the gamepad), the stand-alone Flash player app doesn't detect gamepad at all.
sometimes, even on Chrome, where the mapping works fine, I have to press a button or move a stick for the gamepad to get detected. This is not ideal, because if the user has a gamepad connected, they won't know the game supports it unless they actually try to use the gamepad first. To check if a gamepad is connected, I'm checking that FlxG.gamepads.lastActive != null.