Author Topic: arosx (xinput gamepad usb class)  (Read 383 times)

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
arosx (xinput gamepad usb class)
« on: January 10, 2019, 04:44:35 PM »
Hi,

I've just updated the arosx.class on AbiV1 to show all the input values that the Microsoft game controller API  provides on the interface setting gui.

Buttons:
XINPUT_GAMEPAD_DPAD_UP
XINPUT_GAMEPAD_DPAD_DOWN
XINPUT_GAMEPAD_DPAD_LEFT
XINPUT_GAMEPAD_DPAD_RIGHT
XINPUT_GAMEPAD_START
XINPUT_GAMEPAD_BACK
XINPUT_GAMEPAD_LEFT_THUMB
XINPUT_GAMEPAD_RIGHT_THUMB
XINPUT_GAMEPAD_LEFT_SHOULDER
XINPUT_GAMEPAD_RIGHT_SHOULDER
XINPUT_GAMEPAD_A
XINPUT_GAMEPAD_B
XINPUT_GAMEPAD_X
XINPUT_GAMEPAD_Y

Axis:
LeftTrigger
RightTrigger
ThumbLX
ThumbLY
ThumbRX
ThumbRY

Now in order for make use of it I'm thinking to expose arosx.library build in to the arosx.class.
API would mostly be a clone from Microsoft game controller API...

Only 4 gamepads and only one opener for the library... Or should it be per gamepad...

If anyone would like to make a better gui for it then I'd be pleased...
« Last Edit: January 10, 2019, 04:53:39 PM by dizzy »

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #1 on: January 10, 2019, 05:25:25 PM »
Dizzy:  :D

Thanks man  8) Good to see you back. This is great news. Looking forward to try it out.
4 gamepads is enough.

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #2 on: January 10, 2019, 06:56:46 PM »
Hi,

Sorry for the slow pace... Had so much other things ahead.

I compiled that Prototype for Linux (https://amigaworld.net/modules/news/article.php?storyid=8312) Might be a good candidate for testing the gamepad thingy. Not sure if I'm able to compile it to AROS on the build system.

Here's a link for the arosx.class (i386-AbiV1) https://www.dropbox.com/s/lzqudemy8wjanes/arosx.class?dl=0

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #3 on: January 10, 2019, 08:49:58 PM »
Hi Dizzy. Prototype looks fantastic :D That would be something to have for AROS.

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #4 on: January 10, 2019, 09:19:27 PM »
No stress Dizzy  :D I'm just glad you are back. Tried the class now and seams to work great :) At least all buttons and direction + analog sticks responds :)

Will there be some kind of legacy support. Lowlevel?

edit: only thing I noticed is that the X is blinking in green all the time. Should normaly go to 1 right? Pressing the X button does nothing.
« Last Edit: January 10, 2019, 11:29:16 PM by nikos »

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #5 on: January 11, 2019, 12:20:08 AM »
At the moment there is no limit on the number of controllers. They aren't even counted upon. Hence there is no led thingy going on. Home/logo button is not forwarded either, it's not in the Microsoft API.

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #6 on: January 11, 2019, 10:39:57 AM »
Dizzy: I see. Thanks for the explenation :)

paolone

  • Junior Member
  • **
  • Posts: 92
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #7 on: January 11, 2019, 03:10:41 PM »
Hi. Any hope for an ABIv0 backport?

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #8 on: January 11, 2019, 03:45:28 PM »
Hi. Any hope for an ABIv0 backport?
I don't see any problems for it running on ABIv0, nothing really special about the class in any way. I have not setup any ABIv0 build systems at the moment so I can't provide any test pieces for it.

I'm trying to build the Prototype game for AROS. I had GCC4.6.4 build on my build system, the Prototype code doesn't like it to be that old... I'll check some other games as I haven't got a glue which sort of interface would be most suitable. Event base system would be good, but I think most games just poll the inputs.
« Last Edit: January 11, 2019, 04:04:07 PM by dizzy »

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #9 on: January 11, 2019, 04:50:01 PM »
What about the plugin here.
It is for the PS1 emulator fpse. The emu source code is not available but the plugin source is there to play with.
I be happy to test but must be abi v.0

