Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Switching USB joysticks & Emulator Settings  (Read 3694 times)

0 Members and 1 Guest are viewing this topic.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Switching USB joysticks & Emulator Settings
« on: June 26, 2012, 03:27:12 pm »
I'm considering making a showcase-like cabinet for our rec room, and I'm thinking about making "loose" wired controllers.  I'll make a variety of controllers; a couple Street Fighter sticks, a couple Neo Geo-style sticks (doubling as player 3&4 sticks), and maybe a 4-way or trackball or some other specialized sticks.  They'll all sit on the lap or on a coffee table or TV stand.  I'll also use USB gamepads, like my USB-adapted Wii "classic" controllers when playing NES/NES games.

My question is, how would one set up a bunch of different joysticks to work with MAME and other emulators?  The problem I'm seeing is this: I plug in Stick #1 to play Street Fighter 2 in MAME, configured for all six buttons.  Later I want to play Dig Dug, so I pull out Stick #1 and plug in Stick #2 (which has a 4-way).  Now, won't MAME see the different joystick and force me to reconfigure my controls?  And then when I later plug in a fancy new Robotron stick I made won't I have to do it again?

Does anyone know how to make this kind of thing "plug & play", so I can just plug in the stick I want and it Just Works?  What I don't want is to have to reconfigure my emulators (MAME, SNES9x, etc) every time I plug in a stick.  That's what I have to do in my current cab when switching between my (keyboard) stick and USB gamepad, and it's not family-friendly like I want for this new cab.

Any ideas?  Has anyone done this sort of thing?  How about you modular guys?

Nephasth

  • Guest
  • Trade Count: (0)
Re: Switching USB joysticks & Emulator Settings
« Reply #1 on: June 26, 2012, 03:39:11 pm »
You could just use one encoder (the Lono2 is one device that can handle 4 joysticks) and wire it and your controllers with a common connector. This way the computer will always be seeing those joysticks since the encoder is plugged into the computer, and all your controllers will use the same inputs on the encoder, so you won't have to remap controls. As far as gamepads go, you'll most likely use those for different emulators than MAME, and there may be some flexibility with those, but you might want to look into drventure's controller remap utility...

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Switching USB joysticks & Emulator Settings
« Reply #2 on: June 26, 2012, 04:37:14 pm »
Nephasth is right, easiest would be one encoder so that all sticks are seen by the OS all the time.

If you must plug and unplug sticks, at least for MAME anyway, ControllerRemap will probably be your best bet. See my sig for the thread detailing it.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #3 on: June 26, 2012, 05:18:42 pm »
Cool, thanks guys.  I had no idea where to start searching for this kind of thing.

I would prefer to use USB just because I need to stretch across a room, and 10ft USB cables are easy.  If I can get a USB solution to this problem I also gain the ability to use any kind of joystick, including USB-ized NES gamepads.  I thought about using IDE or Centronics parallel connectors but that seems like a lot more wiring work.

So lets say I've got two Street Fighter 2 sticks and four 4-way sticks (with two buttons each).  If I'm reading it right, ControllerRemap will let me plug in the two SF2 sticks and designate them joysticks 1 and 2 and map all their buttons.  Then I can unplug them all and plug in my 4-way sticks and designate them 1, 2, 3, and 4, and ControllerRemap will make sure MAME sees the first two as the "same" as the SF2 sticks... I just won't be able to press those extra four buttons of course.  And if I for some reason just plugged in the stick I designated #4, I wouldn't have a Player 1 at all.

And it does this by rewriting the MAME.ini every time it is run, so I just make sure it runs before MAME does?

This seems like it would work really well for me, so long as all my joysticks are actual Windows joysticks, and not keyboards (which they will be).  I could even sub in a gamepad or a regular USB joystick, although I'd be at the mercy of the button ordering that the maker of the joystick defined, right?

It seems like so long as I'm the one building the sticks, and the controllers I use define stuff consistently (ie: joystick1, joystick2, button1, button2, etc), the joysticks then become swappable?

What happens if I plug in, say, a steering wheel with three analog axes?  I presume as I plug in a ton of different devices MAME just assumes then that I have a super duper Joystick #1 with a billion buttons and a bunch of analog axes?

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Switching USB joysticks & Emulator Settings
« Reply #4 on: June 26, 2012, 05:34:12 pm »
If I'm reading it right, ControllerRemap will let me plug in the two SF2 sticks and designate them joysticks 1 and 2 and map all their buttons.  Then I can unplug them all and plug in my 4-way sticks and designate them 1, 2, 3, and 4, and ControllerRemap will make sure MAME sees the first two as the "same" as the SF2 sticks... I just won't be able to press those extra four buttons of course.  And if I for some reason just plugged in the stick I designated #4, I wouldn't have a Player 1 at all.
And it does this by rewriting the MAME.ini every time it is run, so I just make sure it runs before MAME does?

More or less, that's correct.

It'd be harder to explain here than it would be to just pull to help PDF and follow through it, but basically, you create a "Controller" definition, say "LogitechGamepad1" that is bound to that specific controller via it's USB ID.

