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: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1  (Read 29284 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!
EDIT - This issue has been resolved and details posted at -

http://forum.arcadecontrols.com/index.php?topic=150452.msg1572347#msg1572347

Please see that thread for up to date information regarding troubleshooting newer versions of MAME in attempt to get dual lightguns working.

I've exhausted the help provided by Andy at ULTIMARC, who cannot seem to resolve the issue, and it does appear to be MAME related. MAME wont see GUN#2, it just see's both guns as GUN#1, when I point both at the screen both of them produce blue (player 1) crosshairs at the same time. When attempting to configure the inputs for light gun 2, it see's both the 2nd gun and the first gun as GUN#1, as if they were the same device.

Im testing on the latest mame, but older versions (I think my main set is .158) produce the same issue.

Here is my verbose output-

C:\Users\Media\Desktop\mame172>mame64.exe ptblank2 -verbose
Video: Monitor 0000000008c74708 = "\\.\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
Value 1 not supported for option sound - falling back to auto
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: Controller (XBOX 360 For Windows)
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: THT Arcade console 2P USB Player
Input: Adding Joy #6: ATRAK Device #1
Input: Adding Joy #7: ATRAK Device #8

Here are the options I've put in my mame.ini -

coin_lockout 1
ctrlr
mouse 1
joystick 1
lightgun 1
multikeyboard 0
multimouse 1
steadykey 0
ui_active 0
offscreen_reload 1
joystick_map auto
joystick_deadzone 0.3
joystick_saturation 0.85
natural 0
joystick_contradictory 0
coin_impulse 0

paddle_device keyboard
adstick_device keyboard
pedal_device keyboard
dial_device keyboard
trackball_device keyboard
lightgun_device lightgun
positional_device keyboard
mouse_device mouse

global_inputs 0
dual_lightgun 0


And as you can see from the verbose output, my AimTrak devices have been registered with different ID's (#1 and #8) .....so as far as I can figure out they SHOULD be seen as GUN#1 and GUN#2, but MAME does not see GUN#2

Im testing on point blank, a 2 player shooter.


Any help is greatly appreciated, these guns are very expensive and I've had them for a week and cannot get player 2 gun working. Im so excited to play with friends/girfriend but cannot get past this problem 
« Last Edit: July 14, 2016, 04:27:11 pm by Sorn »

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #1 on: April 13, 2016, 08:11:58 pm »
I guess - since you got Andy's help - that your Aimtrak have 2 differents ID and are working fine (Sensor View tab on Aimtrak software)

I used this document to setup my MAME and my 2 aimtraks : https://www.ultimarc.com/AimTrak%20Setup%20Guide.pdf
Did you do exactly what is written inside ? there's a part where you need to calibrate Gun1 and Gun2 Axis in MAME control menu

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #2 on: April 13, 2016, 08:34:40 pm »
I guess - since you got Andy's help - that your Aimtrak have 2 differents ID and are working fine (Sensor View tab on Aimtrak software)

I used this document to setup my MAME and my 2 aimtraks : https://www.ultimarc.com/AimTrak%20Setup%20Guide.pdf
Did you do exactly what is written inside ? there's a part where you need to calibrate Gun1 and Gun2 Axis in MAME control menu

I thank you for the reply, but I've of course followed the instructions. When configuring the inputs, MAME see's both guns as being GUN0, as you can see in my log "Input: Adding Gun #0: Win32 Gun 1"

So both ATRAK Device #1 and ATRAK Device #8 (device ID 1 and 8 respectively set in the aimtrak config utility), are seen as GUN#0 in MAME.

I really wish I could figure out why.

brucelee00

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 110
  • Last login:December 13, 2020, 05:16:36 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #3 on: April 14, 2016, 02:59:07 am »
I had this problem about 2 years ago and the only it was resolved for me was to make sure you have a compiled version of mame that does NOT have force directinput. You can easily compile your own version of mame using mame compiler 64 and making sure force directinput is unchecked.

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #4 on: April 14, 2016, 08:26:32 am »
brucelee may be right !
I almost made this mistake by using a prepatched MAME with hi-score/no-nag patch, but forcing directinput
I ended up using simple official MAME release fot testing purposes, it works as expected with Aimtraks

Here's my output for verbose MAME, I don't know if order is relevant but my Aimtraks are listed after "RAW Input" section as HID devices. Not after "Direct Input" section as Win32 Gun like you. Hope this helps :)

Quote
D:\MAME>mame64 timecris -verbose
Video: Monitor 0000000008231FE8 = "\\.\DISPLAY1" (p
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Configuring adapter #0 = NVIDIA GeForce G
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 Kbd #0: Standard PS/2 Keyboard
DirectInput: Using DirectInput 8
Input: Adding Joy #0: ATRAK Device #1
Input: Adding Joy #1: ATRAK Device #2
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 c[...]


Added part of my .ini :
Quote
#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr                     
mouse                     1
joystick                  1
lightgun                  1
multikeyboard             0
multimouse                0
steadykey                 0
ui_active                 0
offscreen_reload          1
joystick_map              auto
joystick_deadzone         0.3
joystick_saturation       0.85
natural                   0
joystick_contradictory    0
coin_impulse              0

#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device             keyboard
adstick_device            keyboard
pedal_device              keyboard
dial_device               keyboard
trackball_device          keyboard
lightgun_device           keyboard
positional_device         keyboard
mouse_device              mouse

#
# INPUT DEVICE OPTIONS
#
global_inputs             0
dual_lightgun             0

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #5 on: April 14, 2016, 11:56:12 am »
Looks promising! The version I posted the verbose output from is directly from mamedev-

https://github.com/mamedev/mame/releases/download/mame0172/mame0172b_64bit.exe

Does that have directinput compiled in? I just looked for a different source and dont see anything pre-compiled? Can someone direct me to some binaries without it please and thank you? :) ...EDIT....just found the mame compiling at the top of this forum! Will give it a shot in a few here!
Doubleedit - Is this gonna break my hyperspin? Still trying to figure out what directinput is.

Also fantastic work on demulshooter!!!! I was just playing hotd2 last night :) :) :)!!!!

brucelee may be right !
I almost made this mistake by using a prepatched MAME with hi-score/no-nag patch, but forcing directinput
I ended up using simple official MAME release fot testing purposes, it works as expected with Aimtraks

Here's my output for verbose MAME, I don't know if order is relevant but my Aimtraks are listed after "RAW Input" section as HID devices. Not after "Direct Input" section as Win32 Gun like you. Hope this helps :)

