Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: How to successfully configure 2 Aimtrak lightguns to work with MAME  (Read 10975 times)

0 Members and 1 Guest are viewing this topic.

Sorn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:July 09, 2018, 08:56:19 pm
  • I want to build my own arcade controls!
I wanted to create a topic specifically for this issue, since I spent such a large amount of time troubleshooting the issue and think it would be helpful to other Ultrimarc customers. The original troubleshooting thread is located here for reference, though all the necessary information is located in this topic for the sake of organization -
http://forum.arcadecontrols.com/index.php/topic,150393.0.html


First, I would like to state that I was only able to get this working on specific versions of mame. As of right now MAME 0175 is the most current version, but the input appears to be broken in regards to the dual Aimtrak lightgun setup. I was only able to get 0171 fully functional. I would suggest getting the windows 0171 exe from mamedev here - https://github.com/mamedev/mame/releases/download/mame0171/mame0171b.exe extracting it to a folder, and then replacing the mame64.exe with the exe I've provided here - http://www.xbins.org/iriez/mame64.zip . Make sure there is no mame.ini in the same folder as mame64.exe, you will want to create your own when you change some options provided below.

The MAME I've provided above (xbins link) is 0171 64-Bit with all stock options, with high score patch applied. If you want to make sure high score is working, please remember to add the highscore.dat and the "hi" folder to your directory, which can find in MKCHAMP's thread here - http://forum.arcadecontrols.com/index.php/topic,64298.0.html

Important options you will need to change in order to get this working -

Run your mame64.exe, in the interface select configure options, then device mapping, and change the lightgun selection to lightgun (duh right? :), hit return to previous screen and then you MUST hit save changes in order for the program to create the mame.ini with your changes! Exit mame, then open mame.ini with notepad or whatever your preferred text editor is! You will need to change these options from the default setting of 0 to 1  in the CORE INPUT OPTIONS section -

lightgun                  1
multimouse                1

Once you've made those two changes, you can check below that your other change you made was saved correctly -

# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device             keyboard
adstick_device            keyboard
pedal_device              keyboard
dial_device               keyboard
trackball_device          keyboard
lightgun_device           lightgun  <---- this is what you changed in the mame UI. If it says lightun leave it, if it says keyboard change it to say lightgun, then save.

Now that you've configured all the right things, lets launch mame, select configure options, General Inputs, player 1. Half way down the list on your screen you should see P1 B1 (player 1 button 1), hit enter on your keyboard and then point the gun at the screen and pull the trigger. You should see ONLY Gun# B0 (# is the number your gun has been assigned, it can be GUN0, GUN1, GUN2, etc). If you see something like GUN0 X + GUN0 B0 it means that it took the coordinates of your gun aim into it, hit delete, then try again and make sure you hold the gun steady at the screen and pull the gun trigger until you get JUST GUN# B0. Once you are finished with that go to the very bottom where you see Lightgun X Analog, aim your gun at the left side of the screen, hit enter on your keyboard and slowly pan your gun to the right side of the screen. You should see it change to GUN# X. If it says anything other than just X that means you went up or down a little bit and you need to redo it until you just see GUN# X. Then repeat the same process with Lightgun Y Analog, except this time start at the bottom of the screen and slowly move your gun towards the top until it shows just GUN# Y.

If you are trying to map the gun input, and after you hit enter and nothing happens then it means MAME does not see your gun. The first thing I would check is to see if my guns were working. Pointing your lightgun at the screen should move the cursor. If you have 2 guns both of them should move the cursor. Also with Aimtrak guns you will need to run the Configuration Utility to set the device ID of the 2nd gun to a different ID than  whatever the 1st gun was assigned as (Usually 0 or 1). You can find that utility here - http://www.ultimarc.com/aimtrak_setup.exe . You'll need to reboot your computer after you make the ID change, and upon restarting the computer, open the config utility again and drop down the device ID to whatever you changed the 2nd gun to. It should now show as being connected on that device ID. While I did this I also upgraded the firmware of the guns, which at the time of this writing was 9.17. I received the guns from Ultimarc with a stock 9.15 firmware, so they immediately needed updating. So be sure to do this even if you just got the guns because it appears Andy doesnt keep his stock updated when he ships it out :P If they can both move the cursor and pressing the trigger makes them right click then your guns should be ready to go, assuming you've followed the above instructions and everything checks out all right.

You can also checkout Ultimarc's MAME setup guide for more detailed instructions on how the configuration utility works and MAME tips here - http://www.ultimarc.com/AimTrak%20Setup%20Guide.pdf

In the troubleshooting process I found Shalma's excellent Nuvee input plugin that works on a special Lightgun build version of PCSX-R. In the zip of his input plugin there is a raw_mouse_test.exe file that when you run it will open a application with coordinates displayed on the screen. If you wave your lightgun at the screen, it will show you which mouse # that particular light gun is as seen by windows. For me, it was Mouse 2 and Mouse 3 that lightgun #1 and #2 showed up as. This confirmed to me that the issue was MAME related, and had nothing to do with windows, driver ID's, etc.

