XGameSave: long container names use a hashed folder (#326) #476

Open
Grimkaaah wants to merge 1 commit from upstream-pr/481 into main
Grimkaaah commented 2026-11-24 00:56:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-24T00:56:06Z.


Summary

  • When enc(name) would exceed 200 characters (Windows path component limit / / → %2F expansion), store the container under ~xclc.<fnv1a64> instead of the raw encoded name.
  • Persist the exact GDK container name in a container_name sidecar so enumerate / get-info / delete keep the real name.
  • Unit tests for the short/long folder naming and a full create → submit → enumerate → delete round-trip with a 256-char name.

Fixes #326

Test plan

  • cargo test -p xcl --lib hle::xgameruntime::gamesave:: (13 passed)
<!-- greyfinch-sync:ivall/xcl:issue:5464005042 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481). Originally posted by [Grimkaaah](https://github.com/Grimkaaah) on 2026-11-24T00:56:06Z. --- ## Summary - When `enc(name)` would exceed 200 characters (Windows path component limit / `/` → `%2F` expansion), store the container under `~xclc.<fnv1a64>` instead of the raw encoded name. - Persist the exact GDK container name in a `container_name` sidecar so enumerate / get-info / delete keep the real name. - Unit tests for the short/long folder naming and a full create → submit → enumerate → delete round-trip with a 256-char name. Fixes #326 ## Test plan - [x] `cargo test -p xcl --lib hle::xgameruntime::gamesave::` (13 passed)
shdann commented 2026-11-24 01:02:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by shdann on 2026-11-24T01:02:00Z.

Review: COMMENTED


container_folder_name changes the location of existing saves with encoded folder names of 201–255 ASCII characters. For example, a valid name of 201 ASCII letters fits in a legacy folder. After this change enumeration still finds that folder, but opening or deleting the same name selects the new hash path. A subsequent update can create a second container with the same displayed name. Please resolve the existing legacy folder first, or migrate it safely, and add an upgrade test covering enumerate, read, update, and delete. Also preserve case-insensitive lookup for hashed names: the hash currently takes the original case-sensitive bytes. Static review with OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ivall/xcl:review:6032025367 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#pullrequestreview-6032025367). Originally posted by [shdann](https://github.com/shdann) on 2026-11-24T01:02:00Z. **Review:** COMMENTED --- `container_folder_name` changes the location of existing saves with encoded folder names of 201–255 ASCII characters. For example, a valid name of 201 ASCII letters fits in a legacy folder. After this change enumeration still finds that folder, but opening or deleting the same name selects the new hash path. A subsequent update can create a second container with the same displayed name. Please resolve the existing legacy folder first, or migrate it safely, and add an upgrade test covering enumerate, read, update, and delete. Also preserve case-insensitive lookup for hashed names: the hash currently takes the original case-sensitive bytes. Static review with OpenAI Codex (GPT-6).
H0UNDZER0 commented 2026-11-24 07:05:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by H0UNDZER0 on 2026-11-24T03:05:48Z.


Tested on an RTX 5080, release build: pass, 679 passed, 0 failed.

  • Commit f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d, this PR's head as is (on its base 2997c9a), release build.
  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; Ryzen 7 9700X; Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0). No XCL_* variables set.
  • cargo build --release --workspace --locked: OK, the same single fetch_update warning as main.
  • cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with --show-output): 679 passed, 0 failed, 41 ignored both times. main 2997c9a gives 676 / 0 / 41 on this PC: the difference is the 3 new tests, container_folder_name_short_stays_encoded, container_folder_name_long_uses_stable_hash_prefix and long_container_name_saves_and_enumerates, which pass.
  • SKIPPED: the usual 2, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64).
  • The test title (e2e), its save-storage check included, ends with failures: 0.

Not tested

  • A save made before this PR with a folder name of 201–255 characters, the upgrade case in the review above: no test covers it.
  • This PR merged onto a newer main. When this was written that was dd2ae9a; git merge-tree showed no conflict.
  • Debug build, retail titles, scripts/smoke.ps1.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

<!-- greyfinch-sync:ivall/xcl:comment:7120767222 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/481#issuecomment-7120767222). Originally posted by [H0UNDZER0](https://github.com/H0UNDZER0) on 2026-11-24T03:05:48Z. --- **Tested** on an RTX 5080, release build: **pass**, 679 passed, 0 failed. - Commit `f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d`, this PR's head as is (on its base `2997c9a`), release build. - NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; Ryzen 7 9700X; Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0). No `XCL_*` variables set. - `cargo build --release --workspace --locked`: OK, the same single `fetch_update` warning as `main`. - `cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4`, run twice (the second with `--show-output`): **679 passed, 0 failed, 41 ignored** both times. `main` `2997c9a` gives 676 / 0 / 41 on this PC: the difference is the 3 new tests, `container_folder_name_short_stays_encoded`, `container_folder_name_long_uses_stable_hash_prefix` and `long_container_name_saves_and_enumerates`, which pass. - `SKIPPED`: the usual 2, `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64). - The test title (`e2e`), its save-storage check included, ends with `failures: 0`. **Not tested** - A save made before this PR with a folder name of 201–255 characters, the upgrade case in the review above: no test covers it. - This PR merged onto a newer `main`. When this was written that was `dd2ae9a`; `git merge-tree` showed no conflict. - Debug build, retail titles, `scripts/smoke.ps1`. **AI use:** Claude Code (Claude Opus 5.5, Claude Fable 5.2)
MesshM commented 2026-11-24 07:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T05:24:03Z.


