Jump to content
LaunchBox Community Forums

Windows 10 keeps changing controller id's for MAME


darrenmarchand

Recommended Posts

Hi guys,

 

I thought I had this problem solved. I took the suggestion of someone to setup the general controls in MAME then set the default.cfg to READ ONLY. Also, setting special controls per game when needed and setting those to READ ONLY. That seemed to work, but Windows will still randomly change my arcade stick designations. I don't unplug any of the USB controllers btw.

 I have a custom built arcade controller with 3 sticks, multiple buttons, a tracball and spinner. I also have a gun, racing wheel and gamepad. everything is connected to a usb hub with power buttons for each (the arcade controller with all the sticks and buttons is all in one. Inside the box, all devices are connected to a usb hub, then that hub is connected to the powered hub). I only power on the controller that I need. So, if I'm in mame, the whole arcade controller with all sticks and buttons is powered on.  I don't think Windows changes things after every reboot, but it does eventually change the designations. Is there anything that I might have missed? I read that there's a MAME function using the command prompt, but this seems very complicated and I have a LOT of controllers. Is there a better way?

 

thanks

Link to comment
Share on other sites

3 hours ago, darrenmarchand said:

I read that there's a MAME function using the command prompt, but this seems very complicated and I have a LOT of controllers. Is there a better way?

If we're talking the same thing, it does appear complicated, but it's not overly complicated.  You'll use the Command Prompt just once to get a list of all your controller ID's.  Once you get those, it's a matter of following the rest of 'the guide' to set them up for MAME.

https://docs.mamedev.org/advanced/devicemap.html

There are supposedly some third party programs out there that can help with this.  Not just for MAME, but other emulators/situations as well.  But I've never tried any.

There've been several (many?) posts here on the forums and probably even some YT videos.  You'll want to look for 'stable controller IDs' or 'stable IDs'  or a variant thereof.

Link to comment
Share on other sites

13 hours ago, JoeViking245 said:

If we're talking the same thing, it does appear complicated, but it's not overly complicated.  You'll use the Command Prompt just once to get a list of all your controller ID's.  Once you get those, it's a matter of following the rest of 'the guide' to set them up for MAME.

https://docs.mamedev.org/advanced/devicemap.html

There are supposedly some third party programs out there that can help with this.  Not just for MAME, but other emulators/situations as well.  But I've never tried any.

There've been several (many?) posts here on the forums and probably even some YT videos.  You'll want to look for 'stable controller IDs' or 'stable IDs'  or a variant thereof.

Ok. Thanks. I'll give it a try.

Link to comment
Share on other sites

  • 3 weeks later...
On 4/17/2021 at 7:23 PM, JoeViking245 said:

If we're talking the same thing, it does appear complicated, but it's not overly complicated.  You'll use the Command Prompt just once to get a list of all your controller ID's.  Once you get those, it's a matter of following the rest of 'the guide' to set them up for MAME.

https://docs.mamedev.org/advanced/devicemap.html

There are supposedly some third party programs out there that can help with this.  Not just for MAME, but other emulators/situations as well.  But I've never tried any.

There've been several (many?) posts here on the forums and probably even some YT videos.  You'll want to look for 'stable controller IDs' or 'stable IDs'  or a variant thereof.

Hi,

 

