Loader: find a title DLL whatever its name's case, even beside a folder spelled like it #162

Open
github-bot wants to merge 2 commits from github-bot/gh-162 into main AGit
Owner

@⁠Peppacodes on GitHub · 2026-11-24 22:03 UTC · original
Peppacodes:vf/title-dll-name-case → main · +87 −5 · 2 files · 2 commits · open

On a case-sensitive folder, a title DLL whose file name's case differs from the name it is loaded by is silently skipped. Its imports then go to stubs, and the title's own LoadLibrary sees "not a title image".

Case-sensitive folders are common:

  • Wine/Proton: the game folder on ext4.
  • WSL: it creates folders that way, and new subfolders inherit the flag.

1. Find a title DLL whatever its name's case. map_dll lowercased the DLL's name and joined that to the title folder. On a case-sensitive folder, GameLib.dll is not gamelib.dll. is_file() was false and the DLL was skipped without an error.

  • The lowercased name stays the key (seen, wanted, the returned list).
  • The file is the name as written or, failing that, the folder's entry that matches it ignoring ASCII case. The Windows loader ignores case too.

2. A folder spelled like a title DLL does not hide it. The case-ignoring fallback took the folder's first entry that matched the name, and only then checked it was a file. A folder listed before the file made the DLL not found (NTFS lists LATE.DLL before late.dll). It now takes the first matching entry that is a file. MichaelSmithAI found this in Wine on ext4; the same happens on a case-sensitive NTFS folder.

Tested on this branch's base (2119b0e) plus these two commits, on Windows 11:

  • New loader tests use a case-sensitive temp folder (fsutil setCaseSensitiveInfo, no admin needed) holding Late.dll. They load it as Late.dll, LATE.DLL and late.dll, also with a folder named like the DLL listed before it. They're skipped where Windows cannot make such a folder.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.
  • cargo test -p victory-shader -p victory-hle -p victory-loader --locked: 337 passed, 0 failed, 2 ignored. This was with the two other PRs from this account applied as well.

AI-assisted (Claude Code).

**@⁠Peppacodes** on GitHub · 2026-11-24 22:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/162) `Peppacodes:vf/title-dll-name-case` → `main` · +87 −5 · 2 files · 2 commits · open On a case-sensitive folder, a title DLL whose file name's case differs from the name it is loaded by is silently skipped. Its imports then go to stubs, and the title's own `LoadLibrary` sees "not a title image". Case-sensitive folders are common: - **Wine/Proton:** the game folder on ext4. - **WSL:** it creates folders that way, and new subfolders inherit the flag. **1. Find a title DLL whatever its name's case.** `map_dll` lowercased the DLL's name and joined that to the title folder. On a case-sensitive folder, `GameLib.dll` is not `gamelib.dll`. `is_file()` was false and the DLL was skipped without an error. - The lowercased name stays the key (seen, wanted, the returned list). - The file is the name as written or, failing that, the folder's entry that matches it ignoring ASCII case. The Windows loader ignores case too. **2. A folder spelled like a title DLL does not hide it.** The case-ignoring fallback took the folder's first entry that matched the name, and only then checked it was a file. A folder listed before the file made the DLL not found (NTFS lists `LATE.DLL` before `late.dll`). It now takes the first matching entry that is a file. MichaelSmithAI found this in Wine on ext4; the same happens on a case-sensitive NTFS folder. **Tested** on this branch's base (`2119b0e`) plus these two commits, on Windows 11: - New loader tests use a case-sensitive temp folder (`fsutil setCaseSensitiveInfo`, no admin needed) holding `Late.dll`. They load it as `Late.dll`, `LATE.DLL` and `late.dll`, also with a folder named like the DLL listed before it. They're skipped where Windows cannot make such a folder. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. - `cargo test -p victory-shader -p victory-hle -p victory-loader --locked`: 337 passed, 0 failed, 2 ignored. This was with the two other PRs from this account applied as well. AI-assisted (Claude Code).
map_dll lowercased the DLL's name and joined that to the title folder.
On a case-sensitive folder (WSL creates them so, and new subfolders
inherit the flag) GameLib.dll is not gamelib.dll: is_file() was false
and the DLL was skipped without an error, so its imports went to stubs
and a title's own LoadLibrary saw "not a title image".

The lowercased name stays the key (seen, wanted, the returned list).
The file is the name as written or, failing that, the folder's entry
that matches it ignoring ASCII case, as the Windows loader ignores case.

Test: a case-sensitive temp folder (fsutil setCaseSensitiveInfo, no
admin) holding Late.dll, loaded as Late.dll, LATE.DLL and late.dll.
Skipped where Windows cannot make such a folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 1e24f34d13e85b980015002cded548429443be1e)
The case-ignoring fallback took the folder's first entry that matched the
name and only then checked it was a file. A folder listed before the file
(NTFS lists LATE.DLL before late.dll) made the DLL not found. It now
takes the first matching entry that is a file.

Found by MichaelSmithAI in Wine on ext4; the same happens on a
case-sensitive NTFS folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 22c3d0034f50de74a74de5a938e1ffeaeb40f680)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:18 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/162/head:github-bot/gh-162'
git switch 'github-bot/gh-162'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-162'
git switch 'github-bot/gh-162'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-162'
git switch 'github-bot/gh-162'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-162'
git switch 'main'
git merge --squash 'github-bot/gh-162'
git switch 'main'
git merge --ff-only 'github-bot/gh-162'
git switch 'main'
git merge 'github-bot/gh-162'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.