[SOLVED] PS3 D-Pad output as arrows, not d-pad

Discussion about DroidMote Server for Windows
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

[SOLVED] PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

Hi zulu99

Following your suggestion from XDA forum, I write here :)
For reminder and to other users, this is my post from XDA:
zulu99 I would be gratefull if you could answer my earlier question regarding PS3 sixaxis pad wire connected to Android phone client + working with Droidmote Windows Server.

I can map the whole droidpad/PS3 pad in x360ce with great results except the D-PAD which is read as arrows (up, down, etc...) and therefore cannot be mapped. I tried "use arrows as buttons" in the client and it works for the on screen pad but still not for the connected PS3. Do you plan to assign hardware PS3 dpad to act as buttons in the future? It would be great for some games "i.e. Tomb Raider 2013"...

If you need more feedback or tests I'll be happy to help.
You suggested to install the newest drivers and server for windows (2.1.5). I already had them but installed anyway just to make sure and it didn't help. DPad from PS3 pad cannot be mapped in x360ce as it is not detected as pad button but keyboard arrows. :cry: Would appriciate if you could take a look at this matter.
Last edited by BimberX on Tue Nov 19, 2013 9:46 pm, edited 1 time in total.
User avatar
zulu99
Site Admin
Posts: 2485
Joined: Tue Oct 09, 2012 6:42 am

Re: PS3 D-Pad output as arrows, not d-pad

Post by zulu99 »

The default ps3 controller keylayout in your device is the /system/usr/keylayout/Vendor_054c_Product_0268.kl

If you open this file, there is this mapping:


key 0x124 DPAD_UP
key 0x125 DPAD_RIGHT
key 0x126 DPAD_DOWN
key 0x127 DPAD_LEFT

key 0x120 BUTTON_SELECT
key 0x123 BUTTON_START
key 0x12e BUTTON_A
key 0x12d BUTTON_B
key 0x12f BUTTON_X
key 0x12c BUTTON_Y
key 0x12a BUTTON_L1
key 0x12b BUTTON_R1
key 0x128 BUTTON_L2
key 0x129 BUTTON_R2
key 0x121 BUTTON_THUMBL
key 0x122 BUTTON_THUMBR

# PS key
key 0x2d0 HOME

# Left Analog Stick
axis 0x00 X
axis 0x01 Y

# Right Analog Stick
axis 0x02 Z
axis 0x05 RZ

# DPAD
# axis 0x2c -HAT_Y
# axis 0x2d +HAT_X
# axis 0x2e +HAT_Y
# axis 0x2f -HAT_X

# L2 trigger
axis 0x30 LTRIGGER

# R2 trigger
axis 0x31 RTRIGGER

# L1 trigger
# axis 0x32

# R1 trigger
# axis 0x33

# Triangle
# axis 0x34

# Circle
# axis 0x35

# Cross
# axis 0x36

# Square
# axis 0x37


as you can see, the d-pad is mapped as DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT in this lines:

key 0x124 DPAD_UP
key 0x125 DPAD_RIGHT
key 0x126 DPAD_DOWN
key 0x127 DPAD_LEFT

Instead this lines are commented:
# DPAD
# axis 0x2c -HAT_Y
# axis 0x2d +HAT_X
# axis 0x2e +HAT_Y
# axis 0x2f -HAT_X

Following this default keylayout droidmote is working well, because get DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT (when is in foreground mode) and send DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT

If you can use the D-PAD as analog command and not standard button like in the default keylayout (decommenting the D-PAD analog mapping and commenting the first d-pad mapping), droidmote send analog command for d-pad and not standard button DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT.

The problem is that good drivers of PS3 controller are only in sony android devices, all other android devices use or external app / drivers to attach the ps3 controller or connect it directly with wire.

In other words, if your drivers to connect ps3 controller to your device are good or original, you can use also this mapping:
# DPAD
# axis 0x2c -HAT_Y
# axis 0x2d +HAT_X
# axis 0x2e +HAT_Y
# axis 0x2f -HAT_X

and if you can use this analog mapping droidmote send real hat axis and not DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT like in the shield, xbox, logitech and other controllers.

This is not a droidmote problem, but is a problem of your ps3 controlelr drivers on your device (if you not solve uncommenting the analog mapping)


p.s.
what i can do in a future client version, is to map also DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT when the client is in background and droidmoteime active (in forground already work), but this is a workaround because the defaul action for the D-PAD of a controlelrs are analog axis and games want analog axis. DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT are keyboard key and not controller buttons and you can't map it in tool like x360ce or other tools that remap a real controller buttons and axis.
Developer of DroidMote Server and DroidMote Client. Read the Quick Start Guides and then I'll be happy to help.
Donate with Paypal or Donate with Crypto
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

Re: PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

Thank you for quick reply.

As for device, I use Galaxy Note II if it matters.

If I understood correct I should try to uncomment the DPAD lines with axis and comment ones with buttons?