I'll probably tackle this in a few days, but I just have a couple questions. I had read that after setting up the controller in mame, you can go into the config file for the game (that Mame creates) and set it to Read Only and that would keep the controller from changing. That obviously isn't working. My question is, if I follow the device mapping instructions, do I need to do anything else after setting up my controllers in Mame? Normally, I'd go in and set up general (default) controls for most games, then set game specific controls for certain games. Then Mame creates those config files for each. I don't want to keep setting up specific controls for games in mame, only to have it change (like what's been happening). Basically, I've been setting up the joysticks (#1, 2, or 3) for a Meme game, then at random, Windows changes the order or designation of that joystick.

My other question is, I don't need to worry about the trackball, spinner or racing wheel, correct? Just the 3 joysticks?

thanks in advance!

Link to comment
Share on other sites

7 hours ago, darrenmarchand said:

you can go into the config file for the game (that Mame creates) and set it to Read Only and that would keep the controller from changing. That obviously isn't working.

Yes and No.  Windows switching around the controller input 'locations' (ports) when you unplug, plug-in and/or reboot is their little gift to us.  But what they can't change is the controllers' (devices) ID's.  Call it a unique serial number each device has.  When you do the steps from the above link, you'll be getting and saving these ID's and setting them to the respective 'controller #' for MAME.  So then at this point, MAME doesn't care which port they're plugged into.  It reads the 'serial numbers' from all ports, then matches those to what you have setup in your config file for controller #'s.

8 hours ago, darrenmarchand said:

I don't need to worry about the trackball, spinner or racing wheel, correct? Just the 3 joysticks?

Ya, you probably should. At least the wheel, the gun, the gamepad (if you intend to use it with MAME) as well as the cab joy's and buttons.  The trackball is usually 'just a mouse'.  So should be fine.  I honestly have no idea about the spinner.

Generally, what you want to do is:

  1. plug in   E V E R Y   D E V I C E   you have. 
  2. Set up all the default inputs in MAME for each player/device. 
  3. Get the ID's from every device as they are set up "now" (step 2). 
  4. Modify the config file to associate the ID's  (step 3) with the players/devices (step 2)
  5. Play games.

Don't know if you stumbled across this during your research, but it kind lays out these steps in a little more detail. Except step 5.  That always stays the same. ;) 

Oh... and to be clear, all this is for stand alone MAME only.  No RetroArch-MAME or some offshoot branch of MAME shtuff.  Just good ol' fashioned MAME.  It may work for those also. But this can of worms would end up turning into a barrel of snakes.  Just sayin'. :D

Link to comment
Share on other sites

22 minutes ago, JoeViking245 said:

Yes and No.  Windows switching around the controller input 'locations' (ports) when you unplug, plug-in and/or reboot is their little gift to us.  But what they can't change is the controllers' (devices) ID's.  Call it a unique serial number each device has.  When you do the steps from the above link, you'll be getting and saving these ID's and setting them to the respective 'controller #' for MAME.  So then at this point, MAME doesn't care which port they're plugged into.  It reads the 'serial numbers' from all ports, then matches those to what you have setup in your config file for controller #'s.

Ya, you probably should. At least the wheel, the gun, the gamepad (if you intend to use it with MAME) as well as the cab joy's and buttons.  The trackball is usually 'just a mouse'.  So should be fine.  I honestly have no idea about the spinner.

Generally, what you want to do is:

  1. plug in   E V E R Y   D E V I C E   you have. 
  2. Set up all the default inputs in MAME for each player/device. 
  3. Get the ID's from every device as they are set up "now" (step 2). 
  4. Modify the config file to associate the ID's  (step 3) with the players/devices (step 2)
  5. Play games.

Don't know if you stumbled across this during your research, but it kind lays out these steps in a little more detail. Except step 5.  That always stays the same. ;) 

Oh... and to be clear, all this is for stand alone MAME only.  No RetroArch-MAME or some offshoot branch of MAME shtuff.  Just good ol' fashioned MAME.  It may work for those also. But this can of worms would end up turning into a barrel of snakes.  Just sayin'. :D

Actually,  after some reading, I did have a quick question. If I follow this, then I set up joystick 1 in Mame as my default controls for most games, can I still set joystick 2 or joystick 3 in Mame for specific games and it'll save that?

So, I'd have all 3 joysticks set in the ame configuration file with the 3 seperate ID's. In Mame, joystick 1 is set to default. And say, joystick 3 is set to control Defender. In general, is this correct?

Link to comment
Share on other sites

14 minutes ago, darrenmarchand said:

can I still set joystick 2 or joystick 3 in Mame for specific games and it'll save that?

Yes. You can save game-specific configurations that will override the [created] default configuration.  When playing a game and you go into the MAME menu (press Tab) and you select Input (this Machine) and make changes, those game-specific 'changes' will be automatically saved and will ONLY ever be used buy that specific game, every time it's loaded.

You'll find 'this' game-specific configuration file in the "cfg" folder:    ../MAME/cfg/defender.cfg

Link to comment
Share on other sites

Thanks for the reply. I did know about the seperate cfg files for games, what I meant was I would only need 1 file with all the controller ID's in the ctrl folder, correct? I don't need to create seperate ones? My setup is a bit different.  I'm not setting the controllers up as player 1, player 2. I'm setting it up based on joystick 1 is a 4 way, joystick 2 is an 8 way and joystick 3 is a Tron style stick - all for specific games. 

So once I have the ID'S set in the ctrl folder, I just set the default joystick and then if I want a game specific controller for say Tron, I set that up under "this machine", then Mame creates those cfg's. Then I'm good to go. Do I have that right?

 

Thanks again for clarifying.

Link to comment
Share on other sites

50 minutes ago, darrenmarchand said:

I'm not setting the controllers up as player 1, player 2. I'm setting it up based on joystick 1 is a 4 way, joystick 2 is an 8 way and joystick 3 is a Tron style stick - all for specific games. 

Wait!  So your cab isn't setup for 3 players, but just 3 'types' of controls?  Remember that 'can of worms' I mentioned?  lol  Just kidding.

I think then what you're wanting to do is create 3 different config files.  For each one, you setup Player 1 controls with the respective joystick.  Then save them individually as something like "4way.cfg", "8way.cfg" and "flightStick.cfg" (or something that's easy for you to remember).  (in each one of the 3, you'll add the respective ID's and JOYCODE_1)

Then in your mame.ini file, have the "CORE INPUT OPTIONS" section set ctrlr to 8way.cfg

#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr                     8way

Since this is [probably] the most common, this will be the default.

Unfortunately there's not a way (that I'm aware of) for MAME to automatically load a 'special' configuration file based on controller type used.  

1 hour ago, darrenmarchand said:

if I want a game specific controller for say Tron, I set that up under "this machine", then Mame creates those cfg's. Then I'm good to go.

If you did this, I think you'd still need to then edit each of these cfg's to add the ID info.   

Since you've created the 4way.cfg and flightStick.cfg configuration files, what you can do is create a game (machine/rom) specific ini file that only needs one line of text in it.  Then save these files in   ../MAME/ini/

i.e. create "tron.ini", and in it, have the line

ctrlr       flightStick

No more. No less.  ("tron" being the rom name only. v.s. the games full 'Title')

 

Not to add more to the confusion...  Another option [instead of creating a zillion ini files] is, in LaunchBox, for all the games that use, i.e. a 4-way joystick, you can use the Custom Command-Line Parameter "-ctrlr 4way".  If you happen to have Categories for your Arcade Platform... i.e.

image.png.f17182ed6a81b0a5c7bde5592d2916b8.png

..you can Bulk Edit the Custom Command-Line Parameters for the respective category.

Link to comment
Share on other sites

So if I understand you correctly,  I can't have 1 cfg file with all 3 joysticks? I have to create 3 different ones? That's fine, but under Core Input Options, I can only put 1 in there (8wayconfig in your example)? Do I do this first before setting the default and game specific controls within Mame?

