XGameSave: decode %XX from bytes without slicing the str (#325) #509

Closed
Grimkaaah wants to merge 1 commit from upstream-pr/514 into main
Grimkaaah commented 2026-11-24 01:08:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-24T01:08:04Z.


Summary

  • Decode %XX escapes from bytes with is_ascii_hexdigit, never by slicing &str indices (#325).
  • Rejects signed forms such as %+1 (left literal).
  • Unit tests for %a + é, %+1, and enc/dec round-trip.

Fixes #325

Test plan

  • cargo test -p xcl --lib hle::xgameruntime::gamesave::tests::dec_handles
<!-- greyfinch-sync:ivall/xcl:issue:6572265775 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/514). Originally posted by [Grimkaaah](https://github.com/Grimkaaah) on 2026-11-24T01:08:04Z. --- ## Summary - Decode `%XX` escapes from **bytes** with `is_ascii_hexdigit`, never by slicing `&str` indices (#325). - Rejects signed forms such as `%+1` (left literal). - Unit tests for `%a` + `é`, `%+1`, and `enc`/`dec` round-trip. Fixes #325 ## Test plan - [x] `cargo test -p xcl --lib hle::xgameruntime::gamesave::tests::dec_handles`
H0UNDZER0 commented 2026-11-24 07:05:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by H0UNDZER0 on 2026-11-24T02:40:33Z.


Tested on an RTX 5080, release build: pass, 678 passed, 0 failed. This adds the whole suite to the unit test in the description.

  • Commit 4a17a0ae898fd58ec06a2fe0179af690e032cfdc, this PR's head as is (on its base 7ebf1b8), 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): 678 passed, 0 failed, 41 ignored both times. The base 7ebf1b8 gives 677 / 0 / 41 here: the difference is the new dec_handles_percent_before_non_ascii_and_rejects_signed_hex, which passes.
  • 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

  • This PR merged onto a newer main. At the time of the run that was 9ce2070; 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:7120374230 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/514#issuecomment-7120374230). Originally posted by [H0UNDZER0](https://github.com/H0UNDZER0) on 2026-11-24T02:40:33Z. --- **Tested** on an RTX 5080, release build: **pass**, 678 passed, 0 failed. This adds the whole suite to the unit test in the description. - Commit `4a17a0ae898fd58ec06a2fe0179af690e032cfdc`, this PR's head as is (on its base `7ebf1b8`), 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`): **678 passed, 0 failed, 41 ignored** both times. The base `7ebf1b8` gives 677 / 0 / 41 here: the difference is the new `dec_handles_percent_before_non_ascii_and_rejects_signed_hex`, which passes. - `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** - This PR merged onto a newer `main`. At the time of the run that was `9ce2070`; `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:05Z.


Test run of 4a17a0ae898fd58ec06a2fe0179af690e032cfdc 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: 705 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 664 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the gamesave decoding tests pass.

Review: Duplicate of #448 (open), and #325 has had other PRs too: all decode %XX from bytes instead of slicing the &str. Only one should land.

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:7122912056 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/514#issuecomment-7122912056). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T05:24:05Z. --- Test run of `4a17a0ae898fd58ec06a2fe0179af690e032cfdc` 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: **705 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 664 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; the `gamesave` decoding tests pass. **Review:** **Duplicate of #448** (open), and #325 has had other PRs too: all decode `%XX` from bytes instead of slicing the `&str`. Only one should land. **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.
upstream-sync closed this pull request 2026-11-24 11:04:49 +00:00
raylitebull commented 2026-11-24 11:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:44:01Z.


Closing as a duplicate of #442 / #448 for #325, which pass the PR description check (whereas this PR fails PR description).

<!-- greyfinch-sync:ivall/xcl:comment:7129171236 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/514#issuecomment-7129171236). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:44:01Z. --- Closing as a duplicate of #442 / #448 for #325, which pass the `PR description` check (whereas this PR fails `PR description`).

Pull request closed

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!509
No description provided.