Run: find title DLLs, the manifest and G: in a separated exe/dump layout #3350

Open
oni-swr wants to merge 1 commit from upstream-pr/3350 into main
oni-swr commented 2026-11-26 19:40:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T19:40:50Z.


Fixes #3336 (resolution 1, the search order). Task: #3336 on #1633.

A dump whose executable is in another folder than its data got TitleID 0, no G: and unbound imports, because run looked for the title's DLLs, MicrosoftGame.config and the package only beside the executable.

  • load_title_dlls / load_title_dll take the title folders in search order (&[&Path]); a new find_title_dll picks the first folder that has the file.
  • run searches the executable's folder, then game_dir (once if they are the same folder). The same DLL in both comes from the executable's folder.
  • MicrosoftGame.config is read from beside the executable, else from game_dir; G: is mounted where it is found. With one folder, behaviour is unchanged. The startup-archive check and the missing-DLL message use the same folders.
  • README notes the layout.

Tests (synthetic temp dirs, no game files, no GPU): find_title_dll order; load_title_dll finds a DLL in the second folder and prefers the first (title_dlls.rs); TitleLayout for one folder, a separated one, and manifest precedence (run.rs). With the old single-folder behaviour emulated, the loader test and the separated-layout test fail; they pass with the fix.

Checked: cargo test -p victory-loader -p victory, cargo clippy -p victory-loader -p victory --all-targets -- -D warnings, cargo xtask policy. cargo clippy --workspace --all-targets -D warnings stops on undocumented-unsafe errors in victory-gpu test code that this PR does not touch. Not run with a title or a GPU.

AI-assisted: Claude Code (Claude Sonnet 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5516159212 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3350). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T19:40:50Z. --- Fixes #3336 (resolution 1, the search order). Task: #3336 on #1633. A dump whose executable is in another folder than its data got TitleID 0, no `G:` and unbound imports, because `run` looked for the title's DLLs, `MicrosoftGame.config` and the package only beside the executable. - `load_title_dlls` / `load_title_dll` take the title folders in search order (`&[&Path]`); a new `find_title_dll` picks the first folder that has the file. - `run` searches the executable's folder, then `game_dir` (once if they are the same folder). The same DLL in both comes from the executable's folder. - `MicrosoftGame.config` is read from beside the executable, else from `game_dir`; `G:` is mounted where it is found. With one folder, behaviour is unchanged. The startup-archive check and the missing-DLL message use the same folders. - README notes the layout. Tests (synthetic temp dirs, no game files, no GPU): `find_title_dll` order; `load_title_dll` finds a DLL in the second folder and prefers the first (`title_dlls.rs`); `TitleLayout` for one folder, a separated one, and manifest precedence (`run.rs`). With the old single-folder behaviour emulated, the loader test and the separated-layout test fail; they pass with the fix. Checked: `cargo test -p victory-loader -p victory`, `cargo clippy -p victory-loader -p victory --all-targets -- -D warnings`, `cargo xtask policy`. `cargo clippy --workspace --all-targets -D warnings` stops on undocumented-unsafe errors in `victory-gpu` test code that this PR does not touch. Not run with a title or a GPU. AI-assisted: Claude Code (Claude Sonnet 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Dukestar69 commented 2026-11-26 19:48:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T19:48:05Z.

Review: APPROVED


LGTM — verified on Windows against origin/main (63bcca4).

  • Searching title DLLs, manifest, and data folders in order cleanly supports separated exe/data layouts while preserving single-folder behavior.
  • cargo test -p victory-loader -p victory -- --test-threads=1: all passed (17 victory unit + 4 integration, 36 victory-loader unit + 5 integration, including layout_tests::*, search::tests::the_first_folder_that_has_the_file_wins, and title_dlls_are_searched_in_folder_order).
  • cargo clippy -p victory-loader -p victory --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6079745964 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3350#pullrequestreview-6079745964). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T19:48:05Z. **Review:** APPROVED --- LGTM — verified on Windows against `origin/main` (`63bcca4`). - Searching title DLLs, manifest, and data folders in order cleanly supports separated exe/data layouts while preserving single-folder behavior. - `cargo test -p victory-loader -p victory -- --test-threads=1`: all passed (17 `victory` unit + 4 integration, 36 `victory-loader` unit + 5 integration, including `layout_tests::*`, `search::tests::the_first_folder_that_has_the_file_wins`, and `title_dlls_are_searched_in_folder_order`). - `cargo clippy -p victory-loader -p victory --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
