textures: honor declared zero padding in raw page maps #290

Manually merged
github merged 1 commit from gh-pr/290/head into gh-pr/290/base 2026-11-26 21:40:31 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 20:57 UTC · original
Vonsek:codex/texture-raw-page-padding → main · +60 −6 · 3 files · 1 commits · merged 2026-11-21 21:25 UTC

Change

Extend the raw descriptor page map to account for a declared alignment suffix in a raw interval. The 12 high bits of the interval's starting boundary give the trailing-byte count. For unequal lengths the count must equal the excess of stored length over logical length, and every byte in that suffix must be zero. Equal-size ranges retain their original metadata-only mapping. The reader then maps the logical prefix at the stored interval start. The reported offsets and 4 KiB page size are unchanged. Usage and field reference.

Verification

Windows 11 x64, Python 3.12.10, commit a809eb23ae46235c1a64f18124de7f9da19cff5f on upstream d311159b7ba56f4c75c10c1dd8c4303988c80d99.

python -m venv out/pe-env
.\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt
. ./tools/dev.ps1
$paddingPython = (Resolve-Path out/pe-env/Scripts/python.exe).Path
cmake --fresh --preset dev "-DINTAKE_PYTHON=$paddingPython"
& $paddingPython -B tests/resource_ranges_check.py -v
ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V

Before the change both the Python regression and its CTest failed with Raw mapping requires equal stored and logical range sizes. The new control puts a 1,280-byte zero suffix after a two-page raw payload, gives its next boundary a different count, and verifies that the second logical page still maps to file offset 8,704. All fifteen Python tests and the focused CTest passed.

Evidence and follow-up

The input is an original MIT-licensed Python fixture. Its guarded stream permits only metadata and the padding range to be read. It rejects a wrong neighboring count, a truncated count, a nonzero first or last suffix byte, and premature EOF during the suffix read. A short-read guard reproduces the original equal-size mapping even with nonzero high bits and permits no suffix read in that case. The suffix check reads at most 4,095 bytes and does not interpret texture pixels or subresource layout. This change shares the indexed interval lookup integrated by #280.

AI-assisted contribution.

Checklist

  • This pull request covers one reviewable behavior.
  • I included commands and results for the public fixture checks.
  • I included negative controls for size, field ownership and storage errors.
  • I updated the experiment documentation.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠Vonsek** on GitHub · 2026-11-21 20:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/290) `Vonsek:codex/texture-raw-page-padding` → `main` · +60 −6 · 3 files · 1 commits · merged 2026-11-21 21:25 UTC ## Change Extend the [raw descriptor page map](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/275) to account for a declared alignment suffix in a raw interval. The 12 high bits of the interval's starting boundary give the trailing-byte count. For unequal lengths the count must equal the excess of stored length over logical length, and every byte in that suffix must be zero. Equal-size ranges retain their original metadata-only mapping. The reader then maps the logical prefix at the stored interval start. The reported offsets and 4 KiB page size are unchanged. [Usage and field reference](https://github.com/Vonsek/Xbox2Windows/blob/a809eb23ae46235c1a64f18124de7f9da19cff5f/docs/experiments.md#reading-logical-ranges-and-probing-structured-resources). ## Verification Windows 11 x64, Python 3.12.10, commit `a809eb23ae46235c1a64f18124de7f9da19cff5f` on upstream `d311159b7ba56f4c75c10c1dd8c4303988c80d99`. ```powershell python -m venv out/pe-env .\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt . ./tools/dev.ps1 $paddingPython = (Resolve-Path out/pe-env/Scripts/python.exe).Path cmake --fresh --preset dev "-DINTAKE_PYTHON=$paddingPython" & $paddingPython -B tests/resource_ranges_check.py -v ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V ``` Before the change both the Python regression and its CTest failed with `Raw mapping requires equal stored and logical range sizes`. The new control puts a 1,280-byte zero suffix after a two-page raw payload, gives its next boundary a different count, and verifies that the second logical page still maps to file offset 8,704. All fifteen Python tests and the focused CTest passed. ## Evidence and follow-up The input is an original MIT-licensed Python fixture. Its guarded stream permits only metadata and the padding range to be read. It rejects a wrong neighboring count, a truncated count, a nonzero first or last suffix byte, and premature EOF during the suffix read. A short-read guard reproduces the original equal-size mapping even with nonzero high bits and permits no suffix read in that case. The suffix check reads at most 4,095 bytes and does not interpret texture pixels or subresource layout. This change shares the indexed interval lookup integrated by [#280](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/280). AI-assisted contribution. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included commands and results for the public fixture checks. - [x] I included negative controls for size, field ownership and storage errors. - [x] I updated the experiment documentation. - [x] I did not include game files, dumps, distribution links or secrets.
Raw intervals can extend beyond the logical bytes they store. Verify the left boundary padding count and its suffix before mapping the logical payload, so the caller can locate a page without reading the texture.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:40:29 +00:00
github manually merged commit a809eb23ae into gh-pr/290/base 2026-11-26 21:40:31 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 20:57 UTC · original · edited 2026-11-21 20:59 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T20:59:13.566058Z a809eb2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 20:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/290#issuecomment-7069136295) · edited 2026-11-21 20:59 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"a809eb23ae46235c1a64f18124de7f9da19cff5f","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T20:59:13.566058Z">2026-11-21T20:59:13.566058Z</relative-time> | `a809eb2` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.