I'll look into the file and let you know what I have.
User avatar
zulu99
Site Admin
Posts: 2485
Joined: Tue Oct 09, 2012 6:42 am

Re: PS3 D-Pad output as arrows, not d-pad

Post by zulu99 »

BimberX wrote:Thank you for quick reply.

As for device, I use Galaxy Note II if it matters.

If I understood correct I should try to uncomment the DPAD lines with axis and comment ones with buttons?

I'll look into the file and let you know what I have.
yes but the result depend from how you connect the ps3 controller to your android device, and specially if the drivers are good. For sure on sony devices you can do that.

when you edit the keylayout file Vendor_054c_Product_0268.kl don't forget to reassign the right file permissions. I suggest to read the previous file permissions with es file explorer and after edit you assign the same.

ATTENTION: to edit the file /system/usr/keylayout/Vendor_054c_Product_0268.kl you must remount the /system folder read and write, by default is only read. you can do this easly with es file explorer.


If you not solve, as workaround, i suggest to map the default d-pad mapping to real controller buttons.

This:
key 0x124 DPAD_UP
key 0x125 DPAD_RIGHT
key 0x126 DPAD_DOWN
key 0x127 DPAD_LEFT

and swap DPAD_UP , DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT with real controleler buttons that you can remap in tools like x360ce. All the possible controller buttons are this:

BUTTON_A
BUTTON_B
BUTTON_C
BUTTON_X
BUTTON_Y
BUTTON_Z
BUTTON_L1
BUTTON_R1
BUTTON_L2
BUTTON_R2
BUTTON_SELECT
BUTTON_START
BUTTON_MODE
BUTTON_THUMBL
BUTTON_THUMBR

but ATTENTION not reassign buttons already assigned otherwise your custom keylayout not work.
Developer of DroidMote Server and DroidMote Client. Read the Quick Start Guides and then I'll be happy to help.
Donate with Paypal or Donate with Crypto
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

Re: PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

OK, I suppose it will take me a while to change the files properly. But I sure let you know.
So if I understand correctly, if above doesnt work (as PS3 driver in my android device may not work with dpad as axis) I can try to assign dpad to keys:

BUTTON_A
BUTTON_B
BUTTON_C
BUTTON_X
BUTTON_Y
BUTTON_Z
BUTTON_L1
BUTTON_R1
BUTTON_L2
BUTTON_R2
BUTTON_SELECT
BUTTON_START
BUTTON_MODE
BUTTON_THUMBL
BUTTON_THUMBR

as they are apparently not used (spare).

Am I correct?

BTW: do you know if it is possible to change the PS3 pad driver in android?
User avatar
zulu99
Site Admin
Posts: 2485
Joined: Tue Oct 09, 2012 6:42 am

Re: PS3 D-Pad output as arrows, not d-pad

Post by zulu99 »

BimberX wrote:OK, I suppose it will take me a while to change the files properly. But I sure let you know.
So if I understand correctly, if above doesnt work (as PS3 driver in my android device may not work with dpad as axis) I can try to assign dpad to keys:

BUTTON_A
BUTTON_B
BUTTON_C
BUTTON_X
BUTTON_Y
BUTTON_Z
BUTTON_L1
BUTTON_R1
BUTTON_L2
BUTTON_R2
BUTTON_SELECT
BUTTON_START
BUTTON_MODE
BUTTON_THUMBL
BUTTON_THUMBR

as they are apparently not used (spare).

Am I correct?

BTW: do you know if it is possible to change the PS3 pad driver in android?

YES CORRECT. but some buttons are already used other no. you can use the buttons not used reading the default keylayout.

about drivers there is only the official sony solution and sixaxis app (sixaxis app that i not know if is standard, but i know that the developer is a very good developer)
Developer of DroidMote Server and DroidMote Client. Read the Quick Start Guides and then I'll be happy to help.
Donate with Paypal or Donate with Crypto
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

Re: PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

Thank you very much.

I already have sixaxis installed so I also try that.

As for free buttons I think:
BUTTON_C
BUTTON_Z
BUTTON_L(1or2?)
BUTTON_R(1or2?)
looks like they are free.

I also tried to use PPJoy to redirect arrows to pad keys which seems to work but requires lots of trial/error mapping.

I'll be home tommorow to give it a try. Thank you.
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

Re: PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

Ok, I have spend like 15+ hours on this one, rooted my phone and uploaded custom, unofficial 4.3 android, bought bunch of apps from Google Play, etc... here are the results:

What I tried:
1. Editing pad config in Android System Folder. Changing to axis D-PAD makes the dpad useless, system doesnt support it. There is not enough number of unused buttons to map all 4 D-pad directions as buttons although it works ok (UP as A/X DOWN as B/Y etc.) . Maybe there is a way to add additional buttons to config file but I could not find it so I doubt it

2. Tried using custom driver supported by SixAxis - works but no additional options

