pelya / commandergenius

Port of SDL library and several games to the Android OS.
http://libsdl-android.sourceforge.net/
GNU Lesser General Public License v2.1
533 stars 248 forks source link

Some buttons in USB controllers won't emit signal #80

Open protoman opened 6 years ago

protoman commented 6 years ago

In SDL configuration menu, I can map all the buttons fine, they are all detected. But when I start my game, some buttons won't emit event and I can't use them.

Relevant configuration:

AppUsesSecondJoystick=n

RedefinedKeys="NO_REMAP NO_REMAP NO_REMAP NO_REMAP NO_REMAP ESCAPE NO_REMAP"

AppTouchscreenKeyboardKeysAmount=5

RedefinedKeysScreenKb="X A Z C RETURN W"

RedefinedKeysScreenKbNames="JUMP FIRE SHIELD DASH START R"

# Redefine gamepad keys to SDL keysyms, button order is:
# A B X Y L1 R1 L2 R2 LThumb RThumb Start Select Up Down Left Right
RedefinedKeysGamepad="X A Z C Q W E R T Y RETURN HOME UP DOWN LEFT RIGHT"
FloatingScreenJoystick=n

When I plug my PS4 Controller, buttons CIRCLE and R1 won't give any events. The code that reads input is like: while (true) { // keep reading until a key is found while (SDL_PollEvent(&event)) { __android_log_print(ANDROID_LOG_INFO, "###ROCKBOT###", "### INPUT::pick_key_or_button - event.type[%d] ###", (int)event.type);

This not never executes for those keys. I've also tested with a PS2 controller and got same problem, and a user reported that by using one of those "clip" controllers on his tablet, he also can't use a few buttons.

protoman commented 6 years ago

I am trying to debug this and I think I've found the cause, even if I still don't know exactly how to fix. So, first the code for the buttons that didn't work in TranslateKeyGamepad are 98 and 101. So I've looked upon SDL_android_gamepad_keymap variable and added logs into SDL_ANDROID_SetIndividualGamepadKeymap, and the parameter values are (in same order as the method signature): [120][97][118][98][113][119][101][114][116][121][13][278][273][274][276][275]

So, we have in the values both 98 and 101 (Y and L2), that is great but.... The map actually don't use those values, but rather KEYCODE_BUTTON_Y that is 100, KEYCODE_BUTTON_1 that is 188 and KEYCODE_BUTTON_L2 that is 104, KEYCODE_BUTTON_7 that is 194.

So, the problem is that TranslateKeyGamepad is trying to get from the array using the key value and not the index for the equivalent key... yeah, I got lost here :-(

protoman commented 6 years ago

OH, I found it :) C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

I tried to fix that and add the two buttons, but I was unable without spending a lot of time to change the defines for the keys, and when I got into that part I was aware of breaking things for not knowing what I was doing.

pelya commented 6 years ago

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346162723, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

protoman commented 6 years ago

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" notifications@github.com escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346162723, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346174146, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

pelya commented 6 years ago

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" notifications@github.com escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346162723, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346174146, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346174837, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

protoman commented 6 years ago

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko notifications@github.com wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" <notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346176359, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg .

pelya commented 6 years ago

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346177106, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg .

protoman commented 6 years ago

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" notifications@github.com escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346177106 , or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

pelya commented 6 years ago

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" notifications@github.com

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRPqROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

protoman commented 6 years ago

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" notifications@github.com escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" <notifications@github.com

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80# issuecomment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346185735

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecomment-346193479

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewLgRPqROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxGu9pLOxGsiYA-N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

protoman commented 6 years ago

Oh, and the touchpad on dualshock controller works as a button, it can be pressed, much like ones in notebooks.

Also, when plugging the dualshock4, sound stops, as if android tries to use its little speaker as output. But this does not worry me, just FYI.

Em 21 de nov de 2017 10:11 PM, "Iuri Fiedoruk" protoman@upperland.net escreveu:

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" < notifications@github.com> escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" < notifications@github.com>

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" notifications@github.com wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" notifications@github.com wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecom ment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRP qROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxGu9pLOxGsiYA-N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

pelya commented 6 years ago

This SDL port is mostly used to port opensource Linux games to Android, most of them support keyboard really well, but joystick input requires some additional code. Mapping gamepad buttons to keypresses just makes it easier to port. I did plan to provide API through SDL_JoyButtonEvent, but did not implement it yet.

On Nov 22, 2017 2:13 AM, "Iuri Fiedoruk" notifications@github.com wrote:

Oh, and the touchpad on dualshock controller works as a button, it can be pressed, much like ones in notebooks.

Also, when plugging the dualshock4, sound stops, as if android tries to use its little speaker as output. But this does not worry me, just FYI.