passerbyyhx commented 2026-11-26 22:33:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T22:33:01Z.


I exercised the Windows victory run ... --execute entry point at adccf080113532c9377a990e8096676a1be9ecb9 and its parent in five fresh processes per revision. A generated EXE calls an export in the title's own DLL and reads a byte from G:\fixture.bin. Its exit code encodes both values. The CLI supplies the independently checked manifest TitleID.

Layout Head (TitleID, exit code) Parent
One folder BBB00003, 59 Same
DLL and manifest only in data directory AAA00007, 125 00000000, launch fails
DLL in both folders, manifest only in data directory AAA00007, 61 00000000, 59
Manifest in both folders, DLL only in data directory BBB00003, 123 BBB00003, launch fails
DLL and manifest in both folders BBB00003, 59 Same

The independent markers distinguish the selected DLL from the package mount even when they come from different folders. Source-only reproducer. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204778128 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3350#issuecomment-7204778128). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-11-26T22:33:01Z. --- I exercised the Windows `victory run ... --execute` entry point at `adccf080113532c9377a990e8096676a1be9ecb9` and its parent in five fresh processes per revision. A generated EXE calls an export in the title's own DLL and reads a byte from `G:\fixture.bin`. Its exit code encodes both values. The CLI supplies the independently checked manifest TitleID. | Layout | Head (TitleID, exit code) | Parent | | --- | --- | --- | | One folder | BBB00003, 59 | Same | | DLL and manifest only in data directory | AAA00007, 125 | 00000000, launch fails | | DLL in both folders, manifest only in data directory | AAA00007, 61 | 00000000, 59 | | Manifest in both folders, DLL only in data directory | BBB00003, 123 | BBB00003, launch fails | | DLL and manifest in both folders | BBB00003, 59 | Same | The independent markers distinguish the selected DLL from the package mount even when they come from different folders. [Source-only reproducer](https://github.com/passerbyyhx/VIctory/commit/d18aba0e118160835c3a489f6439ebeeaf4f3ab7). AI-assisted with Codex.
fuzeofficlal commented 2026-11-26 23:15:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:15:14Z.

Review: APPROVED


Reviewed adccf080 merged onto main (63bcca43) — clean support for separated executable and content directories across startup archives, manifest/G: mounting, initial title DLLs, and LateDlls.

Verification

  • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory -p victory-loader --all-targets -- -D warnings (both default and --features diagnostics): 0 warnings; Cargo.lock diff is a single dev-dependency link (tempfile).
  • cargo test --locked -p victory-loader (including load_probe and title_dlls integration tests) and cargo test --locked -p victory (17 unit tests + integration tests) all passed on Windows.
  • Verified TitleLayout (apps/victory/src/run.rs:44-103) and find_title_dll (crates/victory-loader/src/search.rs:9-14) against additional edge cases: nonexistent game_dir, Unicode directory names, mixed-case DLL lookups, and startup_archive / MicrosoftGame.config located in game_dir — all resolved in the expected exe_dir-first priority order.

Minor non-blocking note

  • When exe is passed as a bare filename without a parent component (e.g. Path::new("title.exe")), exe.parent() returns Some("") rather than None, so same_dir("", ".") cannot canonicalize "" and keeps both "" and "." in layout.dirs. Filtering empty parents (.filter(|p| !p.as_os_str().is_empty()) before .unwrap_or(Path::new(".")) at apps/victory/src/run.rs:125) would normalize that edge case cleanly (same pre-existing behavior as main).

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6081392775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3350#pullrequestreview-6081392775). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T23:15:14Z. **Review:** APPROVED --- Reviewed `adccf080` merged onto `main` (`63bcca43`) — clean support for separated executable and content directories across startup archives, manifest/G: mounting, initial title DLLs, and `LateDlls`. ### Verification - `cargo xtask policy`: 191 files ok; `cargo clippy --locked -p victory -p victory-loader --all-targets -- -D warnings` (both default and `--features diagnostics`): 0 warnings; `Cargo.lock` diff is a single dev-dependency link (`tempfile`). - `cargo test --locked -p victory-loader` (including `load_probe` and `title_dlls` integration tests) and `cargo test --locked -p victory` (17 unit tests + integration tests) all passed on Windows. - Verified `TitleLayout` (`apps/victory/src/run.rs:44-103`) and `find_title_dll` (`crates/victory-loader/src/search.rs:9-14`) against additional edge cases: nonexistent `game_dir`, Unicode directory names, mixed-case DLL lookups, and `startup_archive` / `MicrosoftGame.config` located in `game_dir` — all resolved in the expected `exe_dir`-first priority order. ### Minor non-blocking note - When `exe` is passed as a bare filename without a parent component (e.g. `Path::new("title.exe")`), `exe.parent()` returns `Some("")` rather than `None`, so `same_dir("", ".")` cannot canonicalize `""` and keeps both `""` and `"."` in `layout.dirs`. Filtering empty parents (`.filter(|p| !p.as_os_str().is_empty())` before `.unwrap_or(Path::new("."))` at `apps/victory/src/run.rs:125`) would normalize that edge case cleanly (same pre-existing behavior as `main`). LGTM.
steven-seagull27 commented 2026-11-27 11:01:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-27T11:01:35Z.


I checked the Windows victory run map-and-bind entry point on the parent (63bcca43) and this PR (adccf080). Each row used a fresh process and isolated data and cache directories. I checked the expected manifest ID independently.

Layout Manifest ID, parent → PR DLLs mapped, parent → PR Unresolved executable imports, parent → PR
EXE, DLLs and manifest together expected → expected 4 → 4 0 → 0
EXE separate from DLLs and manifest zero → expected 0 → 4 72 → 0
EXE and DLLs together, manifest separate zero → expected 4 → 4 0 → 0

The third layout isolates the manifest lookup: all imports already bound on the parent, but the ID was zero. On the PR, all three layouts matched the unified control in both identity and bindings. All six processes exited normally after binding. This check covered manifest and DLL lookup through the CLI; it stopped before guest execution or a read from G:.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7216589735 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3350#issuecomment-7216589735). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-27T11:01:35Z. --- I checked the Windows `victory run` map-and-bind entry point on the parent (`63bcca43`) and this PR (`adccf080`). Each row used a fresh process and isolated data and cache directories. I checked the expected manifest ID independently. | Layout | Manifest ID, parent → PR | DLLs mapped, parent → PR | Unresolved executable imports, parent → PR | |---|---|---:|---:| | EXE, DLLs and manifest together | expected → expected | 4 → 4 | 0 → 0 | | EXE separate from DLLs and manifest | zero → expected | 0 → 4 | 72 → 0 | | EXE and DLLs together, manifest separate | zero → expected | 4 → 4 | 0 → 0 | The third layout isolates the manifest lookup: all imports already bound on the parent, but the ID was zero. On the PR, all three layouts matched the unified control in both identity and bindings. All six processes exited normally after binding. This check covered manifest and DLL lookup through the CLI; it stopped before guest execution or a read from `G:`. AI-assisted with Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3350:upstream-pr/3350'
git switch 'upstream-pr/3350'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3350'
git switch 'upstream-pr/3350'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3350'
git switch 'upstream-pr/3350'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3350'
git switch 'main'
git merge --squash 'upstream-pr/3350'
git switch 'main'
git merge --ff-only 'upstream-pr/3350'
git switch 'main'
git merge 'upstream-pr/3350'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3350
No description provided.