From c3cbff86e09858b61835db31aefcf3a1149e8edd Mon Sep 17 00:00:00 2001 From: simplysanatori <149214925+simplysanatori@users.noreply.github.com> Date: Wed, 28 Oct 2026 03:04:35 -0400 Subject: [PATCH] toolchain: build proxy and launcher with SSE2 math; run-trio.sh paths from $HOME i686 GCC defaults to x87 floating point; MSVC x86 defaults to SSE2 and x87 is the slow path under FEX. Add -msse2 -mfpmath=sse -mstackrealign (the game calls in with 4-byte stack alignment) to the proxy and launcher flags. The DXVK fork's meson.build already passes -msse -msse2 -msse3 -mfpmath=sse. d3d9.dll x87 instructions 80809 -> 3627, SSE 0 -> 67940. Co-Authored-By: Claude Sonnet 5.5 --- toolchain/container-build.sh | 7 +++++-- toolchain/run-trio.sh | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/toolchain/container-build.sh b/toolchain/container-build.sh index abdf58a..dc8c1ff 100755 --- a/toolchain/container-build.sh +++ b/toolchain/container-build.sh @@ -55,7 +55,10 @@ if [ "$WHAT" = all ] || [ "$WHAT" = proxy ]; then DEFS=$(grep -E '^set CFLAGS=' /src/build.bat | grep -oE '/D[A-Za-z_0-9]+' | sed 's#^/D#-D#' | tr '\n' ' ') INC="-I$W/third_party/openvr/headers -I$W/third_party/openxr/include -I$W/third_party/imgui -I/src/dxvk-trlvr/src/d3d9 -I/src/dxvk-trlvr/include/vulkan/include" # -include seh_compat.h: MSVC __try/__except shim + _ReturnAddress + sret helper; sources stay unmodified. - CXXFLAGS="-std=gnu++17 -O2 $DEFS -fno-strict-aliasing -include /shims/seh_compat.h $INC ${EXTRA_CXXFLAGS:-}" + # MSVC x86 defaults to SSE2 math; i686 GCC defaults to x87, which is slow under FEX. -mstackrealign: + # the game (MSVC, 4-byte stack alignment) calls into the proxy, and GCC's SSE spills assume 16. + FPFLAGS="-msse2 -mfpmath=sse -mstackrealign" + CXXFLAGS="-std=gnu++17 -O2 $FPFLAGS $DEFS -fno-strict-aliasing -include /shims/seh_compat.h $INC ${EXTRA_CXXFLAGS:-}" echo "sources: $(echo $SRCS $IMGUI_SRCS | wc -w); defs: $DEFS" objs=(); pids=() for s in $SRCS $IMGUI_SRCS; do @@ -79,7 +82,7 @@ if [ "$WHAT" = all ] || [ "$WHAT" = proxy ]; then -Wl,-Map,/out/dist/d3d9.map \ -ldxguid -luser32 -lkernel32 -ladvapi32 -lgdi32 -ldwmapi ${EXTRA_LIBS:-} # Launcher: its own exe (large-address-aware bit must be in the file). - i686-w64-mingw32-g++ -std=gnu++17 -O2 -DWIN32 -DNDEBUG -D_CRT_SECURE_NO_WARNINGS \ + i686-w64-mingw32-g++ -std=gnu++17 -O2 $FPFLAGS -DWIN32 -DNDEBUG -D_CRT_SECURE_NO_WARNINGS \ -include /shims/seh_compat.h -static -static-libgcc -static-libstdc++ -s \ -o /out/dist/trlvr_launcher.exe "$W/src/launcher/main.cpp" \ -mwindows -municode -Wl,--large-address-aware -luser32 -lkernel32 -lshell32 diff --git a/toolchain/run-trio.sh b/toolchain/run-trio.sh index 1cdf833..b135860 100755 --- a/toolchain/run-trio.sh +++ b/toolchain/run-trio.sh @@ -2,11 +2,10 @@ # usage: run-trio.sh