-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Hackfix for clipping in Gormiti #9914
Conversation
Wouldn't it be better to patch the game to remove the rectangle? |
That would probably be better than the current fix (given the side effects of breaking a bunch of games), but if a more accurate fix is found that'd be preferable to a game patch. However, I don't own Gormiti, so I can't do a patch myself. |
914297b
to
b2ec900
Compare
What would be the motivation of the devs to implement anti-emulation? Certainly it would be different than anti-piracy, right? |
b2ec900
to
679cab6
Compare
FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:
automated-fifoci-reporter |
Closing this as this is not the correct fix (and breaks other games). I will probably investigate this further later on and come up with a better fix (once I understand the problem better). |
This should fix bug 12436.
I don't really know what I'm doing here, to be honest; I don't fully understand the clipping code.
What I do know is that the game deliberately draws a black rectangle over the entire screen (the first 3 values are the x/y/z coordinates, with the hex values first and then the decoded float values in parentheses, and the last value is the color, where alpha is 1):
It also configures the alpha test and z-test to pass for these. I can only assume that this is deliberate anti-emulation code, because there doesn't seem to be any other purpose to this rectangle.
Testing using the hardware fifoplayer showed that this rectangle did not render; I assume this is because it is passing the far plane (but I'm not 100% sure whether it's the far or near plane, as I don't have a perfect understanding of this part of rendering. The z coordinate is transformed to -1 and then projected position's z-coordinate is 0, so I think it it's the far plane, though.) My guess is that this is supposed to be a
>= 0
comparison for clipping instead of a> 0
comparison, which I did with the software renderer, but I did some hacky stuff in the hardware renderers instead.This PR also applies the sonic epsilon hack for
host_config.backend_depth_clamp = false
to UberShaders (it was implemented for specialized shaders in #9591). I haven't tested anything forbackend_depth_clamp = false
.