https://www.amidog.com/amiga/fpse/

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #10 on: January 13, 2019, 09:58:48 AM »
What about the plugin here.
It is for the PS1 emulator fpse. The emu source code is not available but the plugin source is there to play with.
I be happy to test but must be abi v.0

https://www.amidog.com/amiga/fpse/
I'll see about the plugin once I get things going on better with the class. It's a bit early for backporting as the code at the moment doesn't actually do anything usefull.
I've limited the number of gamepads to four now and set the leds to lid according to the gamepad number.

I'll clean up the basic framework of the code so it will change quite a bit. Now the code is mostly just some code snippets here and there...

EDIT: I've cleaned the code a lot now, it should be easier for now to attach other library to it. It needs a bit more streamlining, I'll do a commit after that is done.

I'm not sure if I should provide the arosx_ll.library to substitute the lowlevel.library with hex editor on already compiled games. As Poseidon already patches the lowlevel I'm not sure how my patching would affect it.

EDIT: On HTML5 the gamepad API inhibits the discovery of controllers until one presses a button on the controller. This is to inhibit fingerprinting the machine, I don't think that is needed for us... ?
As the arosx Poseidon class now only setups gamepads, I think if there will ever come support for different kind of XInput controller, say a racing wheel, then I think they will get their own numbering so the four controller limit isn't for all xinput controllers but for controllers of the same kind... don't know...
« Last Edit: January 13, 2019, 02:06:45 PM by dizzy »

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #11 on: January 13, 2019, 10:13:42 PM »
Hi Dizzy. Thank you a lot for your work on this. Realy appreciated. On Morphos there is this lowlevel emulation using Xbox controllers to support classic. That would be nice for us to I think.

dizzy

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #12 on: January 14, 2019, 10:09:21 AM »
I've basicly now rewritten the whole thing...  :o

I should have started a bit more object oriented way. Now there is the AROSXClass and it has AROSXClassController which in turn can be XInput gamepad. The arosx.library does nothing at the moment but now it is actually working (can be opened and closed...), it was just a quick copypastemonkeycode from the first thing I found on the AROS tree.

I've looked at a lot of game controller API's and they pretty much just poll the inputs, let's see what the arosx.library will house.

As the arosx.library is part of the arosx.class  (just a different interface exposed to outside world) I'm thinking just to use arosx.class memory as if it belonged to arosx.library. Or pass around messages.
Maybe messaging is better suited... Don't know... For force feedback it might be beneficial to have a queue of ff-commands with duration and instant flush of the queue when needed.

Yesterday I tried to find how the battery information is passed on the USB, but my Windows machine is W7 and it has older xinput. Not sure if it provides such information. I installed vs2017 and got at least one example that polled the inputs and send ff commands to work.

For the Logitech F710 wireless gamepad arosx.class shows that it is wireless and when it goes to sleep mode and when it wakes, not sure if it will work the same with different wireless controllers.

nikos

  • Member
  • ***
  • Posts: 126
  • Karma: +1/-1
    • View Profile
    • aspireos
Re: arosx (xinput gamepad usb class)
« Reply #13 on: January 14, 2019, 12:26:03 PM »
This sound fantastic Dizzy. When you have it ready I will talk to the porter of Tower 57. That game realy requires analog pads.
Hope he will do a recompile for AROS version.

wawa

  • Junior Member
  • **
  • Posts: 76
  • Karma: +0/-0
    • View Profile
Re: arosx (xinput gamepad usb class)
« Reply #14 on: January 14, 2019, 10:39:59 PM »
@dizzy. kalamatee is complaining about your naming convention "arosx".. he says it should be simply "xinput".
wanna join us on slack?

edit: ah, he wrote you already. nevermind.
« Last Edit: January 14, 2019, 11:00:17 PM by wawa »