-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scaling lightgun coordinates to usable game area #655
Comments
As a quick follow-up, the same issue appears to have been solved in Beetle-psx using a similar scaling formula. |
what system are you using or better are you able to compile pcsx on the system you are using. if your able to, try to change these lines from: pcsx_rearmed/frontend/libretro.c Lines 2451 to 2452 in 824ba21
to
and see how it behaves as i dont have an actual lightgun device |
Thank you! I am using a Raspberry Pi. Sorry, I should have included that in the first place. Yes, I am able to make those code changes and compile to test. I will try that out shortly. |
That code change reduces how far the in-game cursor can go. The cursor is aligned at screen center, but it loses alignment the further I point from center. If I'm reading this correctly, the formula is essentially dividing |
Can you try out fceumm and some light gun games like duck hunt if it performs with sinden gun as expected? BTW, in what gpu is running fceux in this platform? Peops unai or the other one? See in core options to know there should be options there for the specific gpu used |
FCEUMM, FBNeo, and various MAME cores are all good with the Sinden gun for me. I'm using RetroArch 1.10.0 and am accounting for the changes to how lightgun coordinates are handled by using a 16:9 border. I don't see info about the GPU for FCEUMM in the core options. The information section in the menu just lists FCEUMM as an SVN build. @Widge-5, do you happen to know that info? The issue in my original post does happen for many games in this emulator, but some are fine and track perfectly as is (Time Crisis). |
i actually meant core option in pcsx. if your gpu is neon, try to disable that enhancemen t-related thing, its only neon-gpu i know of that has enhanced viewport, so the guncon coordinates probably need a multiplier of 2 or probably 4 |
Oh, I see that option. It is NEON. All of those options were off for me while testing. The behavior seems to be the same regardless of having the enhanced resolution on or off. The issue doesn't seem to be related to integer scaling of the entire screen. Unless I'm forgetting something, the issue only occurs on the X axis. It's more like a 7-10% difference that can be accounted for with the core option for the GunCon ratio. The problem is that the cursor is trapped inside of a pillar-boxed area, but parts that are considered out of bounds still include game data. That's why I was curious if it had to do with overscan. Apologies for the poor description. It would be easier to explain if the emulator had its own cursor representing the emulating computer's own mouse cursor. What you get with the original GunCon code here is very similar to what's shown in the linked images. The game's internal crosshair is the red one, while the + is the user's computer's mouse cursor. The offset is at its worst at the edge of the screen. https://user-images.githubusercontent.com/5952315/50057642-4d8b6980-017e-11e9-98ac-6bfcfba14d9b.png |
I did some more research on this. I noticed that, in
The code assumes a resolution of 256x240. I know that PlayStation games could have pretty wildly varying resolutions. The only list I could find including a lightgun game was this one, which states that Time Crisis has a resolution of 256x240. Time Crisis also happens to be possibly the only game that functions correctly out of the box with lightgun devices in this emulator. The rest have scaling issues on the X axis. Perhaps adjusting this so that the resolution is more generic would solve the issue. The example I gave above with Project Titan seems to indicate that it has an X resolution greater than 256, but the emulator is limiting the cursor movement to the portion 256 px wide centered at the calibration point the user triggers when firing at the target at the start of the game. |
There are two Time Crisis games. One is simply called "Time Crisis" and the other is called "Time Crisis: Project Titan". They are two very different games.
|
@Widge-5 Thanks! Yes, I was referring to those two games separately. The original Time Crisis from 1997 is fine in this emulator. It's the console-exclusive sequel Time Crisis: Project Titan from 2001 that I was referring to with the problem. I can confirm Widge's numbers with those ratio adjustments (now called "response" in the core options). The ratio adjustment works to give nearly perfect accuracy, but the game gets artificially pillarboxed as a result. You still see the whole game, but parts of the left and right sides of the screen become inaccessible by the gun. |
Thank you @negativeExponent . |
@negativeExponent Thanks for the suggestions! Making the changes you mentioned does appear to correct the scaling in Time Crisis: Project Titan while maintaining the tracking for the original Time Crisis (both NTSC USA versions). The patched version of the NTSC/USA Resident Evil: Survivor to add back in the removed GunCon support also appears to track correctly. However, some other games I have tried are negatively affected. PAL games in particular seem to be hit the hardest. I can't seem to get any shots to hit the screen in Ghoul Panic (PAL) anymore, and Extreme Ghostbusters: The Ultimate Invasion (PAL) has the usable screen area reduced by a lot. The formula right below the changed lines in pcsx_rearmed/libpcsxcore/plugins.c Lines 673 to 676 in ca177c0
@SindenLightgun (the one who added that code) Do you have insights on how to generalize the formula? |
Ok |
For what it's worth, with
The difference between the max and min for |
The above commit resolved the specific issue I was having with games losing screen real estate when using the core options to adjust the ratio and offset. |
Hello,
This is more of a question about a potential improvement because I'm not sure how to implement it. In
pcsx_rearmed/frontend/libretro.c
, these lines of code appear:If the whole screen is used for lightgun access, then this works perfectly (Time Crisis). Both the emulator and RetroArch treat (0,0) as the center of the screen and have the same coordinate ranges for lightgun usage. However, many other games do not use the entire viewable area for the lightgun coordinates. For example, Time Crisis: Project Titan does not allow the cursor to move all the way to the left or right and requires adjustments to the GunCon X ratio in order to get line-of-sight alignment with an absolute-mouse device such as a Sinden Lightgun.
I'm guessing the above issue is why the offset/ratio core options were added in the first place, but I am still curious: Is there an existing variable that fetches the width and height that the game is actually using for the lightgun? This would be different from the visible game area. If those were to exist and, say, be labeled as
width
andheight
, respectively, then the lightgun coordinates could probably be scaled as(where the Libretro lightgun coordinates range from
-0x7FFF
to0x7FFF
, so we'd want to divide by2 * 0x7FFF = 0xFFFE
to scale). Perhaps these variables exist somewhere and are related to overscan?The text was updated successfully, but these errors were encountered: