XGameRuntime: store over-long XGameSave container names in hashed folders #492
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!492
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-492"
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?
@DavidM1911 on GitHub · 2026-11-24 01:01 UTC · original
DavidM1911:gamesave-long-names→main· +143 −8 · 1 files · 2 commits · openFixes #326.
enc()expands every non-unreserved byte to%XX, so a GDK-legal container name (up to 256 chars,/allowed) can produce a folder name far past the 255-char path-component limit —create_dir_allthen fails inapply()and everyXGameSaveSubmitUpdateto that container returnsE_FAIL.What is in it
container_dir_name():enc(name)while it fits (<= 200chars — longer encodings cannot fit a Windows path component once the provider root is counted anyway), otherwise~xcllong.<sip-hash>;~is percent-encoded byenc(), so no plain folder can collide with the prefix.apply()writes the real container name to anamefile inside hashed folders (atomic write, every update — self-healing if a previous update died mid-commit).each_containerresolves~xcllong.*folders through that file, so enumeration,GetContainerInfoexact lookup,EnumerateContainerInfoByNameandDeleteContainerall keep working by the real name.XGameSaveCreateContainer/delete_pathuse the same mapping;Updatecarries the container name forapply.Names that fit keep their
enc()folder, so existing saves are untouched.Tested
x86_64-pc-windows-msvc:cargo test -p xcl --lib gamesave: 11 passed, 0 failed (newlong_container_names_round_trip_through_a_hashed_foldercovers a 256-char name and an"a/"-heavy name through create → submit → enumerate → exact lookup → delete)cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7a(upstream/main is now2997c9a, a docs-only commit on top):this PR's head
560368c:Not tested
enc()name of 200–255 chars would now get a hashed folder on its next update — judged unreachable in practice since the full path already exceeded MAX_PATH thereAI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@SM-dev123 on GitHub · 2026-11-24 01:09 UTC · original
Human here :
Thank you for wanting to contribute but please read CONTRIBUTING.md, it explicitly states that contributions must be provided by a Frontier Model,
Devin SWE 2 Flash (on Medium Thinking) is not a frontier model and can introduce alot of slop into the project
@MesshM on GitHub · 2026-11-24 05:28 UTC · original
Test run of
560368c4c9bd03de8ae504df4b82785636ad6decon AMD RDNA4. I merged it onto currentmaine50836blocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 705 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 664 passed, 0 failed, 21 ignoredSKIPPED;long_container_names_round_trip_through_a_hashed_folderpasses.Review: Duplicate of #481 (open), which also stores over-long container names in hashed folders for #326. Only one should land, and its folder naming must then stay fixed, or existing saves would no longer be found.
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 ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@DavidM1911 on GitHub · 2026-11-24 08:59 UTC · original
All three points addressed in
7bf139f:container_dir_namenow uses the crate'sfnv64(same FNV-1a as #481) instead ofDefaultHasher.name.to_ascii_lowercase(), so"A"*256and"a"*256share one folder; thenamefile keeps the original case for enumeration. The new test creates+submits with the upper-case name, looks up and deletes with the lower-case one, and asserts enumeration is empty afterwards.container_dir_namereturns theenc()folder wheneverroot.join(enc(name)).is_dir(), so a 201–255-charenc()folder written before this change keeps being used (the test builds exactly that layout by hand:enc()= 201 chars, plain folder, nonamefile).cargo test -p xcl --lib gamesave: 11 passed, 0 failed.@DavidM1911 on GitHub · 2026-11-24 08:59 UTC · original
Fresh regression smoke on the new head
7bf139f(review fixes: FNV-1a hash, case-insensitive folder, existingenc()folders kept). RTX 3060 Ti, GTA VI 1.0.2.1, 60 s:cargo test --workspace -- --test-threads=4: 677 passed, 0 failed, 41 ignored.@upipibi on GitHub · 2026-11-24 14:07 UTC · original
This and #481 (opened 5 minutes earlier) both fix #326. They are not interchangeable, because each writes its own on-disk layout for a long container, and the one that lands fixes the layout of players' saves:
~xclc.+ FNV-1a 64 of the name~xcllong.+fnv64of the name lowercasedcontainer_namefile, read back for every folder (falls back to decoding the folder name)namefile written when an update is submitted; enumeration reads it only for~xcllong.folders and skips one without itroot.join(&e).is_dir())The lowercasing makes two names that differ only in case share one folder. That matches how the short encoded names behave on a case-insensitive NTFS volume, which #481 does not do for long names. Read from the diffs only; I have not run either.
AI-assisted (Claude Code).
@Snorps37 on GitHub · 2026-11-24 01:17 UTC · original · reviewed
Three problems with the folder mapping, found by reading the diff against
main(2997c9a). I have not run the tests: I'm on Linux, and XCL builds on Windows only.1.
DefaultHasheris not stable across Rust releases.container_dir_namenames the folder withDefaultHasher::new(). The std docs say its algorithm "should not be relied upon over releases", and the repo does not pin a toolchain. The folder name is stored on disk. After a Rust update,XGameSaveCreateContainerandXGameSaveDeleteContainerwould point a long-named container at a new, empty folder. Enumeration would still list the old one through itsnamefile. The next update would then create a second container with the same name. A fixed hash avoids this, for example FNV-1a, which #481 uses.2. Hashed names are case-sensitive; every other name is case-insensitive. Lookups use
eq_ignore_ascii_case.enc()keeps letter case, so on NTFSSlot1andslot1share one folder. The hash is taken over the exact bytes, so"A".repeat(256)and"a".repeat(256)get two folders:XGameSaveDeleteContainerwith the other case removes a folder that does not exist and returnsS_OK. The container is still listed.XGameSaveCreateContainerplus a submit with the other case makes a second container.XGameSaveGetContainerInfothen reports two matches for one name.Hashing
name.to_ascii_lowercase()keeps it consistent; thenamefile can keep the original case.3. Existing saves with a 201–255 character folder name move. On
main, a name whoseenc()is 201–255 characters long saves fine. With this PR the same name maps to~xcllong.<hash>, so opening it by name finds an empty container, while enumeration still lists the old folder. The same was raised on #481. Checking for theenc()folder first and using it when it exists would keep those saves, without any migration.A test that covers both fixes: create and submit with one case, then delete with the other case, and check that enumeration is empty. Plus a container whose
enc()folder is 201–255 characters long, created with the old layout.AI use: Claude Code (Claude Opus 5.5) helped read the diff and draft this. I checked each point against the code myself.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.