Set up keyboard to look like 2 devices

I’m thinking of this as an alternative to another problem that seems unsolveable. (I say that after a lot of research and posts on multiple forums - still hoping to work it out.)

Is it possible to set up a keyboard to look like it’s two controllers? My thought is that if I go into RGUI and set up keys on the left side of the keyboard with Port 1 Bindings and the keys on the right side under Port 2 Bindings, that will make it look like the keyboard is 2 separate controllers.

Will this work? If not, is there another way to set up a keyboard to behave as if it’s two separate controllers?

That should work, yeah. I have an I-PAC and J-PAC, both of which report themselves as keyboards (using the default MAME layout) and I have them hooked up to 2 sets of buttons with no issues.

Mine is a Mini-PAC, pre-wired in the console. Basically, it’s two Mini-PACs, one for the spinner (that I can’t get to be recognized - you’ve seen that issue!), and the other has all the buttons, joysticks, and trackball. I can put the Mini-PACs into 3 modes, one is keyboard. When I do that, the spinner has worked, but not the trackball.

So I have only one keyboard, but I’d like to make it look like 2 separate devices.

My thought was if I mapped some keys to Port 1 Bindings and some to Port 2 Bindings, that I might get it to be seen as two different controllers.

It’ll still be seen as a single physical device. However, you might be able to use something like antimicro to map some keyboard functions to a virtual gamepad device.

Like I said in the other post, though: RetroArch will only let you have a single mouse hooked up per player/port. If you have your trackball hooked up as a mouse, it’s not going to let you hook your spinner up as a mouse to the same player/port.

That’s what’s confusing: I have the spinner hooked up on a 2nd port, but it can’t see it at all. Even when I change the settings in retroarch.cfg to specifically use the spinner on the 2nd port.

@hunterk: Okay, rereading this. Let me do some rephrasing to make sure I get everything.

I get that you’re saying I can only have a single mouse hooked up per player per port. So if I have two mice hooked up, a trackball and spinner, I can only use one as Player 1. I get that. But I’m not clear about the rest.

The trackball is plugged into one USB controller and the spinner is plugged into another. Does RetroArch automatically classify one of those as Port 1 and one as Port 2? In other words, does RetroArch care what physical USB port the mouse device is plugged into? Or does it only care about the device node used to access it in /dev/input/mouseX or /dev/input/eventX?

In other words, should I be able to specify, in Port 1 Binds, whether to use /dev/input/mouse0 to use the trackball or, instead, specify /dev/input/mouse1 and use that instead?

Or does Port 1 refer ONLY to a specific controller on a specific USB connection?

the physical location shouldn’t matter, no.

So if I have two mouse devices, I should be able to tell RetroArch, “Use /dev/input/mouse0” or, “Use /dev/input/mouse1” and it should use the one I specify, regardless of what port it’s plugged into?

If that’s true, then that’s the heart of my problem: No matter what I try, I can only get RetroArch to see and take input from /dev/input/mouse0. It cannot see or use /dev/input/mouse1. When I also had a mouse plugged in, it would only see the mouse and never the trackball or spinner.

it should, yeah. I don’t have any experience with it myself, and it’s not a particularly battle-tested feature, so it’s possible that it’s broken or never worked completely in the first place.

I would recommend trying back a few stables and see if it ever worked as expected. If so, it broke. If not, it probably never worked right.

Okay. I’ll experiment.

I also had another situation that doesn’t make sense in this context, which is why I asked about the possibility of making a keyboard look like 2 devices.

When I first set everything up, the controllers were in Keyboard Mode. (I don’t know if that’s an UltraMarc thing or if it’s something Xtensions added to it. I suspect it’s UltraMarc, since it seems Xtensions isn’t doing anything other than assembling parts.) At that time, I had a USB keyboard that was a keyboard/mouse combo. I couldn’t plug in the keyboard without plugging in the mouse.

It would always set up like this:

/dev/input/mouse0 = trackball /dev/input/mouse1 = mouse /dev/input/mouse2 = spinner

When I had that running, I could use the mouse and spinner. So RetroArch was recognizing TWO devices, and not just the first one. (Other than this, it seems RetroArch was stuck on /dev/input/mouse0 and ignores anything else.)

Since I’ve seen it work that way, one test will be to go back to keyboard mode and see if I can get two devices recognized. (The obvious solution being that if I can get both recognized at all, I can use ROM specific config files to use the one I want.) If that works, I’ll just manually edit the retroarch.cfg files (by “manually edit,” I mean using RGUI - just bypassing the EmulationStation setup) to “split” the keyboard and have some keys in Port 1 Binds and some in Port 2 Binds.

