Saving Key Mapping Configuration when using !JoyKeys by Ian Jeffray

discuss the archimedes & risc pc, peripherals and risc os/risc os on pi
Post Reply
User avatar
!FOZ!
Posts: 620
Joined: Sun Oct 24, 2021 6:02 am
Contact:

Saving Key Mapping Configuration when using !JoyKeys by Ian Jeffray

Post by !FOZ! »

I have been using the amazing !JoyKeys app and module to enable Joystick support in many games.

https://ian.jeffray.co.uk/riscos/joypad/

I noticed in the !Help file Ian mentions a possible enhancement to save an Obey file representing the mappings chosen in the UI.

This would allow automated mapping setup in a given games !Run file for example.

Attached is a replacement !RunImage file based on the latest version that implements this.

Once applied simply then shift double click to open the app and you will see your last settings in !JoyKeysCf. :D

Thanks to Ian for building this awesome tool! =D>

Code: Select all

 3271 CFG=OPENOUT("<Obey$Dir>.!JoyKeysCfg")
 3280 FORn=1 TO 12
 3290   IF map(n)= 9 A$+=B$:B$="":sel$=" "+STR$n
 3300   IF map(n)=10 A$+=B$:B$="":men$=" "+STR$n
 3310   IF map(n)=11 A$+=B$:B$="":adj$=" "+STR$n
 3320   OSCLI"JoyKeysEmulateKey "+STR$n+" "+STR$map(n)
 3321   BPUT#CFG,"JoyKeysEmulateKey "+STR$n+" "+STR$map(n)
 3330 NEXT
 3340 IF B$="" A$+=sel$+men$+adj$
 3350 OSCLI"JoyKeysEmulateMouse "+A$
 3351 BPUT#CFG,"JoyKeysEmulateMouse "+A$
 3352 CLOSE#CFG
P.S. The above lines inserted into Ian's code, are 3271,3321, 3351 and 3352. These 4 lines represent my first real BBC Basic code on an Archie in many many years! I am sure it can be improved - but thought I would share as is for now.
Attachments
joykeyspatch.adl.zip
(37.75 KiB) Downloaded 19 times
Electron,+1,+3
BBC B,GoTek,Boobip 64k SRAM + 64k EEPROM,Speech, BeebSID,VideoNula,Pi Copro
BBC Master,BeebSCSI,UPUSFS,MultiOS,GoTek,DS12887 RTC,VideoNula,Pi Corpo,Mouse,MasterSD,User Port x2
A3000,GoTek,4MB,Watford IDE,CF HD
A5000 Alpha,4MB,CF HD
Pandemo69
Posts: 20
Joined: Wed Jan 12, 2022 5:49 am
Contact:

Re: Saving Key Mapping Configuration when using !JoyKeys by Ian Jeffray

Post by Pandemo69 »

Thank you Ian Jeffray, for this great JoyPad interface.

I built it, and it works fine. In the help file you mentioned a possibility to save the assignment of the keys.
Thanks to the idea of !FOZ! I created a way to save the setting. Thank you !FOZ!

All you have to do is change or add the following lines:

Code: Select all

 
  570
  580CFG=OPENIN("<Obey$Dir>.!JoyCfg")
  581  FORn=1TO12
  582    w$=GET$#CFG:map(n)=VAL(w$)
  583  NEXT
  584  m$=GET$#CFG:movement=VAL(m$)
  585IF VAL(m$)=1 PROCr(keyboard2, 108, movement<<1)
  586CLOSE#CFG
  590

 3220A$="":MO$="0"

 3230IF movement A$=" -move":MO$="1"

 3271CFG=OPENOUT("<Obey$Dir>.!JoyCfg")

 3351BPUT#CFG,MO$
 3352BPUT#CFG,"JoyKeysEmulateMouse "+A$
 3353CLOSE#CFG
 
The data “!JoyCfg” is also required BEFORE THE FIRST START (can be blank). Now every time you exit !JoyKeys, the key assignment and mouse settings are saved and loaded the next time you start.

It's probably not the most elegant solution, but I wrote my last BASIC listing years ago.

If someone likes it, I hope you enjoy it.

@Ian: It's a shame that the first keyboard (A30x0) wasn't finished. :)

Greetings. Pan
Attachments
!JoyKeys.zip
(23.12 KiB) Downloaded 5 times
Post Reply

Return to “32-bit acorn hardware”