Skip to content

fix(core): apply core 64-bit and thread stability fixes - #242

Merged
fbraz3 merged 5 commits into
mainfrom
fix/core-64bit-and-threads
Aug 4, 2026
Merged

fix(core): apply core 64-bit and thread stability fixes#242
fbraz3 merged 5 commits into
mainfrom
fix/core-64bit-and-threads

Conversation

@fbraz3

@fbraz3 fbraz3 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Objective

Apply critical core 64-bit & thread stability fixes discovered during the online services investigation.

Summary of Changes

This PR incorporates 4 independent stability and compatibility fixes onto main:

  1. System Timer 64-Bit Truncation (systimer.h):

    • Updates systimerGetMS(), SysTimeClass::Get(), and internal members (StartTime, WrapAdd) to explicit unsigned int return/variable types.
    • Prevents LP64 64-bit integer truncation when TIMEGETTIME values are stored in 32-bit unsigned int variables, resolving premature ThreadClass::Stop() timeouts and shutdown segfaults.
  2. GadgetListBox 64-Bit Pointer Truncation (GadgetListBox.cpp):

    • Fixed multi-selection handling in GadgetListBoxSystem for GLM_GET_SELECTION message.
    • Casts mData2 to Int** to properly pass internal 64-bit list->selections pointer without truncating bits.
  3. POSIX Thread Cancellation Exception Handling (abi::__forced_unwind):

    • Added #if defined(_UNIX) && !defined(__APPLE__) guarded catch (abi::__forced_unwind&) { throw; } blocks before catch (...) in GameSpy worker thread loops (BuddyThread, GameResultsThread, PeerThread, PersistentStorageThread, PingThread).
    • Ensures clean thread unwinding on Linux GCC/Clang while guarding against missing abi::__forced_unwind on macOS libc++.
  4. Linux Deployment Scripts Static Library Check (deploy-linux.sh / deploy-linux-zh.sh):

    • Guarded runtime library check for libavcodec.so using ldd "${BINARY_SRC}" | grep -q "libavcodec.so".
    • Prevents script failure when FFmpeg is statically linked.

Commits Included

  • b810340b1 fix(core): resolve 64-bit truncation bug in system timer
  • 5bae35508 fix(ui): fix pointer truncation in GadgetListBox GetSelection for 64-bit systems
  • 41bebcb08 fix(network): rethrow abi::__forced_unwind in GameSpy threads
  • 2e40f523d fix(deploy): handle static FFmpeg linkage gracefully in Linux deploy scripts

Verification

  • Built and configured cleanly using cmake --preset macos-vulkan.

@fbraz3
fbraz3 merged commit 21ea8af into main Aug 4, 2026
8 checks passed
@fbraz3
fbraz3 deleted the fix/core-64bit-and-threads branch August 4, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant