Help Remapping non-LibRetro games/systems
-
I was faced with these same issues all too frequently when I first jumped on the Pi. I tried quite a few different methods and found the path of least resistance to be mapping the controllers to keyboard input. Now everything just works and the best part is that I have a great deal of control over how it works.
Speaking directly to your request, the only comparable alternative I found was creating scripts that temporarily renamed the various
jsX
assignments tojs0
on launch. I also had mirrored scripts that would set the assignments back on exit. I ultimately abandoned this approach, as it became extremely hard to manage compared to the key-mapping alternative. -
I'm pretty much done adding systems to my setup. I really wanted Atari joysticks because the port also works with Sega controllers. I have it all inside an NES so obviously an NES controller was a must too. For 99% of my gaming though, I'm using an Xbox 360 controller because it's wireless and I just love the way it feels in my hands (and that it has lots of buttons and can work as a PlayStation controller too). For the most part, using the Joystick-Selector addon works great if I want to switch to one of the classic controllers for a short while. The problem I have is with the systems that aren't LibRetro, where you have to use whatever control scheme the the emulator wants you to use. Atari800 (emulator) and Streets of Rage remix are both examples of this.
When you say you created a script that renames the
jsX
assignments temporarily, then back as needed, what all was involved with that? It seems like that would be the simplest approach for the time being. Are there any guides? -
@hansolo77 said in Help Remapping non-LibRetro games/systems:
It seems like that would be the simplest approach for the time being.
Renaming the
jsX
assignments is nothing more involved than knowing what all the assignments are going to be in advance, renaming the currentjs0
to a placeholder of your choosing and then finally renaming the intendedjsX
tojs0
. In practice, an example would look like:mv /dev/inputs/js0 /dev/inputs/placeholder mv /dev/inputs/jsX /dev/inputs/js0
Like any other scriptable approach to this problem, you now need to be able to execute these scripts based on the software they are meant to accompany. While I don't know of any guides that cover this off the top of my head, @MadHorse's case statement from the xboxdrv keymapping guide is very close to what I was originally using when I tried this myself and could be adapted to fit your needs. Instead of calling upon the xboxdrv commands, you could just replace them with the commands to rename the
jsX
assignments. This would of course necessitate some trial and error, but really any solution to this problem is likely to require similar finesse in some way. -
Wow I just looked at that link... WAY over my head.. :( Maybe it's because I'm half asleep. I'll see if I can figure it out tomorrow. Unless you happen to be able to reply with some simple tips! :) (I know, wishful thinking lol!)
-
Unfortunately, these types of tailored control issues are just tough to overcome in many cases. It literally ran me away from RetroPie in the beginning, but after I saw the lack of flexibility in the alternatives such as RecalBox and Lakka, I took a second look, then a third, fourth and so on until I had a grasp on something that suited me. Granted, it came at the cost of my sanity, but I've always believed that to be highly overrated anyway. I'm sure you'll find a solution that works for you as well.
-
I guess I'm just confused on where I put those
mv
lines at. Do I need to create a new script, and have it called from an existing script? Or can I just add it to whatever existing script I have that involves the emulator? Like, I know there's a/home/pi/retropie/roms/ports/Streets of Rage Remix.sh
file. Can I just add thosemv
lines to before and after the command inside that file? Or would I need to do something more than that? I don't have any problem experimenting, I just need a place to start. Anyway, I'm done for the night. Thanks for your help! -
@hansolo77 said in Help Remapping non-LibRetro games/systems:
Can I just add those mv lines to before and after the command inside that file?
It's a great place to start. Just make a backup of the script first and there's really no downside to trying it.
-
OK, so a bit of work, I have a working "swap" in my script:
#!/bin/bash sudo mv /dev/input/js0 /dev/input/js99 && sudo mv /dev/input/js5 /dev/input/js0 "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" "" sudo mv /dev/input/js0 /dev/input/js5 && sudo mv /dev/input/js99 /dev/input/js0
When that launches from EmulationStation, the game loads up. I then SSH into my Pi and do a
jstest /dev/input/js0
and see that it has changed to the Xbox controller (which is onjs5
). However, inside the game, it still doesn't recognize the controller. I connected my Sega controller to the Mayflash (js3
andjs4
) and it wasn't picked up either. Then I connected my NES controller (js1
andjs2
) and it was recognized. So I had an 'aha!' moment, in that the game is looking for input onjs1
and notjs0
. So I made the changes to the launch script, verified in SSH that it swapped, and tried to remap the buttons again. Still nothing. The NES gamepad though was still being recognized. ARGH!!!! So apparently it's not a matter of which controller is plugged in where, but a matter of the game recognizing the device as a controller. And in this particular case, it only likes my keyboard and the NES pad. :(I think this is the point where I pull my hair out. Is this where I'd need to use Joy2Key or something? How do I set that up?
-
I started thinking about all this a bit later after we talked and remembered some other of my own issues with this approach. There are indeed many times that this will work, but it's not a magic bullet, as quite a few emulators actually make use of the first joystick event rather than js0. Unfortunately I was never able to find a way to change how the joystick event order is set. Most of what I did find led me to believe that it's just not possible. I was hoping for the best here too.
Is this where I'd need to use Joy2Key or something? How do I set that up?
I haven't yet learned how to use all the key-mapping alternatives, but Joy2Key is definitely one I'd like to look at sometime in the future. Outside of xboxdrv, Joymap and Linux Joystick Mapper are also options to consider.
-
It sounds like xboxdrv is your favorite. Is it possible to use it just for 1 or 2 systems, or is it a complete replacement to the default xpad driver? How hard is it to setup? Can you give me some pointers/tips?
-
@hansolo77 said in Help Remapping non-LibRetro games/systems:
It sounds like xboxdrv is your favorite.
It is, but I do recognize that it's not a simple thing to jump into. After a cursory look at the different options when I was starting out, xboxdrv seemed to be the most versatile solution. The others seem to lack a valuable feature to me here or there, but they also seem a bit easier to setup and that can of course be a valuable trade-off to many people. I've even noticed a few features from other mappers that don't exist in xboxdrv.
Is it possible to use it just for 1 or 2 systems, or is it a complete replacement to the default xpad driver?
It can indeed be used with one or two systems. When used in conjunction with the xpad driver, the following line would need to be added.
--detach-kernel-driver
As I have never tried this myself, I'll leave the explaination to the xboxdrv manpage entry:
"Detaches the kernel driver that is currently associated with the given device. This is useful when you have the xpad module loaded and want to use xboxdrv without unloading it."
Can you give me some pointers/tips?
Again, I'll be honest. All this is not exactly easy. You may even find out that it's still not the right approach for your particular setup. However, if you find that it does work for you, it becomes pretty easy to configure these mappings over time.
When I started looking into this, there wasn't even an available guide, so I had to pour through the manpage and seek out help on other forums that made similar use of the software. As far as following the guide here on the wiki is concerned. I would recommend reading closely, asking questions and eat it one bite at a time. Any problems that will prevent it from working on your setup will present themselves in the first few steps, so you won't really waste any time.
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.