v1.4.0: fail-closed codec self-test, VR multi-cluster fix, crash-on-exit guard#1
v1.4.0: fail-closed codec self-test, VR multi-cluster fix, crash-on-exit guard#1ShugokiFable wants to merge 1 commit into
Conversation
…xit guard - Round-trip self-test before installing Detours hooks (libdeflate, zlib-ng, LZ4) - Fix VR extra-cluster hook trampoline pointer lifetime (stack -> static) - atexit flag for stats-logging thread, chunked 1s sleep slices - MSVC options guard on MSVC (Ninja/cl compat), drop /GL on lz4_static - Version bump 1.2.0 -> 1.4.0
There was a problem hiding this comment.
Code Review
This pull request introduces several robustness improvements to the decompression hooks. It adds a startup self-test (RunSelfTest) to verify the integrity of the zlib and LZ4 decompression paths before installing hooks, falling back to vanilla speed on failure. It also refactors the VR hook cluster handling to store trampoline pointers in static storage rather than stack locals, and improves the stats logging thread's shutdown mechanism using std::atexit and chunked sleeps to prevent crashes during CRT teardown. In CMake, it cleans up compiler flags and uses if(MSVC) instead of generator matching. The feedback suggests utilizing a condition variable and mutex for a cleaner, more prompt shutdown of the logging thread instead of chunked sleeps.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| #include <algorithm> | ||
| #include <vector> |
Changes (Skyrim-only, base 3d7aa4c)
Fail-closed codec self-test. Before any Detours hook is installed,
Install()now round-trips a 96 KB mixed run/noise buffer through every replacement codec path (libdeflate one-shot zlib, zlib-ng streaming inflate, LZ4decompress_safe+decompress_safe_usingDict). If any path mismatches, hooks are NOT installed.VR multi-cluster hook bookkeeping fix. Extra-cluster hook loop trampoline pointers moved from stack locals to
static void* s_extraOrig[kMaxClusters][4];DetourTransactionCommitreturn is now checked and logged.Crash-on-exit guard. Stats-logging thread stops on
atexitflag; 60s sleep chunked into 1s slices for prompt shutdown.Minor: version 1.2.0 -> 1.4.0; MSVC options guard on
MSVCinstead ofCMAKE_GENERATOR(Ninja/cl compat); dropped/GLon lz4_static.Compiled with CommonLibSSE-NG (colorglass vcpkg port), MSVC. Smoke-tested on Skyrim AE 1.6.1170 with ~2500-plugin Vortex load order.