Jump to content
LaunchBox Community Forums

MAME - Xbox Controller Config (ctrlr file)


Buddy Dacote

Recommended Posts

5 hours ago, MoonKnightFTW said:

I do not have any folder named this that i can find?....... should i create one in root of mame folder and download a ctrlr file as a guide to try this tip?

The ctrlr directory is typically in the root.  However, check you Core Search Path entries in your MAME.INI file.  You should see an entry (default) of:    ctrlrpath                 ctrlr

Also within the MAME.INI file is an entry under "Core Input Options" that is "ctrlr" which is where you can set which controller file you want MAME to use. Then you don't have to use the -ctrlr flag in LB as noted by TheNewClassics since the MAME.INI file will tell MAME where to pull the CTRLR file. 

Basically, all this does is that when MAME launches, it looks to the CTRLR setting. If there is an entry it copies those settings within the named CFG file to the Default.CFG file located in the \CFG folder at MAME launch.  That is why when you don't use the CTRLR option you can get everything setup and working (which saves everything to the Default.CFG file) and then if you launch MAME and the controller isn't on the Default.CFG gets overwritten with "null" entries since the controller isn't there.  The other "cheat" you can do and which I used before I got the CTRLR option working was I setup controllers the way I wanted and then went into the CFG folder, found the Default.CFG file and set it to read only (via Windows properties).  MAME will then not be able to overwrite the file if controller is not on when launches.  It never seemed to cause issues (or whined that was read only) but the CTRLR way is the "right" way to do it and less likely to cause issues (or if you forget it is write protected, your changes you make will not be saved). 

Because of the above, the easiest way to generate your custom CFG file for the CTRLR entry is to setup in MAME as you want.  Then copy the DEFAULT.CFG file located in the CFG directory to the CTRLR directory and rename it.  Then whatever you name it reference that in the CTRLR entry within the MAME.INI file. 

  • Like 1
Link to comment
Share on other sites

sungodak is right about how to go about it; the first method specifically is how I attempted to do it in the past. However, for whatever reason, my MAME setup would overwrite the ctrlr setting in my ini and reset it to blank each time I would run MAME. This is after I would change the read and write settings on the ini, without any luck. I have set the whole file to read only as well, which does work, but I'm not a big fan of that method. It might just be specific to my system, but for whatever reason adding the parameter was the only way that worked for mine. 

Link to comment
Share on other sites

ugh.... guys. I suck, I am usually not bad at this stuff, but for whatever reason this is throwing me for a loop! You all gave me so much extremely valuable information! Here is what I have realized happens. If I program it for my 2 xbox one controllers its great. no issues. If I boot up all 4 controllers, it randomly changes which controllers are what and the 2 additional xbox 360 controllers then become P1 and P2. Here is what I am typing for my .cfg but mame says it cant open the file...... 

<mameconfig version=”10”>
        <system name=”default”>
                <input>
                        <mapdevice device=”XInput Player 1” controller=”JOYCODE_2” />
                        <mapdevice device=”XInput Player 2” controller=”JOYCODE_3” />
                    <mapdevice device=”XInput Player 3” controller=”JOYCODE_4” />
                        <mapdevice device=”XInput Player 4” controller=”JOYCODE_5” />
                </input>
        </system>
</mameconfig>

 

I also dont see any solid device id's to make it work right either...... so I just dont get it! here is paste from the text file I created to see ID's in mame: (2 xbox one controllers that I want as P1 and P2 and 2 xbox 360 controllers for P3 and P4)

Skipping DirectInput for XInput compatible joystick Bluetooth XINPUT compatible input device.
Skipping DirectInput for XInput compatible joystick Bluetooth XINPUT compatible input device.
Skipping DirectInput for XInput compatible joystick Controller (Xbox 360 Wireless Receiver for Windows).
9¨83Input: Adding joystick #0: vJoy Device (device id: vJoy Device product_¨83 instance_9)
Skipping DirectInput for XInput compatible joystick Controller (Xbox 360 Wireless Receiver for Windows).
Input: Adding joystick #1: XInput Player 1 (device id: XInput Player 1)
Input: Adding joystick #2: XInput Player 2 (device id: XInput Player 2)
Input: Adding joystick #3: XInput Player 3 (device id: XInput Player 3)
Input: Adding joystick #4: XInput Player 4 (device id: XInput Player 4)