So, as long as I have 3 config files (1 for each joystick), then I go into Mame and load Tron up and under "this machine" set the controller to use my Tron style stick, Mame creates that Tron.cgfg (or .ini, I can't remember) and then each time I load Tron up, that specific controller loads up? I won't run into Windows changing it anymore? 

Would I put my wheel, gun and gamepad still in the default cfg still? Along with the 8way.

 

Sorry for so many questions.  I just want to get it right. 

Link to comment
Share on other sites

1 hour ago, darrenmarchand said:

I can't have 1 cfg file with all 3 joysticks?

I was just about to no.  But....   Since your cab is just one player... you can have just one cfg file.  (A total brain fart, afterthought on my part)  When you set your General Inputs for Player 1 Controls, i.e. for P1 UP, You'll set all 3 joysticks to UP.  So it'll say [something along the lines of ]

P1 UP     Joy1Up OR Joy2UP OR Joy3UP
P1 DOWN   Joy1Down OR Joy2Down OR Joy3Down
P1 LEFT   Joy1Left OR Joy3Left OR Joy3Left
(and so on down the line)

What it actually calls the joysticks/numbers is probably different, but you get the idea.  To be clear, this is what it 'may' look like in MAME when setting it up.  It'll look totally different in the .cfg file where you'll add in the ID info.  

Might as well throw the wheel, gun and gamepad in here too.  So you might end up with ["something like"]

P1 UP    Joy1Up OR Joy2UP OR Joy3UP OR gamePad_UP

So ya, just the one .cfg file.  And this will handle any input from any of the various 'controllers' for your one player cab.  Still do the part where you copy it to the "ctrlr" folder and add all the ID info in.  Give the file a special name like "MyCustomControlsThatJoeVikingHelpedMeWith.cfg".  Or something simpler like "MyCabControls.cfg".  Whatever you want to call it.  (best not to have any spaces in the name)  And then in "mame.ini", set the ctrlr line (as before) to this cfg. 

Disregard what I mentioned about the rom_name.ini files (like "tron.ini").  Disregard needing to add Custom Command-Line Parameters.  And if you had set up  game-specific controls, you 'should' be able to delete those cfg files (like "tron.cfg" that would have gotten saved to your ../MAME/cfg/ folder).   Note: those game-specific cfg files will also save other misc info like # of times played.  So if you delete them, they will reappear on their own. 

Sorry for my confusion, confusing you.  hope I haven't made matters even more so confusing. lol ;) 

Link to comment
Share on other sites

2 hours ago, JoeViking245 said:

I was just about to no.  But....   Since your cab is just one player... you can have just one cfg file.  (A total brain fart, afterthought on my part)  When you set your General Inputs for Player 1 Controls, i.e. for P1 UP, You'll set all 3 joysticks to UP.  So it'll say [something along the lines of ]


P1 UP     Joy1Up OR Joy2UP OR Joy3UP
P1 DOWN   Joy1Down OR Joy2Down OR Joy3Down
P1 LEFT   Joy1Left OR Joy3Left OR Joy3Left
(and so on down the line)

What it actually calls the joysticks/numbers is probably different, but you get the idea.  To be clear, this is what it 'may' look like in MAME when setting it up.  It'll look totally different in the .cfg file where you'll add in the ID info.  

Might as well throw the wheel, gun and gamepad in here too.  So you might end up with ["something like"]

P1 UP    Joy1Up OR Joy2UP OR Joy3UP OR gamePad_UP

So ya, just the one .cfg file.  And this will handle any input from any of the various 'controllers' for your one player cab.  Still do the part where you copy it to the "ctrlr" folder and add all the ID info in.  Give the file a special name like "MyCustomControlsThatJoeVikingHelpedMeWith.cfg".  Or something simpler like "MyCabControls.cfg".  Whatever you want to call it.  (best not to have any spaces in the name)  And then in "mame.ini", set the ctrlr line (as before) to this cfg. 

Disregard what I mentioned about the rom_name.ini files (like "tron.ini").  Disregard needing to add Custom Command-Line Parameters.  And if you had set up  game-specific controls, you 'should' be able to delete those cfg files (like "tron.cfg" that would have gotten saved to your ../MAME/cfg/ folder).   Note: those game-specific cfg files will also save other misc info like # of times played.  So if you delete them, they will reappear on their own. 

Sorry for my confusion, confusing you.  hope I haven't made matters even more so confusing. lol ;) 

Sorry. Should all 3 joysticks say "joycode 1"? Or is it ok for them to say joycode 1, 2, 3 etc? Or does that matter?

Link to comment
Share on other sites

(I deleted and moved some stuff for readability here.  DO NOT DELETE ANYTHING LIKE I DID)

<mapdevice device="Generic   USB  Joystick"                             controller="JOYCODE_1" />
<mapdevice device="Generic   USB  Joystick"                             controller="JOYCODE_2" />
<mapdevice device="Xinmotek Controller device id: Xinmotek Controller"  controller="JOYCODE_3" />
<mapdevice device="XInput Player 1 device id: XInput Player 1"          controller="JOYCODE_4" /> 

<port type="P1_JOYSTICK_UP">
  <newseq type="standard">
    JOYCODE_1_YAXIS_UP_SWITCH OR JOYCODE_2_YAXIS_UP_SWITCH OR JOYCODE_4_YAXIS_UP_SWITCH OR JOYCODE_5_YAXIS_UP_SWITCH
  </newseq>

1st 4 lines show "JOYCODE_1"   "JOYCODE_2"   "JOYCODE_3"   "JOYCODE_4"   (note: 1, 2, 3, 4)

The 2nd to last line here references JOYCODE_1, 2, 4, 5  (note: 1, 2, 4, 5)

So when you tested this, it probably didn't work for the last 2 controllers correctly.

Based on what I'm seeing, the 1st 4 lines should point to 1, 2, 4, 5   OR   (less likely)  the 2nd to last line needs to reference 1, 2, 3, 4.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...