Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

lr-fuse Joypad to Keyboard mapping



  • Hi all,

    The last few weeks I've been getting more and more nostalgic for my ZX Spectrum games, and since I only play on a set up without a keyboard, many of the good games there (Head Over Heels, and others that need more than one fire button) were impractical to play.

    I put together a PR for lr-fuse that enables users to map keyboard inputs to joypad buttons, so that the joypad can emulate keypresses. The good folks at lr-fuse have kindly helped a lot throughout the process and have just merged the PR, so (I believe) anyone who now updates lr-fuse from source will be able to map keyboard inputs to joypad buttons and enjoy more games. :)

    Some notes:

    • Keyboard mappings are set in the Options menu. They'll override the joystick you choose.
    • You can save per-game option files to store keyboard mappings for specific games. I believe you also need to set RetroArch to load per-game config files in Settings > Configuration (?). Don't quite recall.
    • Also added support for L2, R2, L3, R3 and Start buttons to be mapped.

    A million thanks for leiradel and fr500 from lr-fuse (I don't think they're here in the forums, but if they run into this, this wouldn't have been done without their precious guidance).

    Have a great weekend.



  • It's about time leiradel updated it to the latest version ! Although i'm not sure if he knows how to, several people have asked several times over the last few years and he said 'Yes' he'll update it, but still no update. Standard Fuse has had 2 years of updates since then. I'd rather use a keyboard with the latest version, it is a computer after all ! (Thanks for the update though).



  • @maxbeanz well, one step at a time, I suppose. What are the key changes that the latest fuse version has they lr-fuse doesn't, out of curiosity?

    Thanks.



  • @pjft yes it's merged : https://github.com/libretro/fuse-libretro/commits/master

    Really a big thanks to you, i love the ZXSpectrum <3
    I will try it.
    And playing with joystick on TV is really better for me, and my little children, i want they know this old cool computer :)
    So bad we don't have this great feature for some other LR Computers emulators ....
    Thanks a lot



  • @pjft said in lr-fuse Joypad to Keyboard mapping:

    @maxbeanz well, one step at a time, I suppose. What are the key changes that the latest fuse version has they lr-fuse doesn't, out of curiosity?

    Thanks.

    Mainly compatibility updates, lr-fuse is based on v1.1 (nearly 2 years old). There have also been improvements with Fast Loading protected games like Alkatraz Protection, tape loading detection improvements, TRD/SCL files can now autoboot, proper Recreated ZX Spectrum Keyboard support, RZX playback improvements and probably lots of other cool stuff.

    EDIT: If you only use Z80 files then you probably wouldn't notice any difference anyway. lr-fuse will do the job.



  • @maxbeanz said in lr-fuse Joypad to Keyboard mapping:

    Mainly compatibility updates, lr-fuse is based on v1.1 (nearly 2 years old). There have also been improvements with Fast Loading protected games like Alkatraz Protection, tape loading detection improvements, TRD/SCL files can now autoboot, proper Recreated ZX Spectrum Keyboard support, RZX playback improvements and probably lots of other cool stuff.

    Hoooo excellent, i can be excellent if some one port these updates :)
    Fast loading is always a good option :)



  • I would welcome a ZX Spectrum emulator with greater focus on 'controller led play', particularly if it would allow the play of games like Bruce Lee or Gauntlet with 2 players :D



  • @horaceandspider couldn't you play Bruce Lee in the current lr-fuse builds already even prior to this change? Player 1 set to Kempston, player 2 set to Interface 2 and off you go?



  • @pjft I have never had a great deal with fuse-lr as a “plug and play” solution.

    Always seemed to end up in endless menu navigation just to set something like that up. Maybe I need to check the latest versions, but I remember zesarux was friendlier for setting custom controls but didn’t (doesn’t?) support multiple controller play unfortunately.

    Bruce Lee requires for example “enter” to start iirc, and then games like Gauntlet which have loads of joystick options but need the magic key (shift?) for each player!



  • @horaceandspider wasn't aware of the Gauntlet controls, but for Bruce Lee other than accessing the on screen keyboard once to get things started I don't think you'll have much trouble with it.



  • @pjft

    Yes OSK is ok to “do the job” but my interest in this thread is for a fully remapped solution :)



  • @horaceandspider you can remap Start as Enter and save it as a game for option file, I suppose.



  • @pjft

    This is what I’ve looked to do, but as I said above I seem to end going round in circles on the menus.

    although I confess I am not a massive fan of the libretro/retroarch menu system anyway....

    I guess I’ll just watch and wait with interest :)



  • @horaceandspider I have taken a look at Bruce Lee and Gauntlet and here's how I have managed to get both games working with controllers for two players.

    For both games, I took @pjft's suggestion of player 1 using the Kempston joystick and player 2 the Interface 2. To configure this, you can add the following lines to /opt/retropie/configs/zxspectrum/retroarch.cfg:

    input_libretro_device_p1 = "513"
    input_libretro_device_p2 = "1025"
    

    It's worth nothing that, in lr-fuse, by default, buttons L1 and R1 are mapped to RETURN and SPACE respectively so you can use L1 to start a game in Bruce Lee.

    Menus are best navigated using the onscreen keyboard. I see little gain in trying to map navigation to a controller, especially in the case of Gauntlet which requires the cursor joystick to navigate the menus. The numbers 5 to 8 from onscreen keyboard can be used to choose an option and Space (R1) to make the selection.

    For magic in Gaunlet, player 1 uses the Caps key. This can now be mapped to a controller thanks to @pjft's keyboard mapping update. If you want to avoid using the RGUI, you can create a text file GAUNT128.opt (or whatever the tape name is minus the extension) in the folder /opt/retropie/configs/all/retroarch/config/fuse. You can create the fuse folder if it doesn't exist. To this file, add the following:

    fuse_joypad_y = "Caps"
    fuse_machine = "Spectrum 128K"
    

    I have mapped magic to the Y button but you can map to your preferred button. Note, after you have launched Gauntlet, the game options file will auto-fill with default values for the other parameters.

    For player 2, magic is the Space bar which is already be mapped to R1.

    I have tested both games and they work reasonably well, though I haven't got far enough in Gauntlet to test the magic but the relevant buttons on both controllers did make a sound when pressed.



  • @dudleydes said in lr-fuse Joypad to Keyboard mapping:

    especially in the case of Gauntlet which requires the cursor joystick to navigate the menus. The numbers 5 to 8 from onscreen keyboard can be used to choose an option and Space (R1) to make the selection.

    Thanks. But just to note you can select the 'protec' controller and use the cursors on the menu all from the same controller at once.

    Menus are best navigated using the onscreen keyboard. I see little gain in trying to map navigation to a controller

    I respectfully disagree, but this is a personal preference. I am trying to create a comfortable 'pick up and play' experience, not just for myself, but also for others who might use the machine, and I still want to avoid any OSK usage where i can.

    I think maybe a little bit too much focus is being spent on the specfic games i mentioned... these were 'off the top of my head' example. There are so many that require a bit of keyboard input (or something like SkoolDaze that requires a hell of a lot of customisation!) , or a game like say jetpac would benefit just from having the 'select kempston' and 'start' menu controls mapped... or better still the game should start with mapping for the keyboard controls and then just use 'start' to ... well... start the game!

    Greateful for the feedback, and i will look at what you have suggested for the editing of the retroarch file(s).... just a shame not to have a nice clear and easy GUI approach to this which is easy to navigate to, but as i said before , this could be as a result of my dislike of the RGUI interface.

    I have yet to try the latest update from pjft 's update though. I have been so focused on Amiga development that i must admit my ZX Spectrum love has been left to neglect somewhat.

    Just to note, in your examples, although working, I would want some consistency, so for example, if i was mapping the magic for player 1 to 'y' i would want player 2 to be the same... so certainly there is need for a bit ore input in many cases than just the default.



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.