USBJoystick 0.12
USBJoystick 0.12
Hi all,
As previously mentioned, here is an alpha test version of my USB Joystick driver module (scroll to bottom of post for download link).
Edit: I have removed the overview/instructional content: see later posts.
As previously mentioned, here is an alpha test version of my USB Joystick driver module (scroll to bottom of post for download link).
Edit: I have removed the overview/instructional content: see later posts.
- Attachments
-
- USBJoystick012.zip
- (191.42 KiB) Downloaded 1174 times
-
- USBJoystick009.zip
- (185.29 KiB) Downloaded 1022 times
-
- USBJoystick008.zip
- (183.42 KiB) Downloaded 1066 times
Last edited by richw on Thu Nov 08, 2018 10:14 pm, edited 19 times in total.
Re: USB Joystick driver
Just tried it on a RPi 3B+ with SWIV. Works great with a Competition Pro and a cheapo Snes Clone.
Seems really responsive.
Initially couldn't get the usbjoystick_read to show any changes. Had to remove !USBHID from !Boot. It also caused aborts when booting.
Adding the USBJoystick module to PreDesk works OK too once !USBHID was removed from !Boot.
Seems really responsive.
Initially couldn't get the usbjoystick_read to show any changes. Had to remove !USBHID from !Boot. It also caused aborts when booting.
Adding the USBJoystick module to PreDesk works OK too once !USBHID was removed from !Boot.
Re: USB Joystick driver
Ah, yes. I shall have to try that (I have the freeware version somewhere).
USBJoystick scans all connected devices, and anything that it decides looks like a joystick, it will try and talk to. Maybe HID is trying to do similar? I cannot recall the error-handling path when it cannot open the stream, so I shall investigate.
Thanks for the feedback.
Regarding your earlier question on the keyboard handling, yes, I am planning on adding more *commands so you can map a movement to a fake key press. So keyboard-only games could become controlled by joystick. Same idea for the mouse.
USBJoystick scans all connected devices, and anything that it decides looks like a joystick, it will try and talk to. Maybe HID is trying to do similar? I cannot recall the error-handling path when it cannot open the stream, so I shall investigate.
Thanks for the feedback.
Regarding your earlier question on the keyboard handling, yes, I am planning on adding more *commands so you can map a movement to a fake key press. So keyboard-only games could become controlled by joystick. Same idea for the mouse.
Re: USB Joystick driver
I have just upped the version to 0.03.
The second stick on the Joystick_Status SWI was corrupt, and I have tried to indicate if the endpoint could not be opened on *USBJoystick_List
The archive also includes the source code.
The second stick on the Joystick_Status SWI was corrupt, and I have tried to indicate if the endpoint could not be opened on *USBJoystick_List
The archive also includes the source code.
Re: USB Joystick driver
I can modify ADFFS to pass reads/writes to the Econet interface to your code if it's any use? At the time it handles them it's in Abort mode with IRQ disabled, so you won't be able to issue any SWI, but assuming it's just translating cached values it will work.Emulate RTFM joystick API (based on Econet hardware peeks)
Is there any documentation on the RTFM interface? I'll need to know which addresses it's on.
Re: USB Joystick driver
I've found the RTFM drivers here, based on which I've modified ADFFS so the check for the RTFM Joystick Interface works.
It appears to use bits 4..0 across two ports @ 33A0004 and 33A0008. From what I can gather, each port is a separate Joystick with bits defined as follows:
Code: Select all
Bit / Value
0 Right
1 Left
2 Down
3 Up
4 Fire
Re: USB Joystick driver
After much faffing around I've finally manage to get the 0.03 source to compile under DDE24 - had to create aliases for some commands and duplicate path variables, not to mention hunt down FAppend!
Anyhow...assuming the resultant Module is ARMv7 compatible, I tested the two HID devices I have on a Pi3. Sadly neither show up under *USBJoystick_List.
The first I tried was a Microsoft Force Feedback Joystick, which identifies as:
The second one was a Thrustmaster Force Feedback Steering Wheel, which identifies as:
I have however made the changes to ADFFS to translate the Acorn Joystick interface to RTFM...just need to test it, if I can find a Joystick that will show up.
Anyhow...assuming the resultant Module is ARMv7 compatible, I tested the two HID devices I have on a Pi3. Sadly neither show up under *USBJoystick_List.
The first I tried was a Microsoft Force Feedback Joystick, which identifies as:
Code: Select all
USB$Device_00_00_00_045E_001B_-1_-1_0A00_USB5 : 5
USB$Device_03_00_00_045E_001B_01_00_0A00_USB5 : 5 0 0
Code: Select all
USB$Device_00_00_00_06F8_0004_-1_-1_0100_USB6 : 6
USB$Device_FF_FF_FF_06F8_0004_01_00_0100_USB6 : 6 0 0
Re: USB Joystick driver
Ah yes, I knew I’d downloaded them before from somewhere! I vaguely recall looking at the ReadJoy BASIC program. Shame the archive contains the Extend virus.
That sounds reasonable from my glance over the ReadPorts code (ARM assembler isn’t really my thing, though!). It looks fairly similar to the Serial Port’s SWI interface, so I’m sure I can produce the correct data format. The bit which scared me was the hardware probing, where it’s doing all that funky Econet stuff. I guess it can be dumbed down slightly, so as you say, we just need to trap reads from BoardAddr (0x33A0004). Not sure how to do that in a C module, but I’ll ponder it.It appears to use bits 4..0 across two ports @ 33A0004 and 33A0008. From what I can gather, each port is a separate Joystick with bits defined as follows:If I read the joystick state via Joystick_Read at VSync and set the two registers accordingly, will that be sufficient to work with your Module?Code: Select all
Bit / Value 0 Right 1 Left 2 Down 3 Up 4 Fire
I suspect it’s also worth looking at a game itself, as it’s a bit of an assumption that the official test application is representative of the games. Mind you, that’s the approach I took for the Acorn and Serial Port SWIs, and it seemed to work OK. I don’t suppose in your archive metadata, you note the joystick status for each game?
Re: USB Joystick driver
Ah yes, I had some fun with FAppend being missing from my DDE (27), and I was going to raise that on the ROOL forums. You’ve reminded me! I was trying to follow the pattern of the shared makefiles etc., using some of the modules in the RISC OS source code as templates for how things should be set up.
Shame. Any chance you can run Reporter and observe the output when you start the USBJoystick module? It will only list (and try and talk to) devices that it believes are USB HID compliant, and ‘look like’ gamepads/joysticks. The ‘look like’ algorithm came from XMAME, which apparently uses the same sort of approach Microsoft used in Windows. I am not totally surprised that a steering wheel might be too funky, but you’d think an FF joystick would work (are they quite old?).Anyhow...assuming the resultant Module is ARMv7 compatible, I tested the two HID devices I have on a Pi3. Sadly neither show up under
*USBJoystick_List.
I have an Ancient (2005-ish) Playstation 1 pad to USB adaptor, and that doesn’t work at all. It doesn’t provide a HID descriptor.
Ah, so you trap those memory reads, and just issue a Joystick_Read SWI? That should ‘just work’ as they say. I have a feeling converting to Joystick_Status might be even easier.I have however made the changes to ADFFS to translate the Acorn Joystick interface to RTFM...just need to test it, if I can find a Joystick that will show up.
Re: USB Joystick driver
My joystick is a PSX original joystick that uses a GreenAsia adapter, very popular around here.
It seems that, according to *usbjoystick_list, it's not recognized...
Any chances for it to work? Works on GNU/Linux with no problem on PC, Raspberry Pi, etc...
It seems that, according to *usbjoystick_list, it's not recognized...
Any chances for it to work? Works on GNU/Linux with no problem on PC, Raspberry Pi, etc...