Joystick support changes

Discuss ADFFS development and download test releases
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Joystick support changes

Post by JonAbbott »

Last week, I started looking at adding Joystick support for games that do not natively support Joysticks.

I started working through the games from A-Z, the first two I hit were 2060 BC, which needs buttons for flapping and picking/dropping things and Alerion which needs two fire buttons. So...off the back of those two games I completely rewrote the * command for mapping Joysticks to keys, so it supports up to 8 fire buttons.

I've also modified the direction key mapping, so it also checks the 16bit Joystick interface which USBJoystick maps to thumb wheels if available. So on XB360 controllers you can use the thumb sticks, or D-Pad to move.

Alerion has however thrown up an issue I need to investigate. When Joystick keymapping is enabled, Alerion randomly crashes which appears to be down to ADFFS calling the KeyV vector to trigger the key press. I've tried various workarounds, such as calling KeyV via CallBack, checking for threading etc. None of which worked.

I think what I'm going to do is continue adding Joystick key mapping to games and see just how many are affected - its possible it is simply a re-entry bug in Alerion which needs patching.

Abuse and Blood Lust pose another challenge as they use the mouse for the fire direction, so I need to figure out a solution. I did try using the mouse mapping in USBJoystick, but couldn't get it working - I've not had a chance yet to figure out why that didn't work.

Games with Joystick support added (2.74):
  • F10001 2067 BC (1993) (Oregan Developments)
  • F10006 Aggressor (1992) (Atomic Software)
  • F10643 Aggressor Macho Edition (1992) (Matt Black)
  • F10706 Alien Invasion (1990) (Alien Images)
  • F10010 Alerion (1988) (DABS Press)
  • F10015 Alone In the Dark (1995) (Krisalis Software)
  • F10231 Ballarena (1990) (Sisteme)
  • F10036 Ballarena (1994) (Uffenkamp Computer Systeme)
  • F10038 Battle Chess (1993) (Krisalis Software)
  • F10041 Big Bang (1996) (Psycore)
  • F10046 Blitz! (1991) (Arxe Systems)
  • F10048 Blood Sport (1993) (Matt Black)
  • F10047 BloodLust (1998) (The Fourth Dimension)
  • F10052 Bobby Blockhead vs The Dark Planet (1991) (Atomic Software)
  • F10053 Boogie Buggy (1991) (The Fourth Dimension)
  • F10058 Bubble Impact [demo version] (1997) (Moving Pixels)
  • F10059 Bug Hunter & Moondash (1990) (Minerva)
  • F10060 Bug Hunter in Space (1990) (Minerva)
  • F10065 Cannon Fodder (1994) (Krisalis Software)
  • F10067 Carnage Inc. (1993) (The Fourth Dimension)
  • F10355 Cascade (1992) (Milo Shaffer and Richard Norman)
  • F10071 Cataclysm (1991) (The Fourth Dimension)
  • F10482 Cataclysm [SA version] (1998) (The Fourth Dimension)
  • F10072 Caverns (1991) (Minerva)
  • F10624 Chequered Flag [RO3 version] (1992) (Cambridge International Software) (steering only reliable when stick pulled down)
  • F10089 Confusion (1989) (Cambridge International Software)
  • F10095 Crisis (1990) (Cambridge International Software)
  • F10157 Fireball II (1990) (Cambridge International Software)
  • F10202 Hoverbod (1988) (Minerva)
  • F10565 Humanoids and Robotix (1993) (Cambridge International Software) (Humanoids not ideal, as left/right need to switch direction. Robotix not ideal, as it needs the right thumbstick as the fire direction)
  • F10204 Ibix the Viking (1989) (Minerva)
  • F10213 Jet Fighter (1988) (Minerva) (needs to ignore a centred Joystick)
  • F10220 KerBang! (1991) (Eterna)
  • F10253 Missile Control (1988) (Minerva)
  • F10270 Orion (1988) (Minerva) (not ideal, as left/right need to switch direction)
  • F10289 Provocator (1991) (Computer Tutorial Services)
  • F10303 Redshift (1990) (Minerva)
  • F10327 Serpents (1993) (Cambridge International Software)
  • F10362 Talisman (1989) (Minerva)
  • F10366 Terramex (1988) (Grandslam Entertainments)
  • F10367 Thundermonk (1989) (Minerva)
  • F10402 Zarch (1987) (Superior Software) (needs to ignore a centred Joystick)
