Print Thread
USB game controllers
nikos
As things are right now AROS has only basic game controller support.

Would be nice to have a more advanced controller interface where analogue sticks would be supported and a more easy way to configure them.
 
cavemann
Iirc the lowlevel lib was designed for the Cd32. It can only read 7 buttons per port, it reads the hat or xy analog, but not both, and cannot read z-axis or rotation, Imo, if the lowlevel lib was expanded or redesigned, then joy configuration would not be such a pita.

What have the other Ng systems done?
Edited by cavemann on 09/24/2018 16:21
 
nikos
OS4 and MorphOS have support for some controllers that is working with 2 analogue sticks and more buttons.

DizzyOfCRN is trying to implement this for AROS too now. He tried to register here so maybe he show up soon Smile
 
DizzyOfCRN
Hi,

Got the controller today to communicate back to the xinput.class

https://youtu.be/ckQKZSz9otM

Only debug prints at the Trident

EDIT: Seems I don't know how to use that video embedding... I'll just leave the link... Shock
Edited by admin on 09/25/2018 14:30

jyrki.j.koivisto
 
nikos
It is life Grin

Following this with excitement.
 
DizzyOfCRN
Tested both of my controllers (the F710 and F310) on native installation and they seem to work with the class just fine while plugged in at the same time. Had bit of a trouble with the corded one on housted. It just didn't want to play along... at all...
jyrki.j.koivisto
 
nikos
Cool Grin
I can test my controllers if you give me the class Smile
You can send to nik-tom(at)online.no
 
DizzyOfCRN
Well I'd like it to be somewhat more mature than what it is now... I've barely changed a couple of lines from one existing Poseidon class to be frank... Well, I emptied most of the code away from one and did some MUI gui's

If it wasn't for my gcc 8 point something It would only take two lines altered to get some input from the controller... Smile Now the bare minimum is 4 lines...

For this to be of any use the games would need a mechanism to get to the controller, I think I'll go the XInput API way and provide a simple library for four players.

Whenever a gamepad is inserted it tries to take one of location from the four provided. If there's no room then it won't be used (or somehow unused needs to be purged)

Game could then query for the controller (just gamepad for now) and allocate it to use. A call to get the controller state is also provided, very much the same as in XInput. No need to over complicate things.

https://docs.microsoft.com/en-us/windows/desktop/xinput/getting-started-with-xinput
jyrki.j.koivisto
 
DizzyOfCRN
For the rumble effects we need a couple of more lines of code. The interface to the gamepad is really, really simple. More simple than what I first thought. This is good for us as I'm pretty confident that we can cook something up!

I'm assuming that a full XInput API isn't wanted? We could make this what ever we want.
jyrki.j.koivisto
 
nikos
Dizzy: Ok Smile Just tell me when you have something ready you want me to test.
Little off topic but in Triden I have tried to configure 2 pads using the hid interface to play 2 player games in Janus-uae. I configure everything to the right ports. That is 1 and 0 and also configure this in Janus-UAE.
What happen is that the trigger button works on both ports but for port 0 I can not controll or stear anything. For port 1 everything works good.
Any clue if this is triden or janus-uae fault? Is there any other way to test this?
 
DizzyOfCRN

>nikos wrote:


Cool Grin
I can test my controllers if you give me the class Smile
You can send to nik-tom(at)online.no

I've send you the class, compiled for AbiV1.i386 Smile How is it working there?

If you press on the analog stick then there will be a lot of debug messages and at least here the Trident can't really keep up showing them, but it's just because it prints so much.

There is no wakeup code to the gamepad, that is if it is on somekind of sleep state then it will remain so and no output appears at the Trident log
Edited by DizzyOfCRN on 09/26/2018 09:09

jyrki.j.koivisto
 
nikos
Dizzy: yes, just like you say Smile Tested with original X-Box controller pad.

Lots of stuff like this:


11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 09 0E BF 35 C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 09 0E 9A 49 C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 09 0E 7B 60 C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 9E 0D A2 75 C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 9E 0D FF 7F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 E0 0E FF 7F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 A5 12 FF 7F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 59 19 FF 7F C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 BA 21 FF 7F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 DA 28 FF 7F C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 34 2C FF 7F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 22 2F 90 7F C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F9 2F AD 7B C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F9 2F 39 78 C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F9 2F E8 73 C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F9 2F 97 6F C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F9 2F 63 67 C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 F2 2A FD 43 C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 17 18 DD 1E C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 90 03 E6 FB C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 FB 03 32 FD C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 FB 03 E6 FB C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 90 03 BD F9 C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 FB 03 DB F5 C8 EE 63 06 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 90 03 ED EB C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 FB 03 F4 DB C8 EE F2 05 00 00 00 00 00 00

