USBJoystick 0.12
Re: USB Joystick driver
Hmm. I could see if I can do the scaling without the floats - some sort of integer only approximation.
I wonder about the limitations from C, yet when I was looking at the code for EtherUSB, there were comments regarding reentrancy. If it is possible to code a network driver and an SD card file system in C, then you would think a Joystick doable!
Does ADFFS need to call Joystick_Read for the Econet discovery? Could you not return a fixed value? Or do your own Read when ADDFS starts, and remember that?
I wonder about the limitations from C, yet when I was looking at the code for EtherUSB, there were comments regarding reentrancy. If it is possible to code a network driver and an SD card file system in C, then you would think a Joystick doable!
Does ADFFS need to call Joystick_Read for the Econet discovery? Could you not return a fixed value? Or do your own Read when ADDFS starts, and remember that?
Re: USB Joystick driver
Updated Modules / obey.zip attached (see later post). I've switched RTFM support to be done via a CallBack to avoid SWI re-entrancy. Delete !ADFFS.override and replace it with the copy in the ZIP, which will fix crashing that's occurring with games that have overrides.
I've tested every game that supports RTFM except Tactic and Bubble Fair as they require a keypad. Nevryon appears to be the only one I can't get to recognise a Joystick; from looking at its source, it looks like the Mouse possibly overrides RTFM support.
I've tested every game that supports RTFM except Tactic and Bubble Fair as they require a keypad. Nevryon appears to be the only one I can't get to recognise a Joystick; from looking at its source, it looks like the Mouse possibly overrides RTFM support.
Re: USB Joystick driver
It calls Joystick_Read 50 times a second whilst the blitter is active and updates the Econet registers accordingly. Ideally it should call Joystick_Read when the Econet port is queried, but that will cause issues if IRQsema is set.
The only other option I can think of is to get the address of the RTFM Joystick values from USBJoystick and directly load them in the IOC handler, avoiding SWI's. The obvious disadvantage to that approach is that it's then dependent on USBJoystick.
Re: USB Joystick driver
I've now added Joystick->Key translation to ADFFS, via *ADFJoystickKeys. For example, to allow Joystick support in Catalyst enter the following (or add it to the !Run if it's HD installed):
The number are the Low-Level Internal Key Numbers in the order Right, Left, Down, Up, Fire. It also supports a second Joystick if you append a further five values.
Note that I've not tested it in many games, only Catalyst and Cyber Ape.
Richard, if you want to add this to USBJoystick, the code is as follows:
Code: Select all
ADFJoystickKeys &4F &4E &57 &46 &47
Note that I've not tested it in many games, only Catalyst and Cyber Ape.
Richard, if you want to add this to USBJoystick, the code is as follows:
Code: Select all
;Entry:
; R2 - previous RTFM Joystick state
; R3 - current RTFM Joystick state
; R4 - key map table (+0=right +1=left +2=down +3=up +4=fire)
._key_translate
STMFD R13!, {R0-R5, R9, R14}
MOV R9, #19 ;Vector_KeyV
EOR R2, R2, R3 ;bit set if changed
MOV R5, #5
._L2
LDRB R1, [R4], #1 ;R1=key to press/release
TEQ R1, #0 ;is there a mapping?
BEQ _P1 ;NO
MOVS R2, R2, LSR #1 ;C set if changed
ANDCS R0, R3, #1
ADDCS R0, R0, #1 ;R0 1=released or 2=pressed
SWICS XOS_CallAVector
MOV R3, R3, LSR #1
._P1
SUBS R5, R5, #1
BNE _L2
LDMFD R13!, {R0-R5, R9, PC}
Re: USB Joystick driver
@Jon: With this new version, the joystick in Overload only works intermitently... Was working fine before.
Re: USB Joystick driver
I can't reproduce the problem. Looking at it's code it only supports Joystick_Read (Acorn's interface), so ADFFS shouldn't affect it as that's provided directly by USBJoystick.
Re: USB Joystick driver
Well, I don't know what to say. I am seeing that. Can you upload your RiscOS ROM so we have the exact same version? We already have two discrepancies: this and Pacmania's corrupt screen on second run.
Re: USB Joystick driver
It's not that I disbelieve you, it is the sort of problem that will occur with the Joystick being read via CallBack. Regards Pac-mania, what's the F number of the version you're seeing the issue with, I've probably been testing the wrong version.
Whilst pondering the issue overnight (C Modules being a bad idea if IRQsema is active or the SVC stack is not aligned to a 1mb boundary), I might have a solution. Instead of passing Joystick_Read through to USBJoystick, I'll handle Joystick_Read internally within the JIT's SWI handler. I can then move ADFFS' Joystick code back into the VSync handler, so its definitely read on time and avoid the use of CallBack's, it will also resolve any IRQsema related issues.
Re: USB Joystick driver
Updated Modules attached (see later post) which move Joystick_Read into the JIT's SWI handler. This should hopefully resolve all lag issues and crashing caused by IRQsema.
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 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.
Re: USB Joystick driver
@Jon: With these new modules:
-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.
-Overload is back to normal, works fine again.
-Xenon 2 control is as bad (or worse) than how it was in Overload before! Directions seem to be wrong, only detected sometimes, etc...
As for Pac-Mania, it's F1044701, which is the Learning Curve version.
-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.
-Overload is back to normal, works fine again.
-Xenon 2 control is as bad (or worse) than how it was in Overload before! Directions seem to be wrong, only detected sometimes, etc...
As for Pac-Mania, it's F1044701, which is the Learning Curve version.
Last edited by Vanfanel on Sun Apr 08, 2018 8:36 pm, edited 1 time in total.