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

Qt: Add very-early VC++ runtime version check #11361

Merged
merged 1 commit into from
Jun 9, 2024
Merged

Qt: Add very-early VC++ runtime version check #11361

merged 1 commit into from
Jun 9, 2024

Conversation

stenzek
Copy link
Contributor

@stenzek stenzek commented Jun 9, 2024

Description of Changes

Backport of stenzek/duckstation@a2e6a48

image

Rationale behind Changes

MS decided to effectively break the ABI with the Visual C++ runtime, resulting in crashes if a user tries to run a newer PCSX2 on an out-of-date runtime. Throw an error up, and prompt them to update instead of crashing.

Suggested Testing Steps

Try the PR build on an old install.

@stenzek stenzek merged commit 37df1ad into PCSX2:master Jun 9, 2024
12 checks passed
@stenzek stenzek deleted the vcruntime branch June 9, 2024 11:47
HeapFree(heap, 0, version_block);
HeapFree(heap, 0, filename);

if (v0 >= MIN_VERSION_V0 && v1 >= MIN_VERSION_V1 && v2 >= MIN_VERSION_V2)
Copy link

Choose a reason for hiding this comment

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

This can cause some issues in the future. If V0 is strictly greater than MIN_VERSION_V0, there is no reason to check for V1 and V2 (and same for V1 with V2).
For example msvc version 14.39.0.0 would fail this check and display the warning prompt, which I don't think is intended.

Copy link
Member

@refractionpcsx2 refractionpcsx2 Jun 9, 2024

Choose a reason for hiding this comment

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

I think this is a common trip up when doing version number checks, you need to do

v0 > Min_version0 || (v0 == min_version0 && (v1 > min_version1 || (v1 == min_version1 && v2 >= min_version2)))

I think that covers all bases.. lol

Copy link

@Macdu Macdu Jun 9, 2024

Choose a reason for hiding this comment

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

Yes, that should work. Another way would be to convert v0, v1 and v2 to a single 64-bit integer and compare it to the one made from MIN_VERSION_{V0,V1,V2} I guess (it may look nicer)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, yeah, originally I had it the other way around, but stuffed up the inversion.

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.

3 participants