Link to comment
Share on other sites

ya.... I think I am throwing in the towel. I can get it to save config atleast through everyones help. I will just accept the fact that if I need 4 controllers, the older junkier ones will default to player 1 and 2 and the other two controllers "should work, but default to 3 and 4.... should. 

Off topic, but I have discovered a weird glitch or bug or something in bigbox with Arcade (mame) only......... when exiting in bigbox on the arcade platform, it brings up a black screen. That screen will stay indefinitely. If I click the mouse, the exit screen image then pops up. It closes and goes back to game selection, but it will be frozen until I click once more to like refresh it. Seems like a window priority or something and its only Arcade and only in BigBox! 

Link to comment
Share on other sites

As noted above, device IDs are potential issue.  However, one item I see below is your Joycode reference vs the player reference.  Had you intended to map joystick 1 as player 2?  Your Joycodes are 2,3,4, 5 rather than 1,2,3,4. Other than that, looks okay. I attached my working 2 controller CFG version with XBOX ONE controllers.  In theory, it would be adding in the other two by duplicating (minus the keycodes) for the other two controllers and inserting the devices 3 and 4.

Lastly, might take a look at the MAME Docs here, it isn't super detailed but might be helpful.  https://docs.mamedev.org/advanced/devicemap.html  

I haven't tried firing up my XBOX 360 controllers but may try and see if it is doing the same thing.  My long term goal was to have a setup similar to yours, with 2 XBOX ONE controllers and my two non-used 360 controllers. Just have to find the 360 dongle buried in a drawer somewhere......

1 hour ago, MoonKnightFTW said:

<mameconfig version=”10”>
        <system name=”default”>
                <input>
                        <mapdevice device=”XInput Player 1” controller=”JOYCODE_2” />
                        <mapdevice device=”XInput Player 2” controller=”JOYCODE_3” />
                    <mapdevice device=”XInput Player 3” controller=”JOYCODE_4” />
                        <mapdevice device=”XInput Player 4” controller=”JOYCODE_5” />
                </input>
        </system>
</mameconfig>\

 

 

 

 

xbox2player.cfg

Link to comment
Share on other sites

Thank you so much for the cfg and information. I guess I was confused as mame saw my joystics as I labeled them in my code attempt. Using your .cfg, I was able to program the controls how I wanted and they now register as controller 1 and 2. So I can assume it is working. Upon closing and reopening , it lost config for player 2 again. At this point, I think  I will just make the default.cfg read only and this way it should keep my global settings now. It appears that individual game mappings are not altered, always the default, so in theory I can just leave it read only and be good to go. I havent really figured it out, but I really appreciate everyones help and the file. You guys are great! 

Link to comment
Share on other sites

Hmm, interesting it was losing player 2 again. I was hoping it was that JOYCODE setting.  USB IDs are being difficult I suspect. MAME is a dark art at times!  I definitely would go with the read only CFG file then. I used that option for many years, so it doesn't seem to cause any issues that I found. 

Good to know that the CTRL settings may be wonky when I start fiddling with my 360 controllers and may just skip and go the read only route again.

Link to comment
Share on other sites

Sundogak, i really appreciate your help. I agree mame can sometimes have a mind of its own and then coupled with windows 10, its hard to know exactly whats freaking out! If you do end up tinkering at some point with same stuff i was unsuccessful with in this post and you figure out how to do it successfully, I'd greatly appreciate it if you updated this thread or PM'd me! 

Link to comment
Share on other sites

  • 2 weeks later...
On 1/6/2019 at 2:01 AM, MacGuyver said:

Changing the config file to read-only worked for me.  Now all 4 of my x-box 360 controllers always work on Mame.  Could never get this to stick and it was driving me crazy.

Did you change the"default" config file within the cfg folder to read only?

