gwizdavid Posted September 13, 2020 Share Posted September 13, 2020 I'm using 2 standard usb powered joystick/button layouts on my new mame. I set up each set, one as controller 1 and the other controller 2. However, after a reboot sometimes Windows will mix up the two, and designate controller 2 as 1, etc. m guessing Windows designates controller 1 as whichever usb port checks in first. Is there a way to set the port as ways that specific usb port? Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted September 13, 2020 Share Posted September 13, 2020 (edited) There's really no rhyme nor reason on how Windows assigns controllers on boot. But MAME does have a fix for that. Read (and try to make sense of) this: https://docs.mamedev.org/advanced/devicemap.html And if/when you get all confused by that, try this. - Plug in all your controllers. - Start MAME and configure all your controllers, light guns, keyboard, mouse etc... - Save Configuration. - Exit MAME. - From the Windows Command Prompt and in your ../MAME/ directory, Enter in mame64 -v >ouput.txt and press Enter. - Exit MAME and close the Command Prompt window. - In the ‘../MAME/cfg’ folder, copy “default.cfg” and paste it into the ‘../MAME/ctrlr/’ folder. From here you can rename it to something like “MyControls.cfg”. - Now open ‘../MAME/output.txt’. (the text file created from the Command Prompt above) - Scroll down until you see the “Input: Adding” lines. There will be several. - Look for signs of your specific controller(s). In my case I only have a single Xbox controller (ignoring “keyboard #0”, “mouse #0”, “mouse #1”…) Input: Adding joystick #0: XInput Player 1 (device id: XInput Player 1) - Open your ‘new’ ‘../MAME/ctrlr/MyControls.cfg’ file. - Near top, right after the “<input>” line, (using info from the output.txt file) add in something like <mapdevice device="XInput Player 1" controller="JOYCODE_1" /> "XInput Player 1" is the part AFTER “device id:”. (Not to be confused with the part after “#0”.) "JOYCODE_1" is for player 1. ("JOYCODE_2" would be for player 2. Etc.) From the example in the above link, their “output.txt” has the line Input: Adding Gun #5: HID-compliant mouse (device id: \?HID#VID_D209&PID_1601&MI_02#9&375eebb1&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}) Note what part of the info they used to create the “<mapdevice device=>” line(s) <mapdevice device="VID_D209&PID_1601" controller="GUNCODE_1" /> - after "device id:" started at “VID” - added “amp;” after the ampersand (&) - set it to player 1 ("GUNCODE_1") After you’ve added your controllers (and light guns), save MyControls.cfg. - Now open “../MAME/mame.ini” - Scroll down to the section “CORE INPUT OPTIONS”. - On the “ctrlr” line, set the value to "MyControls". (Do not put the ‘cfg’ file extension) # # CORE INPUT OPTIONS # coin_lockout 1 ctrlr MyControls - Save and close - Play games Edited September 13, 2020 by JoeViking245 1 Quote Link to comment Share on other sites More sharing options...
gwizdavid Posted September 13, 2020 Author Share Posted September 13, 2020 This is amazing! Thank you very much 1 Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted September 13, 2020 Share Posted September 13, 2020 JoeViking245, just curious if starting with the default.cfg key mappings in your ctlr file, prevents the erasing of removable devices issue or do you still need to rely on the read only work around? gwizdavid, wish all emulators worked like MAME, but they all don't (there are pluses and minus as to why), but you can check out devreorder for establishing device order for other emulators. I use it with a large collection of devices and it works very well with emulators including m2emulator, supermodel3, retroarch and more. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted September 13, 2020 Share Posted September 13, 2020 13 minutes ago, Headrush69 said: do you still need to rely on the read only work around? No. Thank goodness! MAME will only read your custom controls file that you created/saved in the ../ctrlr/ folder, and 'pointed' to in mame.ini. No need to to make the 'new' cfg file readonly. So if you forget to plugin any or all of your controllers, your custom config file won't get wiped out. So when you DO forget... curse!, exit MAME, plug your stuff in, restart MAME, apologize for cursing, and play games. Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted September 13, 2020 Share Posted September 13, 2020 3 minutes ago, JoeViking245 said: No. Thank goodness! MAME will only read your custom controls file that you created/saved in the ../ctrlr/ folder, and 'pointed' to in mame.ini. No need to to make the 'new' cfg file readonly. So if you forget to plugin any or all of your controllers, your custom config file won't get wiped out. So when you DO forget... curse!, exit MAME, plug your stuff in, restart MAME, apologize for cursing, and play games. That's great to know. Although I guess this will only help for games/systems you are using the default inputs for that device, but still helpful. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted September 13, 2020 Share Posted September 13, 2020 "Default" being how you set up your custom config file. Yes. But if you initially setup all possibilities (Player1 left side of cab, Player2 right side of cab, Player1 "XInput Player 1", Player2 "XInput Player 2"......) it should all be good in the 'hood. For the rare game that may have something different, you can always create a 2nd cfg file (MyControls2.cfg) for it and then override the mame.ini ctrlr line by adding to the custom command line parameter for that game "-ctrlr MyControls2". Or if you want to get real crazy, you can create and custom ini file (copied from mame.ini), and name it the same name as the driver source file, or the BIOS set, or the parent [rom] system, or the system[game][rom] itself. Then set the ctrlr line in it. Loading the ini becomes automatic through MAME. No extra custom command line parameters required. https://docs.mamedev.org/advanced/multiconfig.html (But ya, that's going a bit far. ) Same goes for softlists. (i.e. spectrum.ini) Useful for setting "ui_active" and "autoboot_command". Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted September 13, 2020 Share Posted September 13, 2020 I think for exceptions the read-only on the game specific cfg file is easier, cleaner for me. I think most of my non-defaults are non Arcade titles anyways, plus I'm not a big fan of allowing controllers instead of my arcade controls for Arcade titles unless absolutely required. The important part is now realizing you can put key maps in the ctrlr file as well and they won't get erased. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
Headrush69 Posted September 27, 2020 Share Posted September 27, 2020 On 9/13/2020 at 12:30 PM, JoeViking245 said: No. Thank goodness! MAME will only read your custom controls file that you created/saved in the ../ctrlr/ folder, and 'pointed' to in mame.ini. No need to to make the 'new' cfg file readonly. So if you forget to plugin any or all of your controllers, your custom config file won't get wiped out. So when you DO forget... curse!, exit MAME, plug your stuff in, restart MAME, apologize for cursing, and play games. Just a heads up for anyone using LEDBlinky and default controls in your MAME custom ctrlr file, make sure in LEDBlinky config that you point to your ctrlr file under the MAME tab. If not, depending on how your LED ports are mapped, you can get some unexpected results since LEDBlinky is reading the default.cfg and game specific cfgs only, not the ones set in your custom ctrlr file. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.