Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
06185 DIP/Input Major Always Apr 23, 2016, 23:43 Aug 8, 2016, 23:14
Tester Sorn View Status Public Platform MAME (Self-compiled)
Assigned To Resolution Fixed OS Windows Vista/7/8 (64-bit)
Status [?] Resolved Driver
Version 0.172 Fixed in Version 0.177 Build Normal
Summary 06185: LIGHTGUNS: Aimtrak Dual Lightguns no longer properly detect
Description Both 0171 and 0172 were compiled successfully with mame compiler 64 on windows 7, and both specifically did not have "forced direct input" checkmarked, all other options were left stock.

First, here is my verbose output of 0171 so that you can see my 2 Aimtrak guns are properly configured and that MAME is correctly mapping them upon startup -

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 #. It seems that whenever Win32 Gun # shows up on the list it is a indicator that something is wrong.


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 launched from its own folder so default/vanilla.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 player 1 crosshairs (2 blue 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
Steps To Reproduce
Additional Information You guys are awesome! Also, the maker of the Aimtrak lightguns @ Ultimarc (Andy) said that he would like to get ahold of a MAME dev to get them some free guns to help out with input driver debugging/stability. If you could please provide a method to contact a developer who is willing to receive the product I would love to get that sorted for you guys.

thank you!
Flags
Regression Version 0.172
Affected Sets / Systems LIGHTGUNS
Attached Files
zip file icon patch_v2.zip (15,489 bytes) Jul 9, 2016, 01:03 Uploaded by Pitou
zip file icon patch_v3_mouseonly.zip (1,057 bytes) Jul 21, 2016, 14:38 Uploaded by Pitou
zip file icon input_rawinput_relative.zip (6,199 bytes) Jul 27, 2016, 11:53 Uploaded by Pitou
zip file icon patch_v5.zip (15,878 bytes) Jul 30, 2016, 14:40 Uploaded by Pitou
zip file icon patch_v5_0176.zip (15,759 bytes) Aug 1, 2016, 00:44 Uploaded by Pitou
Relationships
There are no relationsihp linked to this issue.
Notes
26
User avatar
No.12551
Tafoid
Administrator
Apr 24, 2016, 08:20
According to your report, it was working in 0.171 and not in 0.172. Adjusted regression version to account for that.

User avatar
No.12633
Sorn
Tester
May 6, 2016, 21:13
Just compiled 0173b and tested, the same issue persists across both 0172 and 0173.

Thank you.
User avatar
No.12697
Pitou
Tester
May 21, 2016, 19:58
Just want to add that I'm getting the same behavior since mame 0.172 (working fine on 0.171) with the EMS LCD Topgun II
User avatar
No.12906
Pitou
Tester
Jul 7, 2016, 05:01
edited on: Jul 9, 2016, 01:05
Hello,

You can refer to this link for information.

http://forum.arcadecontrols.com/index.php/topic,150393.msg1579789.html#msg1579789

Here is a patch I did for Mame 0.175 to fix the Gun #2 issue.

Actually, this enable a rawinput provider for lightgun. you can set it to "rawinput" or leave it to "auto" in mame.ini

It might be important to set the differents axis and buttons in the config file as the assignation from the GUI might not give the expected results.

Offscreen reload works as long as it is set to 0 in mame.ini

This was tested partially with the EMS LCD TopGun II on Windows 10.

If someone could try it with the AimTrak lightguns, that would be appreciated.

Please keep in mind that this is my first attempt working on Mame. This could work as a temporary fix. I'll let an official Mame developer do it right.

I'm providing the diff files. You can apply them using patch and compile. Also included are the full files for you to replace.

Here is the path for each:

osd\modules\input\input_rawinput.cpp
osd\modules\lib\osdobj_common.cpp

If needed, I can compile some binaries for you.

Feel free to give any feedback!

Thank you.

Pitou!

User avatar
No.12907
Robbbert
Developer
Jul 7, 2016, 11:28
Patch uploaded.
User avatar
No.12915
Pitou
Tester
Jul 8, 2016, 18:12
Just posted a small patch update (patchv2.zip) as it compiled fine with Visual Sutdio but not with MinGW. patch v2 compile fine with both.

http://forum.arcadecontrols.com/index.php/topic,150393.msg1579971.html#msg1579971

Sorry for that.

Pitou!
User avatar
No.12918
Haze
Senior Tester
Jul 9, 2016, 09:43
probably worth somebody making a pull request of this for review as it is a rather serious issue to people using the feature.

i've noticed quite a lot of little complaints about the OSD code lately, little warts from refactoring (although a lot of it was Windows 10 issues) so getting them ironed out would be useful, it's typically been one area MAME has excelled compared to other emulators and recent improvements like XINPUT should only have further improved that, so it's a shame if people hold back due to bugs.
User avatar
No.12966
Pitou
Tester
Jul 21, 2016, 14:46
edited on: Jul 21, 2016, 14:48
Hello,

I made another attempt (patch_v3_mouseonly.zip). Mame.ini needs to have "lightgunprovider none" setting.

A lightgun reports coordinates as aboslute values. In Mame, using the rawinput system, it seems to only accept relative values. This patch tries to calculate the position differences and report relative values. the Win32 input system works fine with absolute values. That's why lightgun is only mapped using the win32 input system at the moment.

The best way would be for the Mame rawinput to interpret absolute values. I would need someone to enlighten me on where to look for this. I could try to implement it the same way Win32 input does.

The patch is made for the official 0.175 mame source. It patches the file "osd\modules\input\input_rawinput.cpp"

Thank you.

Pitou!

User avatar
No.12979
Pitou
Tester
Jul 27, 2016, 11:52
edited on: Jul 27, 2016, 11:54
Here another patch. (input_rawinput_relative.zip). This is the full file, not a diff.

I don't think that using the rawinput system which uses relative values only is suitable for this. I post my last patch anyway as I was very close.

Pitou!

User avatar
No.12980
Stiletto
Developer
Jul 27, 2016, 13:06
Pitou, if it's ready for submission, could you please create a pull request on github? This missed the 0.176 release.
User avatar
No.12982
Pitou
Tester
Jul 27, 2016, 13:47
It's not ready yet. Also, I don't know how to create a pull request.
User avatar
No.12999
Robbbert
Developer
Jul 29, 2016, 09:11
Before adding anything to MAME, keep an eye on this thread:

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

until the users there are all happy with it.
User avatar
No.13002
Pitou
Tester
Jul 29, 2016, 12:22
I will. This is the thread I'm participating in.
User avatar
No.13011
justindarc
Tester
Jul 29, 2016, 22:09
Pitou: I can help with creating the pull request when your patch is ready. I've been looking forward to seeing this fixed :-)
User avatar
No.13018
Pitou
Tester
Jul 30, 2016, 14:39
edited on: Jul 30, 2016, 14:40
Great news today, I think this patch works fine. (patch_v5.zip)

This patch is still based on Mame 0175.

I'll wait for some feedback and see what is the result.

Thank you.

Pitou!

User avatar
No.13019
Sorn
Tester
Jul 31, 2016, 21:09
Just wanted to confirm that the v5 patch is working wonderfully! The issues that have persisted between 0172 - 0176 are now fixed with Pitou's input code changes. I look forward to that pull request being merged!

Thanks to everyone and congratulations on your first MAME contribution Pitou!
User avatar
No.13020
Pitou
Tester
Aug 1, 2016, 00:44
edited on: Aug 1, 2016, 00:45
Thanks very much Sorn!

Uploaded patch_v5_0176.zip to support Mame 0.176

Please guide me on how to do a pull request.

Thank you.

Pitou!

User avatar
No.13024
justindarc
Tester
Aug 1, 2016, 18:15
Pitou:

The MAME submission guide is here: http://wiki.mamedev.org/index.php/Submitting_Source_Code

More generally, you'll need to have a GitHub account and "fork" the MAME repo by clicking "Fork" button in the top-right of the page:

https://github.com/mamedev/mame

Once you've forked the repo, you'll have to clone your fork to your local machine. Then, from there, apply your patch and commit it to your local repo. After you've pushed your changes to your fork, you'll then have the ability to create a Pull Request from GitHub. There's really good documentation on GitHub on how to do all of this:

https://help.github.com/articles/using-pull-requests/

If you have any other questions let me know. Also THANK YOU for fixing this bug! :-)
User avatar
No.13026
Pitou
Tester
Aug 2, 2016, 04:45
edited on: Aug 2, 2016, 04:46
Pull request #1179 done and checks successful. (commit 87a73f6f51ac8a1504fcdfc2728135300fea44aa)

