HLE files: wrap missing SetCurrentDirectoryW and Win32/UCRT path twins #2245

Open
Sidlik900 wants to merge 1 commit from upstream-pr/2247 into main
Sidlik900 commented 2026-11-25 08:46:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Sidlik900 on 2026-11-25T08:46:56Z.


Claimed in https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7157314448.

Summary

  • Wrap missing SetCurrentDirectoryW alongside SetCurrentDirectoryA in crates/victory-hle/src/modules/files.rs so wide current-directory changes on virtual drives rewrite to the host folder instead of hitting kernel32.dll directly.
  • Add missing narrow Win32 file/directory/disk wrappers (CreateDirectoryA, RemoveDirectoryA, SetFileAttributesA, GetFileAttributesExA, GetDiskFreeSpaceExA, MoveFileA, MoveFileExA, CopyFileA) and missing wide two-path twins (MoveFileW, CopyFileW), using
    arrow_pair so mixed virtual/host path pairs route safely through *W without double-rewriting.
  • Add missing UCRT file/directory wrappers (_stat64, _wstat64i32, _wremove, _unlink, _wunlink,
    ename, _wrename, _mkdir, _wmkdir, _rmdir, _wrmdir, _access, _waccess, _access_s, _waccess_s, _chmod, _utime64).
  • Add synthetic unit tests covering every new wrapper, mixed virtual/host pairs, single-rewrite guarantees on nested virtual drives, and an isolated child-process test for SetCurrentDirectoryA/SetCurrentDirectoryW.

Verification

ustfmt --edition 2024 --check crates\victory-hle\src\modules\files.rs

  • cargo xtask policy (182 files ok)
  • cargo test -p victory-hle --locked (146 unit + idelityfx +
    o_dll_planting passed)
  • cargo test -p victory-hle --all-features --locked (146 unit + idelityfx +
    o_dll_planting passed)
  • cargo test -p xtask -p victory --locked ( ictory: 10 + 2 passed; xtask: 6 passed)
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings

AI-assisted (Antigravity); synthetic tests only, no game data.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6600644597 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2247). Originally posted by [Sidlik900](https://github.com/Sidlik900) on 2026-11-25T08:46:56Z. --- Claimed in https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7157314448. ### Summary - Wrap missing SetCurrentDirectoryW alongside SetCurrentDirectoryA in crates/victory-hle/src/modules/files.rs so wide current-directory changes on virtual drives rewrite to the host folder instead of hitting kernel32.dll directly. - Add missing narrow Win32 file/directory/disk wrappers (CreateDirectoryA, RemoveDirectoryA, SetFileAttributesA, GetFileAttributesExA, GetDiskFreeSpaceExA, MoveFileA, MoveFileExA, CopyFileA) and missing wide two-path twins (MoveFileW, CopyFileW), using arrow_pair so mixed virtual/host path pairs route safely through *W without double-rewriting. - Add missing UCRT file/directory wrappers (_stat64, _wstat64i32, _wremove, _unlink, _wunlink, ename, _wrename, _mkdir, _wmkdir, _rmdir, _wrmdir, _access, _waccess, _access_s, _waccess_s, _chmod, _utime64). - Add synthetic unit tests covering every new wrapper, mixed virtual/host pairs, single-rewrite guarantees on nested virtual drives, and an isolated child-process test for SetCurrentDirectoryA/SetCurrentDirectoryW. ### Verification - ustfmt --edition 2024 --check crates\victory-hle\src\modules\files.rs - cargo xtask policy (182 files ok) - cargo test -p victory-hle --locked (146 unit + idelityfx + o_dll_planting passed) - cargo test -p victory-hle --all-features --locked (146 unit + idelityfx + o_dll_planting passed) - cargo test -p xtask -p victory --locked ( ictory: 10 + 2 passed; xtask: 6 passed) - cargo clippy --workspace --all-targets --locked -- -D warnings - cargo clippy --workspace --all-targets --all-features --locked -- -D warnings AI-assisted (Antigravity); synthetic tests only, no game data.
catminou4 commented 2026-11-25 09:06:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:39Z.

Review: COMMENTED


HLE files: wrap missing SetCurrentDirectoryW and Win32/UCRT shims (+613). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Broad compatibility shim; Windows-only behavior needs on-hardware validation.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054382378 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2247#pullrequestreview-6054382378). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:48:39Z. **Review:** COMMENTED --- HLE files: wrap missing SetCurrentDirectoryW and Win32/UCRT shims (+613). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Broad compatibility shim; Windows-only behavior needs on-hardware validation.
Marvisak commented 2026-11-25 14:07:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:31:31Z.


Automated triage for the maintainers. This adds about 25 path wrappers in victory-hle/src/modules/files.rs (narrow Win32 twins such as CreateDirectoryA and MoveFileA, SetCurrentDirectoryW, MoveFileW / CopyFileW, and UCRT functions such as _stat64, rename, _mkdir and _access), registered with hle_export!, plus a narrow_pair helper for mixed virtual/host path pairs. The wrappers follow the existing pattern. Two things keep it from being a merge candidate:

  • The new SetCurrentDirectory* test re-runs the test binary as a child process (std::process::Command::new(std::env::current_exe())), so it needs the maintainer's decision.
  • No CI run is recorded on this head.

The PR also gives no evidence that the title imports these functions. Showing which of them the title actually calls (import names only, no game data) and trimming the rest, and running the working-directory test without spawning a process, would change the verdict.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163902003 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2247#issuecomment-7163902003). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:31:31Z. --- <!-- victory-triage v1 head=6d8c4f6834f58a2a1f6e34fa757dd481ee3b17a0 verdict=needs-work at=2026-11-25T13:42:00Z --> Automated triage for the maintainers. This adds about 25 path wrappers in `victory-hle/src/modules/files.rs` (narrow Win32 twins such as `CreateDirectoryA` and `MoveFileA`, `SetCurrentDirectoryW`, `MoveFileW` / `CopyFileW`, and UCRT functions such as `_stat64`, `rename`, `_mkdir` and `_access`), registered with `hle_export!`, plus a `narrow_pair` helper for mixed virtual/host path pairs. The wrappers follow the existing pattern. Two things keep it from being a merge candidate: - The new `SetCurrentDirectory*` test re-runs the test binary as a child process (`std::process::Command::new(std::env::current_exe())`), so it needs the maintainer's decision. - No CI run is recorded on this head. The PR also gives no evidence that the title imports these functions. Showing which of them the title actually calls (import names only, no game data) and trimming the rest, and running the working-directory test without spawning a process, would change the verdict. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2247:upstream-pr/2247'
git switch 'upstream-pr/2247'

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/2247'
git switch 'upstream-pr/2247'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2247'
git switch 'upstream-pr/2247'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2247'
git switch 'main'
git merge --squash 'upstream-pr/2247'
git switch 'main'
git merge --ff-only 'upstream-pr/2247'
git switch 'main'
git merge 'upstream-pr/2247'
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!2245
No description provided.