Then in your CTLRL file, where you want to use that controller, your reference it directly, instead of using the typical mame references.

Finally, you're right. Right before you launch mame, just run ControllerRemap and point it to your cntrlr file, it runs through and rewrites the controller file, replacing entries for any controllers that are currently visible (and just leaving any entries for controllers that are no longer plugged in).

But the help file details the operation in much better detail.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #5 on: June 26, 2012, 09:13:45 pm »
Wow, drventure, I just spent some time reading through the documentation for ControllerRemap.  That's pretty comprehensive!  It'll take me a while to digest all that.

Thanks for writing this utility.  When I get a chance to start putting controllers together (have to move into the house before I can set up the rec room :) ) I'll be poring over your utility.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Switching USB joysticks & Emulator Settings
« Reply #6 on: June 26, 2012, 10:15:00 pm »
Thanks. I had similar problems to yours. I wish I had time to really dive into the mame source and fix it up to essentially do the same thing internally, but, that'll take more time than I have to devote to it right now, sadly.

But ControllerRemap works pretty good in the interim.

It can seem a bit daunting when you first starting reading about it. My advice is to try and get just one joystick/usb device working first. Once you've gone through that and see how all the pieces fit together, the rest should be pretty easy.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #7 on: June 26, 2012, 10:44:56 pm »
Yeah, it looks like the kind of thing that's easiest to learn by doing.  I just need to build the sticks that are going to cause me this problem first.   ;D

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Switching USB joysticks & Emulator Settings
« Reply #8 on: June 26, 2012, 10:47:34 pm »
Have you considered hacking those wireless pads? I've seen any number of "fight stick" type builds that were completely wireless because they made use of a hacked wireless controller.

Might be another option (and alleviate stringing USB cords across the room  :)

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #9 on: June 27, 2012, 01:08:34 pm »
I was hoping to avoid hacking gamepads, but wireless is an intriguing idea.  That would be really handy considering it's a big room and people will be scattered all around the room, unlike with my upright.

Hm, thanks for the idea.  I'll have to keep an eye out for wireless gamepads.

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10994
  • Last login:July 06, 2024, 08:43:49 pm
  • Awesome face!
Re: Switching USB joysticks & Emulator Settings
« Reply #10 on: June 27, 2012, 10:06:58 pm »
Why would people be scattered all over the room with separate controls? That is more complex and less functional than just having a control panel on a stand. At that point you should just have wireless Xbox 360 gamepads and a tv set.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #11 on: June 27, 2012, 10:22:28 pm »
Well, the reasons are particular to my setup, really.  The room has a big projection screen TV, and standing anywhere near it to use a 4P control panel gets out of the TV's sweet spot viewing angle-wise.  Sitting down it looks great.  But I can't really crowd four people around a cabinet while sitting down.  Not without making it obscenely large.

I'm considering making a 1-2 player sit-down stand (heh) for those times when I've only got two people.  But when I have only two people we'll probably head over to my upright cab anyway.  I'd generally prefer to use that, but I don't have the space to dedicate to a 4P cab.

Four loose sticks seems the best way to get four people into the game in the space I have available.  Besides, I am reminded of the last time someone was at my place playing on my upright cab and asked me if we could play on the big screen TV instead.  Sacrilege, I know.  :)

As for the 360 gamepads, they suck for most arcade games IMHO.  I did enough shroyukens on an SNES gamepad as a kid that I don't want that pain anymore.

paigeoliver

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10994
  • Last login:July 06, 2024, 08:43:49 pm
  • Awesome face!
Re: Switching USB joysticks & Emulator Settings
« Reply #12 on: June 27, 2012, 10:33:33 pm »
Is there a couch or something? If so then build the controls into the coffee table. Loose fighter sticks isn't going to work all that well.
Acceptance of Zen philosophy is marred slightly by the nagging thought that if all things are interconnected, then all things must be in some way involved with Pauly Shore.

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #13 on: June 27, 2012, 10:49:53 pm »
Yeah, it's a big sectional, which is great for the room, but crappy for this kind of thing.  The coffee table can't be moved close enough to reach a stick while sitting.

I've got some TV dinner-style stands around the house that I figure we can use if the lap thing doesn't pan out.  I'm hoping it will be good enough for guests and 4P games of Teenage Mutant Ninja Turtles or NBA Jam.

I have a feeling I'm going to be making a whole lot of shoebox mockups before I get this right.  :)

Gray_Area

  • -Banned-
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3363
  • Last login:June 23, 2013, 06:52:30 pm
  • -Banned-
Re: Switching USB joysticks & Emulator Settings
« Reply #14 on: June 30, 2012, 12:24:36 am »
I would have a dedicated arcade cabinet in the room.
-Banned-

ChrisK

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 96
  • Last login:April 23, 2017, 12:06:50 pm
Re: Switching USB joysticks & Emulator Settings
« Reply #15 on: June 30, 2012, 06:19:24 pm »
I will have my cab in the same room, actually.  But it's a two player cab and I want something for four players, and to hook up my PC steering wheel to play whatever driving games I can get to work with my particular wheel (Fanatec Porsche wheel).