Repository navigation
fix(install): detect SDL imports and replace outdated runtimes - #8
Merged
Merged
Conversation
Co-Authored-By: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Installing into a Counter-Strike game that imports SDL2 could report success while leaving outdated SDL2.dll and SDL3.dll untouched. The shared GUI/CLI engine detector read the CLR directory instead of the import directory, calculated the section table from the optional-header magic, and lost the descriptor position while resolving module names.
Correct the PE32/PE32+ import-directory and section-table offsets, and walk descriptors using explicit offsets bounded by the import directory and file length. Engines importing SDL2 now receive both packaged SDL runtimes; engines without that dependency retain their existing runtimes.
Add regression coverage for SDL2 after earlier imports, case-insensitive names, missing imports and truncated input, and SHA-256 matching after both shared setup and Counter-Strike CLI installation. The optional real-payload checks now exercise engine detection and verify SDL hashes for Sven Co-op, Half-Life and Counter-Strike.
Validation:
dotnet build MetahookInstaller.slnx -c Release: passed, 0 warnings/errors.dotnet run --project tests/MetahookInstaller.FileTests -c Release --no-build -- --payload <downloaded install/output>: 43 regression cases and all 3 real-payload targets passed.hw.dlland old SDL runtimes copied into a temporary game: both installed SDL hashes match the downloaded payload; actual game files remained unchanged.git diff --check: passed.