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

Retroarch Core Input Remapping for Keyboard Encoders



  • Hi all,

    I'm somewhat new to this, but managed to get most everything working just like I like it. There's one thing that's frustrating me, though, and that's core input remapping for FBNeo. I have seen lots of guides and advice which make sense, but don't seem to work.

    Here's the background:

    • RetroPie 4.5.1 on a Pi3b with an UltimateIO encoder
    • Being on an UltimateIO, my buttons are keyboard keys. The default ones, in fact.
    • RGBCommander is running fine. I wouldn't think it matters, but someone said it did once.

    Here is the relevant section of all/retroarch.cfg:

    input_libretro_device_p1 = 3
    input_libretro_device_p2 = 3
    
    input_player1_a = "ctrl"
    input_player1_b = "alt"
    input_player1_y = "shift"
    input_player1_x = "space"
    input_player1_start = "v"
    input_player1_select = "c" 
    input_player1_l = "z"
    input_player1_r = "x"
    input_player1_left = "left" 
    input_player1_right = "right"
    input_player1_up = "up"
    input_player1_down = "down"
    
    input_player2_a = "a"
    input_player2_b = "s"
    input_player2_y = "w"
    input_player2_x = "q"
    input_player2_start = "l"
    input_player2_select = "j"
    input_player2_l = "i"
    input_player2_r = "k"
    input_player2_left = "d"
    input_player2_right = "g"
    input_player2_up = "r"
    input_player2_down = "f"
    

    At this point, everything works fine for most emulators, and I don't want to change it. Select/Start work as COIN1/P1_START in FBNeo, which is great. That catch is that, for FBNeo only, I want to use my dedicated Coin and 1-Up buttons instead as select and start. They correspond to the following keystrokes:

    • 1 is 1-Up
    • 2 is 2-Up
    • 5 is 1-Coin
    • 6 is 2-Coin

    So I follow the various guides to Core Input Remapping. Since I have specified keyboard input with this:

    input_libretro_device_p1 = 3
    input_libretro_device_p2 = 3
    

    I have all the various keyboard inputs available to me in the input remapper screen. I set Select and Start to 5/1 and 6/2 respectively and save the core remap file. Here's entirety of the remap file after I make those changes (only) and hit save:

    input_libretro_device_p1 = "3"
    input_libretro_device_p2 = "3"
    input_libretro_device_p3 = "1"
    input_libretro_device_p4 = "1"
    input_libretro_device_p5 = "1"
    input_player1_analog_dpad_mode = "0"
    input_player1_key_select = "53"
    input_player1_key_start = "49"
    input_player2_analog_dpad_mode = "0"
    input_player2_key_select = "54"
    input_player2_key_start = "50"
    input_player3_analog_dpad_mode = "0"
    input_player3_btn_start = "-1"
    input_player4_analog_dpad_mode = "0"
    input_player5_analog_dpad_mode = "0"
    

    So I see the input device for P1 and P2 set for 3 (Keyboard).
    I see the inputs set as key codes (53/49 and 54/50) which I understand and expect.

    The problem is that it doesn't DO anything. Select and Start are still tied to v/c/l/j and still work. The core remap file loads as expected when I start a new game, but has no effect.

    That said, I've tried several things:

    • I've mapped the coin/start keys to L2/R2/L3/R3 in EmulationStation, and then tried setting joypad input in Retroarch and mapping them that way. didn't work, and not my preferred method anyway.
    • I've tried flipping from "5" to "num5", and so forth. No effect.
    • I've remapped a whole bunch of buttons to "5" in the hopes to just see it work for ANY remap, and so far no effect.
    • I've verified that the buttons themselves do work (they work perfectly and as you'd expect in Mame2003, 2010, and AdvMame)
    • I've tried just using a keyboard, which functions exactly the same as the joystick (c/v are coin/start, 5/1 do nothing)

    What am I missing?



  • this version of xarcade2joystick is supposed to work with any keyboard encoder to capture the events and act as 2 separate joysticks, making it a lot easier to configure in emulationstation

    https://github.com/substring/Xarcade2Jstick/tree/xarcade-with-anykbd



  • Is there a benefit to using xarcade2joystick over just configuring the UltimateIO to be two gamepad controllers instead of a keyboard encoder?

    Also, how would this address remapping? I don't want to change how the buttons are presented to EmulationStation, I just want to change JUST FBAlpha's mapping.



  • ....or rather, FBNeo, too be accurate.



  • the benefit would be that you will be able to easily configure the 2 controllers in emulationstation and they will then be auto configured in all emulators, including fbneo.



  • That would be a great benefit if it worked, but it does not.

    I built and installed xarcade2joystick from the latest. Out of the box (or make anyway) it's looking for the xarcade, which isn't there. There's a note on git about using -e to specify an input event to bind to, but the binary doesn't recognize -e as an option, and all it will say is that xarcade isn't detected, retrying (forever).

    For funzies, I:

    • re-flashed the UltimateIO with the dual-GP firmware
    • set all the pins to the appropriate gamepad buttons.
    • reset EmulationStation inputs via retropie-setup. (which was apparently a mistake because now run command pops up the launch menu every single time, so that's something else to fix now)
    • went through the gamepad setup in EmulationStation for both gamepad devices.
    • remapped all my Mame2003 controls for consistency

    I tested the controls in Mame2003 - they work fine.
    I tested the controls in a couple of libretro emulators (NES, Megadrive) and they work fine.
    I tested the controls in FBNeo, and they work fine.

    I tried to remap the buttons via Core Input Remaps as described in the top post, and got the exact same (lack of) outcome - the remaps are completely ignored in favor of the defaults.



  • @Shandower

    the version i linked is not the same as the one you can install via retropie setup and yes, you need to use the -e switch and define the event you want to capture.

    but if you can configure the keyboard encoder to act as joysticks, then the problem should be solved, unless you messed something up.

    after reflashing, does it act as 2 joysticks or only 1 and have you tested using jstest command?



  • Thank you for your efforts, but I don't think you're reading my actual posts. I specifically said I got it from GitHub -your exact link, in fact- and built it, and did not mention retropie setup except when I erased the EmulationStation configs to start fresh.

    That said, I have determined the cause and solved the issue. For anyone else struggling with this, here's what I did and how I got there:

    Since all/retroarch.cfg was working fine, but fba/retroarch.cfg didn't seem to be working, I decided to remove a step and temporarily adjust the all/retroarch.cfg to work the way I wanted FBA to work. This couldn't be a long term solution, because it necessarily messed up all the other libretro emulator maps, which I didn't want to do.

    Focusing just on start and select (for clarity), this is what all/retroarch.cfg looked like to start with:

    input_player1_start = "c"
    input_player1_select = "v"
    input_player2_start = "l"
    input_player2_select = "j"
    

    Knowing that this mapping was working fine, I changed it to what I WANTED it to look like for FBA when I was done:

    input_player1_start = "1"
    input_player1_select = "5"
    input_player2_start = "2"
    input_player2_select = "6"
    

    I tried it, and... it didn't work! Not from buttons or from the attached USB keyboard. So I chose some semi-arbitrary letters that weren't used anywhere else in the config or on the UltimateIO board. It just so happens that these letters are the Mame defaults for P4's buttons.

    input_player1_start = "e"
    input_player1_select = "b"
    input_player2_start = "h"
    input_player2_select = "m"
    

    I tried again with the USB keyboard, and IT WORKED!.

    I connected the UltimateIO to WinIPAC and reset my board to the keyboard encoder mode that I had previously. I then reassigned the COIN and START pins to be e/b/h/m keypresses.

    I reconnected the Ipac to the cabinet and low and behold - success with the buttons.

    I went back into all/retroarch.cfg and reset the mappings back to the original state (which you will recall was what I wanted for all the other libretro emulators). I then added the above four lines to fba/retroarch.cfg.

    I fired it up and... COMPLETE SUCCESS!

    So the problem wasn't with the remapping per se, it was with the target binding. For some reason, libretro just REALLY doesn't want you to use numbers on the keyboard.

    For completeness, I went through the Core Input Remap process (though it was no longer necessary, given I had hardcoded the correct mappings in) and confirmed that the remapping DOES indeed work, IF I gave it letters instead of numbers.



  • @Shandower
    i do read posts, but considdering that you wrote "out the box" i assumed you installed xarcade2joystick via the retropie setup script.

    either way, if this works for you, then it doesnt really matter anyway



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.