Skip to content

v1.4.0: fail-closed codec self-test, VR multi-cluster fix, crash-on-exit guard#1

Open
ShugokiFable wants to merge 1 commit into
1001Bits:mainfrom
ShugokiFable:modlist-stability
Open

v1.4.0: fail-closed codec self-test, VR multi-cluster fix, crash-on-exit guard#1
ShugokiFable wants to merge 1 commit into
1001Bits:mainfrom
ShugokiFable:modlist-stability

Conversation

@ShugokiFable

Copy link
Copy Markdown

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, LZ4 decompress_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]; DetourTransactionCommit return is now checked and logged.

Crash-on-exit guard. Stats-logging thread stops on atexit flag; 60s sleep chunked into 1s slices for prompt shutdown.

Minor: version 1.2.0 -> 1.4.0; MSVC options guard on MSVC instead of CMAKE_GENERATOR (Ninja/cl compat); dropped /GL on lz4_static.

Compiled with CommonLibSSE-NG (colorglass vcpkg port), MSVC. Smoke-tested on Skyrim AE 1.6.1170 with ~2500-plugin Vortex load order.

…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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +10 to +11
#include <algorithm>
#include <vector>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To support a thread-safe and prompt shutdown of the stats logging thread using a condition variable, we need to include <condition_variable> and <mutex>.

#include <algorithm>
#include <condition_variable>
#include <mutex>
#include <vector>

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