Games with Joystick support fixed:
  • F10153 Fine Racer (1991) (Eterna) (previously expected the Joystick on RTFM port 2)
richw
Posts: 159
Joined: Sat Sep 14, 2013 9:05 pm

Re: Joystick support changes

Post by richw »

I think I had some issues getting the mouse emulation to work, so that will be my bad. I think it is unfinished.

I really must get the Pi out, as it has been hibernating for some time!
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

richw wrote: Thu Nov 19, 2020 12:38 am I think I had some issues getting the mouse emulation to work, so that will be my bad. I think it is unfinished.
Thanks for confirming what I suspected.

The version of USB Joystick publicly available here and the version bundled with ADFFS are a few versions out of step...ADFFS being several versions ahead, which might explain it.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

I've put an ADFFS beta package up, with support for the games in the OP.

Although the Alerion package has also been updated, it's currently crashing due to the Joystick checks; please ignore testing it until I come up with a fix.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

JonAbbott wrote: Thu Dec 24, 2020 4:46 pm Although the Alerion package has also been updated, it's currently crashing due to the Joystick checks; please ignore testing it until I come up with a fix.
This is now resolved. It was a combination of bugs in the game itself, not only did it alter R13 in its IRQ handler, without disabling IRQ's, but also didn't handle IRQ re-entrancy.

ADFFS 2.74h beta is now up, along with the updated packages for the games above to add Joystick support.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

ADFFS 2.74k beta has been uploaded for testing. Many Joystick changes such as adding DeadZone and Mouse support, damping is still work-in-progress.

It now also writes any changes back to floppy images if they are either ADF or JFD with the Auto flush flag set. JFD's can take some time to save and as I've yet to add an hourglass, it can appear to lock the machine whilst its saving - this is particularity noticeable if it needs to write the image file at shutdown.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: Joystick support changes

Post by Vanfanel »

@Jon This is truly fantastic to see new betas with improved joystick support!!
IS there anything special to test on games? Previously I had 1 button support working with latest stable ADFFS (2 buttons support so we can avoid the "up-to-jump" syndrome would be great!).
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

It supports 8 Joystick buttons, the D-pad, the first thumb-stick and eight directions. Which game is up/jump mapped to the same button? I am aware that there’s a need to split the D-Pad and Thumb-stick, or support two Thumb-sticks in some games. Bloodlust for example.

There’s nothing specific to test, only to confirm games with Joystick support added still work correctly and don’t crash.

I’m hoping to have another beta up soon with Mouse support in a more polished state and some games updated to use it.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

ADFFS 2.74n beta is now up for testing. I've fixed several bugs in the Joystick commands and Mouse support is now in a better state that I feel is good enough to release. Zarch now supports Joystick control, although it does take some getting used to with auto-centring Joysticks.

Joystick support is backported to RISC OS 3.x, so this should be suitable for all machines and all makes/models of Joystick.

I'm aiming to release this along with the public game updates above by Christmas. If I get time, I'll go through the ~30 releasable games that currently don't have Joystick support and update them in parallel.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: Joystick support changes

Post by JonAbbott »

Hold off on testing 2.74n, there's a bug in the key mapping which is not observing the Deadzone correctly and its not accounting for the game/OS changing the mouse position or observing the mouse bounding box. I'm working through those issues and will get another beta uploaded soon.
Post Reply