Skip to content
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

Workaround for sin/cos issue in GTA on Mac (and maybe others) #16928

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Feb 7, 2023

Fixes #15149

Turns out the game is hyper sensitive to the shape of the sin curve, so while we tried making its precision a bit more accurate to the hardware by reducing the precision, this resulted in something going slightly over one threshold or another due to the sin curve shape not being bit identical on all platforms. This just works around it by lowering the threshold for when we flush the angle to zero.

@hrydgard hrydgard added this to the v1.15.0 milestone Feb 7, 2023
@hrydgard hrydgard merged commit 59ae9da into master Feb 7, 2023
@hrydgard hrydgard deleted the mac-math-workaround branch February 7, 2023 17:46
@@ -29,6 +29,13 @@
#define V(i) (currentMIPS->v[voffset[i]])
#define VI(i) (currentMIPS->vi[voffset[i]])

// Flushes the angle to 0 if exponent smaller than this in vfpu_sin/vfpu_cos/vfpu_sincos.
// Was measured to be around 0x68, but GTA on Mac is somehow super sensitive
Copy link
Collaborator

@unknownbrackets unknownbrackets Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's not "about zero", the PSP doesn't return any non-zero value with an exponent below 0x68 (based on an exhaustive analysis of all possible input values that don't wrap.) I'm not arguing with this change, though, as clearly macOS/iOS are returning values with lower exponents than that for values for which the PSP returns an exponent >= 0x68.

-[Unknown]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GTA : LCS - All character and vehicle models are invisible on M1 Mac
2 participants