USBJoystick 0.12

USB Joystick driver for RISC OS 5
Post Reply
Vanfanel
Posts: 601
Joined: Mon Sep 16, 2013

Re: USB Joystick driver

Post by Vanfanel »

@Jon: Now I got it to work. I had to to what you said, about replacing in the !Run file:

Code: Select all

Run <Chuck$Dir>.JSTest
to

Code: Select all

RMLoad <Chuck$Dir>.JoyMod
Set JSflag 1 
I had reverted to the original line so different things weren't tried at once..

Now the joystick works! But the game quits via CTRL+SHIFT+F12 with: undefined instruction at &01A00048
JonAbbott
Posts: 3311
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Vanfanel wrote: Mon Apr 02, 2018 the game quits via CTRL+SHIFT+F12 with: undefined instruction at &01A00048
I can't reproduce the error, so suspect there may be another issue in your !Run. It should be:

Code: Select all

Set Chuck$Dir <Obey$dir>
Wimpslot -min 464K -max 464K
RMEnsure QTMTracker 1.44 RMLoad ADFFS:trackers.QTMModule
RMEnsure MusicModule2 0.09 RMLoad ADFFS:trackers.MusMod2
ADFReserveMemory 800K
IF ADFFS$OSVersion>=&35000 THEN ADFRemapVideoMemory 9 160 ELSE ScreenSize 160
IF ADFFS$OSVersion<&35000 THEN Echo <22><9>

IF ADFFS$CPUID>=&A10 THEN GOARM3JIT 0
RMLoad <Chuck$Dir>.JoyMod
Run <Chuck$Dir>.JSTest
Run <Chuck$Dir>.ChuckProg

MusSampleRate 2
FX 19
FX 19
Unset Chuck$Dir
IF JSflag>0 Then RMKill JoyStick
IF ADFFS$OSVersion>=&35000 THEN GOARM3JIT
IF ADFFS$OSVersion>=&35000 THEN ADFRemapVideoMemory
RMKill MusicModule2
RMKill QTMTracker
Unset JSflag
Vanfanel
Posts: 601
Joined: Mon Sep 16, 2013

Re: USB Joystick driver

Post by Vanfanel »

@Jon: Using your !Run, everything is now perfect with Chuck. Joystick works and no errors on quit.
JonAbbott
Posts: 3311
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

JonAbbott wrote: Mon Apr 02, 2018 JoyMod SWI block: CFFC0
0 - Joy_Read0 (returns RTFM Joystick 0 value R0 = %FUDLR)
1 - Joy_Read1 (returns RTFM Joystick 1 value R0 = %FUDLR)
2 - Joy_Test (Checks for RTFM and returns R0=255 - Nothing in Econet port, R0=128 - Econet present, R0=0 - RTFM present)
3 - Joy_ReadPipe (Input R1=?, R2=table pointer. If R1<&11 or >=&1B returns R1=[R2, R1]. For R1=&11..1A returns R1=0 or 1 depending on an internal table read)
Richard, do you want to add these SWI to USBJoystick? Joy_Read0, Joy_Read1 and Joy_Test are pretty straight forward to add. Joy_ReadPipe however is a problem, but we might get away with simply returning if the SWI is called. I've checked dumps of the following games and none use Joy_ReadPipe, so it's possibly its not used by any games:

Chuck Rock
Fire & Ice
Gods
Heimdall
Jahangir Khan World Championship Squash
James Pond
Krisalis Collection, The: Terramex
Lotus Turbo Challenge 2
Mad Professor Mariarti
Manchester United
Manchester United Europe
Nebulus
Pac-mania [Learning Curve version]
Revelation!
Sensible Soccer
Spheres of Chaos
SWIV

Gods, which according to the !ReadMe supports RTFM and Serial Port, doesn't in fact support either directly. The only Joystick related SWI's in the code are Joystick_Read. I can only guess that for RTFM and Serial Port support, it's relying on Joystick->Keyboard translation.
richw
Posts: 183
Joined: Sat Sep 14, 2013

Re: USB Joystick driver

Post by richw »

Jon, yeah, I will put those in. Sounds like a plan. Will any of those games do to test? I guess I can always knock up a bit of BASIC to confirm.

I shall have to look at the scaling again, as I thought that was licked!

Not sure I will have a chance tomorrow, but should on Wed.

Thanks for trying, chaps!
JonAbbott
Posts: 3311
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

Chuck Rock is probably the easiest to test as you can simply not load JoyMod in !Run (or obey.zip/F1008101 if booting.) The current obey.zip version doesn't in fact load JoyMod.

I'll go through all the scripts that use JoyMod at some point and modify them to not load it, if USBJoystick is loaded.
richw
Posts: 183
Joined: Sat Sep 14, 2013

Re: USB Joystick driver

Post by richw »

@Jon: Your joystick which is returning diff values... can you tell me the min/max/mid values from *USBJoystick_Read/List/Debug? I think I print those things out in one of those commands (read rings a bell).
JonAbbott
Posts: 3311
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

richw wrote: Tue Apr 03, 2018 @Jon: Your joystick which is returning diff values... can you tell me the min/max/mid values from *USBJoystick_Read/List/Debug? I think I print those things out in one of those commands (read rings a bell).
Detailed in my post:
The values returned by Joystick_Read are the wrong way round for me. All the way down is returning 0 (should be -127), centred is returning 127 (should be 0) and all the way up is returning -2 (should be 127). The Joystick axis read -512/-512 at top/left and 511/511 at bottom right.
Mid's are obviously 0, Min -512, Max 511
richw
Posts: 183
Joined: Sat Sep 14, 2013

Re: USB Joystick driver

Post by richw »

Thanks. I wrote that down, but for some reason I was doubting it. Not sure why! Anyway, I've put my scale function into a spreadsheet and can see why it is barfing, and have fixed it. Just need to put that into the C code, but I'll try and do that as I put the Joy SWIs in.

Note that I'll only be able to claim the SWIs by number (which I assume is how any assembled/compiled code would hit them). If you try by name, like SYS "Blah" then it won't be handled. But I wouldn't have thought any legacy code would be doing that.
JonAbbott
Posts: 3311
Joined: Thu Apr 11, 2013
Location: Essex
Contact:

Re: USB Joystick driver

Post by JonAbbott »

richw wrote: Tue Apr 03, 2018 Note that I'll only be able to claim the SWIs by number (which I assume is how any assembled/compiled code would hit them). If you try by name, like SYS "Blah" then it won't be handled. But I wouldn't have thought any legacy code would be doing that.
I believe that will be okay, the games are all machine code. IIRC even the BASIC test code uses the SWI number.
Post Reply