Build Your Own Arcade Controls Forum

Main => Lightguns => Topic started by: Jayinem on December 05, 2025, 09:15:23 pm

Title: MAME switching gun numbers without even a reboot
Post by: Jayinem on December 05, 2025, 09:15:23 pm
I've had this problem before I seem to remember being able to somewhat fix it I know I had to go into the cfg files but I don't remember what I did. I just set all the lightgun controls and it had assigned them to gun 4, every game I tried working fine well without even rebooting about an hour later I just tried a game that I just added to Launchbox and it didn't work. Sure enough I go to check the input and it switched them to gun 3. I am hoping for a permanent fix to this to where I'm not constantly having to switch the gun settings back and forth.

thanks
Title: Re: MAME switching gun numbers without even a reboot
Post by: Jayinem on December 05, 2025, 09:24:46 pm
I should have looked first before asking because I remember now I'll go ahead and say what I did in case someone also needs a fix for this. Just go into cfg folder and open default.cfg, go to edit > replace, let's say the last number your gun was in MAME was gun 3 you want to replace anything that says CODE_1 or CODE_2 or CODE_4 with CODE_3 so you put in find what the code that the cfg says and in the replace box replace it with CODE_3.

But it'll probably change the gun number again so what you want to do after you've saved and closed the default.cfg is right click on it go to properties and click the box that says read-only and hit ok. This should prevent it from changing the numbers on you, I believe so anyway, hopefully.
Title: Re: MAME switching gun numbers without even a reboot
Post by: Jayinem on December 06, 2025, 01:18:03 am
Yeah nevermind I'm not good I thought I was but then it switched back from 3 to 4, so it's gone from 4 to 3 no reboot and back to 4 even after making the default.cfg read only. So still seeing if someone knows a permanent fix.
Title: Re: MAME switching gun numbers without even a reboot
Post by: MartyKong on December 16, 2025, 11:50:34 am
I watched some videos on YouTube by Maverick's Arcade which went into depth about setting Mame controllers to not switch places. Definitely worth a watch. Here's my configuration.

Jayinem,  You have to create your own file as shown in the video. Most people use this to stop mame from switching the controller id's and setting individual controls for peripherals.
 This portion is for controller id order (yours will be different):
<mameconfig version="10">
        <system name="default">
                <input>
                        <mapdevice device="PNP0F03" controller="MOUSECODE_1" />
                        <mapdevice device="PID_0060" controller="MOUSECODE_2" />
                        <mapdevice device="PID_1601" controller="GUNCODE_1" />
                        <mapdevice device="PID_1602" controller="GUNCODE_2" />                     
                        <mapdevice device="XInput Player 1" controller="JOYCODE_1" />
                        <mapdevice device="XInput Player 2" controller="JOYCODE_2" />                                 
                  <mapdevice device="XInput Player 3" controller="JOYCODE_3" />
                  <mapdevice device="XInput Player 4" controller="JOYCODE_4" />
                  <mapdevice device="ATRAK Device #1" controller="JOYCODE_5" />
                        <mapdevice device="ATRAK Device #2" controller="JOYCODE_6" />

       <!-- 1 trackball
            2 spinner
            3 Aimtrak 1
            4 Aimtrak 2
            5 xbox 360 1
            6 xbox 360 2           
            7 xbox 360 3
            8 xbox 360 4
            9 aimtrak buttons 1
           10 aimtrak buttons 2 -->
Title: Re: MAME switching gun numbers without even a reboot
Post by: Fursphere on January 26, 2026, 11:41:16 am
this might be of some use to you:  https://github.com/IntegrumRetro/Integrum-Retro-Lightgun-Assistant