fix(agc): read capture output directories through the wide environment on Windows #8432

Merged
orezraey merged 1 commit from upstream-pr/8432 into main 2026-10-23 18:11:29 +00:00
orezraey commented 2026-10-20 12:38:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-20T12:38:33Z.


What

On Windows, pointing APS5_DUMP_SUBMITS or APS5_DUMP_COMPUTE_PIPELINES at a directory with a non-ASCII character, for example under C:\Users\José\AppData\Local\Temp, stops the process as soon as the first capture is written:

filesystem error: Cannot convert character sequence: Illegal byte sequence

Both are read with std::getenv, which returns the ANSI code page, and handed to a std::filesystem::path, which MinGW's libstdc++ decodes as UTF-8.

Changes:

  • SubmissionCapture.cpp: SubmissionCapture::Active reads APS5_DUMP_SUBMITS with _wgetenv on Windows.
  • VulkanDevice.cpp: a ComputePipelineDumpDirectory() helper in the anonymous namespace reads APS5_DUMP_COMPUTE_PIPELINES with _wgetenv on Windows; the capture condition uses it.
  • tests/Pm4Replay.cpp reads APS5_DUMP_SUBMITS the same way, so it looks in the directory the library writes to.

Linux and macOS keep std::getenv. APS5_TRACE_DIR has the same problem; #7599 already changes it, so it is left out here.

Tested

  • Windows 11 Pro 26200, CP1252 (OEM 850), NVIDIA GeForce RTX 5070 Ti (driver 616.64), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON.
  • agc_driver_pm4_replay_tests run directly with APS5_DUMP_SUBMITS=C:\tools\tmp\pm4-ação: with SubmissionCapture.cpp from main (891d56751) it exits 1 with the error above and writes nothing; with this change it passes and writes 6 captures there.
  • agc_driver_buffer_load_store_tests run with APS5_DUMP_COMPUTE_PIPELINES=C:\tools\tmp\cap-ação and ANYPS5_NO_SHADER_CACHE=1: with VulkanDevice.cpp from main it exits 1 with the same error and writes nothing; with this change it passes and writes 10 compute-*/capture.aps5cp captures there.
  • ctest -R ^agc_driver_pm4_replay (the test and agc_driver_pm4_replay_tool) passes. tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists no conflicting lines; the open pull requests it could not compare do not change these lines.
  • Not covered: the registered capture directory stays ASCII, because agc_pm4_replay itself still takes the capture directory through its narrow argv; that tool is a separate change. Linux and macOS were not run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 Pro 26200 (capture paths only; no rendering change)
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4935834691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8432). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-20T12:38:33Z. --- ### What On Windows, pointing `APS5_DUMP_SUBMITS` or `APS5_DUMP_COMPUTE_PIPELINES` at a directory with a non-ASCII character, for example under `C:\Users\José\AppData\Local\Temp`, stops the process as soon as the first capture is written: ``` filesystem error: Cannot convert character sequence: Illegal byte sequence ``` Both are read with `std::getenv`, which returns the ANSI code page, and handed to a `std::filesystem::path`, which MinGW's libstdc++ decodes as UTF-8. Changes: - `SubmissionCapture.cpp`: `SubmissionCapture::Active` reads `APS5_DUMP_SUBMITS` with `_wgetenv` on Windows. - `VulkanDevice.cpp`: a `ComputePipelineDumpDirectory()` helper in the anonymous namespace reads `APS5_DUMP_COMPUTE_PIPELINES` with `_wgetenv` on Windows; the capture condition uses it. - `tests/Pm4Replay.cpp` reads `APS5_DUMP_SUBMITS` the same way, so it looks in the directory the library writes to. Linux and macOS keep `std::getenv`. `APS5_TRACE_DIR` has the same problem; #7599 already changes it, so it is left out here. ### Tested - Windows 11 Pro 26200, CP1252 (OEM 850), NVIDIA GeForce RTX 5070 Ti (driver 616.64), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. - `agc_driver_pm4_replay_tests` run directly with `APS5_DUMP_SUBMITS=C:\tools\tmp\pm4-ação`: with `SubmissionCapture.cpp` from `main` (`891d56751`) it exits 1 with the error above and writes nothing; with this change it passes and writes 6 captures there. - `agc_driver_buffer_load_store_tests` run with `APS5_DUMP_COMPUTE_PIPELINES=C:\tools\tmp\cap-ação` and `ANYPS5_NO_SHADER_CACHE=1`: with `VulkanDevice.cpp` from `main` it exits 1 with the same error and writes nothing; with this change it passes and writes 10 `compute-*/capture.aps5cp` captures there. - `ctest -R ^agc_driver_pm4_replay` (the test and `agc_driver_pm4_replay_tool`) passes. `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists no conflicting lines; the open pull requests it could not compare do not change these lines. - Not covered: the registered capture directory stays ASCII, because `agc_pm4_replay` itself still takes the capture directory through its narrow `argv`; that tool is a separate change. Linux and macOS were not run. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 Pro 26200 (capture paths only; no rendering change) - [x] AI-assisted: yes (Claude Code)
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
boykopovar/AnyPS5!8432
No description provided.