That particular program is located in the nuvee_ps1_pad - guncon1, mouse\bin directory of the nuvee 7z/zip archive.

You can see that thread, which is a great resource to get PSX lightgun games working here -
http://ngemu.com/threads/input-plugin-nuvee-psx-controller.143143/ and just incase that sendspace file for the nuvee plugin goes down, here is a mirror http://www.xbins.org/iriez/nuvee_latest.7z

If you still cannot get your lightgun working, I have no idea what to tell you other than you should try running mame64.exe from a command line with the -verbose tag to generate some output that maybe others can help you with, to resolve the issue. Pro tip - Hold SHIFT and right click on empty space (make sure no files are selected) and you will see a 'open command prompt window here'. Below are some examples of various output from recent tests so you can get a idea of when its working, and when its not -

Here is mame 0171 compiled with MC64 with no direct input selected, note GUN#0, 1 and 2. You'll notice "DirectInput: Using DirectInput 8" is AFTER MAME has assigned the mice, guns and keyboard! This is how I know its working. If the DirectInput: Using DirectInput 8 shows up BEFORE the mice/keyboard/gun assignment, then somethings wrong. I still dont know why 0171 works and why 0172, which was compiled the same exact way, configured the same way, does not. Notice the 3 mice, that is my real mouse, plus the 2 lightguns, which windows sees as mice. You can see the "Input: Adding Gun #0: HID-compliant mouse", which is right after the "Input: Adding Mouse #0: HID-compliant mouse", which means MAME is correctly seeing my lightgun as a lightgun. I believe that anything listed after "RawInput: APIs detected", is using the new MAME input code, and anything after "DirectInput: Using DirectInput 8", is using the old direct input method. I dont know if im incorrect on this assumption, but if I am correctly this is extremely confusing since I compiled this version myself with no forced direct input, and would not expect that directinput option to kick in.

H:\HyperSpin\Emulators\MAME\test>mame64.exe ptblank -verbose
Video: Monitor 00000000003CA768 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Configuring adapter #0 = AMD Radeon HD 5450
Direct3D: Using dynamic textures
Direct3D: YUV format = RGB
Direct3D: Max texture size = 16384x16384
Direct3D: Device created at 1920x1080
RawInput: APIs detected
Input: Adding Mouse #0: HID-compliant mouse
Input: Adding Gun #0: HID-compliant mouse
Input: Adding Mouse #1: HID-compliant mouse
Input: Adding Gun #1: HID-compliant mouse
Input: Adding Mouse #2: HID-compliant mouse
Input: Adding Gun #2: HID-compliant mouse
Input: Adding Kbd #0: HID Keyboard Device
DirectInput: Using DirectInput 8
Input: Adding Joy #0: Controller (XBOX 360 For Windows)
Input: Adding Joy #1: THT Arcade console 2P USB Player
Input: Adding Joy #2: THT Arcade console 2P USB Player
Input: Adding Joy #3: THT Arcade console 2P USB Player
Input: Adding Joy #4: THT Arcade console 2P USB Player
Input: Adding Joy #5: ATRAK Device #1
Input: Adding Joy #6: ATRAK Device #8
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels

Here is 0172, compiled same way with MC64, with just the exe thrown in the same directory as 0171 so that the same settings would be forced, note how Directinput 8 is ABOVE the keyboard/mouse list, speculating that 'direct input' is initialized early. On 0171 you can see that DirectInput 8 does not show up until AFTER the mice/keyboards/guns are added to mame.

See the "Input: Adding Gun #0: Win32 Gun 1" ? That does not happen on 0171 when its working correctly. This also happened on my 0158 version. When its working correctly it shows up as "Input: Adding Gun #0: HID-compliant mouse", not Win32 Gun #. Also you should notice that directinput popped up early, right after rawinput, so any devices beneath it is using 'direct input', which is causing a issue with the lightguns -

"RawInput: APIs detected
DirectInput: Using DirectInput 8"


H:\HyperSpin\Emulators\MAME\test>mame640172.exe ptblank -verbose
Video: Monitor 000000000036f0f8 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Configuring adapter #0 = AMD Radeon HD 5450
Direct3D: Using dynamic textures
Direct3D: YUV format = RGB
Direct3D: Max texture size = 16384x16384
Direct3D: Device created at 1920x1080
RawInput: APIs detected
RawInput: APIs detected
DirectInput: Using DirectInput 8
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels
Input: Adding Kbd #0: HID Keyboard Device
Input: Adding Mouse #0: HID-compliant mouse
Input: Adding Mouse #1: HID-compliant mouse
Input: Adding Mouse #2: HID-compliant mouse
Input: Adding Gun #0: Win32 Gun 1
Input: Adding Joy #0: Controller (XBOX 360 For Windows)
Input: Adding Joy #1: THT Arcade console 2P USB Player
Input: Adding Joy #2: THT Arcade console 2P USB Player
Input: Adding Joy #3: THT Arcade console 2P USB Player
Input: Adding Joy #4: THT Arcade console 2P USB Player
Input: Adding Joy #5: ATRAK Device #1
Input: Adding Joy #6: ATRAK Device #8