Quote
D:\MAME>mame64 timecris -verbose
Video: Monitor 0000000008231FE8 = "\\.\DISPLAY1" (p
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Configuring adapter #0 = NVIDIA GeForce G
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 Kbd #0: Standard PS/2 Keyboard
DirectInput: Using DirectInput 8
Input: Adding Joy #0: ATRAK Device #1
Input: Adding Joy #1: ATRAK Device #2
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 c[...]


Added part of my .ini :
Quote
#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr                     
mouse                     1
joystick                  1
lightgun                  1
multikeyboard             0
multimouse                0
steadykey                 0
ui_active                 0
offscreen_reload          1
joystick_map              auto
joystick_deadzone         0.3
joystick_saturation       0.85
natural                   0
joystick_contradictory    0
coin_impulse              0

#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device             keyboard
adstick_device            keyboard
pedal_device              keyboard
dial_device               keyboard
trackball_device          keyboard
lightgun_device           keyboard
positional_device         keyboard
mouse_device              mouse

#
# INPUT DEVICE OPTIONS
#
global_inputs             0
dual_lightgun             0
« Last Edit: April 14, 2016, 12:12:04 pm by Sorn »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #6 on: April 14, 2016, 11:50:18 pm »
Im having a hell of a time getting mame compiled, the mame compiler 64 is throwing all sorts of errors :/ This issue has become a ENORMOUS time suck and I just am struggling to make this work. I've spent dozens of hours on this small issue at this point and its driving me crazy.

Can anyone compile 0158 with no nag / high scores / neogeoxtra / auto fire  - patches? thats what patches my current exe says it has, plus direct input of course. I cant even seem to find half those patches :/ I just really need 0158 with no direct input please, with no nag / high scores being the necessities.

Also, im assuming this will break my input? How can I have my cake and ice cream too? Ayiee :(

Anyway to submit this to mame dev's as a bug? Since its not recognizing both guns? Is it a bug? Seems like it would be awesome to get both guns recognized and still be able to use my joysticks/gamepads to control mame.

« Last Edit: April 15, 2016, 12:03:17 am by Sorn »

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #7 on: April 15, 2016, 03:08:33 am »
Unfortunatelly I do not know MAME very well, I can just tell that I didn't compile anything : I just downloaded it on the official page (same kind of link you put here) and followed Aimtrak guide and voilą :(
Official MAME should work with rawinput without any patch. The only reason I can see for raw input to be disabled is to apply a pre-made patch for highscore/no-nagg forcing DirectInput (that's the idee behind brucelee00's message)

Your aimtraks setup seems to work fine if you played Hotd2 with Demulshooter with both guns, so problem seems to be on MAME side and for specific MAME configuration I'm affraid I can't help you much more :(

Doubleedit - Is this gonna break my hyperspin? Still trying to figure out what directinput is.
To make it short :
DirectInput : MAME get mouse position by getting Windows calculated cursor position from DirectX. The problem is, Windows handle only one cursor... so if you have multiple mice, they all control the same cursor and MAME will only have P1 position
RawInput : MAME reads raw data directly from device. You have to handle which device send whatever message but you can handle as many devices as you want separately

So no impact to hyperspin  configuration ;)
« Last Edit: April 15, 2016, 03:25:03 am by argonlefou »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #8 on: April 15, 2016, 11:35:28 am »
Unfortunatelly I do not know MAME very well, I can just tell that I didn't compile anything : I just downloaded it on the official page (same kind of link you put here) and followed Aimtrak guide and voilą :(
Official MAME should work with rawinput without any patch. The only reason I can see for raw input to be disabled is to apply a pre-made patch for highscore/no-nagg forcing DirectInput (that's the idee behind brucelee00's message)

Your aimtraks setup seems to work fine if you played Hotd2 with Demulshooter with both guns, so problem seems to be on MAME side and for specific MAME configuration I'm affraid I can't help you much more :(

Doubleedit - Is this gonna break my hyperspin? Still trying to figure out what directinput is.
To make it short :
DirectInput : MAME get mouse position by getting Windows calculated cursor position from DirectX. The problem is, Windows handle only one cursor... so if you have multiple mice, they all control the same cursor and MAME will only have P1 position
RawInput : MAME reads raw data directly from device. You have to handle which device send whatever message but you can handle as many devices as you want separately

So no impact to hyperspin  configuration ;)

Can you send me your exe? I cannot get mame compiler to work, im getting all kinds of errors.

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #9 on: April 15, 2016, 11:49:27 am »
I'm not at home for a few days but i'll mp you a link when I return

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #10 on: April 17, 2016, 04:25:36 pm »
Hey all,

Just a update. Getting 0171 to cleanly compile with no direct input checked has resolved the situation. Now all of my guns are recognized as separate GUN#'s and I can configure their inputs and they all work great!

So if anyone is having a issue please use mame compiler 64 to get it done. What worked for me is only downloading the latest source from mamedev, extracting it in its own folder like 0171, checkmarking and downloading the build tools in mame 64 compiler, and then setting all the directories correctly. Check mark clean compile in the firs tab and hit go, then you will probably get this error:

make: *** No rule to make target `build/generated/mame/layout/', needed by `build/generated/mame/layout/18w.lh'. Stop.

Then i hit go again, and it seems to power through it and compile cleanly.


Then I just run the exe on my mame cabinet and its all good.
« Last Edit: April 18, 2016, 11:51:18 am by Sorn »

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #11 on: April 18, 2016, 03:43:41 am »
Great news  :applaud:

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #12 on: April 18, 2016, 03:39:46 pm »
Great news  :applaud:

Oh, i wanted to add for anyone else thaqt may have this problem in the future -

DirectInput: Using DirectInput 8

That still shows up even on mame 0171 with no forced input checked on mame compiler 64. So that is not a good indicator of whether or not mame is using forced input. Maybe it has to do with something else? Not sure.

mDang

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:February 15, 2017, 04:33:33 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #13 on: April 19, 2016, 02:03:43 pm »
hello !
i have exactly the same problme ! and i spend hours to correct it, but nothing good !
please can you send us your mame version to try it ?
thanks !

maxime

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #14 on: April 19, 2016, 04:27:43 pm »
hello !
i have exactly the same problme ! and i spend hours to correct it, but nothing good !
please can you send us your mame version to try it ?
thanks !

maxime

Funny you responded, I was just about to post it anyways! For anyone who is having similar problems as me, here you go! 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 above is MAME 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. 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

mDang

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:February 15, 2017, 04:33:33 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #15 on: April 19, 2016, 06:28:22 pm »
ok, it's working perfectly now for me ! thanks for your help and for your share  :cheers:

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #16 on: June 27, 2016, 10:19:24 pm »
Deleted
« Last Edit: June 29, 2016, 04:13:03 pm by Pitou »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #17 on: July 07, 2016, 12:58:07 am »
Hello,

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!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #18 on: July 07, 2016, 12:18:04 pm »
Hello,

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!

I will compile 0.175 and give it a try. Is the only change made just setting it to rawinput in mame.ini ?

What program are you using to apply these .diff's ? I use mame compiler 64 and its throwing the following error on both .diff files when I try to "test" them against 0175 sources -

Testing Diff Patch...
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
Finished!
0 Hours 0 Minutes and 0 Seconds Elapsed.
The text leading up to this was:

Also, MKChamp's 0175 hi score patch isnt working with MC64 either :(

Testing Diff Patch...
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nru old/emu/emuopts.cpp src/emu/emuopts.cpp
|--- old/emu/emuopts.cpp   2016-06-29 03:04:14.753317700 -0500
|+++ src/emu/emuopts.cpp   2016-06-29 09:36:42.863647400 -0500
« Last Edit: July 07, 2016, 12:34:47 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #19 on: July 07, 2016, 03:23:05 pm »
I'm not sure where MC64 drop the patch diff files. So I can't tell which -p# you should use.

To simplify things, Just overwrite both file included in the zip to the right locations. (I gave the locations in my previous post), then recompile.

About the lightgunprovider in mame.ini, there is no need to change it to "rawinput", you can leave it to auto.

Thanks!

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #20 on: July 08, 2016, 12:13:06 am »
I'm not sure where MC64 drop the patch diff files. So I can't tell which -p# you should use.

To simplify things, Just overwrite both file included in the zip to the right locations. (I gave the locations in my previous post), then recompile.

About the lightgunprovider in mame.ini, there is no need to change it to "rawinput", you can leave it to auto.

Thanks!

Pitou!

Every single time I go to recompile a new mame version theres always something wrong. I cannot even get MC64 to attempt to compile now and I have no idea what im doing wrong.

CompileMame(): The system cannot find the file specified

Is all i get when trying to compile with MC64.

If you can compile 64bit with your changes and the high score patch I would be able to test, otherwise I can't get this damn source to compile. MC64 is insanely finnicky with very little debug output that states what the actual problem is.

I found a pre-compiled 0175 with hi score on hyperspin-fe and someone said to get dual lightguns working just....

"set your Mame.ini for

lightgunprovider = win32
mouseprovider = rawinput

to work with dual lightguns "

So I will try that.
« Last Edit: July 08, 2016, 12:17:35 am by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #21 on: July 08, 2016, 11:13:43 am »
Ok let me try to help you.

Are you a bit familiar with the command line interface? Much much easier in my opinion. I'll post a binary 64-bit later today.

Please read carefully and take your time when doing it.

I'll try to detail step by step:

- Compiling for the first time:

1- Download the building environment:

https://github.com/mamedev/buildtools/releases/download/1.5/msys64-2016-02-16.exe

Extract it to let's say:

D:\Compile

It should create a dir called "msys64"

2- Go to D:\Compile\msys64 and execute "autorebase.bat"

3- Go to D:\Compile\msys64 and execute "win32con.bat". This is the CLI.

4- Type: git config --global core.autocrlf true

5- Type: git clone https://github.com/mamedev/mame.git

6- Type: cd mame

7- Type: make

This should create the mame64.exe

-----------------------------------------------------------------------

- To compile future versions:

1- Go to D:\Compile\msys64 and execute "win32con.bat". This is the CLI.

2- Type: cd mame

3- Type: git pull

4- Type: make

This should create the mame64.exe

-----------------------------------------------------------------------


Now going back to our issue here, until an official patch is included to the Mame source code.

1- Replace/overwrite both .cpp files included in the zip to their proper location

2- Go to D:\Compile\msys64 and execute "win32con.bat". This is the CLI.

3- Type: cd mame

4- Type: make

This should create the mame64.exe


Now about the High Scores, I would suggest you activate the built-in high score support in Mame instead of using the diff patch file.
It works pretty well in my opinion. It's using LUA and it's using the plugins. All this is already included in Mame. No more patch needed anymore.

To enable them:

1- In mame.ini, make sure it's set like this:

plugins                   1
plugin                   
noplugin                 
language                  English

2- In plugin.ini

#
# PLUGINS OPTIONS
#
cheat                     0
cheatfind                 0
dummy                     0
hiscore                   1
layout                    0
timer                     0

3- Make sure the "plugins" directory exists. It should already be provided by Mame.

4- It still use the same "hi" directory as the patch diff used. It will also re-use the same <rom>.hi files that are already present in the "hi" directory

Hope it helps.

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #22 on: July 08, 2016, 02:06:10 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!
« Last Edit: July 08, 2016, 03:18:36 pm by Pitou »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #23 on: July 11, 2016, 10:13:47 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Sorry for not testing sooner, life seems to get in the way of fun!

Well, first things first you are half way there! Its working better than the rawinput patched 0175 provided by hyperspin found here -http://www.hyperspin-fe.com/files/file/11913-mame-64bit-nonag-hi-score-raw-input/

Here's the results. With the new mame.ini settings set like this -

mouseprovider             auto
lightgunprovider          auto

Here is the verbose output -

H:\HyperSpin\Emulators\MAME>mame640175-pitou.exe ptblank -verbose
Video: Monitor 000000000adac020 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Initialize
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
Direct3D: Initialize HLSL
Direct3D: First store options
Direct3D: HLSL initialized
RawInput: APIs detected
RawInput: APIs detected
RawInput: APIs detected
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: HID-compliant mouse
Input: Adding Gun #1: HID-compliant mouse
Input: Adding Gun #2: HID-compliant mouse
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Input: Adding Joy #0: THT Arcade console 2P USB Player
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: ATRAK Device #1
Input: Adding Joy #5: ATRAK Device #8
Input: Adding Joy #6: XInput Player 1
Input: Adding Joy #7: XInput Player 2
Region ':maincpu' created

With it set to auto, I get a strange ALMOST working setup. As you can see from above the guns are added and are assigned their own separate #, so mame can see them as different guns. However when I try to use them, what happens is I can only use gun #1 if gun #2 is pointed off screen and vice versa. So for example if I point both at the screen, I get this weird color that appears to be the crosshairs flickering back and forth from blue to red, and trying to use them results in strange inaccuracies. But if I point gun 1 off screen, then gun 2's crosshairs will then stabilize to blue. If I bring gun1 back onscreen, then gun2 gets all sketchy again. Similarly if I point gun1 at the screen and gun2 off screen, gun1 is recognized as red, shoots for the correct character, everything is normal. It just gets whacky when I try to bring both lightguns onscreen. If you need a better explanation I can try to do a screen record to get video of the issue. Just let me know and I would be happy to oblige the request.

my offscreen_reload option is set to 0.



Here is verbose for the rawinput patched version hosted on hyperspin-fe with mame.ini set to auto on both options-

H:\HyperSpin\Emulators\MAME>mame64HS.exe ptblank -verbose
Video: Monitor 000000000a936db8 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Initialize
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
Direct3D: Initialize HLSL
Direct3D: First store options
Direct3D: HLSL initialized
RawInput: APIs detected
RawInput: APIs detected
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
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Input: Adding Joy #0: THT Arcade console 2P USB Player
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: ATRAK Device #1
Input: Adding Joy #5: ATRAK Device #8
Input: Adding Joy #6: XInput Player 1
Input: Adding Joy #7: XInput Player 2

No matter how I change the mame.ini lightgun/mouse provider options, they do not seem to recognize both guns.

So you are almost there! So close :)

I should be able to test quicker now should you respond. Thank you!

anchounio

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 121
  • Last login:December 17, 2023, 04:24:10 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #24 on: July 12, 2016, 07:12:09 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Yes, but MkChamp diff also enables nonag.
I've tried your compiled mame with my 2 aimtraks guns and it works!
Could you please compile it with the mkchamp hiscore diff??  It's just for the nonag support.
I've tried to compile it but it always fails mentioning the 2 modified files.
« Last Edit: July 12, 2016, 07:14:34 pm by anchounio »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #25 on: July 12, 2016, 10:30:03 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Yes, but MkChamp diff also enables nonag.
I've tried your compiled mame with my 2 aimtraks guns and it works!
Could you please compile it with the mkchamp hiscore diff??  It's just for the nonag support.
I've tried to compile it but it always fails mentioning the 2 modified files.

What is your OS?

Strange it works for you but not me :( Could you please attach your mame.ini?

dgrace

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 341
  • Last login:April 11, 2024, 01:43:59 am
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #26 on: July 13, 2016, 02:03:11 am »
I use MAMEuifx 0.169 no-nag, raw-input, 64bit 0.169.  I pulled my hair out for about two months before figuring this out.  I figured out why both light guns were being recognized as the same device in MAME.  I was using directinput MAME instead of rawinput.  Once I installed the rawinput version it worked perfectly after setting mouse to mouse and lightgun device to lightgun, lightgun 1, joystick 1, mouse 1 and multimouse.  If you use MAME directinput you have to set player 2 in the aimtrak utility to emulate as a joystick for it to work.  But this creates problems with other emulators that require you to set both as a mouse (i.e. House of the Dead 2 via troubleshooter or supermodel emulator).  I recommend setting both guns in aimtrak utility to emulate as a mouse and use the rawinput MAME version.  I hope this helps. If anyone is interested check out the Hyperspin website download link below.

http://www.hyperspin-fe.com/files/file/11083-mameuifx-0169-no-nag-raw-input-64bit/

anchounio

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 121
  • Last login:December 17, 2023, 04:24:10 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #27 on: July 13, 2016, 02:08:37 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Yes, but MkChamp diff also enables nonag.
I've tried your compiled mame with my 2 aimtraks guns and it works!
Could you please compile it with the mkchamp hiscore diff??  It's just for the nonag support.
I've tried to compile it but it always fails mentioning the 2 modified files.

What is your OS?

Strange it works for you but not me :( Could you please attach your mame.ini?

I use Windows 7 Ultimate x64.
I attach my mame.ini.  I just followed the aimtraks manual, pages 11-12-13-14 to configure MAME :

 https://www.ultimarc.com/AimTrak%20Setup%20Guide.pdf


Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #28 on: July 13, 2016, 03:39:47 pm »
@anchounio

I'm away for the week returning next sunday with limited access to the net. Will compile a version with mkchamp patch after

Thanks for testing and feed-back

@sorn, did you map controls in the cfg file?

Thanks again for your time

Pitou

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #29 on: July 13, 2016, 05:15:22 pm »
@anchounio

I'm away for the week returning next sunday with limited access to the net. Will compile a version with mkchamp patch after

Thanks for testing and feed-back

@sorn, did you map controls in the cfg file?

Thanks again for your time

Pitou

Oops, yes I did and forgot to mention that! Input devices are mapped with Gun1 X and Gun1 Y, Gun b0 for trigger, and same for gun2. As explained, they both work, and the system does see gun1 as gun1 with red crosshairs, and gun2 as gun2 with blue crosshairs, so long as the other gun is pointed offscreen. Gun1 and Gun2 similarly also shoot and are registered as gun1/gun2 b0 and correctly assigns the trigger to each respective players shot, but again, so long as the other gun is pointed off screen.

When both guns are pointed on-screen it causes confusion unlike I've seen before, with the crosshairs constantly flickering between red/blue, so the system is confused as to which device is which. Almost like it is constantly remapping gun1's crosshair as gun2's crosshair, so its constantly switching between red/blue. Strange situation.

Im going to test a little more now, see if I can sort out what the issue is.

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #30 on: July 13, 2016, 06:37:40 pm »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Yes, but MkChamp diff also enables nonag.
I've tried your compiled mame with my 2 aimtraks guns and it works!
Could you please compile it with the mkchamp hiscore diff??  It's just for the nonag support.
I've tried to compile it but it always fails mentioning the 2 modified files.

@anchounio

I am compiling a version with Pitou's v2 patch and MKChamps 0175c patch now for you. When I can get it to compile clean I will post the exe for you.

@Pitou

Here is a video of the behavior I was describing. I have gone over my mame.ini and my settings are exactly the same as @anchounio's. I'll attach as a reference just incase I missed something stupid, but all of the lightgun/mouse info is all the same. The only thing I tried alternating was setting mouse to 1 from 0, which is how dgrace has his setup, but no change occurred.
 


I find it very strange that I am running Windows 7 x64 just like @anchounio with the same setup and yet im getting these strange issues :( I am hoping it will make more sense to you once you see the video.


dgrace

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 341
  • Last login:April 11, 2024, 01:43:59 am
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #31 on: July 13, 2016, 11:34:02 pm »
Wow, that's nuts.  I would recommend just using MAMEuifx 0.169 no-nag, raw-input, 64bit 0.169.  It's worked perfect for me and was super easy to configure p1 and p2 aimtrak guns in dual mode.  See download link in previous post.

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #32 on: July 13, 2016, 11:46:20 pm »
Wow, that's nuts.  I would recommend just using MAMEuifx 0.169 no-nag, raw-input, 64bit 0.169.  It's worked perfect for me and was super easy to configure p1 and p2 aimtrak guns in dual mode.  See download link in previous post.

You are responding in a thread where I have posted a working solution for 0171 with dual light gun support. So I already have it working. I also am the submitter of the bug to the mame dev's -

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

What we are trying to do is actually fix the problem so it does not exist in future versions  :applaud:

potts43

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16
  • Last login:May 15, 2022, 08:46:50 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #33 on: July 14, 2016, 04:04:24 am »
Exactly. I have v171 working perfectly but no version after that works for me.

anchounio

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 121
  • Last login:December 17, 2023, 04:24:10 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #34 on: July 14, 2016, 04:54:05 am »
@Sorn

There is a compile error with my first patch. Use this one instead. (patch_v2.zip). Again, you can just replace the files.

Thing is it was compiling fine with MS Visual Studio, but not with MinGW. I did the correction in patch_v2.zip

Also here is a compiled version here. It's base on 0.175 and it's a 64-bit binary. Again, for High scores, you can use the embedded Mame high score plugin. I didn't apply the high score diff patch from MkChamp.

https://files.fm/u/up7dhn6f#_

Sorry for that.

Pitou!

Yes, but MkChamp diff also enables nonag.
I've tried your compiled mame with my 2 aimtraks guns and it works!
Could you please compile it with the mkchamp hiscore diff??  It's just for the nonag support.
I've tried to compile it but it always fails mentioning the 2 modified files.

@anchounio

I am compiling a version with Pitou's v2 patch and MKChamps 0175c patch now for you. When I can get it to compile clean I will post the exe for you.

@Pitou

Here is a video of the behavior I was describing. I have gone over my mame.ini and my settings are exactly the same as @anchounio's. I'll attach as a reference just incase I missed something stupid, but all of the lightgun/mouse info is all the same. The only thing I tried alternating was setting mouse to 1 from 0, which is how dgrace has his setup, but no change occurred.
 


I find it very strange that I am running Windows 7 x64 just like @anchounio with the same setup and yet im getting these strange issues :( I am hoping it will make more sense to you once you see the video.

I've just tested your mame.ini and it works fine for me!!!   Both guns work!
In my case I'm using 2 ultimarc's aimtraks

potts43

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16
  • Last login:May 15, 2022, 08:46:50 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #35 on: July 14, 2016, 05:01:41 am »
Where is the download for the version that works for you?

anchounio

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 121
  • Last login:December 17, 2023, 04:24:10 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #36 on: July 14, 2016, 01:10:12 pm »
Hi
I've tried this 0.175 version patch with more MAME games and I've found out that it's far from being perfect.
I had only tried it with Maximun Force and Area 51, both games work correctly with 2 players but their crosshairs colors join, so both crosshairs look purple. This doesn't happen in 0.171
But now I've tried Rail Chase and it doesn't work with 2 players. Both guns interfere each other in movements. They are correctly recognized (gun 2 and gun 3, same way mame 0.171 recognises them) but when both are together onscreen one of them doesn't move.
I've copied the mame 0.171 exe file in my mame directory and then Rail Chase works fine with the 2 guns simultaneosly. I've also found out that in the Service menu of both Area 51 and Maximun force the crosshairs colors of both players seem to mix each other, whereas in the 0.171 mame version this doesn't happen.

Somehow, both guns interfere each other and this affect some games.... or maybe all of them in a minor or big impact.

I'll be trying with more games and I'll let you know.

Edit 1:

I've tried Crypt Killer, and player1 trigger interferes with player 2. Some shots of the trigger 1 are shot in the player 2 crosshair. And yes, both crosshairs colors tend to unite. Same problem with Area51 and Maximun Force.
No problem in 0.171 mame version.


By the way, my aimtrak guns are perfectly configured in Model2, Model3 and Demul emulators (using demulshooter 3.2), and they also work perfect in Mame 0.171 version.
« Last Edit: July 14, 2016, 03:05:20 pm by anchounio »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #37 on: July 14, 2016, 03:20:07 pm »
Hi
I've tried this 0.175 version patch with more MAME games and I've found out that it's far from being perfect.
I had only tried it with Maximun Force and Area 51, both games work correctly with 2 players but their crosshairs colors join, so both crosshairs look purple. This doesn't happen in 0.171
But now I've tried Rail Chase and it doesn't work with 2 players. Both guns interfere each other in movements. They are correctly recognized (gun 2 and gun 3, same way mame 0.171 recognises them) but when both are together onscreen one of them doesn't move.
I've copied the mame 0.171 exe file in my mame directory and then Rail Chase works fine with the 2 guns simultaneosly. I've also found out that in the Service menu of both Area 51 and Maximun force the crosshairs colors of both players seem to mix each other, whereas in the 0.171 mame version this doesn't happen.

Somehow, both guns interfere each other and this affect some games.... or maybe all of them in a minor or big impact.

I'll be trying with more games and I'll let you know.

Edit 1:

I've tried Crypt Killer, and player1 trigger interferes with player 2. Some shots of the trigger 1 are shot in the player 2 crosshair. And yes, both crosshairs colors tend to unite. Same problem with Area51 and Maximun Force.
No problem in 0.171 mame version.


By the way, my aimtrak guns are perfectly configured in Model2, Model3 and Demul emulators (using demulshooter 3.2), and they also work perfect in Mame 0.171 version.

That is so relieving to hear! I was going a little crazy assuming it was my setup. I was about to ask you about firmware versions, driver versions and start digging up differences. Good to know we are experiencing similar issues.

I always test on my favorite - Point Blank :)

Where is the download for the version that works for you?

Please read the thread I created specifically to address a working solution (0171), -

http://forum.arcadecontrols.com/index.php/topic,150452.msg1572347.html#msg1572347

I am hosting the working version and provide the link in that topic, thank you.

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #38 on: July 17, 2016, 03:26:26 pm »
ok I'm back.

Thanks very much for testing guys. I see that my patch_v2 does not work.

I just made another patch. This one is using a another strategy. It will detect only mice, so the lightgun will be a mouse instead.

I think the issue is that the lightgun is reported exactly as a mouse in Windows. I could not find any distinguisher to separate a mouse from a lightgun.

This patch is much simpler. It only modify code in the "input_rawinput.cpp" file.

Again just replace/overwrite the file and re-compile (Start from a fresh source code). You also need to change the mame.ini and set "lightgunprovider none" (very important)

In summary:

1- start with a fresh source code tree
2- replace input_rawinput.cpp in the proper directory
3- compile mame
4- set "lightgunprovider none" in mame.ini

I know it's a lot of work, but if you could give it a try and test, that would be great. :)

I will try to post a compiled binary if needed.

Thanks very much!

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #39 on: July 17, 2016, 06:14:32 pm »
ok I'm back.

Thanks very much for testing guys. I see that my patch_v2 does not work.

I just made another patch. This one is using a another strategy. It will detect only mice, so the lightgun will be a mouse instead.

I think the issue is that the lightgun is reported exactly as a mouse in Windows. I could not find any distinguisher to separate a mouse from a lightgun.

This patch is much simpler. It only modify code in the "input_rawinput.cpp" file.

Again just replace/overwrite the file and re-compile (Start from a fresh source code). You also need to change the mame.ini and set "lightgunprovider none" (very important)

In summary:

1- start with a fresh source code tree
2- replace input_rawinput.cpp in the proper directory
3- compile mame
4- set "lightgunprovider none" in mame.ini

I know it's a lot of work, but if you could give it a try and test, that would be great. :)

I will try to post a compiled binary if needed.

Thanks very much!

Pitou!

Im compiling now, if all goes well I will give you test results by end of day, and its really not much work. The work comes into trying to figure out whats wrong with my build environment as most of the time I cannot get  builds to compile.

I was able to compile 0175 with your v2 patch applied clean, so fingers crossed there will be no issues with this v3 method. I cannot for whatever reason get mkchamps patch to compile.

Spoke too soon....

makefile:959: recipe for target 'windows_x64' failed

But no errors in console. It seemed like it was going to compile and then threw a error at the very end, grrrr. So yes, looks like I will need a compiled version.
« Last Edit: July 17, 2016, 07:43:36 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #40 on: July 17, 2016, 07:49:54 pm »
@Sorn,

My mistake, sorry. I made the same error as last week.

Try this patch.

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #41 on: July 17, 2016, 07:55:45 pm »
@Sorn,

My mistake, sorry. I made the same error as last week.

Try this patch.

Pitou!

Great, will try compiling again  :cheers:

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #42 on: July 17, 2016, 10:26:24 pm »
@Sorn,

My mistake, sorry. I made the same error as last week.

Try this patch.

Pitou!

Still no dice.

Linking mame64.exe...
../../../../mingw-gcc/obj/x64/Release/generated/mame/mame/drivlist.o:drivlist.cpp:(.rdata+0x3eab8): undefined reference to `driver_tv990'
collect2.exe: error: ld returned 1 exit status
mame.make:240: recipe for target '../../../../../mame64.exe' failed
make[2]: *** [../../../../../mame64.exe] Error 1
makefile:943: recipe for target 'mame' failed
make[1]: *** [mame] Error 2
makefile:959: recipe for target 'windows_x64' failed
make: *** [windows_x64] Error 2

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #43 on: July 17, 2016, 10:36:52 pm »
I noticed the same with 0.175 official source. I am compiling with the git tree

Let me take a look.

In the meantime, here is a binary to test.

http://www.filedropper.com/mamearcade64_1

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #44 on: July 17, 2016, 10:44:52 pm »
ok this one will compile.

Again, sorry for the trouble.

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #45 on: July 17, 2016, 11:30:14 pm »
here is another binary with MKChamp's hiscore patch along with mine.

http://www.filedropper.com/mamearcade64_2

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #46 on: July 17, 2016, 11:37:15 pm »
and the diff file for 0.175...

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #47 on: July 18, 2016, 01:18:29 am »
here is another binary with MKChamp's hiscore patch along with mine.

http://www.filedropper.com/mamearcade64_2

Pitou!

Just got a chance to test. Gun#2 no longer shows up.
 
H:\HyperSpin\Emulators\MAME>mamearcade64.exe ptblank -verbose
Video: Monitor 0000000008d56c48 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Initialize
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
Direct3D: Initialize HLSL
Direct3D: First store options
Direct3D: HLSL initialized
RawInput: APIs detected
RawInput: APIs detected
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
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Input: Adding Joy #0: THT Arcade console 2P USB Player
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: ATRAK Device #1
Input: Adding Joy #5: ATRAK Device #8
Input: Adding Joy #6: XInput Player 1
Input: Adding Joy #7: XInput Player 2
Region ':maincpu' created
unzip: opened archive file roms\ptblank.zip

However if I change dual_lightgun to 1, then we get 2 guns in the verbose output, but when I go to configure inputs things get qwirky. Im not sure i understand the full extent of dual_lightgun and how it interacts with inputs to comment on whether things are working correctly or not. Even though both guns are added, both guns show up as gun 1 when it comes to b0 (Trigger). However they show up as different mice when calibrating for X/Y. So gun0 calibrates x/y as mouse2 and gun1 calibrates x/y as mouse3. It does not say gun0 or gun1 x or y, only mouse x and y. But the trigger, b0 does say it is both mouse2 and gun1 b0 for gun0, and mouse 3 and gun1 b0 for gun1. 

Also when I try to put both guns on screen at the same time it goes crazy. The crosshairs are forced to the outer edge of the screen. If I move one offscreen, I can kinda shoot, but its still whacky. Also both crosshairs are red, so despite showing up as difference mice in X/Y configs, the game still sees them as the same gun input, which in this case is gun1.

Attached you'll find a screenshot hopefully it clarifies.


H:\HyperSpin\Emulators\MAME>mamearcade64.exe ptblank -verbose
Video: Monitor 0000000008d26998 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1920, height 1080
Direct3D: Initialize
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
Direct3D: Initialize HLSL
Direct3D: First store options
Direct3D: HLSL initialized
RawInput: APIs detected
RawInput: APIs detected
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 Gun #1: Win32 Gun 2
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Skipping DirectInput for XInput compatible joystick Controller (XBOX 360 For Win
dows).
Input: Adding Joy #0: THT Arcade console 2P USB Player
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: ATRAK Device #1
Input: Adding Joy #5: ATRAK Device #8
Input: Adding Joy #6: XInput Player 1
Input: Adding Joy #7: XInput Player 2
Region ':maincpu' created
unzip: opened archive file roms\ptblank.zip
unzip: found roms\ptblank.zip ECD
« Last Edit: July 18, 2016, 01:32:49 am by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #48 on: July 18, 2016, 09:11:47 am »
Please read carefully my previous posts.

You have to set "lightgunprovider none" in mame.ini

Mame will only see and map mice from now on.

No Gun should appear anymore

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #49 on: July 18, 2016, 06:27:19 pm »
Please read carefully my previous posts.

You have to set "lightgunprovider none" in mame.ini

Mame will only see and map mice from now on.

No Gun should appear anymore

Pitou!

Forgive my inattention, I completely missed that. You are correct that it does not assign the guns with lightgunprovider to none. However while mame does see gun0 as mouse 2 and gun1 as mouse 3, and I've calibrated the inputs, it behaves strangely. In the video you'll notice that you can see the mouse cursor move on screen when I've hit tab to open inputs. I can move the mouse cursor and it responds on screen with accuracy.

But once I close the tab and attempt to play the game, it generally freaks out and what occurs is that it forces the cursors to the outside frame of the screen. Almost like in the middle of a screen is a magnet, and the cursors are the opposite polarization of the magnet, constantly forced away from it. If that makes sense :) But basically the cursors refuse to go on screen. It does not seem to be confused about inputs anymore with everything configured as you specified, as I see the blue/red and they dont appear to be getting mixed up anymore. So thats good :) But it seems to freak out about calibration.

Just to make sure there's nothing screwy I fired up my working 0171 exe and played the game right after with the same config with no problems.

Here's a video of the output for you to inspect -


Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #50 on: July 18, 2016, 06:49:43 pm »
I understand what you mean. Let me look if I can find anything about that "magnet" effect.

Thanks for testing.

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #51 on: July 18, 2016, 08:06:53 pm »
Sorn,

Can you use this one and paste the verbose output? You should see some coordinates scrolling.

http://www.filedropper.com/mamearcade64d

Is it the same in window or fullscreen mode?

Can you try holding still as much as you can and see if the crosshair stabilize?

If you connect only 1 gun, is the "magnet" effect still there?

Thank you.

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #52 on: July 18, 2016, 08:57:51 pm »
Sorn,

Can you use this one and paste the verbose output? You should see some coordinates scrolling.

http://www.filedropper.com/mamearcade64d

Is it the same in window or fullscreen mode?

Can you try holding still as much as you can and see if the crosshair stabilize?

If you connect only 1 gun, is the "magnet" effect still there?

Thank you.

Pitou!

yes, same in FS and windowed mode.

I tried to get the crosshairs to stay on screen, and while it is possible, its very difficult. Its almost like their sensitivity is turned up 100x so the slightest movement makes them shoot off. But getting it stabilized is not possible under current conditions. The thing thats throwing me off is you can see in the last video how when configuring inputs, you can see my mouse cursor and its perfectly accurate, no sliding off screen force is being applied. Only when you exit tab menu does it start sliding off screen.

Tried with only 1 gun, magnet effect still there.

Attaching output. Im assuming the extra output is what made the exe run under very heavy load, it was only running at a limited FPS (maybe 10 or less) and audio was similarly choppy, generally unplayable but crawled through a level just so it would generate output for ya. I managed to hit one bad guy, which is saying something haha.

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #53 on: July 18, 2016, 09:14:09 pm »
Thanks for the output.

It's normal it's slow as this is a debug version.

About the issue, might be a miscalculation. I'll look again.

I feel we're close. I'll continue my hunting.

Pitou!


Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #54 on: July 19, 2016, 07:58:56 pm »
Sorn,

I'm having a hard time with this! :)

The problem is that the gun reports a absolute values, but the way Mame seems to implement the rawinput system, seems to accept only relative values.

So I tried to calculate relative values based on absolute ones. It's probably not perfect, but I can tune if necessary.

Can you try this one? (This is still a debug build, so it will be slow)

http://www.filedropper.com/mamearcade64d_1

Thanks!

Pitou

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #55 on: July 21, 2016, 08:38:13 am »
Here is a normal full speed version.

Multiplier /4
http://www.filedropper.com/mamearcade64_3

Pitou!
« Last Edit: July 21, 2016, 10:15:21 am by Pitou »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #56 on: July 21, 2016, 08:53:41 am »
Try these ones also and tell me which one works better.

No multiplier:
http://www.filedropper.com/mamearcade64_4

Multiplier /8
http://www.filedropper.com/mamearcade64_5

Multiplier /16
http://www.filedropper.com/mamearcade64_6

Thank you.

Pitou!
« Last Edit: July 22, 2016, 09:36:28 am by Pitou »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #57 on: July 23, 2016, 04:03:41 pm »
Try these ones also and tell me which one works better.

No multiplier:
http://www.filedropper.com/mamearcade64_4

Multiplier /8
http://www.filedropper.com/mamearcade64_5

Multiplier /16
http://www.filedropper.com/mamearcade64_6

Thank you.

Pitou!

no multipler - magnet effect still exists, but player 1 cursor seems to respond much slower
than it should. So pointing to the bottom of the screen only makes the cursor point to maybe 1/3rd
of the way towards the bottom

4x - magnet effect still exists, cursor seems to move about twice as fast, so pointing it half way towards
the top makes the cursor move all the way to the top

8x - magnet effect still exists, but this multiplier seems to be the most accurate. It moves with the
same accuracy as my hand as I point it across the screen :)

16x - magnet effect still exists, cursor moves 2-3 times slower than it should

So none of them fixed the 'magnet' effect. Thanks for your continued attempts though! Its only a matter of time, and I bet your learning a lot about the input drivers :)

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #58 on: July 23, 2016, 04:49:00 pm »
Thanks for testing.

multiplier /8 is also the most precise for me.

However, it's very strange you still get the magnet effect, I really don't see it here. The crosshair follows the gun and hold steady when I stop moving. It doesn't try to get to the edges like before.

As a reminder, you still have "lightgunprovider" set to "none" and your mame.ini?

Indeed, I'm learining a lot in the process. The whole mame system is really a beast!

I'll double check again to make sure.

Thanks.

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #59 on: July 24, 2016, 01:36:01 am »
@Sorn,

A couple more for you to test, when you get a chance. I tried something else.

512:

http://www.filedropper.com/mamearcade64512

384:

http://www.filedropper.com/mamearcade64384

256:

http://www.filedropper.com/mamearcade64256

The 384 seems to be the best.

Thanks.

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #60 on: July 24, 2016, 06:59:24 pm »
@Sorn,

A couple more for you to test, when you get a chance. I tried something else.

512:

http://www.filedropper.com/mamearcade64512

384:

http://www.filedropper.com/mamearcade64384

256:

http://www.filedropper.com/mamearcade64256

The 384 seems to be the best.

Thanks.

Pitou!

None of these are as accurate as the x8, and they do not fix the magnet issue. They do however slightly change its behavior. As a reminder, the erratic behavior of the crosshairs only occurs when gun #2 is brought onto the screen at the same time as gun #1. If I use each gun individually, the crosshairs are accurate, at least with the x8 multiplier version. Its only when they are attempted to used at the same time that then suddenly the crosshairs are forced off screen.

But that behavior changed a little. Before they seemed more wildly erratic, with more flickering and random movements. These patches seemed to slow that erratic behavior down a little bit, so that they are less jumpy and flickery at the borders of the screen. Its important to keep in mind that the crosshairs are still visible at the borders of the screen, so I can still sort of analyze their behaviors.

For whatever reason, the system is confusing the two inputs and merging them somehow, which makes everything go haywire. At least that is my non-technical observation :)

Regarding the settings for mame.ini, yes, I cannot get both guns properly recognized unless I have that setup correctly, so it has stayed that way throughout testing.
« Last Edit: July 24, 2016, 09:31:13 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #61 on: July 24, 2016, 10:14:57 pm »
You explanation totally makes sense, Sorn.

I keep previous position and do a difference to calculate the movement, but I keep only 1 previous position, so it can be either gun. That's why both on screen, they go crazy. Let me see if I can track the previous position separately. Also, I'll stick with the x8 for now.

I have some issue with my LED bar and should have a new kit this week. That's why I kept asking you to test. :)

Once I get this, I won't bother you anymore and troubleshoot myself.

Thanks very much for your time and all the testing you've done so far. Very appreciated.

Once I get something, I'll let you know.

Pitou!
« Last Edit: July 24, 2016, 10:26:19 pm by Pitou »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #62 on: July 24, 2016, 11:23:39 pm »
Can you quickly test this one? I made an attempt to keep previous position independently.

http://www.filedropper.com/mamearcade64_7

Thanks.

Pitou

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #63 on: July 25, 2016, 12:45:03 pm »
Can you quickly test this one? I made an attempt to keep previous position independently.

http://www.filedropper.com/mamearcade64_7

Thanks.

Pitou

Unfortunately it does not show both gun's anymore. Verbose output shows it adding the mice as it should, and input's in configuration are configured correctly (its mouse 2 and mouse 3 for me), yet only the red and not the blue crosshair shows up. So I cannot test to see if the issue persists. When in (tab) configuration for inputs, I can see both cursors for the guns as they move across the screen, so I know that the windows driver is working correctly.

Also accuracy was still low, cursor moved at maybe half the speed it was supposed to.

Dont worry on testing, im happy to test any builds until your LED bar arrives and anytime after as well.
« Last Edit: July 25, 2016, 05:48:39 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #64 on: July 25, 2016, 06:27:48 pm »
Ok

Can you try this one? I think it works pretty well.

I made some changes and also added a small log message in the verbose to see if Gun 1 and/or Gun 2 points at the screen. Not much useful, but just to see.

This is with the x8
http://www.filedropper.com/mamearcade64_8

Here is one which I think is the right calculation about the movement accuracy. (Instead of using constant multiplier like x4, x8, x16)

http://www.filedropper.com/mamearcade64_9

Tell me what you think.

Thanks.

Pitou!
« Last Edit: July 25, 2016, 11:12:08 pm by Pitou »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #65 on: July 26, 2016, 01:03:09 pm »
Ok

Can you try this one? I think it works pretty well.

I made some changes and also added a small log message in the verbose to see if Gun 1 and/or Gun 2 points at the screen. Not much useful, but just to see.

This is with the x8
http://www.filedropper.com/mamearcade64_8

Here is one which I think is the right calculation about the movement accuracy. (Instead of using constant multiplier like x4, x8, x16)

http://www.filedropper.com/mamearcade64_9

Tell me what you think.

Thanks.

Pitou!

Congratulations! You've fixed the magnet issue :) The x8 one works the best, though it is still inaccurate. The 2nd one was less stable. Cursors were a little wild. For the x8,  From right to left, its perfect. From left to right, I end up losing about 1-2", so my gun sight reaches the edge of the screen and the crosshair lags 1-2" behind. Up and down both cause the crosshair to reach the edge of the screen when im only about 60-70% of the way up/down with my sight.

Just to see whether it was a issue with my gun calibration, i ran 0171 and the cursors are perfectly accurate. No lag or jumping ahead not even by 1/4" .....I've always been really impressed by the accuracy of these things.
« Last Edit: July 26, 2016, 02:25:31 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #66 on: July 26, 2016, 03:43:52 pm »
At last, some good news, thanks!  :cheers:

Regarding the arrow lag versus the crosshair. Since it's relative movement instead of absolute, there will always be some difference. You can see that if you use a real mouse to play your game. Try it and you'll see that the arrow lags. With other mame version or when using the Win32 input driver, all is absolute values and arrow vs crosshair is dead on.

That being said, I'll do my best to improve the accuracy. I should get my LED bars tomorrow and will try to tune as much as possible to have a decent gameplay.

Since you confirm that the Gun separation works fine and the magnet effect is gone, can you do some more tests?

Can you try a couple of games?

Also, can you check if other mouse controls, if you got any (trackball, spinner, optical steering wheel, real mouse) are still working fine. I just want to make sure I didn't break anything else.

Thank you very much!

Pitou!


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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #67 on: July 26, 2016, 07:31:24 pm »
At last, some good news, thanks!  :cheers:

Regarding the arrow lag versus the crosshair. Since it's relative movement instead of absolute, there will always be some difference. You can see that if you use a real mouse to play your game. Try it and you'll see that the arrow lags. With other mame version or when using the Win32 input driver, all is absolute values and arrow vs crosshair is dead on.

That being said, I'll do my best to improve the accuracy. I should get my LED bars tomorrow and will try to tune as much as possible to have a decent gameplay.

Since you confirm that the Gun separation works fine and the magnet effect is gone, can you do some more tests?

Can you try a couple of games?

Also, can you check if other mouse controls, if you got any (trackball, spinner, optical steering wheel, real mouse) are still working fine. I just want to make sure I didn't break anything else.

Thank you very much!

Pitou!

Considering that Its perfect from right to left, it IS possible to get very good accuracy! I think its just a matter of trial, error, and a lot of code :) I dont have anything other than a mouse, but I will test other games as well and report back if anything changes!

I think that perhaps it might be a better solution, in view of absolute vs relative, to discover what changed between 171 and 172 that broke the dual gun support. Since the absolute values are always going to be the most accurate, it seems that the proper path would be to resolve the win32 driver issue instead of trying to hack a less efficient solution.


Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #68 on: July 26, 2016, 07:48:06 pm »
I agree that it would be better to reproduce what was implemented in 0171. I looked at this possibility already (looked at the actual source code), but that seemed complicated. It's almost rewriting the entire input system again and I'm not knowledgeable enough.

Also, from what I see, I'm not sure that the Win32 input system can support multiple mice. I think only rawinput can do it and despite what Microsoft says, rawinput only supports relative values.

I'm wondering if the release of Windows 10 had an effect on decisions regarding the different input systems.

In the meantime, I'll do my best to increase the accurary and let an experimented official Mame developer do it the right way.

At least for now, we'll have something.

Stay tuned for another build probably tonight!

Pitou!
« Last Edit: July 26, 2016, 08:40:19 pm by Pitou »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #69 on: July 26, 2016, 11:32:56 pm »
Hi Sorn,

I got my LED bars. Now I understand what you mean. You're right that it will be very hard using the relative values. While inside the screen, the guns kind of re-adjust and follow pretty well the crosshair, even though the arrow doesn't always in the tab menu. When going offscreen and going back, we have to start all over again the process. Not useful for offscreen reloading.

God, I thought I was up to something. It's a bit discouraging.  :banghead:

I gotta know how they do it in the Config (tab) menu. It seems to work fine there. I guess they use absolute values and both guns are independant.

If someone could guide me a bit and point me in the right direction...

Anyway, I'll see what I can do.

Here is a little one you can try for now.

http://www.filedropper.com/mamearcade64_10

Thanks for your help!

Pitou!

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #70 on: July 28, 2016, 05:33:23 pm »
Also, from what I see, I'm not sure that the Win32 input system can support multiple mice. I think only rawinput can do it and despite what Microsoft says, rawinput only supports relative value
If it can help :
It is true that win32 cannot handle multiple mice, they will all control the same cursor and act as one and only mouse for directinput messages to 3rd party apps.

However rawinput is fully compatible with absolute value, that's what I use with DemulShooter and that's what I get from Aimtraks when I register to rawinput messages
Unless it's been disabled on windows8 or 10 (never tried more recent than win7)

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #71 on: July 28, 2016, 08:23:35 pm »
@argonlefou,

You are right, I've read a lot and experimented more and I can see the absolute values coming from the rawinput.

However, I'm having a hard time finding where Mame interprets these values and convert them to crosshair position. It seems to scale them from 0 to 1, 0.50 being the center.

I read the code a lot and used Visual Studio in step by step mode using breakpoints, but still didn't find where this happens.

If you can enlighten me on this that will help me a lot.

Thanks!

Pitou!

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #72 on: July 29, 2016, 05:11:12 am »
If you were using only your mouse until now (because of your LED bars issue) it's normal you didn't get any absolute value : absolute or relative rawinput is device-dependant. A normal mouse will only feed you with relative messages, whereas Aimtrak is feeding us with absolute rawinput messages.

as for MAME, I never looked into their code and it's so big....
I quickly downloaded 0.176 and 0.171 to compare, and indeed thay modified their input.cpp to multiple files including a brand new "input_rawinput.cpp" where you applied some of diffs from this thread.
I also noticed that they modified ther mouse_state structure, removing a variable which was used to store x,y data when the message was absolute rawinput, so my guess is that there are some deep changes  :(
I won't be of any help right now, I have no time (and not sure I'm skilled enough) to examine whole MAME source code  :(
Moreover I always had trouble (yes, me too !!) when I wanted to compile MAME from source  :banghead:

PS:
I saw on one of your diff that you used GetScreenPos and PointerToScreen to normalize values, maybe you should not : in 0.171 MAME normalizes raw absolute data when it's comming from ther rawinput module

Good Luck !

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #73 on: July 29, 2016, 08:36:01 am »
@argonlefou,

We're exactly on the same page. That's pretty much where I am right now.

I went back to my very first patch. (patch_v2.zip). What I do in this one is add all devices to both mice and lightguns table. What I discovered in Mame is that only Lightgun class devices will handle absolute values. All mouse class devices will be treated as relative. (which is obvious and that's why mouse only class table in mame cannot have lightgun device in it)

So with my patch_v2, the lightguns react accordingly, it tracks perfectly on screen. However, when both on screen, it doesn't work.

What I'm looking for at the moment is a way to add mice to the mouse devices list and lightguns to the lightgun devices list, because right now I add all devices to both lists.

However, I can't find a way to distinguish them right at the beginning. When adding the device, I can't find a way to check if it's a relative or an absolute device. Because to check that, we have to actually create the device first.

Do you know if there is another way?

Thanks very much for your help!

Pitou!

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #74 on: July 29, 2016, 11:03:49 am »
Ok I see, what I can tell you is not really MAME-related but maybe this can help you to look for what you need and/or add what you need :

Regarding rawinput, the only way I know of getting what you're seeking is by processing a WM_INPUT message in the main window message loop (this happens only afer you registered to rawinput for this device, with the RegisterRawInputDevices API)

With the lParam of the WM_INPUT message received, you have to call GetRawInputData window API with uiCommand parameter set to RID_INPUT.
For a mouse you'll obtain in pData parameter a RAWINPUT structure in which the data parameter will be a RAWMOUSE structure.
From this RAWMOUSE structure, you can access the usFlags parameter that will tell you if the device is working with absolute or relative data

I'm sorry I don't know how MAME could have this kind of information sooner :(

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #75 on: July 29, 2016, 04:13:09 pm »
I think I understand what I need to do.

However, I'm having some difficulties to understand the rawinput structures and how it links/relates.

Can you post the simplest example in 1 function, that will allow me to see the value of usFlags?

Thank you.

Pitou!

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #76 on: July 29, 2016, 07:00:27 pm »
Here's a small part of DemulShooter's code. It's C# (not c++) but you'll understand without any problems :

So here's the "Main" windows message loop :
Code: [Select]
protected const int WM_INPUT = 0x00FF;
protected override void WndProc(ref Message m)
{
    switch (m.Msg)
    {
        case WM_INPUT:
                //read in new mouse values.
                ProcessRawInput(m.LParam);
                break;
    }
    base.WndProc(ref m);
}

And then a part of the ProcessRawInput function :
Code: [Select]
private bool ProcessRawInput(IntPtr hDevice)
{
    //You have to call GetRawInputData a 1st time to have the length of the data
    var dwSize = 0;
    Win32.GetRawInputData(hDevice, DataCommand.RID_INPUT, IntPtr.Zero, ref dwSize, Marshal.SizeOf(typeof(Rawinputheader)));
   
    //Then call it a second time like this to get the data
    InputData rawBuffer;
    if (dwSize != Win32.GetRawInputData(hDevice, DataCommand.RID_INPUT, out rawBuffer, ref dwSize, Marshal.SizeOf(typeof(Rawinputheader))))
    {
        //Handle InputData retrieving errors
        return false;
    }

    if (rawBuffer.header.dwType == DeviceType.RimTypemouse)
    {
        //----> and now you can read rawBuffer.data.mouse.usFlags : 0 = RELATIVE , 1 = ABSOLUTE
« Last Edit: July 29, 2016, 07:03:37 pm by argonlefou »

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4222
  • Last login:December 17, 2023, 08:05:48 am
  • I have a gaming addiction.....
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #77 on: July 30, 2016, 03:41:44 am »
Out of interest has anyone tried the new mame with dual guns to see if its fixed?
Ime still running .170 for this reason.

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #78 on: July 30, 2016, 10:36:16 am »
Big update today! :)

@argonlefou,

Big thanks to you for your suggestions and help. As you mentioned, my biggest mistake was the use of the GetScreenPos and PointerToScreen functions. This caused a lot of issues. Can you explain quickly the purpose of those?

What I do now, is use the normalize function provided in Mame that is also used in 0171, like this:
Code: [Select]
// update the X/Y positions
lightgun.lX = normalize_absolute_axis(rawinput.data.mouse.lLastX, 0, INPUT_ABSOLUTE_MAX);
lightgun.lY = normalize_absolute_axis(rawinput.data.mouse.lLastY, 0, INPUT_ABSOLUTE_MAX);
         

I didn't have to separate the devices in the different tables. The "process_event" procedure validates if it's a relative or absolute device.

@Sorn,

Can you test this one?

**Very important**, you have to set back the "lightgunprovider" to "auto" in mame.ini (which is best since it's the default)

http://www.filedropper.com/mamearcade64_11

I'm very happy with the result. You'll probably tell me that the pointer in tab menu doesn't follow the crosshair, but I can guarantee you that I'm processing using the real absolute values for the lightgun and relative for mouse. Maybe the UI is using something different, I can't tell. But, for me, the crosshair tracks perfectly the gun.

I also tested 2 mice, 2 lightguns, 1 mouse and 1 lightgun, etc, and it works fine.

Hope you'll get same result.

Thanks for all the testing.

Note this is still based on Mame0175.

Thanks very much all!

Pitou!

« Last Edit: August 01, 2016, 11:02:13 am by Pitou »

argonlefou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1005
  • Last login:Today at 07:43:32 am
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #79 on: July 30, 2016, 12:17:37 pm »
Big update today! :)

@argonlefou,

Big thanks to you for your suggestions and help. As you mentioned, my biggest mistake was the use of the GetScreenPos and PointerToScreen functions. This caused a lot of issues. Can you explain quickly the purpose of those?
You're welcome :)
I must have been tired when I first replied to you because I can't see why I talked about GetScreenPos and PointerToScreen  ;D
I surely meant GetCursorPos and ScreenToClient

GetCursorPos is used to get [x,y] coordonates of the mouse pointer in your screen (according to your resolution)
ScreenToCLient is used to convert [x,y] coordonates from your screen (usually the value obtain upside with GetCursorPos) to MAME (in our case) window
So with this, you'll obtain [x,y] data betwenn 0 and the width/height of MAME window

Absolute rawinput data are usually between 0 and 65535, it's not the same thing  ;D

sevenseal

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:February 13, 2023, 09:59:14 am
  • Tapatalk User
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #80 on: July 30, 2016, 07:54:26 pm »
i have tried out your compiled of the 175, and it works out great with the dual lightguns...

i tried to apply your diff to 176
does not match what there...
so i tried to add the code manually
could not get it to compiled for 176, too many errors, something seem to be missing code wise

i did a comparsion of the input_rawinput.cpp file you had added with your patch v5 and compared to original input_rawinput.cpp in 175...
the changes dont seem match what is in the input_rawinput.cpp.diff you had made.

so i did a comparsion on 176's input_rawinput.cpp with the your included one... could not make it compile

all i have to say is that your compile seem to work well on 175...
« Last Edit: July 31, 2016, 10:38:23 am by sevenseal »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #81 on: July 31, 2016, 05:04:39 pm »
Big update today! :)

@argonlefou,

Big thanks to you for your suggestions and help. As you mentioned, my biggest mistake was the use of the GetScreenPos and PointerToScreen functions. This caused a lot of issues. Can you explain quickly the purpose of those?

What I do now, is use the normalize function provided in Mame that is also used in 0171, like this:
Code: [Select]
// update the X/Y positions
lightgun.lX = normalize_absolute_axis(rawinput.data.mouse.lLastX, 0, INPUT_ABSOLUTE_MAX);
lightgun.lY = normalize_absolute_axis(rawinput.data.mouse.lLastY, 0, INPUT_ABSOLUTE_MAX);
         

I didn't have to separate the devices in the different tables. The "process_event" procedure validates if it's a relative or absolute device.

@Sorn,

Can you test this one?

**Very important**, you have to set back the "lightgunprovider" to "auto" in mame.ini (which is best since it's the default)

http://www.filedropper.com/mamearcade64_11

I'm very happy with the result. You'll probably tell me that the pointer in tab menu doesn't follow the crosshair, but I can guarantee you that I'm processing using the real absolute values for the lightgun and relative for mouse. Maybe the UI is using something different, I can't tell. But, for me, the crosshair tracks perfectly the gun.

I also test, 2 mice, 2 lightguns, 1 mouse and 1 lightgun, etc, and it works fine.

Hope you'll get same result.

Thanks for all the testing.

Note this is still based on Mame0175.

Thanks very much all!

Pitou!

CONGRATULATIONS!!!!  :cheers: :notworthy: :applaud: ....You've done it!

" You'll probably tell me that the pointer in tab menu doesn't follow the crosshair" .....

Same thing occurs in 0171. It does not seem to have any effect on the accuracy once in game so who cares ? :)

Testing between v11 and 0171, I can notice NO difference whatsoever. I think any variances at this point are variances that exist within the aimtrak calibration itself, and not from any of your input code!
Really excited that you got it working with the win32 drivers, everything is deadly accurate now. Gun 1/2 shows up as it should, everything is 100% in order.

Would really like to try to compile your source (once you've done 0176) now and get mkchamps no-nag/hiscore working so I can slap this in my setup :)

And lets keep our fingers crossed that your patch will make its way to 0177, that maintainers will keep the input code and that you wont have to do anymore updating! I also responded on the mametesters bug report to confirm that all is well. I think it would probably be best to port it to 0176 to make sure there are no regressions in any code, and they will likely get it merged for 0177!

Out of interest has anyone tried the new mame with dual guns to see if its fixed?
Ime still running .170 for this reason.

I just tested 0176 now, same issue persists. However im sure if you give Pitou a day or so he will port the changes to 0176 and it will be posted here. He can also finally submit his patch through the mametesters bug report I created so we can get his patch added to the official repository!

« Last Edit: July 31, 2016, 05:10:51 pm by Sorn »

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #82 on: July 31, 2016, 09:19:55 pm »
Great news!

Thanks to all for the help. Without you, I don't think I would have make it.

Quote
Same thing occurs in 0171. It does not seem to have any effect on the accuracy once in game so who cares ? :)

Ok I didn't notice. I'm happy to see the behavior is the same. :)

Quote
Really excited that you got it working with the win32 drivers, everything is deadly accurate now. Gun 1/2 shows up as it should, everything is 100% in order.

Actually it's the rawinput API, just to be precise. :)

I'm really glad it works fine as before :)

Now...

Here is an official mame 0.176 64-bit arcade only binary:

http://www.filedropper.com/mamearcade64official

Here is mame 0.176 64-bit arcade only binary with MKChamp patch:

http://www.filedropper.com/mamearcade64mkchamp

Also attached is the patch_v5_0176.zip

Next step is the pull request and merge!

Have fun!

Pitou!
« Last Edit: August 01, 2016, 11:01:33 am by Pitou »

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #83 on: July 31, 2016, 09:49:11 pm »
Great news!

Thanks to all for the help. Without you, I don't think I would have make it.

Quote
Same thing occurs in 0171. It does not seem to have any effect on the accuracy once in game so who cares ? :)

Ok I didn't notice. I'm happy to see the behavior is the same. :)

Quote
Really excited that you got it working with the win32 drivers, everything is deadly accurate now. Gun 1/2 shows up as it should, everything is 100% in order.

Actually it's the rawinput API, just to be precise. :)

I'm really glad it works fine as before :)

Now...

Here is an official mame 0.176 64-bit arcade only binary:

http://www.filedropper.com/mamearcade64official

Here is mame 0.176 64-bit arcade only binary with MKChamp patch:

http://www.filedropper.com/mamearcade64mkchamp

Also attachached is the patch_v5_0176.zip

Next step is the pull request and merge!

Have fun!

Pitou!

YOU'RE THE MAN NOW DOG!

 :cheers:

sevenseal

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:February 13, 2023, 09:59:14 am
  • Tapatalk User
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #84 on: July 31, 2016, 10:22:58 pm »
Great news!

Thanks to all for the help. Without you, I don't think I would have make it.

Quote
Same thing occurs in 0171. It does not seem to have any effect on the accuracy once in game so who cares ? :)

Ok I didn't notice. I'm happy to see the behavior is the same. :)

Quote
Really excited that you got it working with the win32 drivers, everything is deadly accurate now. Gun 1/2 shows up as it should, everything is 100% in order.

Actually it's the rawinput API, just to be precise. :)

I'm really glad it works fine as before :)

Now...

Here is an official mame 0.176 64-bit arcade only binary:

http://www.filedropper.com/mamearcade64official

Here is mame 0.176 64-bit arcade only binary with MKChamp patch:

http://www.filedropper.com/mamearcade64mkchamp

Also attachached is the patch_v5_0176.zip

Next step is the pull request and merge!

Have fun!

Pitou!

thank you, i will give this a try

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #85 on: August 02, 2016, 12:47:19 am »
Pull request submitted to Mamedev. Let's hope it's gonna make it for 0.177!

Pitou!

justindarc

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:December 29, 2016, 02:16:15 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #86 on: August 02, 2016, 01:30:09 am »
Pull request submitted to Mamedev. Let's hope it's gonna make it for 0.177!

Pitou!

w00t!! Great work Pitou!! Many, many thanks for fixing this \o/

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #87 on: August 02, 2016, 10:54:46 am »
Big thanks to you justindarc for the pull request procedure help.

This was a successful team work effort. Everyone deserve credit! :)

 :cheers:

Pitou!

appear

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:August 26, 2016, 04:38:44 pm
  • I want to build my own arcade controls!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #88 on: August 26, 2016, 04:28:06 pm »
Hi

I just got two guns and I ran into this problem :)

The 176 binaries are down. Could someone be so kind as to upload them one again? Thank you so much!!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #89 on: August 27, 2016, 10:49:21 am »
@appear,

0.177 will be released next week, if you want to wait just a bit. :)

Pitou!

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #90 on: August 27, 2016, 06:39:05 pm »
Hi

I just got two guns and I ran into this problem :)

The 176 binaries are down. Could someone be so kind as to upload them one again? Thank you so much!!

Here you go -

http://www.xbins.org/iriez/mamearcade64_MKChamp.7z

@Pitou - Looking forward to next week! :) Could you post here when it goes live? I will have forgotten about this in roughly 10 minutes so a reminder would be nice :)

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #91 on: August 28, 2016, 11:16:21 pm »
@Sorn,

I will do!

I also did another patch to fix hit offsets for Laser Ghost and the developers did accept it! :)

You can have a look here in case you're interested in this game:

http://mametesters.org/view.php?id=1455
https://github.com/mamedev/mame/commit/fac1d64c58847ae190f60ee942264cd08d723db3
https://github.com/mamedev/mame/commit/931d6f5b628ecdfc19956316a18da9fdacdd8177

Big thanks to R. Belmont (rb6502) and Happp for the merge!

I'm also looking forward to 0.177!

Pitou!


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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #92 on: August 29, 2016, 06:37:31 pm »
@Sorn,

I will do!

I also did another patch to fix hit offsets for Laser Ghost and the developers did accept it! :)

You can have a look here in case you're interested in this game:

http://mametesters.org/view.php?id=1455
https://github.com/mamedev/mame/commit/fac1d64c58847ae190f60ee942264cd08d723db3
https://github.com/mamedev/mame/commit/931d6f5b628ecdfc19956316a18da9fdacdd8177

Big thanks to R. Belmont (rb6502) and Happp for the merge!

I'm also looking forward to 0.177!

Pitou!

Cool game, never seen it! Thanks :)

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #93 on: August 31, 2016, 08:08:20 am »
@Sorn,

Mame 0.177 is out.

Check it out!

Pitou!

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4222
  • Last login:December 17, 2023, 08:05:48 am
  • I have a gaming addiction.....
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #94 on: August 31, 2016, 03:35:16 pm »
Are both guns working in the new version again?

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #95 on: August 31, 2016, 05:20:58 pm »
Yes it should.

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4222
  • Last login:December 17, 2023, 08:05:48 am
  • I have a gaming addiction.....
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #96 on: August 31, 2016, 07:44:04 pm »
Ile give it a shot over the weekend.
Ime still running .170 to get round this prob.

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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #97 on: August 31, 2016, 09:11:36 pm »
Yes it should.

Awesome!!!! When I have 10 minutes to play I will give it a whirl.

http://mamedev.org/?p=430

Quote
We've integrated a fix for Aimtrack Dual Lightguns on windows from new contributor Pitou

woohooo!!! congratulations :) Very happy to be a contributing part (even if indirect) of the MAME project.


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: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #98 on: July 27, 2017, 12:39:12 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


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!
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #99 on: July 27, 2017, 02:38:32 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

Thats a bummer to hear. I'll ping Pitou and see if he knows whats up. I assumed these fixes were merged into the main branch long ago, but maybe not?

Titchgamer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4222
  • Last login:December 17, 2023, 08:05:48 am
  • I have a gaming addiction.....
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #100 on: July 27, 2017, 05:25:53 pm »
I never did get around to testing this!

Sorry, but .170 defo works lol

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #101 on: July 31, 2017, 11:37:49 am »
Merge was done couple of versions ago.

I will try to test it this week.

Thanks for reporting.

Pitou!

Pitou

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
  • Last login:May 28, 2020, 05:56:46 pm
Re: Cannot get GUN#2 recognized in MAME, both guns show up as GUN#1
« Reply #102 on: July 31, 2017, 09:31:03 pm »
Just tested with Mame 0.188 and Police Trainer and everything is fine.

Pitou!