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: USB2GUN not working on PC - looking for some help - offscreen reload not working  (Read 2546 times)

0 Members and 1 Guest are viewing this topic.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
I decided to start a new thread about this instead of the other happ emulation thread I was kind of hijacking.

I have a Friction I/O board and tested it out with my MAME PC that I have Hyperspin setup in, and I kind of got it tracking.  One monitor it tracked OK and one monitor I couldn't get it to track at all, which happened to be the same monitor that Friction in general would not track with - so I'm guessing it's the Friction IO board.

So I got a USB2GUN board and basically have it connected the same way - VGA in/out going to it, USB plug going to PC, and powered with the PSU.  I see 2 solid red LED lights on it so I know it's getting power.

However inside of Windows, it's not finding it.  I looked at all the jumpers and everything is set correctly.  I don't see anything at all in the device manager.  I also noticed when I remove the USB plug, the screen goes all weird, which is very odd to me and not what I would have expected.

With the Friction board, even with no guns attached, it would show up in device manager as a controller named CRTGUN and would have 2 guns on it if the guns were attached.  Also, with the Friction board, just pressing the trigger at any point would cause a screen flash in Windows.

But again, I am not seeing anything at all with this with the USB2GUN board.  I don't see any screen flash and I don't see it in device manager, which makes sense as to why the guns aren't causing flashes.

I believe this is a Windows 11 machine.  So could that be the problem that it's "too new" of an OS or something?  I'd think it would be backwards compatible and work but so far I can't find anything.  It also isn't connected to the internet but I would think even if it found the new device and couldn't get drivers, it would still show up as "unknown" or something.

I am going to try hooking up the USB2GUN to my Windows 10 desktop at some point and see if it is recognized in there.

I purchased this from someone who said it was working when pulled so I am taking his word that it worked fine. 

Is there something I am doing wrong and something I have to do to get it to show up?

​Thanks.
« Last Edit: June 24, 2023, 06:45:26 pm by purbeast »

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Re: USB2GUN working on PC - looking for some help
« Reply #1 on: June 01, 2023, 01:36:08 pm »
Here's a little bit more information...

I just tried plugging it into my Windows 10 PC and same thing - it just doesn't show up.   I didn't have VGA cables going through it or anything, just the USB cable going to the PC.  I noticed when I pulled the USB plug out the monitor did not get all weird like it did on my arcade cabinet with the PC hooked up there, but I am not surprised since the video wasn't being routed through it.

One thing to mention I guess is that the manual says to plug the USB2GUN board into a PCI USB card and NOT directly to the motherboard.  I do not have a PCI USB card and am plugging directly into the motherboard, and on my desktop, I tried plugging into the front of the PC.  Could this potentially be the problem?  Has anyone plugged it directly into the USB ports on the motherboard?  I read the reason for using the PCI card was due to possible static shorting or something along those lines though, not because it won't work on there.

I also have the one with the JAMMA edge connector.  I had to change 2 jumpers to tell the board to get power from the AUX PSU plug instead of the JAMMA edge.
« Last Edit: June 01, 2023, 01:39:37 pm by purbeast »

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Re: USB2GUN not working on PC - looking for some help
« Reply #2 on: June 24, 2023, 06:45:05 pm »
Okay so I have made some progress.

First I got a USB2GUN board that has the JAMMA edge connector, and I couldn't get any Windows PC to recognize it.

The guy who sold it to me came across the original USB2GUN board without the JAMMA edge and he let me swap, and I got it and finally messed with it and both of my Windows PCs recognize it.

So just to throw that out there, the one with the JAMMA edge does NOT work in a Windows PC.  Windows simply does not recognize it.

Now that I have it working, I got it calibrated and have been testing it out with my GroovyMAME setup and it looks to be working fairly well in Lethal Enforcers.

My only issue however is the offscreen reloading is not working.

There is a setting in the mame.ini file that is for offscreen reloading, and I turned it on, and it's still not working.  I have tried setting the "lightgun" option in the mame.ini file to both "joystick" and "lightgun" just to see if it'll work (the guns are recognized in Windows as analog joysticks) and it isn't working no matter what I try.  I did get some random reloads so I don't know what is triggering that.

Just to clarify, this is a groovymame setup in a PC running at 320x240 resolution on a CRT and using Happ light guns.

Here is a video of it in action showing the issue.

