Bug - Retroarch unable to support 2 gun4ir light guns

Retroarch can’t figure out how to assign my first gun4ir light gun to player 1 and my second to player 2. Each gun controls all cursors and buttons at the same time. It’s like there’s instances of the mouses that Retroarch isn’t understanding.

Using libretro’s Mame Current in-game input options also proves that each gun is controlling all guns at once. When you try to bind a key from either gun it tries to bind all 8 lightgun keys at once and fails.

There was a fix for something nearly identical to this in 2020 and another related one more recently but I don’t know what to say. I’m on a fresh 1.14 install and the problem persists.

I tried using raw input and tried using every single mouse index. Both guns only bind keys if the player port is using mouse index Default. They will only shoot in-game if they’re on Default index as well. However, both guns will control all crosshairs no matter the mouse index or if the controller is set to xbox 360 or the Gun4ir joystick.

Retroarch system config input settings only show the joystick name, not the mouse device:

(c) 2011 drventure Enterprises

Joystick Device List (Devices are in enumeration order) ...

   1.  'Controller (XBOX 360 For Windows)', ID=1
   2.  'Controller (XBOX 360 For Windows)', ID=3
   3.  'GUN4IR Pro Micro P1', ID=0
   4.  'GUN4IR Pro Micro P2', ID=2

Mouse Device List (Devices are in enumeration order) ...

   1.  'HID#IrDeviceV2_Col08#2_2818a073_0_0007#'
   2.  'HID#VID_046D_PID_C52B_MI_01_Col01#7_34cfd926_0_0000#'
   3.  'HID#VID_2341_PID_8042_MI_02_Col03#7_1222c50c_0_0002#'
   4.  'HID#VID_2341_PID_8043_MI_02_Col03#7_1948a9f2_0_0002#'

End of list

This problem is at least happening for mame and flycast cores. Sinden guns are said to work by only needing to set the mouse (joystick?) index for each player. Gun4ir does not work this way it seems.

Importantly, the gun4ir guns work fine in standalone mame with this config in mame’s ctrlr directory referencing their HIDs directly:

<mameconfig version="10">
<system name="default">
        <mapdevice device="VID_2341&amp;PID_8042" controller="GUNCODE_1"/>
	<mapdevice device="VID_2341&amp;PID_8043" controller="GUNCODE_2"/>

And this is the part of the standalone mame.ini that references the file above:

coin_lockout              1
ctrlr                     CtrlrConfigFIleNameHere
mouse                     0
joystick                  1
lightgun                  1`

I’m pretty sure something is wrong with how retroarch handles these guns and I have no way of getting around it so I’m forced to use standalone mame. I have not been able to find anyone else getting two gun4ir guns working in retroarch either. This is a shame because the guns are the best option to use today.

Can anyone help me troubleshoot this?

Raw input driver won’t show the “Default” option, which is the only option for dinput driver, since it can only read one mouse.

So you aren’t using the raw driver properly if you see “Default” in there and not the available mouse names.

1 Like

You’re right. I needed to restart retroarch before raw would take effect! It works correctly now.

Is there a reason to not use raw over dinput in every game or should I only override the light gun games with raw?

And how do I set offscreen_reload to 1 for games like area51?

If raw has any downsides compared to dinput, let me know. I’ve been using it for a long time as the default, and it should be doing everything that dinput does, with the bonus of reading multiple mice of course.