Considering that multiple mice have worked for other people when they’ve used multiple light guns, I would think, if they upgraded, that there would be bug reports and complaints that it’s not working. I realize they’re using one light gun per player, but my issue isn’t about different players, it’s that the 2nd device is not seen at all. But I have multiple images of RetroPie on different micro-SD cards and I can try some earlier versions without much trouble.


This all brings up a couple other related questions. If I need to put them in new topics, I can:

  1. I see references in some threads to adding mame2003-mame_current_mouse_enable = "enabled" to opt/retropie/configs/all/retroarch-core-options.cfg. I grep’ed that file and other config files and saw no such line. The reference I saw to that was from 2018, so I figure RetroArch could include that automatically by now. Any thoughts on that? I was thinking I might as well add it and see if it helps. I also wasn’t sure if “mame2003-mame” would be the same as mame-libretro2003 or not.

  2. I’ve searched, but am not finding an “all in one” guide to all the options and settings for RetroArch. Is there such a thing? (That might help me with hunting down config settings like the one above that might be important.)

  3. Since the physical location doesn’t matter, are “Port” and “Player” not always linked? In other words “Player1” controls might include buttons and more from different ports?

  1. that would be a core option. It wouldn’t be included in RetroArch. Whether or not it still exists in the core, I wouldn’t know, but I know that core hasn’t gotten a ton of work since then, so it’s probably still the same. mame2003 is the core name (and thus, the prefix for the option), mame_current_mouse_enable is the actual option. So, it appears in the file as mame2003-mame_current_mouse_enable.

  2. No, again, that’s a core option, so it won’t be in RetroArch itself. Most of the cores’ options are documented in their own core docs pages. For RetroArch’s options, the best documentation is usually the sublabels visible within the menus themselves and/or when you press ‘select’ to give the extended info.

  3. Port and Player should be the same (or at least linked). That is, Player 1 == Port 1 binds. Port 1 binds == the pad that’s “configured in port 0” in the notifications.

GOT IT!

And it makes no sense to me at all.

Again, here’s what I have:

/dev/input/mouse0: Trackball /dev/input/mouse1: Spinner

And that’s IT for /dev/input/mouseX. If X > 1, the device node just doesn’t exist.

Under events:

/dev/input/event3 = Trackball /dev/input/event6 = Spinner

When I tried cat /dev/input/eventX with event ≠ 3 or 6, I got no input at all from the trackball or spinner.

So when I was in Port 1 Binds, I’d set the Mouse Index to 0, 1, 3, & 6. I’ve seen documentation that says that it’s the event, not the mouse node that matters. But only 0 would work with the trackball. All other numbers would NOT work.

I had, previously, when I had a mouse hooked up (and, I think, when I was using the older version of RetroPie), tried running through 0-10 for Mouse Index in RGUI and got nothing. ONLY 0 would work, and only with the trackball.

But today I tried, almost by accident, using 2 for the Mouse Index and the spinner worked!

I don’t see why. I have mouse0 and mouse1. The only events that showed any input for the mouse devices were 3 & 6, and only when I tested them with cat /dev/input/eventX, and not with RetroArch at all.

I’m wondering if there could be a bug with the Mouse Index numbers in RetroArch. I would think the Mouse Index would be the same number as the mouse device node or the event node. Or that the index would not skip over a blank. (In this case, it skips 1 - go from 0 for trackball to 2 for spinner.)

So it works. If possible, I’d like to know why, but I’m just glad I got it working. There’s other alterations I want to make to my config, but I didn’t want them to get in the way of this issue, so I’ve waited to do them.

This also provides support for the answer to one of my questions: I used Port 1 for almost everything and Port 2 for the spinner, so that’s proof that the virtual pad for Player 1 can use devices from ports other than 1.

Adding to the original issue of this thread: Making the keyboard look like two controllers:

I used the RGUI to go in and edit the Port 2 Binds to use specific keys on the keyboard and then tested it in Street Fighter. Both fighters were easily and properly controlled by the two joysticks and all the buttons. So all I had to do was specify which keys were for Port 1 and which were for Port 2. It now behaves like 2 controllers.

1 Like

I would like some help in this area, sorry im such a NOOB! i also have a mouse i want to use in lieu of a spinner or trackball. primarily for a game i like in Mame2003.(Tempest tubes). i can also emulate this rom from FBA neo, however i haven’t tried to get the mouse working there yet. I have tried to set up the spinner in the mame menu “for this game” however the mouse movement is not registering!

i can however use the mouse buttons. they are detected. also i CAN use my mouse in other games that demand it like those in ScummVM. and in my desktop under “ports” as well as with dosbox games like wolfenstein 3-D i have looked through the retroarch screens and am not finding any “mouse enable/disable” options. i have looked in every menu i can find anything helpfull

i have searched for places to make config changes. nothing is matching any help i am finding. this is a raspberry Pi 3B+ running retropie, emulation station, and Mame2003. mouse control is via an external usb device for keyboard also.