-
Notifications
You must be signed in to change notification settings - Fork 17
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
III/VC cross-compile fixes #95
base: dev
Are you sure you want to change the base?
III/VC cross-compile fixes #95
Conversation
Before I start reviewing - is that not missing the inline assembly changes for San Andreas? That said, I would actually prefer the assembly changes and the rest split into two PRs. Also as mentioned in #31, Actions will not happen because of the RW SDK dependency. Some of those changes will also likely have to go under a macro, because SP needs to support |
That's intentional because San Andreas has even bigger inline assembly changes (and this PR is probably big enough) and I'm currently having weird segfaults in that game (so support will be delayed for a future PR)
So even adding an external RW SDK source in the Actions .yml file is as bad as vendoring the headers directly, right? If so then I guess REing the definitions required by the headers might be the only way Also RW 3.7 SDK seems to work okay for all of the GTA SilentPatches (so I'm not sure why a precise version is needed)
I can work around that if the older compiler requires it |
Probably - it's a risk I choose not to take.
At some point I remember it was problematic with one of the fixes, but maybe that was in another project. I vaguely recall that the SA fixes involving the anim interpolation broke with 3.7.
I'll have to check if it's necessary on all templated static inlines, or only the method pointers. but something like |
ff4112c
to
dcde67d
Compare
Some of the MSVC inline assembly statements do weird things (like doing a double pointer deference on a regular single-star pointer) Is there any real reason for this? |
Do you have an example? Are you sure it's not a |
This is one example: https://github.com/CookiePLMonster/SilentPatch/blob/dev/SilentPatchIII/SilentPatchIII.cpp#L199 ( |
OK I think that may have been me being careless with the notation - the first mov is supposed to load the value in |
dcde67d
to
a48e81a
Compare
Anyway I just redid the MSVC inline assembly statements to be more logical (but they're of course untested) Also there's some llvm-mingw/Clang fixes (now there's just some stubborn |
Thanks! I'll have to verify those assembly statements later. I just hope they don't start |
I'll do that fairly soon |
Ironically up-to-date MSVC on Wine requires some of these cross-compile fixes too (despite not being GCC/Clang of course):
|
Yeah, it's a combination of two things:
|
a2cfac1
to
8871042
Compare
I merged #113 because it's safe and testable, but I am going to hold this one off until the next hotfix is released. |
8871042
to
dc04c3c
Compare
Also the generated .rc files are fully UTF-16 (LE?) encoded which windres doesn't support at all (I'm currently converting those files to UTF-8 at compile-time which complicates the compile process a bit) |
dc04c3c
to
a8c40aa
Compare
It seems to be used in the early days of SilentPatch (but it's no longer included since the III/VC/SA code split and serves no purpose)
This fixes missing header issues on a case-sensitive filesystem with MinGW GCC
This avoids compile warnings on MinGW GCC (because standard C++ headers eventually import the Windows stuff)
MSVC (wrongly) allows those casts to succeed with static_cast: https://stackoverflow.com/questions/74002657/why-cant-i-static-cast-a-void-to-a-pointer-to-function (so adjust those casts for better compiler compatibility including MinGW GCC)
And switch to a common define for this attribute (this fixes compile warnings on MinGW GCC)
…ions This fixes compile warnings with MinGW GCC
MinGW GCC's linker can't find them otherwise
The .def file is either going to have issues on MSVC or MinGW GCC (so replace it with a pragma on MSVC)
This works around the MinGW GCC type strictness
Redefining them can cause strange compile errors with MinGW GCC
MinGW GCC doesn't seem to unwind the layers of the macro define properly (which causes it to not find the declaration type)
MinGW GCC can't locate it in some files otherwise
MinGW GCC doesn't have this MSVC-specific function
This makes sure the fixed-width integer types are included in SVF.h
It's required for the modf() function (and it isn't implicitly included on MinGW GCC)
MinGW GCC doesn't implicitly include it either
These almost work on llvm-mingw too (but there's some stubborn call instructions)
a8c40aa
to
c6885c4
Compare
This also includes a small wrapper to call a C++ function from GCC-style inline ASM These statements almost work on llvm-mingw too (but there's some stubborn call instructions)
c6885c4
to
815ee10
Compare
Amazing work, thanks for your efforts. Also, is it possible to upgrade the project to VS 2022? |
That's hopefully coming soon, there are just a few tiny incompatibilities stemming from how lax v141_xp is. |
This project might be switched to Premake instead for cross-compile support (because it's already used by some other SilentPatches and because Meson might not be accepted) so the existing .sln/.vcxproj files will disappear (Premake does still have a VS generator though so you will still be able to build with VS) I had some strange cross-compile issues with Premake though (so I might put a Git/fork version of Premake as a requirement instead of dealing with that weird stuff) |
This PR might be too large when compared to the ModUtils one (so I can split it if needed)
Compiling with MSVC isn't tested either (maybe I should try installing VS on Wine to avoid this testing void?; GitHub Actions would also help)
Note: Adding a different build system is required to actually use this work (#31 mentions Premake which might be okay here but Meson is an option too and it's used by some popular PE libraries like DXVK) so I'm currently using some hacky Makefiles (I might push those to a branch later)