Having this issue with XBOX one controllers with the Microsoft Wireless adapter and only on MAME

Link to comment
Share on other sites

On 1/18/2019 at 6:49 AM, Reevesad said:

Did you change the"default" config file within the cfg folder to read only?

Having this issue with XBOX one controllers with the Microsoft Wireless adapter and only on MAME

Yes, default file in cfg directory to read only will lock down the changing of controller IDs.  Just have to remember to make write able if wanting to do changes.  I used this method initially and didn’t see any issues.  The others in the directory are the specific settings for games. 

Edited by sundogak
Link to comment
Share on other sites

  • 2 weeks later...

New user here, and new to MAME as of the last month.  I've got it running (.205 w/ complete ROM set) and have Launchbox / Big Box running as well.  Getting ready to work on controls and found this thread very helpful.  My arrangement is Win10 with a wireless KB, pair of XBOX controllers w/ wireless adapter for 8-way games, Mayflash F300 Elite w/ gate rotated for 4-way games, and Kensington trackball.

Few questions:

(1) Prior to finding this thread, I was locking down the default.cfg so it wouldn't lose mappings if I started MAME without the joystick connected.  I'm following what this thread is saying about using the ctrlr config file and calling it from MAME.ini and am interested in doing it that way.  What I don't understand is why locking down default.cfg is the way to fix the issue with Win10 and USB IDs with the XBOX controller wireless adapter.  Why couldn't you keep the default.cfg file unlocked, and make the ctrlr config file read-only instead?

(2) Rather than calling the controller cfg file from the MAME command line, is there a way to call it from within a specific game cfg file?

(3) Do the individual game cfg files behave like the default.cfg with respect to resetting your controller mappings if you start the game without the joystick/controller connected?  In other words, once I get them the way I want, should those be read-only as well?  Or maybe the entire cfg folder at that point?

The arrangement I'd like, and maybe it's not possible, is to have three different config files: one for joystick + KB, one for trackball + KB, and one for the pair of XBOX controllers + KB.  Then when I launch a game, it calls the appropriate ctrlr config.  That way I could just paste the ctrlr.cfg call in each game cfg, rather than going through the process of doing button assignments on each game the first time I play.

Is this feasible?  Or should I just start working on mapping my controls from within each game and locking them down when done?

Link to comment
Share on other sites

  • 4 months later...

For what it is worth, I too ended up use the read-only method to get my setup to stop forgetting my controls.

I have an old school custom arcade stick that is made for two players (Street Fighter 2 layout - two player), and an Xbox One controller that i use for a few console games. I set it all up so player1 can use either the arcade stick player one, or the Xbox controller. I ended up creating my own button layout for the Xbox One controller that can navigate through the MAME menus, but it is still a work in progress. 

What is your default layout for you Xbox One controller for the common controls (anyone)?  for example ... Coin 1, Start 1, Menus, Pause, Exit, Enter, etc

Edited by ItchyRobot
Link to comment
Share on other sites

16 hours ago, sundogak said:

After being screwed by my own ignorance on how exactly all the control saving per game work with MAME, I am a bit gun shy to try an use that file.  A little background on my MAME controller layout issues ...

In the past I set up my two player custom arcade stick in a custom manner to best use all the buttons. For example, I have set up a bunch of two button sequences that allows for multiple actions for buttons. For example, my coin1 button has a secondary function of bringing up the Menu if I hit another button first... and my coin2 button has a secondary function of pausing the game). I have a bunch of these set up for saving game states, loading game states, resetting the game, etc.
Once I got that setup, I decided I wanted to include an Xbox One controller so I could play a few single player consoles games through MAME. The bumper buttons make it much easier to play games like F-zero. I ended setting up the MAME controls so that I could either use the Arcade stick player one controls or the Xbox One controls to play games. 

I also set up a bunch of special control layouts for certain games, like Discs of Tron, Stargate, Defender, fighting games, etc.

 

