libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
152 stars 77 forks source link

Gun4ir light gun inaccurate the closer you point towards the edges of the screen #1175

Open TheInternetIsReal opened 1 year ago

TheInternetIsReal commented 1 year ago

When playing hotd2, my light gun's (gun4ir) cursor moves too quickly to the edge of the screens when aiming towards them. This makes the shots off by multiple inches sometimes.

Normally, this issue only occurs when I have the aspect ratio setting for my guns set incorrectly. For example: the aspect ratio set to wide-screen when I'm playing a 4:3 rom in mame. The calculations for where the gun is aiming gets warped.

I'm not entirely sure what's going on with flycast but my bet is that it's telling the light guns/mice that the entire wide-screen (including the black boarders) is the play field instead of only the current game playfield being rendered within the 4:3 resolution.

TheInternetIsReal commented 1 year ago

After doing some more testing I think the issue is that flycast core is not normalizing the mouse x/y to 4:3 like mame does. It's simply taking in the raw format of the monitor which is widescreen in my case. This causes the behavior of the cursor becoming offset from the center as it moves to an edge.

I've confirmed that everything works perfectly fine when using widescreen hacks. However, I'm playing hotd in a 4:3 resolution on purpose. I don't want widescreen.

This is particularly important because it forces me to change my gun4ir configuration to fullscreen aspect ratio just to play one game. This is a no-go in my arcade cabinet front end. Mame and sega model 2 (/w demulshooter) already function as intended in 4:3.

TheInternetIsReal commented 1 year ago

After doing some more testing I think the issue is that flycast core is not normalizing the mouse x/y to 4:3 like mame does. It's simply taking in the raw format of the monitor which is widescreen in my case. This causes the behavior of the cursor becoming offset from the center as it moves to an edge.

I've confirmed that everything works perfectly fi e when using widescreen hacks. However, I'm playing hotd in a 4:3 resolution on purpose. I don't want widescreen.

This is particularly important because it forces me to change my gun4ir configuration to fullscreen aspect ratio just to play one game. This is a no-go in my arcade cabinet front end. Mame and sega model 2 (/w demulshooter) alreafy function as intended in 4:3.

flyinghead commented 1 year ago

Have you done a lightgun calibration in the game test menu?

TheInternetIsReal commented 1 year ago

Again, this is not about the in-game light gun Calibration. This is about the raw, red x/y cursor drawn by the emulator not being normalized for a 4:3 plays field.

The cursor -> in game shots are perfectly calibrated. Where the red cursor is, the shot is fired. This is not the problem.

I realize I'm coming off a little harsh. I was up for hours troubleshooting this and I must not explaining the problem as well as I could.

TheInternetIsReal commented 1 year ago

This is still an issue. Mame and model 2 emulators correctly draw a 4:3 game video but also darken the edges for the widescreen.

Flycast draws a 16:9 game video which happens to have its edges darkened.

This causes a problem when using gun4ir light guns because they are expecting 4:3 mouse coordinates but get 16:9 mouse coordinates instead. In fact, this should be an issue with ANY mouse based controller.

This causes the cursor (which is properly calibrated in the arcade games menus) to warp to the edges when aiming towards the edge of the screen.

The problem is similar to if you tried to stretch a 4:3 image into a 16:9 image. The X axis gets stretched and looks weird. This is exactly what the mouse coordinates are reporting back, even though the game's image js shown at a 4:3 ratio within the 16:9 window.

SeongGino commented 7 months ago

Just want to chip in here, as another Light Gun user:

I don't see this problem. I can play lightgun shooters on RetroArch just fine on my widescreen TV without stretching the image - i.e. with Flycast or MAME-libretro cores in 4:3 (or whatever their native ratio is) with black pillar boxes. Accuracy's perfectly fine.

Full disclosure, not using GUN4IR, but my own semi-custom IR light gun system that does not do any aspect ratio correction - the mouse will always cover the whole screen without intentionally limiting to a 4:3 space on a 16:9-or-whatever display.

But the truth of the matter is, RetroArch is handling this correctly - it's standalone MAME that's doing it wrong by not correcting the mouse, and instead maps the game screen to the entire display regardless if it's stretched or not. It should not be the gun's job to do aspect ratio correction, but the game/emulator itself. If your gun requires some 4:3 correction, IMO, that's a bug in the emulator that should be fixed. At least, that's how I always perceived it, as a patchwork method for misbehaving emulators.

FWIW, RetroArch cores, PCSX2 nightly, and Model 2 handle this just fine (ish, sans no real offscreen shot detection), but MAME doesn't.