And now here is MAME 0172, compiled with MC64, no direct input but left in its own folder and NOT placed in the 0171 folder that has working settings. So basically exactly how it is supposed to be, by default. I've also tested this with the mame0172 exe from mamedev, extracted to its own folder and ran, which reproduces the same identical results. You'll note its just like above, DirectInput 8 is before the mice/keyboards/guns, which forces mame to only see 1 GUN, which would then trick mame into thinking that both your guns are the same gun, so you get duplicate crosshairs and no player 2.

F:\0172 MC64>mame64.exe ptblank -verbose
Video: Monitor 000000000a82b138 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Configuring adapter #0 = AMD Radeon HD 5450
Direct3D: Using dynamic textures
Direct3D: YUV format = RGB
Direct3D: Max texture size = 16384x16384
Direct3D: Device created at 1920x1080
RawInput: APIs detected
RawInput: APIs detected
DirectInput: Using DirectInput 8
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels
Input: Adding Kbd #0: HID Keyboard Device
Input: Adding Mouse #0: HID-compliant mouse
Input: Adding Mouse #1: HID-compliant mouse
Input: Adding Mouse #2: HID-compliant mouse
Input: Adding Gun #0: Win32 Gun 1
Input: Adding Joy #0: Controller (XBOX 360 For Windows)
Input: Adding Joy #1: THT Arcade console 2P USB Player
Input: Adding Joy #2: THT Arcade console 2P USB Player
Input: Adding Joy #3: THT Arcade console 2P USB Player
Input: Adding Joy #4: THT Arcade console 2P USB Player
Input: Adding Joy #5: ATRAK Device #1
Input: Adding Joy #6: ATRAK Device #8
Region ':maincpu' created
« Last Edit: July 14, 2016, 04:25:19 pm by Sorn »

Scotty_C

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 107
  • Last login:March 22, 2024, 02:54:51 pm
  • The addiction is strong!!
Re: How to successfully configure 2 Aimtrak lightguns to work with MAME
« Reply #1 on: April 24, 2016, 01:23:07 pm »
Really appreciate you writing this up!  didn't realize v0.172 was broken...soon as I went to 171 it works perfectly!!  Again Thanx!
« Last Edit: April 24, 2016, 09:24:30 pm by Scotty_C »

Sorn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 52
  • Last login:July 09, 2018, 08:56:19 pm
  • I want to build my own arcade controls!
Really appreciate you writing this up!  didn't realize v0.172 was broken...soon as I went to 171 it works perfectly!!  Again Thanx!

No problem!

I wanted to update this thread, I compiled 0173 today and gave it a test and the issue is still present. So please continue to use 0171.

I submitted the bug to the mame dev's and it has been acknowledged. If you would like to follow the progress please visit -

http://mametesters.org/view.php?id=6185

Carlisimo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:October 10, 2017, 12:58:03 am
  • I want to build my own arcade controls!
Re: How to successfully configure 2 Aimtrak lightguns to work with MAME
« Reply #3 on: July 27, 2017, 12:39:47 pm »


Has anyone verified that 0.177 has resolved this issue?   I'm running 0.179 and still have the same problem as identified within this thread.   My specifics are described here:

http://forum.arcadecontrols.com/index.php/topic,154850.0.html

DarthMarino

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 565
  • Last login:Today at 06:55:24 am
Re: How to successfully configure 2 Aimtrak lightguns to work with MAME
« Reply #4 on: July 27, 2017, 06:53:44 pm »
I can verify that both my Aimtraks work at the same time in MAME 0.188 which was released yesterday.

Carlisimo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:October 10, 2017, 12:58:03 am
  • I want to build my own arcade controls!
Re: How to successfully configure 2 Aimtrak lightguns to work with MAME
« Reply #5 on: July 28, 2017, 01:32:05 am »
I can verify that both my Aimtraks work at the same time in MAME 0.188 which was released yesterday.

Thanks DarthMarino.  Do you mind sharing your relevant MAME.ini and ctrlr settings for comparison?    Mine are shown here:  http://forum.arcadecontrols.com/index.php/topic,154850.0.html


Thank you!

DarthMarino

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 565
  • Last login:Today at 06:55:24 am
Re: How to successfully configure 2 Aimtrak lightguns to work with MAME
« Reply #6 on: July 28, 2017, 06:03:26 am »
I didn't do anything special except set lightgun device to lightgun in the individual game:

lightgun_device           lightgun