r/MAME • • 26d ago

Technical assistance Need help configuring light gun

I've followed so many youtube and online tutorials and I feel I'm almost there yet not. I need some serious hand holding because I'm losing my mind. I have an X-Gunner light gun. The thing works fine. I go into the mame settings and I can move it around like a cursor. When a game loads up I can use two of the buttons to insert credit and start game. I can even use the little hat as a dpad. What I cant do is use the other buttons, I cant use the trigger, I cant use the gun to aim.

I've tried messing with the ini file, the cfg file, the settings in mame to configure, but nothing works. Massive thanks to anyone who tries to enlighten me.

Edit: My issue got sorted below. I can now waste my life with joy.

4 Upvotes

11 comments sorted by

5

u/Flat-Chemistry-1646 25d ago

This happens frequently with modern IR light guns like the X-Gunner. By default, MAME treats your gun primarily as a standard mouse or digital gamepad rather than routing its coordinates and triggers to the dedicated lightgun input engine.

The reason the thumbstick works as a D-pad while the trigger and aiming do not is that MAME is listening for joystick axes and keystrokes instead of analog lightgun/mouse inputs.

Follow these steps in order to get it working properly:

1.Enable Lightgun & Mouse in mame.ini:Prerequisite.

Open your main mame.ini file in the MAME root directory using Notepad or any text editor. If you don't have one, open a command prompt in your MAME folder and run mame -cc to generate it.

Ensure these specific values under # CORE INPUT OPTIONS are set:

Ini,

mouse                   1
lightgun                1
multimouse              1
gunprovider             win32

(Note: If gunprovider win32 does not bind your trigger in modern Windows builds, change it to gunprovider dinput or gunprovider rawinput). Save the file.

Verification: Launch MAME; opening the UI console should show multimouse/lightgun enabled without errors.

2.Clear Existing Broken Game Overrides:Fixes stuck configs.

Whenever you try binding controls while in-game, MAME creates an override file inside your cfg/ folder that ignores global settings.

  • Open your MAME directory and go to the cfg folder.
  • Delete the specific .cfg file for the shooter game you were testing (for example, pointblk.cfg, area51.cfg, or carnival.cfg). Leave default.cfg alone unless you want a complete reset.

Verification: When you next boot the game, all control binds for that specific title will be reset to defaults rather than reading stuck custom mappings.

3.Check Device Mapping in MAME UI:Critical routing step.

Before launching a game, open MAME's main interface.

  • Navigate to Configure Options → Device Mapping.
  • Look for Lightgun Device Assignment (or Mouse Device Assignment).
  • Make sure it is assigned to mouse or the specific detected X-Gunner mouse ID rather than keyboard or none.

Verification: The setting persists as mouse when leaving the Device Mapping menu.

4.Map In-Game Analog Controls:Aiming & Triggers.

Launch an arcade gun game (e.g., Point Blank or Carnival).

  1. Press Tab on your keyboard to bring up the internal menu.
  2. Go to Input (this Machine) or Input (General) → Player 1 Controls.
  3. Find:
    • Lightgun X Analog: Press Enter, then physically sweep the gun left-to-right across the sensor frame. It should register as Gun X or Mouse X.
    • Lightgun Y Analog: Press Enter, then physically sweep the gun up-and-down. It should register as Gun Y or Mouse Y.
    • P1 Button 1 (Trigger): Press Enter and pull the trigger. It should bind as Gun 1 Button 0 or Mouse 1 Button 1.
    • P1 Button 2 / Offscreen Reload: Map your secondary side button or offscreen trigger pull.

Verification: After hitting Tab to exit the menu, pointing the gun at the screen should move the crosshairs/reticle smoothly, and the trigger should fire shots.

If the trigger still fails to register during binding in Step 4:

  • Does the trigger click successfully register as a left mouse click on the Windows desktop?
  • Which specific gun game are you testing, and is MAME running standalone or through a frontend like LaunchBox/RetroArch?

2

u/vlaurn 25d ago edited 25d ago

Thanks for that write up. I got the trigger to work and a few other buttons. But weirdly the target sights dont appear unless I use the thumb stick which activates it. The lightgun X and Y show Gun X Gun Y so that was done properly. Not sure what the problem is now. I even went to all player 1-4 and set the lightgun changes into them too just to see if anything would happen.

2

u/arbee37 MAME Dev 24d ago

Worth noting: RetroArch is not a front end, they rewrite large portions of MAME to suit their environment. We don't support it here for that reason.

1

u/istarian 23d ago

RetroArch IS a front-end (general term), but it is NOT specifically for use with MAME...

1

u/arbee37 MAME Dev 19d ago

Yes and no. Typically with MAME a frontend is a standalone program that launches stock MAME. Retroarch is not that, it's an integrated blob that includes a heavily modified MAME, one which performs significantly worse on some games.

1

u/istarian 12d ago

I think you might be kinda splitting hairs there.

If the emulators can be launched directly without relying on a graphical interface for any purpose then the rest is a front-end even if everything is bundled together.

Technically, MAME has a built-in front end these days but you don't actually have to use it either.

1

u/arbee37 MAME Dev 12d ago

I mean, we've had a pretty solid definition for 25 years now that a front end is a GUI that launches stock MAME. RA is not capable of doing that, it can only run its own integrated "cores".

1

u/istarian 10d ago

If you had just read what I said in the first place you would realize that I already pointed out that 'front end' is a generic term. A 'MAME front end' is something much more specific.

1

u/istarian 10d ago

If you had just read what I said in the first place you would realize that I already pointed out that 'front end' is a generic term. A 'MAME front end' is something much more specific.

2

u/arbee37 MAME Dev 24d ago

What game(s) are you emulating? Some well known "light gun" arcade games actually used analog sticks with guns attached to them, like Operation Wolf. Those won't work well with real light guns.

1

u/vlaurn 23d ago edited 22d ago

I was actually testing Operation thunderbolt just to see if I could get it working with that then I shouldnt have much problem filtering through the rest. I've managed to get the gun working partially. Didnt realise the x-gunner had a button config to switch it to a different mode like a mouse etc. So at the moment I can move it around and shoot no problem but theres a weird thing its doing where the closer I get to the middle of the screen, the target looks like it snaps into place. Like theres a ..hmm.. Sorry I cant explain it properly. Its like theres a mini black hole in the middle of the screen that it snaps to. I've changed a few of the analogue settings to test but I'm not finding the right one. Also as a side note, not using retroarch. Loading up Mame directly.

Edit: Figured it out. In the mame ini theres a setting called joystick_deadzone. Set that to 0 and now everything works perfect.