Repository navigation
XGameSave: a container name too long for a folder gets a hashed one - #493
Closed
pablogonz12 wants to merge 1 commit into
Closed
pablogonz12 wants to merge 1 commit into
pablogonz12 wants to merge 1 commit into
Conversation
A container's folder is enc(name), and a valid name has up to 256 characters that enc turns into up to three each: past 255 the folder cannot be created, so XGameSaveCreateContainer said S_OK and every XGameSaveSubmitUpdate to it failed with E_FAIL (ivall#326). Such a name now gets the start of enc(name), '~' and a 64-bit FNV-1a hash of the lowercase name as its folder (enc never writes '~'), and the exact name in the folder's 'name' file, which listing reads. Names whose folder fits keep the folder they always had.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A container's folder is
enc(name). A valid name has up to 256 characters, andencturns each escaped byte into three, so past 255 characters the folder cannot be created:XGameSaveCreateContainerreturnsS_OKand everyXGameSaveSubmitUpdateto that container fails withE_FAIL. Fixes #326.What is in it
crates/xcl/src/hle/xgameruntime/gamesave.rs:container_folder(name):enc(name)when it fits in 255 characters (so every folder that works today keeps its name); otherwise the start ofenc(name)(never cut inside a%XX),~and a 64-bit FNV-1a hash of the lowercase name.encnever writes~, so the two kinds never meet; the hash is of the lowercase name because container names match ignoring case, as theenc(name)folders do on NTFS.apply()writes the exact name to the folder'snamefile when the folder is a hashed one;each_containerreads it back throughcontainer_name(dir).XGameSaveCreateContainer,XGameSaveDeleteContainer(Async)usecontainer_folder.long_container_names_are_saved_listed_and_deleted: the two names from the issue (256 letters;"a/" × 85 + "x", 341 characters encoded) are written, read back, found byXGameSaveGetContainerInfoin upper case, listed byXGameSaveEnumerateContainerInfowith their exact names, and deleted; a 255-character name keeps its plain folder.Tested
cargo test -p xcl --lib --release --target x86_64-pc-windows-gnu(llvm-mingw 20261117), test binary run under Wine with--test-threads=4:820ff6a): 632 passed, 5 failed, 21 ignored;main(a6f5f7a): 631 passed, 5 failed, 21 ignored – the same five fail on both (gpu_f64_roots,gpu_f64_math_random,gpu_nonfused_mad_and_mac_prevent_fma_contraction,xma2_source_voice_decodes_and_manages_lifetime, andpe::tests::parses_own_test_binary_tls, which TLS: xcl.exe built with MinGW and lld keeps its TLS directory #464 fixes for this toolchain).cargo test ... gamesave: 11 passed. The new test onmain'sgamesave.rs(without its twocontainer_folderasserts): FAILED at the firstXGameSaveSubmitUpdate, as the issue describes.Regression run
Made with
scripts/linux/smoke.shfrom #257 under Wine (notsmoke.ps1), MSVC builds (cargo xwin) of both commits. Themainblock was made with a local copy of the script with two lines changed so that a run which does not reach its end still prints its block (set -euinstead ofset -euo pipefail; thedata:fallback as anif).Not tested
x86_64-pc-windows-gnuunder Wine on Linux (the Linux file system has the same 255-byte limit on a name).AI use