ampr: keep resolved host paths in native form #1175
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1175
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1175/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@overlordxrz-source on GitHub · 2026-10-08 01:13 UTC · original
overlordxrz-source:ampr/utf8-host-paths→main· +14 −13 · 1 files · 6 commits · merged 2026-10-08 15:27 UTCAPR reads fail when the game is installed under a folder with non-ASCII characters on Windows.
ResolveOnePathfinds the file through the nativestd::filesystem::path, but then stores it as a UTF-8std::string(Common::PathToString). The stat, size and read paths later turn that string back into astd::filesystem::path. On Windows,path(std::string)decodes the bytes with the ANSI code page, not UTF-8 (/utf-8only sets the source and execution charsets, see microsoft/STL#2511), so the path no longer points at the file and every APR read of it fails with ENOENT. On Linux and macOS the round trip is a no-op, which is why this only shows up on Windows.This keeps the native path:
ResolvedPathInfo::host_pathand the file-id table (g_files) now hold astd::filesystem::pathTryGetHostPath,GetHostPathStat,ReadHostFileToGuestand the stat/size/read callers take that path and pass it straight toCommon::FileEvidence
#1156 Tokyo Xtreme Racer, installed under
D:/Инсталляторы/[ps5]/....KernelStatand the directory listing see the pak files, but the first APR read fails:and the game then aborts. This change should stop the folder name from breaking that read, but I couldn't test it on Windows or with the game, and I'm not claiming the game boots.
Testing
tests/KernelFileSystemTests.cpp:CheckAprPathsgets a new case that resolves/app0/Инсталляторы/global.utocthrough the APR export and checks that the APR stat and size exports find it by ID. On Linux the old code passes this too, so it only guards the Windows path.I couldn't run
kernel_file_system_testsitself. It needs a Vulkan device and the full emulator, and my machine is aarch64 Linux. Here is what I did instead:libAmpr.cppforx86_64-linux-gnuandx86_64-windows-gnu(mingw) with clang (zig c++) at-Wall -Wextra, and the updated test file forx86_64-linux-gnu. The changed lines add no warnings.libAmpr.cpp, with stubs for the rest of the emulator. It mounts a temporary folder with a Cyrillic name as/app0, resolves a pak file, checks that the cached host path is the native path, and stats and reads it at an offset through that path. All 5 checks pass. This runs on Linux, so it can't reproduce the ANSI code page conversion itself.src/lines are clean undersrc/.clang-format(clang-format 23.1.3)Not built or run on a Windows machine, and not tested with the game.
AI assistance
An AI assistant helped me trace the failing read in the issue log, write the change and the test, and run the builds above. I reviewed the code and the results.
@coderabbitai[bot] on GitHub · 2026-10-08 01:18 UTC · original · edited 2026-10-08 15:25 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
17ad3b30-c6af-4df8-8137-dd800f3a534e📥 Commits
Reviewing files that changed from the base of the PR and between
39db023c3band96e344b7b6.📒 Files selected for processing (1)
src/libs/libAmpr.cpp🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
Host-path caching, lookup, stat, and size operations now use
std::filesystem::path. AMPR command execution and host-file reads also pass filesystem paths. Diagnostic logging converts these paths to strings.Priority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
96e34No actionable merge-blocking issue was found in the changed path handling. Windows execution is still needed to validate the reported non-ASCII installation scenario.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-10-08 01:18 UTC · original · reviewed
🧹 Nitpick comments (1)
ℹ️ Review info
⚙️ Run configuration
3fc7cdb2-3ddd-4b52-abb3-da6770332c3d📥 Commits
Reviewing files that changed from the base of the PR and between
5a8808086aand1c1d987200.📒 Files selected for processing (2)
src/libs/libAmpr.cpptests/KernelFileSystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@overlordxrz-source on GitHub · 2026-10-08 01:39 UTC · original
@coderabbitai Thanks, added in "tests: read the non-ASCII APR fixture through an APR command". The test now submits one APR read command for the file under the Cyrillic folder and checks that it reads back "UTOC". That covers ExecuteCommand -> ReadHostFileToGuest for the Unicode file ID.
I used a small AprReadMatches helper instead of running CheckAmprOrdering a second time, so the ordering cases stay on the ASCII fixture. As you said, on Linux this only runs the path. The ANSI code page case would only show up on Windows.
@coderabbitai[bot] on GitHub · 2026-10-08 01:43 UTC · original
🧩 Analysis chain
🏁 Script executed:
Length of output: 11196
@overlordxrz-sourceThanks for the update. I checkedtests/KernelFileSystemTests.cpp.AprReadMatchessubmits the read, waits for completion, checks the result, and compares the bytes with"UTOC".This addresses the missing read-path coverage. Keeping
CheckAmprOrderingon the ASCII fixture is appropriate. Linux exercises the read path, but Windows execution is still needed to validate the ANSI code-page regression.If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
You are interacting with an AI system.