Skip to content

fix(install): detect SDL imports and replace outdated runtimes - #8

Merged
hzqst merged 1 commit into
mainfrom
fix/sdl-import-detection
Oct 30, 2026
Merged

hzqst merged 1 commit into
mainfrom
fix/sdl-import-detection

Conversation

@hzqst

@hzqst hzqst commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

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:

  • Confirmed the new PE detection regression fails before the fix.
  • 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.
  • New CLI with the actual Counter-Strike hw.dll and 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.

@hzqst
hzqst merged commit 6b4823a into main Oct 30, 2026
1 check passed
@hzqst
hzqst deleted the fix/sdl-import-detection branch November 7, 2026 15:00
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