3. Tried using custom driver supported by USB/BT Joy Center Gold - works but no additional options

What I have noticed is that when I turned on accelerometer ON in droidmote options it mapped to D-PAD so by moving pad I could use d-pad. Useless but may be helpfull..

So much for the Android side...

On the PC side i tried:
1. Mapping arrows to d-pad in x360ce - doesnt work as x360ce can only map input from PAD not from keyboard
2. Created vitual controller in PPJoy and another one in VJoy (arrows to pad keys). Mapped droidmote+vjoy to ppjoy to get full droidmote + dpad experience and than mapped ppjoy controller in x360ce WHICH seemed to work ok, until I realized that even though droidmote can work and send keystrokes in the background in Android, the arrows are not send in the background (even if Droidmote IME is selected) so when I opened streaming application (splashtop) in android I could use/send droidmote controller ok in the background but the arrows weren send to v-joy...
3. Changed streaming program from Splashtop to Kainy which allowed me to map d-pad/arrows directly in the streaming software WITH droidmote ruuning in the background. So then the arrows are send to vjoy by Kainy and then to PPjoy and all other droidmote input controls are send to ppjoy. Then the PPjoy is mapped in x360ce as xbox pad and detected in games as X360 pad.

The only drawback is that Kainy has faaaaaar less image quality than splashtop :/ but I'll try to figure this out.

It would be perfect if droidmote could also intercept "arrows" while ruuning in the background and than map them as controller buttons on the pc server side. Then we could skip the whole PPjoy + VJoy stuff.

Did I miss anything? :)
User avatar
zulu99
Site Admin
Posts: 2485
Joined: Tue Oct 09, 2012 6:42 am

Re: PS3 D-Pad output as arrows, not d-pad

Post by zulu99 »

BimberX wrote:Ok, I have spend like 15+ hours on this one, rooted my phone and uploaded custom, unofficial 4.3 android, bought bunch of apps from Google Play, etc... here are the results:

What I tried:
1. Editing pad config in Android System Folder. Changing to axis D-PAD makes the dpad useless, system doesnt support it. There is not enough number of unused buttons to map all 4 D-pad directions as buttons although it works ok (UP as A/X DOWN as B/Y etc.) . Maybe there is a way to add additional buttons to config file but I could not find it so I doubt it

2. Tried using custom driver supported by SixAxis - works but no additional options

3. Tried using custom driver supported by USB/BT Joy Center Gold - works but no additional options

What I have noticed is that when I turned on accelerometer ON in droidmote options it mapped to D-PAD so by moving pad I could use d-pad. Useless but may be helpfull..

So much for the Android side...

On the PC side i tried:
1. Mapping arrows to d-pad in x360ce - doesnt work as x360ce can only map input from PAD not from keyboard
2. Created vitual controller in PPJoy and another one in VJoy (arrows to pad keys). Mapped droidmote+vjoy to ppjoy to get full droidmote + dpad experience and than mapped ppjoy controller in x360ce WHICH seemed to work ok, until I realized that even though droidmote can work and send keystrokes in the background in Android, the arrows are not send in the background (even if Droidmote IME is selected) so when I opened streaming application (splashtop) in android I could use/send droidmote controller ok in the background but the arrows weren send to v-joy...
3. Changed streaming program from Splashtop to Kainy which allowed me to map d-pad/arrows directly in the streaming software WITH droidmote ruuning in the background. So then the arrows are send to vjoy by Kainy and then to PPjoy and all other droidmote input controls are send to ppjoy. Then the PPjoy is mapped in x360ce as xbox pad and detected in games as X360 pad.

The only drawback is that Kainy has faaaaaar less image quality than splashtop :/ but I'll try to figure this out.

It would be perfect if droidmote could also intercept "arrows" while ruuning in the background and than map them as controller buttons on the pc server side. Then we could skip the whole PPjoy + VJoy stuff.

Did I miss anything? :)
I can send arrows also in background in the next client version. not warry. thanks for your tests.
Developer of DroidMote Server and DroidMote Client. Read the Quick Start Guides and then I'll be happy to help.
Donate with Paypal or Donate with Crypto
BimberX
Posts: 8
Joined: Mon Oct 14, 2013 3:36 pm

Re: PS3 D-Pad output as arrows, not d-pad

Post by BimberX »

zulu99 wrote:
I can send arrows also in background in the next client version. not warry. thanks for your tests.
No problem. Thank you for the really nice piece of software!

That would be great if you could also send direction keys in the background !!!... or maybe even make server to map them as ie. button 13, 14, 15, 16 ;)

I am really into making an environment for everyday, userfriendly streaming games PC=>android system. I am almost done: you can turn it on from your mobile, turn on any and stream any game no matter if nvidia or amd card etc... I am almost done except for the steering. I wrote all the scripting to make it user friendly and automatic. Your help with game controls would be really appriciated. :)