https://www.youtube.com/shorts/cKGxYjKx7vU

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
From JollyWest's thread that I linked to in your first thread on the subject:
I had to change a few settings in mame.ini to get them to work though.
I had to enable joystick and off screen reload in device input, have joystick as the lightgun and positional controller and had to change joystick deadzone from 0.3 to 0.0 and joystick saturation from 0.85 to 0.95.
The games that originally used a lightgun that I've tested so far (Beast Busters/Lethal Enforcers/Time Crisis) work highly accurately and the games which used a mounted gun (T2/Alien 3) work ok and are accurate but the gun only registers a position on the screen on each individual trigger press, so if you were to hold the trigger down it would only register shots in the one position no matter where you moved the gun whilst holding the trigger down.
The white flash on screen on each trigger press is a bit much on these games as well.

Also make sure there isn't an individual ini file (in MAME's ini folder) for the game or that the individual ini file has the correct options set.
The game's individual ini file will override mame.ini

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
From JollyWest's thread that I linked to in your first thread on the subject:
I had to change a few settings in mame.ini to get them to work though.
I had to enable joystick and off screen reload in device input, have joystick as the lightgun and positional controller and had to change joystick deadzone from 0.3 to 0.0 and joystick saturation from 0.85 to 0.95.
The games that originally used a lightgun that I've tested so far (Beast Busters/Lethal Enforcers/Time Crisis) work highly accurately and the games which used a mounted gun (T2/Alien 3) work ok and are accurate but the gun only registers a position on the screen on each individual trigger press, so if you were to hold the trigger down it would only register shots in the one position no matter where you moved the gun whilst holding the trigger down.
The white flash on screen on each trigger press is a bit much on these games as well.

Also make sure there isn't an individual ini file (in MAME's ini folder) for the game or that the individual ini file has the correct options set.
The game's individual ini file will override mame.ini

Yeah I've already done all of those changes to mame.ini that JollyWest said to do and it's still not working.  I've messed with changing a lot of other settings in there too and had no luck.

And there are no game specific files down in the ini directory either.

I've tried Lethal Enforcers, Maximum Force, and Area 51/Maximum Force and the offscreen reload isn't working for anything.

When aiming the gun on screen it fires "joystick button 1" and when firing the gun off screen it fires "joystick button 2" as you can see in the windows calibration.  Supposedly the offscreen_reload option is supposed to make it so that "joystick button 2" moves the cursor to (0, MAX) which is the edge of the screen and inputs "joystick button 1".  But that just isn't happening.

I've also found some info that offscreen_reload should enable right click reload on the mouse, and that also isn't working on this setup. The right click on the mouse doesn't do anything.
« Last Edit: June 26, 2023, 09:46:14 am by purbeast »

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
One other thing to note that something about the offscreen_reload setting isn't working correctly, is that I know it's supposed to move the cursor to (0,MAX) per the documentation, and I have the cursor visible, and when shooting off screen, it doesn't move the cursor anywhere.

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

Quote
-[no]offscreen_reload / -[no]reload

Controls whether or not MAME treats a second button input from a lightgun as a reload signal. In this case, MAME will report the gun's position as (0,MAX) with the trigger held, which is equivalent to an offscreen reload.

This is only needed for games that required you to shoot offscreen to reload, and then only if your gun does not support off screen reloads.

The default is OFF (-nooffscreen_reload).

I even tried running it from the command line with the example there "mame lethalen -offscreen_reload" and same result.
« Last Edit: June 26, 2023, 01:04:44 pm by purbeast »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
When aiming the gun on screen it fires "joystick button 1" and when firing the gun off screen it fires "joystick button 2" as you can see in the windows calibration.  Supposedly the offscreen_reload option is supposed to make it so that "joystick button 2" moves the cursor to (0, MAX) which is the edge of the screen and inputs "joystick button 1".  But that just isn't happening.

I'm not aware of anywhere in MAME where could map button 2 to reload if the game didn't originally have a separate reload button.

So if the guns are not sending a button 1 press while pointed off-screen, MAME has no way of knowing that the trigger was pulled off-screen.
MAME would only see a button 2 press....and only do whatever button 2 is mapped to.

Is there any way to change the behavior of the USB2Gun to have both on-screen and off-screen shots register as button 1?

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
from the JollyWest thread:

