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 28920 times)

0 Members and 2 Guests are viewing this topic.

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: 1004
  • Last login:Yesterday at 01:34:11 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: 1004
  • Last login:Yesterday at 01:34:11 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: 1004
  • Last login:Yesterday at 01:34:11 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: 1004
  • Last login:Yesterday at 01:34:11 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: 1004
  • Last login:Yesterday at 01:34:11 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