Em 21 de nov de 2017 10:11 PM, "Iuri Fiedoruk" protoman@upperland.net escreveu:

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" < notifications@github.com> escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" < notifications@github.com>

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" <notifications@github.com

wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" <notifications@github.com

wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecom ment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRP qROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxGu9pLOxGsiYA- N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346202547, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewBtdU0MZrn1iDqnI9XJrvF199yCeks5s42dAgaJpZM4QjXLg .

tbaker4802 commented 6 years ago

How do you handle the analog sticks and buttons? I'm guessing it is not variable if it requires maps to keypresses. Sorry know this isn't related to the issue but just curious.

On Nov 21, 2017 10:24 PM, "Sergii Pylypenko" notifications@github.com wrote:

This SDL port is mostly used to port opensource Linux games to Android, most of them support keyboard really well, but joystick input requires some additional code. Mapping gamepad buttons to keypresses just makes it easier to port. I did plan to provide API through SDL_JoyButtonEvent, but did not implement it yet.

On Nov 22, 2017 2:13 AM, "Iuri Fiedoruk" notifications@github.com wrote:

Oh, and the touchpad on dualshock controller works as a button, it can be pressed, much like ones in notebooks.

Also, when plugging the dualshock4, sound stops, as if android tries to use its little speaker as output. But this does not worry me, just FYI.

Em 21 de nov de 2017 10:11 PM, "Iuri Fiedoruk" protoman@upperland.net escreveu:

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" < notifications@github.com> escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" < notifications@github.com>

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecom ment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRP qROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxGu9pLOxGsiYA- N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346202547, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewBtdU0MZrn1iDqnI9XJrvF199yCeks5s42dAgaJpZM4QjXLg .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346232323, or mute the thread https://github.com/notifications/unsubscribe-auth/AM1jGituCdVh4fP5AzyN8J_q_mk6Tih5ks5s45P1gaJpZM4QjXLg .

protoman commented 6 years ago

A bit information on the gamepad that also misses some buttons events:

It a generic gamepad, PS Bluetooth clone by a Polish company (made in China of course).

The company name is MANTA.

Gamepad model: MM824

The gamepad is designed to operate with Android and iOS but also Windows. It has three emulation/working modes: normal gamepad mode, keyboard emulation and mouse emulation - right analog controls the mouse pointer.

The gamepad has an internal power supply of DC 3.7V, 180mA.

Em 22 de nov de 2017 1:24 AM, "Sergii Pylypenko" notifications@github.com escreveu:

This SDL port is mostly used to port opensource Linux games to Android, most of them support keyboard really well, but joystick input requires some additional code. Mapping gamepad buttons to keypresses just makes it easier to port. I did plan to provide API through SDL_JoyButtonEvent, but did not implement it yet.

On Nov 22, 2017 2:13 AM, "Iuri Fiedoruk" notifications@github.com wrote:

Oh, and the touchpad on dualshock controller works as a button, it can be pressed, much like ones in notebooks.

Also, when plugging the dualshock4, sound stops, as if android tries to use its little speaker as output. But this does not worry me, just FYI.

Em 21 de nov de 2017 10:11 PM, "Iuri Fiedoruk" protoman@upperland.net escreveu:

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" < notifications@github.com> escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" < notifications@github.com>

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" notifications@github.com wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecom ment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRP qROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxGu9pLOxGsiYA- N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346202547, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewBtdU0MZrn1iDqnI9XJrvF199yCeks5s42dAgaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346232323, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPrxE8gtkpRldBACv3oyV8KfCxRQIMsks5s45P2gaJpZM4QjXLg .

pelya commented 6 years ago

I've pushed the tentative fix for PS4 gamepad: https://github.com/pelya/commandergenius/commit/66f7cc1cfde57c8e964cb7fe37a806a0907ac5cb

On Wed, Nov 22, 2017 at 11:17 AM, Iuri Fiedoruk notifications@github.com wrote:

A bit information on the gamepad that also misses some buttons events:

It a generic gamepad, PS Bluetooth clone by a Polish company (made in China of course).

The company name is MANTA.

Gamepad model: MM824

The gamepad is designed to operate with Android and iOS but also Windows. It has three emulation/working modes: normal gamepad mode, keyboard emulation and mouse emulation - right analog controls the mouse pointer.

The gamepad has an internal power supply of DC 3.7V, 180mA.

Em 22 de nov de 2017 1:24 AM, "Sergii Pylypenko" <notifications@github.com

escreveu:

This SDL port is mostly used to port opensource Linux games to Android, most of them support keyboard really well, but joystick input requires some additional code. Mapping gamepad buttons to keypresses just makes it easier to port. I did plan to provide API through SDL_JoyButtonEvent, but did not implement it yet.

