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 »

Vanfanel wrote: Sun Apr 08, 2018 4:01 pm Magic Pockets does not crash anymore, but joystick does not work with it. It detects button being pressed to start the game, but it does not work in-game.
You'll probably find keys don't work either, as per my comments above.
Vanfanel wrote: Sun Apr 08, 2018 4:01 pm -Xenon 2 control is as bad (or worse) than how it was in Overload before! Directions seem to be wrong, only detected sometimes, etc...
Are you using the updated boot script that fixes the Joystick support?
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

Yes, I am using the new boot script. I always run from disk image before reporting, to avoid reporting problems fixed on the Obey scripts.

Ah! On the previous post, I meant that Pac-Mania, it's F1044701, which is the Learning Curve version.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

JonAbbott wrote: Sun Apr 08, 2018 1:39 pm I've had a more detailed look at Magic Pockets. It's not actually hanging when it gets into a level, the game is still running but the USB stack appears to have stopped working. I suspect its writing to a rogue address and it keeps killing both the SPI and the I2C on my pi-top.

To double check, I've gone back to ADFFS 2.60 and the problem remains. The next check is to see what it does on Pi1/2 to see if its specific to my pi-top.
I've tested Magic Pockets on a Pi2 and it works correctly, which leads me to believe there's either an instruction that behaves differently on ARMv7, or it's writing to a rogue address that breaks a Pi3. It's unrelated to USBJoystick.
Vanfanel wrote: Sun Apr 08, 2018 4:01 pm -Magic Pockets does not crash anymore, but joystick does not work with it. It detects button being pressed to start the game, but it does not work in-game.
What Pi model are you running it on and do the keys work with or without USBJoystick loaded? Resolved with latest Modules / obey.zip
Vanfanel wrote: Sun Apr 08, 2018 4:01 pm -Xenon 2 control is as bad (or worse) ... Directions seem to be wrong, only detected sometimes, etc...
When this occurs, press ESC, then ENTER to play with keys - are the keys detected correctly? Resolved with latest Modules
Vanfanel wrote: Sun Apr 08, 2018 4:01 pm As for Pac-Mania, it's F1044701, which is the Learning Curve version.
Try changing the "ScreenSize 80" line in the boot script to:

Code: Select all

IF ADFFS$CPUID>&A10 THEN ADFRemapVideoMemory 9 80 ELSE ScreenSize 80
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 attached (see later post), which fixes Xenon2 and Magic Pockets. I noticed Xenon2 crashed when quit via CTRL-ESC so have put a fix in its boot script.

The cause of the issues in Magic Pockets was down to it claiming UpCallV, which royally screws RISC OS 5. ADFFS now prevents UpCallV from being claimed when it returns from the vector.

The Bouncer (F1045201) boot script has been updated, I noticed it wasn't displaying the high score screen correctly when testing RTFM support.

I've updated the boot script for Axis, which had an unsupported instruction in it.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Not trusting game documentation around which Joystick interfaces they support, I added code to the debug build of ADFFS which reports which interfaces are queried. This covers direct Parallel and Econet port access and the three SWI blocks. Having now checked every game that runs on a Pi, it's been interesting to note the discrepancies between what some games say they support and what they actually support. A few for example say they support Serial Port, but are in fact relying on translation to the Acorn interface, so in reality they only support Acorn.

Unfortunately, checking every game under the debug build has highlighted over a dozen that have Page Zero access bugs I've missed, so I've got some game debugging to do!

Richard, some games check for the "Joystick" Module. Mostly this is done in the !Run, so can be corrected in the boot script, but I did spot a game yesterday which did it in BASIC. Is it worth ADFFS loading a stub Joystick Module when Joystick_Read is available but no "Joystick" Module is loaded? Or, add a * command to ADFFS, so it can be targeted at games that specifically check?

Is it worth added Joystick->Key mapping to the boot scripts of games where it's applicable? There's quite a few games that don't directly support Joystick, but could benefit from key translation?

Finally, could we add support for more than one button to the Acorn interface as several games support them. Asylum for example supports two.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: USB Joystick driver

Post by Vanfanel »

@Jon: Xenon2 and Magic Pockets working great now. Joystick in Magic Pockets seems to work well now.
Also, the changed line in Pac-Mania fixed the corrupt screen problem on second run!!! May I suggest that you update the run script on the Obey to reflect the change?
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Tue Apr 10, 2018 12:01 pm @Jon: Xenon2 and Magic Pockets working great now. Joystick in Magic Pockets seems to work well now.
Finally...that was a mission and a half to resolve as I had to keep trapping the code further and further in, until the keyboard stopped working, then backtrack to figure out what the cause was. Very odd its not affecting my Pi2, I can only think there's been a change to the USB stack at some point that now relies on UpCallV.
Vanfanel wrote: Tue Apr 10, 2018 12:01 pm I suggest that you update the run script on the Obey to reflect the change?
Already done and in the obey.zip you downloaded ;)
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 later post), the change to UpCallV was causing the following games to crash:
  • Arcturus
  • Asylum
  • BlowPipe
  • Brutal Horse Power
  • Burn'Out
  • Drifter
  • Iron Lord
  • Pesky Muskrats
  • Zodiac - Aries: BlowPipe
I've changed UpCallV so it only passes UpCall's that are applicable to RISC OS 3.71 and earlier through to the game, I've also added the same functionality to the UpCall Environment handler.

I also noticed an issue in The Crystal Maze script while testing, which was causing it to randomly crash at startup or fail completely if a Joystick Module wasn't available.
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw »

Hi Jon,

Sorry, I have had a busy few days, so no RISC OS time! I think my next two tasks will be multiple buttons (just need to decide how to fit that onto the *command) and keyboard emulation. I have your example code on that, and I was also reading the RISC OS 5 USB keyboard driver for inspiration. What exactly have you added to ADFFS for keymapping?

A shim for Joystick sounds sensible, but highly annoying if it is only to fake an equivalent to RMEnsure in one game!!!

I think Vertical Twist also produced a driver module for the Serial Port hardware which provided the Acorn API. See VTJoystick module in the zip archive. So some games might have hooked into this. I am a little surprised as I thought Acorn's efforts with the A3010 were too little too late in every area!
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: USB Joystick driver

Post by richw »

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.
Post Reply