Thanks very much justindarc! :)

Pitou!

User avatar
No.13033
justindarc
Tester
Aug 5, 2016, 18:17
It looks like this was merged. Should this bug now be closed? (Sorry, I'm still new here at mametesters so I'm not completely aware of the procedures yet)

https://github.com/mamedev/mame/commit/b25aca61770f2f9abd6dc76ddc6d447d06aeb49f
User avatar
No.13034
Tafoid
Administrator
Aug 5, 2016, 19:38
It sounds like it was confirmed fixed from GIT sources, so yes - let us resolve this.
User avatar
No.13035
Pitou
Tester
Aug 7, 2016, 16:09
edited on: Aug 7, 2016, 16:11
Just want to add a quick note about this.

With the patch, it actually adds the rawinput to the lightgun provider. It might a good thing to update the doc here.

http://docs.mamedev.org/commandline/commandline-all.html

Thank you.

Pitou!

User avatar
No.13036
Stiletto
Developer
Aug 7, 2016, 16:47
edited on: Aug 7, 2016, 16:48
We can do that.

Is it safe to say "The default is auto. On Windows, auto will try rawinput with fallback to win32"?

... this also makes me wonder if there can be a DirectInput lightgun provider...

User avatar
No.13037
Pitou
Tester
Aug 7, 2016, 17:24
Just for comparison, here are the modules for keyboard and mouse:

