USBJoystick 0.12

USB Joystick driver for RISC OS 5
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw »

Jon, the hotplug works with my May flash device, and USBJoystick_List 0 and also USBJoystick_Debug 0 show me the file handle open and data RX upcalls going on. Can you see anything odd in those commands when you run it? Is there anything in the Reporter output?

Also, what is the scale factor showing as in the debug command output?
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

JonAbbott wrote: Sat Mar 31, 2018 8:47 pm Sweet, it now detects my Joystick okay. Hot plugging also detects the Joystick, but reports "Joystick not open" when you try to map it, "Data steam open:" reports "No (is something else using it?)". If the Joystick is plugged in before you load the Module, it works okay.
My mistake, although I extracted the Module from the 0.04 ZIP , it didn't overwrite the one I copied it over...giving the impression it was still 0.03! (this is a random "feature" of RISC OS 5 incidentally)

I've retested this morning and hot plugging does indeed work. The only outstanding issue is the min X/Y values returned from Joystick_Read, which need capping at &7F.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Updated Modules and obey.zip which fix Sensible Soccer (see later post for download). It had 190 occurrences of STMFD R13!,{PC}^ - an illegal instruction in USER mode and it also failed to preserve R14 around it's IRQ handler, so crashed when querying the Joystick.

I can't however get it to work fully with a Joystick. You can move the selection around with the Joystick, but fire doesn't select and none of the keys appear to work when there's an active Joystick. Looking through the code it appears to only support the Acorn Joystick interface.

Joystick_Read is returning the correct values, so I'm not sure why it's not working...IRQ latency possibly?

EDIT: It's IRQ latency, if I press ENTER, it actions it about 20 seconds later. I'll have to look through the code, it must be disabling IRQ's for long periods in the menu.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

I am trying version 0.04 of the USB joystick module. Now, *USBJoystick_List will show my GreenAsia USB joystick adapter! Great!
I then did:

*USBJoystick_Map 0 0 0 1 2

Because accordoing to "*usbjoystick_read 0", my x axis is 0 and my Y axis is 1. The button I want to use as fire is 2.

Here's what I found:
-Zool (NATIVE): seems to detect I am always moving to lower-left position!
-TwinWorld(NATIVE): seems to detect I am always moving to lower-left position!

-SWIV (ADFFS) works great with joy!
-Nebulus (ADFFS) works great joy!
-James Pond (ADFFS) works great joy!

-GODS (ADFFS): seems to detect I am always moving to lower-left position!
-Xenon2 (ADFFS): fire button works. Directions do not.
-Poizone (ADFFS): seems to detect I am always moving to lower-left position!
-Wolfenstein3D (ADFFS): seems to detect I am always moving to lower-left position!
-Overload (ADFFS): seems to detect I am always moving to lower-left position!
-James Pond 2: Robocod+ (ADFFS): seems to detect I am always moving to lower-left position!


Note my X and Y axis, according to *usbjoystick_read, move from 0 to 255, being 128 the "neutral" position (I mean, it's 128 when no direction is pushed on the digital pad).
Last edited by Vanfanel on Sun Apr 01, 2018 3:25 pm, edited 9 times in total.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Have you mapped the Joystick? SWIV does work, just tested Zool, which also works.

Updated obey.zip attached (see later post) to fix Sensible Soccer's IRQ issues. I've modified its main menu IRQ handler to enable IRQ on entry, hopefully that doesn't have a knock on effect. Note that this doesn't fix the latency issue when a Joystick is present.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@jon: I have edited my previous post. Sorry, I had not done mapping. Now I have provided better info.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

The games with issues use a selection of interfaces:
Vanfanel wrote: Sun Apr 01, 2018 2:25 pm -Zool (NATIVE): Acorn
-TwinWorld(NATIVE): Acorn
-GODS (ADFFS): RTFM, Serial Port
-Xenon2 (ADFFS): Acorn
-Poizone (ADFFS): RTFM
-Wolfenstein3D (ADFFS): Acorn
-Overload (ADFFS): Acorn, RTFM, Serial Port
-James Pond 2: Robocod+ (ADFFS): Acorn
It could be an issue with the values from the Acorn interface when the Joystick is centred. RTFM is translated from the Acorn interface, so that would also be affected.

What does the following display when the Joystick is centred:

Code: Select all

REPEAT:SYS "Joystick_Read",0 TO A%:PRINT ~A%:UNTIL 0
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw »

Phew, I wasn't going too mad there with the hotplug! I have a better idea for the scaling, which I will try and implement this evening. I need to offset as well as scale, as not all devices use 0 as their centre.

Vanfanel: I was going going to suggest you try 0.04 since your descriptors suggested it would now work with my reportid fix.

I wonder if I could just code in some gigantic assumptions for mapping automatically, or perhaps just automatically save the module state? Hmm...
grannyg
Posts: 18
Joined: Fri Dec 13, 2013 3:47 pm

Re: USB Joystick driver

Post by grannyg »

Lotus Turbo Challenge (RTFM?) works OK with USBJoystick 0.04.

I also tried an original PS3 controller but it doesn't get picked up at all. Appears in USBDevices OK.
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw »

I've just released 0.05 which I'm hoping will sort out the scaling in the Acorn (and Jon's RTFM) method. Vanfanel: can you give it a whirl and see if your funny positioning problem is fixed?

Chris: When Jon mentioned his XBOX controllers, I did a bit of research. Looks like these (and certain PlayStation controllers) are USB devices, but do not follow the standard HID model. They have some sort of bespoke configuration, meaning they need a special driver. It looks like various people have produced fake HID report descriptors which can be used to understand their data format.

If I could dream-up a way of squirting a fake descriptor into USBJoystick (perhaps with a filthy *command that reads it from a file or the command buffer?), then we could tel it to use these fakes for certain deviceids. It needs a bit of thought.
Post Reply