runtime: encode the persistent storage root as UTF-8 #1551

Manually merged
github merged 2 commits from gh-pr/1551/head into gh-pr/1551/base 2026-11-26 23:15:47 +00:00
Owner

@⁠SuperCraft3M on GitHub · 2026-11-24 13:51 UTC · original
SuperCraft3M:runtime/storage-root-utf8 → main · +63 −7 · 5 files · 2 commits · merged 2026-11-24 14:36 UTC

Change

The runtime proxy currently reads X2W_STORAGE_PATH with GetEnvironmentVariableA. On a desktop using a legacy ANSI code page, non-ASCII names are returned in that code page and become damaged when the caller consumes the path as UTF-8. Read the environment in UTF-16 and explicitly encode UTF-8 before appending the separator. The existing bounded buffer and logged fallback remain in use; invalid UTF-16 and UTF-8 expansion beyond capacity are refused without partial output.

This follows the public console encoding contract: https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/utf-8 . The change is limited to the persistent-storage path answer in the startup runtime proxy, with no dependency on #1549.

Verification

Base: 3c6273ac. Windows 11, MSVC 19.44 Debug.

cmake --build C:/Xbox2Windows-build --target startup_storage_root_check startup_stub_gameinput --parallel 4: passed.

ctest --test-dir C:/Xbox2Windows-build --no-tests=error -R '^startup_storage_root' --output-on-failure: passed 2/2, no skips. The source-built fixture adds 7 UTF-8 cases (ASCII, accent/CJK/supplementary character, empty/null, invalid surrogate, maximum fitting expansion and over-capacity expansion). The existing separator mutation remains an expected failure.

git diff --check: passed.

A local offline diagnostic replay independently changed three storage-directory opens from failure to success with the same non-ASCII root. It still reached a later null-pointer write; this does not establish complete startup or gameplay. Raw traces and local inputs remain private.

Evidence and follow-up

Original source-built tests under MIT; no game files, binaries or raw captures included. The conversion fixture verifies exact UTF-8 bytes and output bounds; it does not model the later crash. Reproduction and byte limits are updated in docs/experiments.md and docs/startup-runtime.md.

AI-assisted (Codex).

**@⁠SuperCraft3M** on GitHub · 2026-11-24 13:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1551) `SuperCraft3M:runtime/storage-root-utf8` → `main` · +63 −7 · 5 files · 2 commits · merged 2026-11-24 14:36 UTC ## Change The runtime proxy currently reads `X2W_STORAGE_PATH` with `GetEnvironmentVariableA`. On a desktop using a legacy ANSI code page, non-ASCII names are returned in that code page and become damaged when the caller consumes the path as UTF-8. Read the environment in UTF-16 and explicitly encode UTF-8 before appending the separator. The existing bounded buffer and logged fallback remain in use; invalid UTF-16 and UTF-8 expansion beyond capacity are refused without partial output. This follows the public console encoding contract: https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/utf-8 . The change is limited to the persistent-storage path answer in the startup runtime proxy, with no dependency on #1549. ## Verification Base: 3c6273ac. Windows 11, MSVC 19.44 Debug. `cmake --build C:/Xbox2Windows-build --target startup_storage_root_check startup_stub_gameinput --parallel 4`: passed. `ctest --test-dir C:/Xbox2Windows-build --no-tests=error -R '^startup_storage_root' --output-on-failure`: passed 2/2, no skips. The source-built fixture adds 7 UTF-8 cases (ASCII, accent/CJK/supplementary character, empty/null, invalid surrogate, maximum fitting expansion and over-capacity expansion). The existing separator mutation remains an expected failure. `git diff --check`: passed. A local offline diagnostic replay independently changed three storage-directory opens from failure to success with the same non-ASCII root. It still reached a later null-pointer write; this does not establish complete startup or gameplay. Raw traces and local inputs remain private. ## Evidence and follow-up Original source-built tests under MIT; no game files, binaries or raw captures included. The conversion fixture verifies exact UTF-8 bytes and output bounds; it does not model the later crash. Reproduction and byte limits are updated in `docs/experiments.md` and `docs/startup-runtime.md`. AI-assisted (Codex).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:15:46 +00:00
github manually merged commit b7b17d1f58 into gh-pr/1551/base 2026-11-26 23:15:47 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 14:30 UTC · original

Resolved the startup-runtime documentation conflict in b7b17d1f. The offline store-context row from main and the UTF-8 storage path limit are both preserved. Windows Release built startup_stub_gameinput and startup_storage_root_check. Both storage-root tests passed, including the separator control, and the docs check passed 345 links.

**@⁠R0Y00** on GitHub · 2026-11-24 14:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1551#issuecomment-7134484111) Resolved the startup-runtime documentation conflict in b7b17d1f. The offline store-context row from main and the UTF-8 storage path limit are both preserved. Windows Release built startup_stub_gameinput and startup_storage_root_check. Both storage-root tests passed, including the separator control, and the docs check passed 345 links.
This discussion has been locked. Commenting is limited to contributors.
No description provided.