I had some issues getting off-screen reload to work (in MAME) but since shooting off-screen triggers button 2 in Windows I just used XPadder to map that to a combination of up+ another button (mapped to trigger) on the keyboard and set the digital cursor speed to max. Since there is an area at the top of the screen for reloading, shooting off-screen instantly brings the cursor to the top and activates the trigger.  Works perfectly, problem solved!

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
from the JollyWest thread:

I had some issues getting off-screen reload to work (in MAME) but since shooting off-screen triggers button 2 in Windows I just used XPadder to map that to a combination of up+ another button (mapped to trigger) on the keyboard and set the digital cursor speed to max. Since there is an area at the top of the screen for reloading, shooting off-screen instantly brings the cursor to the top and activates the trigger.  Works perfectly, problem solved!

Yeah I saw that but JollyWest didn't have to do that so I was trying to not do it.  That will be my final option though if I can't figure out what I'm doing wrong.

The whole offscreen_reload option is basically a "hack" for the game that MAME is supposed to register the button 2 press from the "joystick" and turn it into a button 1 press at the (0, MAX) position.  So it knows under the hood that button 2 was pressed then translates it to something the emulator can register as a reload, since shooting the edge of the screen in MAME is how you actually reload games like Area 51, Maximum Force, and Lethal Enforcers.  I've been reading a lot about how it works under the hood the past 2 days and was actually looking at the source code for it as well.

 I can reload with the Happ guns in all of those games if I shoot the edge of the screen, but that's just not fun to actually try and hit the edge lol.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
When aiming the gun on screen it fires "joystick button 1" and when firing the gun off screen it fires "joystick button 2" as you can see in the windows calibration.  Supposedly the offscreen_reload option is supposed to make it so that "joystick button 2" moves the cursor to (0, MAX) which is the edge of the screen and inputs "joystick button 1".  But that just isn't happening.

I'm not aware of anywhere in MAME where could map button 2 to reload if the game didn't originally have a separate reload button.

So if the guns are not sending a button 1 press while pointed off-screen, MAME has no way of knowing that the trigger was pulled off-screen.
MAME would only see a button 2 press....and only do whatever button 2 is mapped to.

Is there any way to change the behavior of the USB2Gun to have both on-screen and off-screen shots register as button 1?

There is no way to do that to my knowledge.  There is only 1 jumper on it and it's to set the resolution, which I have set to CGA since I'm using a standard monitor.

As for the button 1 and 2 press, I explained how it's supposed to work under the hood of MAME based on my research the past 2 days and looking at the code (and comments in code) in my other reply. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
Just thought of something.....
Map the trigger to BOTH button 1 and button 2 in MAME.

Easy so worth a try.

EDIT: I guess it would be more correct to say "OR" rather than "AND".
The in game menu for mapping should like:
"P1 Button 1     Joy1  Button 1 or Joy 1 Button 2"


« Last Edit: June 26, 2023, 03:17:56 pm by BadMouth »

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Just thought of something.....
Map the trigger to BOTH button 1 and button 2 in MAME.

Easy so worth a try.

Yeah that was one of the first things I tried and it just acted super funky.  I believe it was because there is no position of the cursor when button 2 is pressed, so even though it is firing the gun, it just fired where the prior cursor position was.

The whole problem with these games on MAME is there is no concept of "off screen", which was the reason the devs made it so shooting at the edge of the screen reloads.  You can see that works perfectly fine when using the mouse because you can't go further than the edge of the screen.  This offscreen_reload option is supposed to handle it though and simulate that.

It was also hard to actually do it because when you move the aim to be off screen, it would do the direction + button 2, not JUST button 2.
« Last Edit: June 26, 2023, 03:14:11 pm by purbeast »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
I got no more ideas other than trying the official MAME build rather than GroovyMAME if that's even possible on your setup.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
I got no more ideas other than trying the official MAME build rather than GroovyMAME if that's even possible on your setup.

I've already tried it and same behavior.

I wonder if it could potentially be a bug with the version of MAME I'm using.  It's the version for both groovy and normal MAME.

I'm going to try xpadder this evening and just see if that works, and if so, that will be a good enough solution for me, as long as the behavior is as expected. 

As long as the behavior is the same, that's all that really matters.  I'd rather just do that than upgrade MAME if it was some kind of regression bug in the version I'm using.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Man this is such a pain in the ass lol...

So I got a version that was from 2015.01.01 and that one worked.  However, the cursor speed to move vertically at max was WWWWAAAYYYY too slow.  Like when I'd test it out on the PC with the cursor, it took like a half second or maybe more to go from the top to the bottom, and I'm not sure when the other P1 button was actually fired.

So I found some other versions that I believe was 5.3 and 5.7 and neither would start up in Windows 10 (it was registering as "Unknown" and said I needed 98, 2000, XP, or another early version) but then I got it to run in compatibility mode.  However it wasn't really working properly either because none of the buttons would show up in there, and the UI just looked a bit wonky.

So yeah, not really sure wtf to do at this point lol.  I may play around with the version that worked to see if I can move the speed more.  In a video I saw the cursor moved WAY quicker than it did in the version I was using. And that version seemed really old.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 05:42:45 pm
  • ...
Well, with the xpadder workaround digital speed affected the cursor speed when reloading.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Well, with the xpadder workaround digital speed affected the cursor speed when reloading.

Yeah but I am not sure how to make it go faster than it does so that it moves "instantly" to the edge then the key is pressed to reload.

I played around with joytokey last night and this also "gets close" but doesn't quite work.

I can get it to do the same thing and move the cursor, but it's not fast enough.

Then there is this option to "move to" coordinate and I moved it to (0,0), (1,1), and tried some different ones like (50, 0) and (50, 1) and this is considering the screen is 100x100.

Well it works perfectly fine outside of MAME, but once inside of MAME, the "move to" thing just doesn't work.  The key is pressed but the cursor simply doesn't move.

When I first tried this, it didn't work at all in MAME but I googled and there is a mouseprovider and keyboardprovider that you can set to make joytokey work inside of MAME.  It was actually a setting added at one point specifically for this reason.

But, unfortunately, it isn't working.

Jollywest

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 288
  • Last login:April 09, 2024, 01:37:27 pm
Evening, been a while... had a notification to say my BYOAC password had been compromised in data leak, so came to change it, had a little catch up on things and saw this  ;)

I can't remember 100% how I did this, however I've just fired up the cab for the first time in ages and it works flawlessly but... I still don't know how I did it  :lol

Pretty sure I never used Xpadder in the end and that it was all done in the 'Configuration Menu' accessed by the TAB button, so I've attached a photo of the 'INPUT (this game)' & 'ANALOG Controls' sections for you to copy and see if it works.
I think it has something to do with 'P1 Button 1' assigned to both Joy 1 Button 1 & Joy 1 Button 0, 'Lightgun Y analog Dec' also assigned to Joy 1 Button 1, and 'Lightgun Y Digital Speed' set to 255 (Max)





« Last Edit: October 09, 2023, 04:39:36 pm by Jollywest »

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
Evening, been a while... had a notification to say my BYOAC password had been compromised in data leak, so came to change it, had a little catch up on things and saw this  ;)

I can't remember 100% how I did this, however I've just fired up the cab for the first time in ages and it works flawlessly but... I still don't know how I did it  :lol

Pretty sure I never used Xpadder in the end and that it was all done in the 'Configuration Menu' accessed by the TAB button, so I've attached a photo of the 'INPUT (this game)' & 'ANALOG Controls' sections for you to copy and see if it works.
I think it has something to do with 'P1 Button 1' assigned to both Joy 1 Button 1 & Joy 1 Button 0, 'Lightgun Y analog Dec' also assigned to Joy 1 Button 1, and 'Lightgun Y Digital Speed' set to 255 (Max)







Wow man thank you SO much for that!  I ended up getting it working!

I had to manually to into the cfg file to change the Lightgun Y analog Dec but it ended up working.

Many thanks man! 

Now that I have proof of concept that this works in my other MAME cabinet, I can start to piece together the parts to build another PC for my Light Gun cabinet.

purbeast

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:April 08, 2024, 05:51:38 pm
I'm curious if you got Invasion to work with offscreen reload.  I tried those same settings on Invasion but it isn't working.  When I aim off screen it actually fires a bullet and uses some ammo, although it's not on the screen anywhere.

EDIT:

N/M I googled and found your other reply where you found the 2 shot reload fix for it.  Thanks for that too!
« Last Edit: October 21, 2023, 10:43:37 am by purbeast »