Unicode characters in game paths break loading on Windows #714

Closed
opened 2026-11-26 09:30:26 +00:00 by github-bot · 1 comment
Owner

@⁠AghastyGD on GitHub · 2026-09-19 06:54 UTC · original

I found an issue with Unicode characters in game paths on Windows.

At first I thought it was something wrong with my setup, but I could reproduce it just by renaming the game folder.

With an ASCII-only path, the game is detected and loads normally.

For example:

Test-Game

works.

But if I rename the same folder to something like:

Testé
Test–Game
Test日本語

things start breaking in different places.

With é and –, the game gets further, but eventually fails while trying to open sce_sys/icon0.png.

With –, I also noticed the path being printed corrupted.

With Japanese characters it fails earlier:

--game must point to an existing directory or ELF: .../Test???/eboot.bin

So this doesn't seem to be related to the game itself. I can reproduce it with the same files just by changing the directory name.

Environment

  • Windows 11
  • Debug build with clang
  • Commit: f100f78
  • I can also reproduce the issue with the official release

I'm currently investigating where the path gets corrupted and working on a fix

**@⁠AghastyGD** on GitHub · 2026-09-19 06:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/714) I found an issue with Unicode characters in game paths on Windows. At first I thought it was something wrong with my setup, but I could reproduce it just by renaming the game folder. With an ASCII-only path, the game is detected and loads normally. For example: ```text id="k9n4ca" Test-Game ``` works. But if I rename the same folder to something like: ```text id="t5f3uq" Testé Test–Game Test日本語 ``` things start breaking in different places. With `é` and `–`, the game gets further, but eventually fails while trying to open `sce_sys/icon0.png`. With `–`, I also noticed the path being printed corrupted. With Japanese characters it fails earlier: ```text id="o8y2wx" --game must point to an existing directory or ELF: .../Test???/eboot.bin ``` So this doesn't seem to be related to the game itself. I can reproduce it with the same files just by changing the directory name. ### Environment * Windows 11 * Debug build with clang * Commit: `f100f78` * I can also reproduce the issue with the official release **I'm currently investigating where the path gets corrupted and working on a fix**
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:26 +00:00
Author
Owner

@⁠AghastyGD on GitHub · 2026-09-19 10:29 UTC · original

After a few hours debugging this, I finally found where the path actually gets corrupted.

The Unicode path is initially correct. The problem happens later in the Windows directory enumeration code, specifically in SysFileGetDents().

For a folder like:

Testé

the native Windows path is still correct as UTF-16:

0054 0065 0073 0074 00E9

But the current code does this:

std::filesystem::path
→ PathToGenericString()
→ std::string
→ std::filesystem::path(std::string)
→ wstring()
→ FindFirstFileW()

After that round trip, the same path becomes:

Testé

with UTF-16 code units:

0054 0065 0073 0074 00C3 00A9

I confirmed in the debugger that FindFirstFileW() then returns INVALID_HANDLE_VALUE with:

ERROR_PATH_NOT_FOUND

Because of that, enumeration of sce_module returns no entries, so modules such as libc.prx are never preloaded.

That later causes the unresolved:

3GPpjQdAMTw[libc_v1][libc_v1.1][Func]

and eventually the null access reported in runtimeLinker.cpp.

So the crash in runtimeLinker.cpp is a consequence, not the original source of the problem.

I'm working on a small fix for SysFileGetDents() and the equivalent path handling in SysFileFindFiles() by keeping the path native on Windows instead of round-tripping it through a narrow string.

**@⁠AghastyGD** on GitHub · 2026-09-19 10:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/issues/714#issuecomment-5741053325) After a few hours debugging this, I finally found where the path actually gets corrupted. The Unicode path is initially correct. The problem happens later in the Windows directory enumeration code, specifically in `SysFileGetDents()`. For a folder like: ```text Testé ``` the native Windows path is still correct as UTF-16: ```text 0054 0065 0073 0074 00E9 ``` But the current code does this: ```text std::filesystem::path → PathToGenericString() → std::string → std::filesystem::path(std::string) → wstring() → FindFirstFileW() ``` After that round trip, the same path becomes: ```text Testé ``` with UTF-16 code units: ```text 0054 0065 0073 0074 00C3 00A9 ``` I confirmed in the debugger that `FindFirstFileW()` then returns `INVALID_HANDLE_VALUE` with: ```text ERROR_PATH_NOT_FOUND ``` Because of that, enumeration of `sce_module` returns no entries, so modules such as `libc.prx` are never preloaded. That later causes the unresolved: ```text 3GPpjQdAMTw[libc_v1][libc_v1.1][Func] ``` and eventually the null access reported in `runtimeLinker.cpp`. So the crash in `runtimeLinker.cpp` is a consequence, not the original source of the problem. I'm working on a small fix for `SysFileGetDents()` and the equivalent path handling in `SysFileFindFiles()` by keeping the path native on Windows instead of round-tripping it through a narrow string.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/KytyPS5--KytyPS5#714
No description provided.