Test run of f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d on AMD RDNA4. I merged it onto current main d208e14 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 707 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 666 passed, 0 failed, 21 ignored
  • 0 SKIPPED; container_folder_name_long_uses_stable_hash_prefix and container_folder_name_short_stays_encoded pass.

Review: Duplicate of #492 (open), which also stores over-long container names in hashed folders for #326. Only one should land, and the folder naming must not change after it does, or existing saves would be lost.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7122911681 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/481#issuecomment-7122911681). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T05:24:03Z. --- Test run of `f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d` on AMD RDNA4. I merged it onto current `main` `d208e14` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **707 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 666 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `container_folder_name_long_uses_stable_hash_prefix` and `container_folder_name_short_stays_encoded` pass. **Review:** **Duplicate of #492** (open), which also stores over-long container names in hashed folders for #326. Only one should land, and the folder naming must not change after it does, or existing saves would be lost. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Alpha325 commented 2026-11-25 03:05:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Alpha325 on 2026-11-25T02:49:03Z.


I reproduced the legacy-folder issue raised above using a synthetic save with a 201-character ASCII container name. I seeded the old encoded folder layout without a container_name sidecar, then ran the same fixture on parent 2997c9a and PR head f9947a0.

Operation Parent PR
Enumerate before opening One matching entry One matching entry
Open by name and read data Read the original bytes E_GS_BLOB_NOT_FOUND (0x80830008)
Update by name Updated the original folder; one entry Created a second folder; two entries
Delete by name Returned S_OK; zero entries remained Returned S_OK; the original entry remained

The fixture uses a canonical Windows path to isolate the folder-layout change from the Win32 full-path limit. It passed on the parent and failed on the PR. The PR’s 13 existing GameSave tests still passed.

Windows 11, Rust 1.100.0 MSVC debug, temporary synthetic save data only. AI use — OpenAI Codex (GPT-6) wrote and ran the fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7151225125 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#issuecomment-7151225125). Originally posted by [Alpha325](https://github.com/Alpha325) on 2026-11-25T02:49:03Z. --- I reproduced the legacy-folder issue raised above using a synthetic save with a 201-character ASCII container name. I seeded the old encoded folder layout without a `container_name` sidecar, then ran the same fixture on parent `2997c9a` and PR head `f9947a0`. | Operation | Parent | PR | |---|---|---| | Enumerate before opening | One matching entry | One matching entry | | Open by name and read `data` | Read the original bytes | `E_GS_BLOB_NOT_FOUND` (`0x80830008`) | | Update by name | Updated the original folder; one entry | Created a second folder; two entries | | Delete by name | Returned `S_OK`; zero entries remained | Returned `S_OK`; the original entry remained | The fixture uses a canonical Windows path to isolate the folder-layout change from the Win32 full-path limit. It passed on the parent and failed on the PR. The PR’s 13 existing GameSave tests still passed. Windows 11, Rust 1.100.0 MSVC debug, temporary synthetic save data only. AI use — OpenAI Codex (GPT-6) wrote and ran the fixture and drafted this report.
Toons29 commented 2026-11-25 03:05:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T02:55:39Z.


Regression run of f9947a0f on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1482 (PresentX 1482)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14780 MB

Against the limits in CONTRIBUTING.md: 92 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151369046 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#issuecomment-7151369046). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T02:55:39Z. --- Regression run of `f9947a0f` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: f9947a0f680d4fa9ee1731f7dd474bdc98e5ce3d gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1482 (PresentX 1482) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14780 MB ``` Against the limits in CONTRIBUTING.md: 92 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
DavidM1911 commented 2026-11-25 14:10:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:05:12Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7164734715 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#issuecomment-7164734715). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T14:05:12Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 20:43:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:43:45Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262311175 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#issuecomment-7262311175). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:43:45Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:34:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:34:57Z.


Triage (#1607) – head f9947a0

#492 makes the same change in hle/xgameruntime/gamesave.rs: container names whose enc() is over 200 chars go to a ~-prefixed FNV-1a folder, with the real name in a file inside it, and apply / each_container are taught about it. The two on-disk layouts are incompatible, so only one can be merged.
Problems here that #492 avoids:

  • container_folder_name hashes the exact name, but container lookups are case-insensitive (eq_ignore_ascii_case), so a long name opened in another case gets a second folder.
  • A save already stored in an enc() folder of 201-255 chars (valid today) now opens and deletes through the hashed folder, so existing data looks lost.
    This PR also conflicts with main.
    Recommendation: close (duplicate of #492).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7299854277 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/481#issuecomment-7299854277). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:34:57Z. --- **Triage (#1607)** – head f9947a0 #492 makes the same change in `hle/xgameruntime/gamesave.rs`: container names whose `enc()` is over 200 chars go to a `~`-prefixed FNV-1a folder, with the real name in a file inside it, and `apply` / `each_container` are taught about it. The two on-disk layouts are incompatible, so only one can be merged. Problems here that #492 avoids: - `container_folder_name` hashes the exact name, but container lookups are case-insensitive (`eq_ignore_ascii_case`), so a long name opened in another case gets a second folder. - A save already stored in an `enc()` folder of 201-255 chars (valid today) now opens and deletes through the hashed folder, so existing data looks lost. This PR also conflicts with main. Recommendation: close (duplicate of #492). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/481:upstream-pr/481'
git switch 'upstream-pr/481'

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