After getting all this set up, I decided to find bezels for all the games I play. I got that set up and resized the gameplay screen to fit within each bezel (Orions angel realistic bezels) and played the games for a while. Then I decided that I didn't like those specific bezels and wanted some that focused on a bigger gameplay screen. I deleted the old bezels and CFG text files and brought in the new bezels, only to find out that all the game specific controls were tied to the text files for each game, stored along with the CFG folder. Luckily I had a backup, so I was able to get the old text files that store the game specific controls (one text file for each game). I learned a lesson there. But I did have to go in to each game and reconfigure the sliders settings to fit the gamelay window within new bezels. It was either that or reset up the controls for each game which I didnt want to do.

So now I am tying to figure out if i use one of these files you suggest, if it will somehow screw my setup again. I assume it will not over ride my game specific control settings  that I have already setup (MAME calls it Machine), but I am very hesitant due to my past experience in the wonkiness in how MAME stores saved game controls in multiple locations... per game is in the Artwork folder, while universal control setting in the Default file.

 

And I didn't even mention the problems that arise in starting MAME without a controller attached and how that overwrites the Default file unless you set it to read only. That MAME weirdity also screwed me in the past. That's why I have it set to read only now. I am sure there is a rhyme and reason why the Devs have MAME set up this way, but god damn it makes it tough for new people to learn it without taking one step forward and one step back all the time. I am basically learning from my "mistakes", over and over again  =(

 

 

 

Edited by ItchyRobot
Link to comment
Share on other sites

Make a backup of your MAME folder!  (lesson learned :) )

Place the downloaded "xbox2player.cfg" file into the ctrlr folder.

Edit "mame.ini".  Scroll down to "CORE INPUT OPTIONS" and add in xbox2player on the ctrlr line.image.thumb.png.092b7ae8e864795efef6be19c3f92028.pngThis will now load that file (that's located in the ctrlr folder) instead of "default.cfg" (located in the "cfg" folder)  Any game-specific configuration files (located in the "cfg" folder) will still be loaded as before. 

 

The MameDev Team put in the if-the-controller's-not-plugged-in--reset-everything as a kind of fail safe to the "oh crap! I configured everything wrong and now nothing works!" scenario. One solution you've already found. Make default.cfg Read-Only.  Another solution is to have [all] your controllers plugged in, start mame and configure everything just the way you want it using the xbox controller(s), keyboard, mouse clicks, combos....  Now Save Configuration and exit MAME.  Now in the cfg folder, copy 'default.cfg' and put in the ctrlr folder.  From here you can rename it to something like.. oh, I don't know... "xbox2player.cfg" or what ever you want. Then edit mame.ini to load it as noted above.  [Instead of editing mame.ini, you can always add to the command line "-ctrlr xbox2player".]

 

  • Like 1
Link to comment
Share on other sites

20 hours ago, JoeViking245 said:

Make a backup of your MAME folder!  (lesson learned :) )

Place the downloaded "xbox2player.cfg" file into the ctrlr folder.

Edit "mame.ini".  Scroll down to "CORE INPUT OPTIONS" and add in xbox2player on the ctrlr line.
This will now load that file (that's located in the ctrlr folder) instead of "default.cfg" (located in the "cfg" folder)  Any game-specific configuration files (located in the "cfg" folder) will still be loaded as before. 

The MameDev Team put in the if-the-controller's-not-plugged-in--reset-everything as a kind of fail safe to the "oh crap! I configured everything wrong and now nothing works!" scenario. One solution you've already found. Make default.cfg Read-Only.  Another solution is to have [all] your controllers plugged in, start mame and configure everything just the way you want it using the xbox controller(s), keyboard, mouse clicks, combos....  Now Save Configuration and exit MAME.  Now in the cfg folder, copy 'default.cfg' and put in the ctrlr folder.  From here you can rename it to something like.. oh, I don't know... "xbox2player.cfg" or what ever you want. Then edit mame.ini to load it as noted above.  [Instead of editing mame.ini, you can always add to the command line "-ctrlr xbox2player".]

 

Great info, thanks! I will try that setup this weekend. 

Link to comment
Share on other sites

  • 2 months later...

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...