USBJoystick 0.12

USB Joystick driver for RISC OS 5
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

richw wrote: Tue Apr 10, 2018 10:00 pm What exactly have you added to ADFFS for keymapping?
I've added a * command, detailed in the same post as the code example. I need to figure out a key press/release method that works pre RISC OS 5 so all OS versions are covered.
richw wrote: Tue Apr 10, 2018 10:00 pm I think Vertical Twist also produced a driver module for the Serial Port hardware which provided the Acorn API
There's several versions of both the Serial Port and JoyMod Modules, some translate to the Acorn interface and in these cases the games only support Acorn.

Its looking good though, we've pretty much got all games that could make use of a Joystick covered.
richw wrote: Tue Apr 10, 2018 10:01 pm And I think keymapping in the boot scripts is also sensible. Would be nice to do it in a way which isn't bespoke to USBJoystick... Maybe with a *command alias, which I can deal with? I need to dream up some commands for the keymapping too.
It uses Joystick_Read, so there's no reliance on USBJoystick. I'd keep ADFFS key mapping and USBJoystick key mapping totally separate, so games booted with ADFFS are handled internally. USBJoystick meanwhile can be used for ARMv5 compliant games which don't natively support Joystick.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@Jon: With latest modules and obey,
-Iron Lord crashes on quit
-Magic Pockets crashes on quit

(From ADFFS, not hd-installed)
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Wed Apr 11, 2018 1:01 am -Iron Lord crashes on quit
-Magic Pockets crashes on quit
I feel like I'm shuffling bugs around! Whilst testing under the debug build last night, I also noticed RISC OS is passing strange values in R14 when *GO is used, which is causing some games to do odd things. Even more odd is the fact the Page Zero access handler is keeping the games working in the normal build, but I can't fathom out how! Either way, there's some issues around entry and exit I need to investigate.

Strictly speaking Absolute's or code called via *GO shouldn't touch R14 and should exit cleanly via OS_Exit.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Updated Modules attached (see public beta), to fix the crash when terminating tasks via CTRL-SHIFT-F12, caused by Voice handlers crashing. Some debug code crept into the build, ironically the code was to prevent Voice handler termination from crashing the machine!

There's still an issue with Iron Lord and if you terminate via CTRL-SHIFT-F12 and then run and terminate again, it locks the machine. Exiting legally via ESC doesn't exhibit this problem, so there's still an issue in the termination code. The problem also occurs on 2.60, so it's not a bug I've introduced.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@Jon: No more crashes on exit on the games where I had detected them with this version.

A game that still has joystick problems is Arcturus, where only RIGHT and UP directions work, while LEFT and DOWN are ignored.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Wed Apr 11, 2018 2:17 pm A game that still has joystick problems is Arcturus, where only RIGHT and UP directions work, while LEFT and DOWN are ignored.
See if adding the following to its Boot script/!Run before the "<Arcturus$Dir>.GameCode" line resolves the problem:

Code: Select all

IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7D0 E20010FF E1A01C00
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7D4 E3510080 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7D8 C2611080 A3855001
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7DC E3510020 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7E0 A3855001 D3855002
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7E4 E3710020 E1A01800
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7E8 D3855002 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7EC E2001CFF A3855008
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7F0 E1A01421 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7F4 E3510080 D3855004
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B7F8 C2611080 EA000003
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B834 E20010FF E1A01C00
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B838 E3510080 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B83C C2611080 A3855001
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B840 E3510020 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B844 A3855001 D3855002
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B848 E3710020 E1A01800
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B84C D3855002 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B850 E2001CFF A3855008
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B854 E1A01421 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B858 E3510080 D3855004
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B85C C2611080 EA000003
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B92C E20010FF E1A01C00
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B930 E3510080 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B934 C2611080 A3855001
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B938 E3510020 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B93C A3855001 D3855002
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B940 E3710020 E1A01800
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B944 D3855002 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B948 E2001CFF A3855008
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B94C E1A01421 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B950 E3510080 D3855004
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B954 C2611080 EA000003
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B980 E20010FF E1A01C00
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B984 E3510080 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B988 C2611080 A3855001
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B98C E3510020 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B990 A3855001 D3855002
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B994 E3710020 E1A01800
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B998 D3855002 E3510202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B99C E2001CFF A3855008
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B9A0 E1A01421 E3710202
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B9A4 E3510080 D3855004
IF ADFFS$CPUID>=&A10 THEN JITMEMORYA 8B9A8 C2611080 EA000003
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@Jon: That fixes the joystick controls, yes! :)
There's a small problem left with this game, Arcturus: If I try to quit via CTRL+SHIFT+F12 when the OREGAN logo is on screen, the machine hangs instead of exiting.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Wed Apr 11, 2018 8:52 pm @Jon: That fixes the joystick controls, yes! :)
Another overly complicated Joystick movement detection routine, I believe that's three or four I've now had to correct. I'm not surprised this one didn't work...just look at what the code does if the Joystick values are negative (ie &80..&FF), &80 (-128) is treated as the opposite direction and it converts &FE (-2) to -126, so two of the Joystick directions are reversed!

Code: Select all

SWI     Joystick_Read
AND     R1,R0,#&FF
CMP     R1,#&80
RSBGT   R1,R1,#&80
CMP     R1,#&20
ORRGE   R5,R5,#1
CMN     R1,#&20
ORRLE   R5,R5,#2
AND     R1,R0,#&FF00
MOV     R1,R1,LSR #8
CMP     R1,#&80
RSBGT   R1,R1,#&80
CMP     R1,#&20
ORRGE   R5,R5,#8
CMN     R1,#&20
ORRLE   R5,R5,#4
ANDS    R1,R0,#&00FF0000
ORRNE   R5,R5,#&10
Vanfanel wrote: Wed Apr 11, 2018 8:52 pm There's a small problem left with this game, Arcturus: If I try to quit via CTRL+SHIFT+F12 when the OREGAN logo is on screen, the machine hangs instead of exiting.
It also crashes if quit via the menu option, which is on my list of things to investigate. Another Page Zero access issue to fix.

Whilst testing Joysticks, I've turned up 15 games that have issues.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@Jon: Just to be sure, I am reporting that I have detected that Inferno is crashing after very few frames after launch, ONLY if it's HD-installed.
I have updated it's obey file (!Run) from current obey zip in latest version of this thread, and it's still happening.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Sat Apr 14, 2018 9:54 pm Inferno is crashing after very few frames after launch, ONLY if it's HD-installed.
Have you mounted the floppy image? Its probably the disc protection failing. I don't believe this game saves the highscores, so you're better off having a !Run that mounts and boots the floppy and not actually HD install it.
Post Reply