Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Aimtrak Light gun and Mame2003



  • Hello!
    I have look at all the other forum posts that I found to see how to get my aim track working but they haven't worked for me. I am running Vs Duck Hunt on the lr mame 2003. The gun is an ultimarc aimtrak.
    I am running retropie and it had come preloaded from loverpi (https://www.loverpi.com/collections/raspberry-pi-3-model-b/products/loverpi-retropie-game-console?variant=10918327745). It is a raspberry pi 3B.
    I only have a keyboard and the light bar plugged in also. I verified the aimtrak is mouse0. I ran the cat command line and can see input coming from the light gun in the console. I can map the trigger and it sees it as mouse0 click in mame2003. I also saw something about changing the retroarch configuration to turn on pointer instead of mouse mode. But when I do that it won't register the trigger or any movement in mame when mapping the input.

    I tested on my windows pc and got the mame2003 windows version and had to configure the mame.ini to enable lightgun and to make the mouse the lightgun controller. This made the aimtrak work on my pc.

    Seems like I am doing something wrong. Let me know if you need any other information. I did an update on all the basic packages yesterday also.

    Thanks,
    Phil



  • @bigphildogg86

    Similar topic: https://retropie.org.uk/forum/topic/5288/arcadeguns-com-configuration/14

    No way to make them work like lightguns on CRT TV's that I know of yet.



  • @Dochartaigh It's not actually a true light gun. It is the Ultimarc AimTrak. It uses a lightbar like the Wii controller. It is supposed to emulate a mouse. The gun works on my windows machine and moves the mouse cursor. The raspberry pi recognizes it as a mouse also. But the movement doesn't actually move the cursor on the screen.



  • @bigphildogg86 said in Aimtrak Light gun and Mame2003:

    @Dochartaigh It's not actually a true light gun. It is the Ultimarc AimTrak. It uses a lightbar like the Wii controller. It is supposed to emulate a mouse. The gun works on my windows machine and moves the mouse cursor. The raspberry pi recognizes it as a mouse also. But the movement doesn't actually move the cursor on the screen.

    We know, it just seems that people haven't been able to get everything to work with one of those on a Raspberry Pi. No problems on the PC side I believe: for MAME at least – I haven't researched if the console emulators work with one on a PC or not.


  • Global Moderator

    there is no reason why they shouldn't work in mame2003, since it understands linux mice and absolute pointer devices, so it should in theory work. i'm investigating this right now with someone.


  • Global Moderator

    @bigphildogg86 if you set mame2003 to "mouse" mode with a standard USB mouse, does it recognise mouse input in a mouse-compatible game (centipede or whatever)?

    it only understands mouse0 so you will need to unplug the sensor to test the mouse (and vice versa)

    I also saw something about changing the retroarch configuration to turn on pointer instead of mouse mode. But when I do that it won't register the trigger or any movement in mame when mapping the input.

    shouldn't need to remap anything in mame - in fact if you've done that you may have made problems. it should understand mouse input by default.

    can you post your cat output also???



  • @dankcushions Thanks!

    I did verify with Andy at Ultimarc - the Aimtrak does output absolute coordinates. I tried with a regular mouse and it worked. However from what I've read a regular mouse uses relative coordinates. The absolute coordinates that the Aimtrak gun uses is more like a touchscreen. That was why I thought I needed to change the mouse "type" in the config. Here is a link to the setup guide where I found this option for touchscreens and such.
    https://github.com/RetroPie/RetroPie-Setup/wiki/lr-mame2003?#pointertrackpadtouchscreen-support

    Attached is the Cat command output to a file. It actually comes across as gibberish. Even on the screen it's gibberish. When running this all I have plugged in is my keyboard and the gun.

    I also attached the Mame2003 verbose log. Near the end it shows all the input devices it is picking up - and it sees three mice.

    Thanks,
    Phil

    Link to the Mame2003 Log: Mame2003 Log
    Link to Cat output from Light Gun: Cat Output
    The link to the cat output file doesn't display well in OneDrive - here is a picture that shows what it outputs to console:
    Picture of Cat Output


  • Global Moderator

    @bigphildogg86

    thanks! ok i think i have a plan if you don't mind helping me test? :) i've built mame2003 for rpi3 with some extra logging.

    1. go to/opt/retropie/libretrocores/lr-mame2003/ and rename mame2003_libretro.so to mame2003_libretro.so.bak (or whatever)
    2. download and transfer my build to the same folder: https://drive.google.com/open?id=0B_51EcTfJiTqNXlmeC1Cc3htbzg
    3. plug in your aimtrak stuff (and unplug any other mouse/mice type devices), load a game in mame2003 and wiggle your lightgun about for a bit pressing the trigger and then quit.
    4. open /dev/shm/runcommand.log and paste the contents here (if the whole log is very large you might want to use http://pastebin.com)

    for example, with my mouse plugged in i get logs like this:

    RETRO_DEVICE_MOUSE_X = 9, RETRO_DEVICE_MOUSE_Y = -2
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 9, RETRO_DEVICE_ID_LIGHTGUN_Y = -2
    RETRO_DEVICE_MOUSE_X = 41, RETRO_DEVICE_MOUSE_Y = 0
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 41, RETRO_DEVICE_ID_LIGHTGUN_Y = 0
    RETRO_DEVICE_MOUSE_X = 41, RETRO_DEVICE_MOUSE_Y = 0
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 41, RETRO_DEVICE_ID_LIGHTGUN_Y = 0
    RETRO_DEVICE_MOUSE_X = 41, RETRO_DEVICE_MOUSE_Y = 0
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 41, RETRO_DEVICE_ID_LIGHTGUN_Y = 0
    RETRO_DEVICE_MOUSE_X = 41, RETRO_DEVICE_MOUSE_Y = 0
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 41, RETRO_DEVICE_ID_LIGHTGUN_Y = 0
    RETRO_DEVICE_MOUSE_X = 19, RETRO_DEVICE_MOUSE_Y = 1
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 19, RETRO_DEVICE_ID_LIGHTGUN_Y = 1
    RETRO_DEVICE_MOUSE_X = 19, RETRO_DEVICE_MOUSE_Y = 1
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 19, RETRO_DEVICE_ID_LIGHTGUN_Y = 1
    RETRO_DEVICE_MOUSE_X = 19, RETRO_DEVICE_MOUSE_Y = 1
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    RETRO_DEVICE_ID_LIGHTGUN_X = 19, RETRO_DEVICE_ID_LIGHTGUN_Y = 1
    RETRO_DEVICE_MOUSE_X = 19, RETRO_DEVICE_MOUSE_Y = 1
    RETRO_DEVICE_POINTER_X = 0, RETRO_DEVICE_POINTER_X = 0
    

    this version dumps out 3 lines of logging every frame so you probably want to switch back to your .bak version after :)

    also:

    Link to Cat output from Light Gun: Cat Output
    The link to the cat output file doesn't display well in OneDrive - here is a picture that shows what it outputs to console:
    Picture of Cat Output

    the picture is too pixelated for me. i recommend http://pastebin.com/ for text. but maybe this isn't important if you get any readings above!



  • Thanks!

    Here is the cat result in Pastebin - looks like gibberish:
    http://pastebin.com/r5AmiTcj
    So I did this - and everything is 0 it looks like.
    Here is the pastebin for the runcommand log. I had to cut a bunch out because it was too big for pastebin even. But it seemed to all be the same.
    http://pastebin.com/T7EPxAd9

    Also what I find interesting is that the light gun adds a bunch of devices.
    RetroArch [INFO] :: [udev] Adding device /dev/input/event0 as type ID_INPUT_KEYBOARD.
    RetroArch [INFO] :: [udev] Adding device /dev/input/event4 as type ID_INPUT_MOUSE.
    RetroArch [INFO] :: [udev] Adding device /dev/input/js1 as type ID_INPUT_MOUSE.
    RetroArch [INFO] :: [udev] Adding device /dev/input/mouse0 as type ID_INPUT_MOUSE.

    Three mice - if I run cat on any of them that are ID_INPUT_MOUSE then wave the gun they all output - and they output differently.


  • Global Moderator

    @bigphildogg86 said in Aimtrak Light gun and Mame2003:

    Thanks!

    Here is the cat result in Pastebin - looks like gibberish:
    http://pastebin.com/r5AmiTcj
    So I did this - and everything is 0 it looks like.
    Here is the pastebin for the runcommand log. I had to cut a bunch out because it was too big for pastebin even. But it seemed to all be the same.
    http://pastebin.com/T7EPxAd9

    hmm, even near the end of the file (it starts logging as soon as the core loads). that's a shame as it means the libretro udev driver is not understanding these inputs at all, which makes me think the problem is either with the udev driver (an ultimarc issue) or the retroarch udev driver.

    it does at least mean it's not a mame2003 problem :)

    one thing you could try is changing the retroarch input driver to sdl or something else. you'd need to edit your retroarch.cfg (/opt/retropie/configs/mame-libretro/retroarch.cfg) and add the line (i think it needs to be the first line)

    input_joypad_driver = sdl
    

    if that doesn't work try

    input_joypad_driver = linuxraw
    

    you probably want to delete this line after testing as udev is normally what you want.

    Also what I find interesting is that the light gun adds a bunch of devices.
    RetroArch [INFO] :: [udev] Adding device /dev/input/event0 as type ID_INPUT_KEYBOARD.
    RetroArch [INFO] :: [udev] Adding device /dev/input/event4 as type ID_INPUT_MOUSE.
    RetroArch [INFO] :: [udev] Adding device /dev/input/js1 as type ID_INPUT_MOUSE.
    RetroArch [INFO] :: [udev] Adding device /dev/input/mouse0 as type ID_INPUT_MOUSE.

    Three mice - if I run cat on any of them that are ID_INPUT_MOUSE then wave the gun they all output - and they output differently.

    what's strange to me is that retroarch is seeing udev devices but not able to interpret them. so close!!



  • Thanks for all your help! I'll try that tonight. It's never easy!

    So are you saying the Aimtrak has a "udev" driver in it? I can plug it into my windows machine and it moves the mouse right away and works great.
    How would the udev driver be an ultimarc issue?

    I'll change those settings tonight. Found this link which actually shows another line input_driver that may also do something.
    https://github.com/libretro/RetroArch/blob/master/retroarch.cfg

    Part of me was thinking well maybe I'll put Ubuntu onto one of my computers and see if the gun works with Ubuntu. I'm a software developer but I have limited experience with Linux and no experience with writing or changing software drivers or anything. Seems like this shouldn't be too hard to fix but that's also my naivety when it comes to this stuff talking I'm sure.


  • Global Moderator

    @bigphildogg86 said in Aimtrak Light gun and Mame2003:

    Thanks for all your help! I'll try that tonight. It's never easy!

    So are you saying the Aimtrak has a "udev" driver in it? I can plug it into my windows machine and it moves the mouse right away and works great.
    How would the udev driver be an ultimarc issue?

    well udev is a linux thing. see https://en.wikipedia.org/wiki/Udev
    so it working in windows doesn't say anything about udev.

    however i don't know how you'd test a udev mouse via the command line in linux. you can see whether it's connected, but i don't know how to tell that it's actually being sent coordinates, etc, without coding something.

    if it's being sent coordinates correctly, then it seems like it would be a retroarch issue somehow, but a mouse is a mouse, no matter if it's absolute or relative it should still retrieve some sort of input i would of thought!

    I'll change those settings tonight. Found this link which actually shows another line input_driver that may also do something.
    https://github.com/libretro/RetroArch/blob/master/retroarch.cfg

    sorry yeah, that might be the one you should change instead (or as well as?)!

    Part of me was thinking well maybe I'll put Ubuntu onto one of my computers and see if the gun works with Ubuntu. I'm a software developer but I have limited experience with Linux and no experience with writing or changing software drivers or anything. Seems like this shouldn't be too hard to fix but that's also my naivety when it comes to this stuff talking I'm sure.

    it depends on how ubuntu reads the mouse i guess. not really my area either :(

    did someone say they were in contact with ultimark? they might be able to help us diagnose


  • Global Moderator

    oh, looks like udevadm monitor should give us a realtime readout. http://fibrevillage.com/sysadmin/93-udevadm-useage-examples

    i'll investigate it properly later and give an example of what my mouse does :)



  • Awesome thanks so much!
    Yeah Andy had responded with the following to my query:
    Phil,

    For the gun to work, Mame needs to explicitly support the mouse as a light gun device. The gun appears as a mouse and sends “absolute” XY data. This is a standard type of device on a PC and is the same as a touch screen. Standard mice send relative data, ie movement from the previous location.

    So I don’t know if that version does interpret mouse XY data as light gun data unfortunately. It seems it does not, if the data is getting through and the game is configured but not working.

    Andy


  • Global Moderator

    @bigphildogg86 said in Aimtrak Light gun and Mame2003:

    Awesome thanks so much!
    Yeah Andy had responded with the following to my query:
    Phil,

    For the gun to work, Mame needs to explicitly support the mouse as a light gun device. The gun appears as a mouse and sends “absolute” XY data. This is a standard type of device on a PC and is the same as a touch screen. Standard mice send relative data, ie movement from the previous location.

    So I don’t know if that version does interpret mouse XY data as light gun data unfortunately. It seems it does not, if the data is getting through and the game is configured but not working.

    Andy

    so mame2003 actually does support relative devices (pointer), but our issue is that it's not actually getting any readings :) that's why the cursor isn't moving at all rather than moving around crazily.



  • @dankcushions Ahh right. If it was sending any kind of XY coordinates the cursor should be moving, if it was an absolute versus relative issue the XY coordinates would just be misinterpreted and make the cursor go all around the screen. Yeah if we can get that tool to show us the real time results maybe I can take that to Andy and see if he has any ideas.



  • @dankcushions So I didn't make any progress with SDL. BUT I found a Vs. Duckhunt that would work on AdvanceMame 0.94. And in AdvanceMame the light gun is moving the cursor and I was able to map the x and y motion to the cursor motion. It is still acting a little funny jumping from corner to corner and not really giving me much but it seems that the gun is interacting with AdvanceMame. Maybe it is just Mame2003 and udev. Not sure if AdvanceMame uses udev also or not.

    Maybe it's also that when I'm mapping in AdvanceMame it says it's joy2. So the actual input isn't coming from mouse0?


  • Global Moderator

    @bigphildogg86 did you try input driver linuxraw?

    unfortunately the udevadm monitor tool doesn't give a real-time readout of coords, only if things are connected.



  • Hi, any movement on this?

    im eager to add a light gun to my bartop.

    fingers crossed



  • AdvanceMame 1.4 light gun games are working for me using a wii mote and sensor bar. I've tested Aliens 3, Lethal Enforcer and Police Trainer successfully.



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.