REGISTER_MODULE(m_mod_man, KEYBOARDINPUT_SDL);
REGISTER_MODULE(m_mod_man, KEYBOARDINPUT_RAWINPUT);
REGISTER_MODULE(m_mod_man, KEYBOARDINPUT_DINPUT);
REGISTER_MODULE(m_mod_man, KEYBOARDINPUT_WIN32);
REGISTER_MODULE(m_mod_man, KEYBOARD_NONE);

REGISTER_MODULE(m_mod_man, MOUSEINPUT_SDL);
REGISTER_MODULE(m_mod_man, MOUSEINPUT_RAWINPUT);
REGISTER_MODULE(m_mod_man, MOUSEINPUT_DINPUT);
REGISTER_MODULE(m_mod_man, MOUSEINPUT_WIN32);
REGISTER_MODULE(m_mod_man, MOUSE_NONE);

From the modules order I see here in the source, (osdobj_common.cpp)

REGISTER_MODULE(m_mod_man, LIGHTGUN_X11); <----- Windows ignore this one
REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_RAWINPUT);
REGISTER_MODULE(m_mod_man, LIGHTGUNINPUT_WIN32);
REGISTER_MODULE(m_mod_man, LIGHTGUN_NONE);

I would say "The default is auto". On Windows, auto will try "RAWINPUT, Win32" in that order or fallback to "none" if it doesn't find any.

You're right saying that there is no "Directinput" input for lightgun.

Of course, the user can specify one in mame.ini if desired.

What do you think?

Pitou!
User avatar
No.13040
Stiletto
Developer
Aug 8, 2016, 18:57
Okay, I just applied a docs fix, hopefully I'm accurate re: the Linux platform :)
User avatar
No.13041
Pitou
Tester
Aug 8, 2016, 23:14
I just read it. I think it's good!

I don't want to sound picky, but there is a missing dot after the word "none" in this sentence:

" win32, or none On SDL"

Thanks! :)

Pitou!