11:20 pm| 0-arosx.class: Msg: 00 14 00 00 00 00 90 03 CD C6 C8 EE 63 06 00 00 00 00 00 00
Edited by nikos on 09/26/2018 12:25
 
DizzyOfCRN
Did the values change in any sane way? I think I'll commit tonight the code so far as arosx.class

It doesn't do much, but it has MUI gauges showing the thumb stick movements on devices settings window

At the moment it has no limit on the number of controllers that can be plugged in (should it? We don't even have an API to read the controller to)

On my Logitech controller there are buttons that do not map for XInput, like the mode button(maps dpad as left thumb stick and vice versa) and vibration level button. We can read those too if we like

My Logitech Wireless F710 gamepad goes to sleep if left alone, but it wakes up on a button press of the controller
Edited by DizzyOfCRN on 09/26/2018 22:22

jyrki.j.koivisto
 
DizzyOfCRN
Just commited the code. I've not enabled the build for it though, so it won't show up on nightlies

Link for the class is below, it's build for AROS AbiV1.i386

https://www.dropb...class?dl=1

And here's a video...

https://youtu.be/...
Edited by DizzyOfCRN on 09/26/2018 23:37

jyrki.j.koivisto
 
nikos
Yes Dizzy, the values do change.

Thank for the video. That looks good Smile

If lets say Janus-UAE is going to use your class does it need to be compiled again or is it a matter of changing the Janus-UAE configuration file?
 
DizzyOfCRN

>nikos wrote:


Yes Dizzy, the values do change.

Thank for the video. That looks good Smile

If lets say Janus-UAE is going to use your class does it need to be compiled again or is it a matter of changing the Janus-UAE configuration file?


This class should really connect to some sort gamepad library of some sort. If I'd make this class expose a library interface then only xinput gamepads could be used by the library, but if this thing connects to some external gamepad API then everything that connects to that API can be used.

There is no interface yeat to get any output, but I'd imagine that a new compile of said software is needed in order to connect to that something, which we don't have.

EDIT:

Does the new class show gauges moving? Remove all previous xinput.classes if you have them in the class directory or they will fight on the ownership of the usb interface.

There's also some serial debug stuff going on the background, this will hinder the MUI performance as the code prints it's debug. Slowdown if more than one controller is checked in the settings window
jyrki.j.koivisto
 
nikos
If only xinput devices would work with the new library I don't have problem with that, but it should be compatible with lowlevel, or classic input.
I know the classic stuff is stupid to configure for multible controllers, but I guess it could be fine that only 1 controller is supported that always go for port 1 anyway.

I guess mapping classic with the new lib to different ports might be difficult?

I tried lot's of hid devices and it seams to always be problems unless you are only out for classic 2-3 button joystick and even with classic controllers it is sometimes not possible to configure the buttons and some controllers does not even take me to the config window. They are simply not recoginzed by the hid interface as a controller and it does not help to try to force the class.

All this said it is better to be fully compatilbe with one controller that is easy to find like the xbox controller than making some mess out of lot's not working and others half way working etc.

For my distro "AspireOS" I simply would put in the hardware page that xbox controllers is what is working and others not recommended.
 
DizzyOfCRN
Updated the linked arosx.class with some fixes, the same link should still work

If not then it's this one:
https://www.dropb...class?dl=1

I will need some advice on how to proceed, maybe those who have actually ported/coded some apps for AROS could shed some light on me on what to do. I have no experience on that field...
jyrki.j.koivisto
 
nikos
I tried the new class. As you mentioned it is now no debug from the controller. Nothing happen pressing buttons or directions.
When I insert it in usb port it say play it again "controller"
Does that seam ok?
 
DizzyOfCRN

>nikos wrote:


I tried the new class. As you mentioned it is now no debug from the controller. Nothing happen pressing buttons or directions.
When I insert it in usb port it say play it again "controller"
Does that seam ok?

Sounds about right, there is no automatic popup for the testing window, need to go there manually. There's two ways of opening the window:

https://youtu.be/...
jyrki.j.koivisto
 
Jump to Forum: