Cannot seem to get dual Gun4IR lightguns working

Having technical difficulties with Supermodel? Last-minute wardrobe malfunction? Get help here.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Cannot seem to get dual Gun4IR lightguns working

Postby hamburglin » Sat Jan 21, 2023 7:38 pm

I've got the latest version of supermodel and I have inputmode set to rawinput. I've also rebound my lightgun bindings to use mouse3 and mouse4. I've confirmed my gun4ir guns are mouse 3 and 4 via the -input-config mode:

Code: Select all
; Light guns (Lost World)
InputGunLeft = "KEY_LEFT"               ; digital, move gun left
InputGunRight = "KEY_RIGHT"             ; digital, move gun right
InputGunUp = "KEY_UP"                   ; digital, move gun up
InputGunDown = "KEY_DOWN"               ; digital, move gun down
InputGunX = "MOUSE4_XAXIS,JOY1_XAXIS"
InputGunY = "MOUSE4_YAXIS,JOY1_YAXIS"
InputTrigger = "KEY_A,JOY1_BUTTON1,MOUSE3_LEFT_BUTTON"
InputOffscreen = "KEY_S,JOY1_BUTTON2,MOUSE3_RIGHT_BUTTON"
InputAutoTrigger = 1                    ; automatic reload when off-screen
InputGunLeft2 = "KEY_LEFT"               ; digital, move gun left
InputGunRight2 = "KEY_RIGHT"             ; digital, move gun right
InputGunUp2 = "KEY_UP"                   ; digital, move gun up
InputGunDown2 = "KEY_DOWN"
InputGunX2 = "MOUSE3_XAXIS,JOY2_XAXIS"
InputGunY2 = "MOUSE3_YAXIS,JOY2_YAXIS"
InputTrigger2 = "KEY_A,JOY1_BUTTON1,MOUSE4_LEFT_BUTTON"
InputOffscreen2 = "KEY_S,JOY1_BUTTON2,MOUSE4_RIGHT_BUTTON"
InputAutoTrigger2 = 1


When I boot up lost world, both guns still control player 1's gun.

Secondly, the gun sensitivity is way off (accuracy of crosshair is good after calibration).

Third, my arrow keys are only moving the red crosshair and not the green, even though I bound them to move both players (see above)

Has anyone gotten 2x gun4ir guns working or does anyone know if I'm missing something else?
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: Cannot seem to get dual Gun4IR lightguns working

Postby hamburglin » Sun Jan 22, 2023 11:17 am

The fix was that I needed to keep configuring the analog gun controls for Ocean Hunter. I have NO IDEA why the config doesn't say that those are for lost world as well!
hamburglin
 
Posts: 17
Joined: Sat Jan 21, 2023 6:33 pm

Re: Cannot seem to get dual Gun4IR lightguns working

Postby Bart » Mon Jan 30, 2023 12:18 am

Lost World supports two different kinds of light guns: traditional photodiode based guns which require the screen to flash and consequently cannot be continuously tracked when the trigger is not pressed (Supermodel originally only supported this configuration) or a newer type of light gun that tracks IR LEDs surrounding the monitor, allowing the gun position to be continuously tracked. I keep forgetting why but people really prefer the latter. This is configurable in Games.xml and you can indeed revert back to the older light guns.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: Cannot seem to get dual Gun4IR lightguns working

Postby Ian » Mon Jan 30, 2023 2:00 am

How does the screen flash method work?
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Cannot seem to get dual Gun4IR lightguns working

Postby Bart » Mon Jan 30, 2023 4:54 pm

Ian wrote:How does the screen flash method work?


It's quite ingenious. Old-fashioned CRT light guns worked by having a single photodiode in the gun with a lens to focus light on it. So imagine a single-pixel sensor looking for a spike in brightness. A CRT scans line by line from top to bottom and the phosphors that are illuminated are of course brightest at the moment they are irradiated by the electron beam and then quickly decay. This means that if you look at a CRT in slow motion, you can see the current pixel being drawn. See this video for an example.

Now, the system actually knows exactly where the raster beam is at all times because the CRT beam position is controlled by the video signal. Makes sense if you think about it: CRT TVs were analog devices that output exactly what was fed to them without any buffering. How rapidly the beam goes back and forth and up and down is controlled by horizontal and vertical sync signals that implicitly define the resolution being displayed. On old 8- and 16-bit systems, CPU cycles per scanline were known, and there were V-blank and H-blank (per line) interrupts. So the CPU could deduce at any point where the raster beam was.

When you press the trigger on the lightgun, the game sees that as it would any other controller button press. Except for a lightgun game, it displays a white screen for one frame. The next frame will therefore be brighter than the last one and the gun's sensor can then look for the spike in brightness. When the beam crosses the field of view of the lightgun's sensor, the light gun sends a signal back to the game system (another digital input, just like a button press), and the game records the beam position at that point (because it knows where the beam is). That is the (x,y) coordinate that the gun must have been pointed at! The gun's aim is deduced by the CPU based on the timing of when the lightgun's single-pixel sensor saw a brightness spike. This is why lightguns don't work on LCD and LED displays. I think there are even some newer CRTs where they fail to work.

Exactly how this is done depends on the system. On the Sega Genesis, there was a hardware "HV counter" that could be read at any given time and gave the current vertical and horizontal position of the raster beam during the active frame. This could also be latched. Peripherals like the Menacer light gun were able to cause the HV counter to be latched at the time the trigger was pressed, generate a CPU interrupt, and then the CPU could read the counter value at the time it was latched. See page 35 here.

I'm not sure how Model 3 communicates raster beam timing. It's clear that the trigger is simply read by the PowerPC as a digital input and the screen is flashed for a frame. But then the X, Y position is read out directly. I assume that something similar to the HV counter exists and is piped into whatever logic implements that input register directly. It's clearly not done by the CPU.

Here's a good video about lightguns and light pens.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada


Return to The Fitting Room

Who is online

Users browsing this forum: No registered users and 1 guest