On Nov 22, 2017 2:13 AM, "Iuri Fiedoruk" notifications@github.com wrote:

Oh, and the touchpad on dualshock controller works as a button, it can be pressed, much like ones in notebooks.

Also, when plugging the dualshock4, sound stops, as if android tries to use its little speaker as output. But this does not worry me, just FYI.

Em 21 de nov de 2017 10:11 PM, "Iuri Fiedoruk" <protoman@upperland.net

escreveu:

The guy that found the issue is using one of those "clip" controls that attach to the device and plugs in USB port and he have the same issue of some buttons not being mapped. When using a os2 controller with usb adapter I also got the problem. It is not only the number of buttons, but the order that matters, some unimportant ones can work before the ones you want to use.

That said, why is that you translate gamepads as keyboard inputs to android sdl instead of just passing it as joysticks to sdl? I think that way you would not have to worry about the buttons. Or it is possible to do that and I am just missing something in config?

Em 21 de nov de 2017 10:01 PM, "Sergii Pylypenko" < notifications@github.com> escreveu:

L3 and R3 buttons are analog stick buttons, they are already in the API as LThumb and RThumb.

I've been using XBox gamepad as a reference so far, and most Android games expect 12-button gamepad, if you count two analog stick buttons, Start, and Select (the big X button is used to power it on, it does not send a keycode): https://en.wikipedia.org/wiki/Xbox_360_controller

And PS3 controller is the same: https://en.m.wikipedia.org/wiki/DualShock#DualShock_3

PS4 adds touchpad, but it would make more sense to use it as a mouse input. I don't have that gamepad so I cannot test it, but a long time ago SDL supported Xperia Play touchpad.

On Nov 22, 2017 1:21 AM, "Iuri Fiedoruk" notifications@github.com wrote:

There are more. X, circle, triangle, square, l1, r1, l2, r2, l3, r3, ps and the touchbar press.

Em 21 de nov de 2017 8:43 PM, "Sergii Pylypenko" < notifications@github.com>

escreveu:

If there are still only 4 face buttons and 4 shoulder buttons, there's no point in adding separate keycodes for C and Z keys, they should simply send the same keycodes as L1 an Y keys. I'll add that to SDL.

BTW I've updated that API, now you can assign keycodes to both analog joysticks to act as another DPAD, if you do not open them with SDL_JoystickOpen().

On Nov 22, 2017 12:08 AM, "Iuri Fiedoruk" <notifications@github.com

wrote:

I've tried to add more parameters to the map that sets the keys for C and Z, but then I had to do the same for the other calls, one one of those used some values set by #define, I needed more (it goest until number 15, I was trying to create 16 and 17 to map it). I created the defines, but got lost when I needed to also set its values with another #defines....

On dualshock4, circle is 98 and R1 is 101.

-- Iuri Fiedoruk, Software Developer

On Tue, Nov 21, 2017 at 8:05 PM, Sergii Pylypenko < notifications@github.com> wrote:

Are you trying to increase the key amount in SDL API? I would simply treat the circle key as another 'start' or 'select' key. I'll do that myself then. Does L1 button send keycode 98, and circle button

  • keycode 101?

On Nov 21, 2017 11:59 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

I've started doing that, but the changes needed are way more greater. I've stopped when I got into having to change macros and defines :(

Em 21 de nov de 2017 7:56 PM, "Sergii Pylypenko" < notifications@github.com

escreveu:

That explains. Please add these keycodes to SDL_ANDROID_SetIndividualGamepadKeymap in addition to existing ones and submit a pull request.

On Nov 21, 2017 11:13 PM, "Iuri Fiedoruk" < notifications@github.com

wrote:

OH, I found it: C and Z do not exist, they also do not exist on any gamepad I've seen (PS3/XBox/SHIELD)

KEYCODE_BUTTON_Z = 101, KEYCODE_BUTTON_C = 98,

:)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346162723

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewIqv4Yxm3nNdutybpdgFttbarYu3ks5s4zzsgaJpZM4QjXLg .

SDL_ANDROID_SetIndividualGamepadKeymap

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174146

, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxHmTer5XqqCGCtqdcec8z54RI9mVks5s40cDgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#

issuecomment-346174837

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewGbOzzHLYPsPmyK4qhKFtqMEe7RCks5s40esgaJpZM4QjXLg .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346176359,

or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxC8u4DqrnqaBixXUauZ14yemz9RIks5s40kMgaJpZM4QjXLg

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/pelya/commandergenius/issues/80#issuecom ment-346177106

, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewByyEeExKoGoB0yw7ishT5bTIeDHks5s40nHgaJpZM4QjXLg

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346185735, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxA7JDiFz0Oqz9mAAttICg00AlVR5ks5s41ImgaJpZM4QjXLg .

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecom ment-346193479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewLgRP qROmoZpP3VVa59hz6qymp22ks5s41rogaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346200547, or mute the thread https://github.com/notifications/unsubscribe- auth/ABPrxGu9pLOxGsiYA- N6XfNymWoynmbqks5s42RzgaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346202547, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAJewBtdU0MZrn1iDqnI9XJrvF199yCeks5s42dAgaJpZM4QjXLg .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80# issuecomment-346232323, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABPrxE8gtkpRldBACv3oyV8KfCxRQIMsks5s45P2gaJpZM4QjXLg .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346290085, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewHArkBjMaLAaz2w1RJO1IODdpMhVks5s4-bGgaJpZM4QjXLg .

protoman commented 6 years ago

I will give a try later today. Yesterday I made a very similar change that didn't solve the issue, but I noticed you made further changes before this, to add more keys, so lets see; I'll let you know.

BTW, I made a few methods to add achievements into the game. Once I have the time to separate it into its own class, I'll make a push. I hadn't submited before because it had a freeze problem, but it seems I solved by using runOnUiThread on the calls in the Java code.

protoman commented 6 years ago

The fix "works" in the sense that buttons work, but it actually makes two buttons as one. So, in dualshock4, Circle ans X are not the same thing (A in the case of my configuration). I will give a try and implement a full-fledged fix, it just will take time, as I'm not familiar with all your code (mostly the #define key stuff is hard as one define uses another one in some point) and I don't have much free time, but it will be better just add two more buttons.

protoman commented 6 years ago

Got the buttons working, but something strange happened. I don't know if was my change or yours, because I made my changes after executing a git pull, but now the digital d-pad won't work anymore and the dualshock4 LED is turned off after I plug it in. I can get the analog working, but it is not really the best for playing this kind of game. Tomorrow I try to figure out what made the d-pad stop working by looking at your commits and my changes.

My config is: RedefinedKeysGamepad="X A Z C 4 5 Q R 8 9 j k RETURN HOME UP DOWN LEFT RIGHT PAGEUP PAGEDOWN HOME END PLUS MINUS LEFTBRACKET RIGHTBRACKET"

Diff of my changes (sorry about not being cleaned, it is late of the night here in Brazil right now): http://rockbot.upperland.net/files/diff_changes_joystick.txt

protoman commented 6 years ago

I got the d-pad working by adding back the dpadx checkm that you removed when adding thumbs, into the code. But one thing I noticed is that both touch buttons as gamepad sends key.which as zero. Ideally, it would be better to use distinct values, so the programmer can know from where the input is coming. The reason is that my game have an option to map custom buttons, but this makes the on-screen joystick not work anymore if I map the buttons to something else. The easiest fix for that would be to use default keys when the input comes from on-screen keyboard, and custom ones when it comes from anything else. But, as it seems a good bunch of work to add this into your code, as I would have to add an extra parameter to all SDL_ANDROID_MainThreadPushKeyboardKey() calls, the other option would be to just change, from my game, the key-mapping for the touch-joystick also.

I will see what I can do about that...

pelya commented 6 years ago

Yes, I've removed dpad processing code by accident. I've added it back, and also fixed the problem when dpad and analog sticks are using the same keycode.

On Fri, Nov 24, 2017 at 12:54 AM, Iuri Fiedoruk notifications@github.com wrote:

I got the d-pad working by adding back the dpadx checkm that you removed when adding thumbs, into the code. But one thing I noticed is that both touch buttons as gamepad sends key.which as zero. Ideally, it would be better to use distinct values, so the programmer can know from where the input is coming. The reason is that my game have an option to map custom buttons, but this makes the on-screen joystick not work anymore if I map the buttons to something else. The easiest fix for that would be to use default keys when the input comes from on-screen keyboard, and custom ones when it comes from anything else. But, as it seems a good bunch of work to add this into your code, as I would have to add an extra parameter to all SDL_ANDROID_MainThreadPushKeyboardKey() calls, the other option would be to just change, from my game, the key-mapping for the touch-joystick also.

I will see what I can do about that...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pelya/commandergenius/issues/80#issuecomment-346706721, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewP9dEZz3IHY2BDIxIs3V0XYSYbHCks5s5fe8gaJpZM4QjXLg .

protoman commented 6 years ago

I made the whole fix, including sending key.witch as 0 for touch and 1 for gamepad/other inputs, so the developer can deal with those differently if he wants. In my case, I use default keys for input 0 and use custom ones for input 1.

As soon as I can, I will clean-up the code and make a pull-request; I am very busy this week with some real-life stuff :) I also will create pull-requests to add achievements and another to fix volume with Amiga-MOD files in SDL_mixer - see here: https://discourse.libsdl.org/t/sdl-mixer-playing-a-mod-file-changes-music-volume/18252/3 - once I test it.