Android Gamepad Support

3rd test

in this test build you can check IF gamepad buttons are recognized by SDL lib.
If it works then the problem is the engine,
otherwise the problem is SDL
https://www48.zippyshare.com/v/RkUjg3z9/file.html
please check, I have not a gamepad

if it works we need to delete .Data property of s_joysticks struct in joystick.h and we have to map the keys into control_update() of control.c using separate properties Hats,Buttons,Axis
 
when i press buttons then itshows "button keys 2097152" and different numbers so it works for buttons, when i press dpad then hat keys dont change, it stays at "hat keys 0".
My log also says that i have 0 hats and just 4 axes if that makes any  difference:
Microntek              USB Joystick          - 4 axes, 36 buttons, 1 hat(s)
dpad still doesnt work
--
With second gamepad  GreenAsia Inc.      USB  Joystick  - 2 axes, 30 buttons, 0 hat(s)
LEft and right works in game properly , up and down doesnt work but hat keys value still dont change when i press directions , only button keys value is changing.
 
bWWd said:
when i press buttons then itshows "button keys 2097152" and different numbers so it works for buttons, when i press dpad then hat keys dont change, it stays at "hat keys 0".
My log also says that i have 0 hats and just 4 axes if that makes any  difference:
Microntek              USB Joystick          - 4 axes, 36 buttons, 1 hat(s)
dpad still doesnt work
--
With second gamepad  GreenAsia Inc.      USB  Joystick  - 2 axes, 30 buttons, 0 hat(s)
LEft and right works in game properly , up and down doesnt work but hat keys value still dont change when i press directions , only button keys value is changing.

Great bwwd!!
So we can confirm that the bug is on SDL_JoystickGetHat() and all relative to hat functions. I will report this bug!
I reported the bug on official forum and Bugzilla!
 
wow that is a great way to debug how did you get the key flag to display directly on the screen ?
 
So.. whats causing that other gamepad to work?  Left right works on it,
Maybe its some problem with axis ?
Im not super familiar but typical gamepad has buttons, axes and hats , right ? ive seen some guys configured their gamepad in openbor and it was showing "hat" instead of "axis" for up/down/left/right  so i was surprised a bit that my gamepads show axis,
I mean if gamepad does not use hat technology for DPAD then why trying to make it  use it if this technology is not physically built into the gamepad ?
Is there any way to let engine use axis instead of hats for directional movements?
--
Ok i have old openbor build and my gamepad works in it, i mean only DPAD works in it and butons does not work at all, i cant even configure them cause they dont register, Its build 4161 compile date  apr 2015
Code:
Used Ram: 18625536 Bytes

SDL video Renderer: opengles 

1 joystick(s) found!
SDL video Renderer: opengles 

1 joystick(s) found!
OpenBoR v3.0 Build 4161, Compile Date: Apr 28 2015

Game Selected: /mnt/sdcard/OpenBOR/Paks/mstone.pak

FileCaching System Init......	Enabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............	480x272 (Mode: 1, Depth: 32 Bit)
 
It works in windows , never had problems, i tested new android build and axis shows "axis key 4" when i press up,1 when left,2 -right,8-down ,upleft-5,upright-6,downright-10,downleft -9.So it is detected.Is it possible to make it use axis buttons too to control openbor instead of only hats ?
 
Yes they work and their names in config are like on android build.Maybe something gyroscope relatedis preventing axes to control the game on android.
 
Dunno if this will help, but this site can identify easily all controllers and all buttons
http://html5gamepad.com/

Works in both desktop and mobile.
 
O Ilusionista said:
Dunno if this will help, but this site can identify easily all controllers and all buttons
http://html5gamepad.com/

Works in both desktop and mobile.

tested wired ps4 pad on this site it works with android. Here are the results:

dpad up = b12 - 1.0
dpad down = b13 - 1.0
dpad left = b14 - 1.0
dpad right = b15 - 1.0
left analogue up = axis1 - -1.0
left analogue down = axis1 - 1.0
left analogue left  = axis0 - -1.0
left analogue right  = axis0 - 1.0
 
msmalik681 said:
White Dragon said:
Test build 5:

enabled dpad from native java.
disabled sdl joystick/mouse detection for UP/DOWN buttons:

Let's try:
https://ufile.io/rz1v4
or
https://www88.zippyshare.com/v/CoIDdHFt/file.html

(sorry for these tests for you but I have not a gamepad)

Thats what i was thinking but i was trying to figure out how to pull it off.  I will be surprised  if this solution does not work.

In this build simply I remapped the dpad button from gamepad to v x y w of keyboard.

Then I force to use key down and key up event for keyboard disabling the gamepad and mouse detection

All into SDLActivity.java
 
version from zippyshare - i can configure only dpad, buttons are not detected, after config dpad doesnt work.
version from ufile - nothing is detected, gamepad cant be configured..
From gamepad tester on pc , on android it doesnt detect gamepad even tho i can actually switch to different buttons/tabs  on browser using gamepads dpad.
2Gdwc.png

 
Yes , before every test i uninstall and go to saves to delete evertyhing except touch.txt
 
bWWd said:
Yes , before every test i uninstall and go to saves to delete evertyhing except touch.txt

I still think this should work.  Sure I have asked this before but just to be sure your dpad worked in older builds but all buttons did not is that right ?  If it did work in older builds was that just config or in game too ?
 
Back
Top Bottom