textures: report all descriptor matches for a texture key #298

Manually merged
github merged 2 commits from gh-pr/298/head into gh-pr/298/base 2026-11-26 21:41:10 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:14 UTC · original
Vonsek:codex/texture-key-matches → main · +132 −15 · 4 files · 2 commits · merged 2026-11-21 21:55 UTC

Change

Add --lookup-key KEY to tools/texture_descriptors.py. It returns each matching input path and zero-based descriptor index for an unsigned 64-bit key. Two descriptors can share a key across archives. Callers can inspect both candidates or distinguish an absent key from a unique match. Passing the same file twice, including by hard link, produces an error. Inventory and page mapping continue to accept one archive. Experiment and command · README experiment.

Verification

Windows x64, Python 3.12.10, commit 661a539c100bf4d22ed3b0067f377b5064ce319d on upstream b53bfb0b6489398aba7a81f3761e2d56aaa00ccf.

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

Before implementation the new CLI control exited 2 with unrecognized arguments: --lookup-key and the focused CTest failed. The change passed all 17 direct Python tests and that CTest. Two source-built same-basename archives give three exact matches in a specified input order, including two ordinals in one store. Changing either half of the test key selects the expected separate record. The maximum uint64 key also resolves, and the absent key returns an empty list.

Evidence and follow-up

The MIT-licensed fixtures build all bytes from Python source. The profile accepts ETPF version 0x27a and derives the key array from the descriptor count. A guarded input with 65,536 records permits reads only in the headers and key array and only up to 4 KiB per call. Oversized descriptor counts, unsupported versions and a key table past the first range are rejected. The output identifies candidate descriptors and leaves the choice between them to the caller. The reader shares header validation with #266 and operates independently of the raw-page mapping change in #290. Parallel key table.

AI-assisted contribution.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the commands and results for the public fixture checks.
  • I included negative controls for collisions, input aliases, unsupported profiles and bounds.
  • I updated the README experiment row and its linked commands.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠Vonsek** on GitHub · 2026-11-21 21:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298) `Vonsek:codex/texture-key-matches` → `main` · +132 −15 · 4 files · 2 commits · merged 2026-11-21 21:55 UTC ## Change Add `--lookup-key KEY` to `tools/texture_descriptors.py`. It returns each matching input path and zero-based descriptor index for an unsigned 64-bit key. Two descriptors can share a key across archives. Callers can inspect both candidates or distinguish an absent key from a unique match. Passing the same file twice, including by hard link, produces an error. Inventory and page mapping continue to accept one archive. [Experiment and command](https://github.com/Vonsek/Xbox2Windows/blob/661a539c100bf4d22ed3b0067f377b5064ce319d/docs/experiments.md#reading-logical-ranges-and-probing-structured-resources) · [README experiment](https://github.com/Vonsek/Xbox2Windows/blob/661a539c100bf4d22ed3b0067f377b5064ce319d/README.md#choose-an-experiment). ## Verification Windows x64, Python 3.12.10, commit `661a539c100bf4d22ed3b0067f377b5064ce319d` on upstream `b53bfb0b6489398aba7a81f3761e2d56aaa00ccf`. ```powershell python -m venv out/pe-env .\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt . ./tools/dev.ps1 $keyPython = (Resolve-Path out/pe-env/Scripts/python.exe).Path cmake --fresh --preset dev "-DINTAKE_PYTHON=$keyPython" & $keyPython -B tests/resource_ranges_check.py -v ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V ``` Before implementation the new CLI control exited 2 with `unrecognized arguments: --lookup-key` and the focused CTest failed. The change passed all 17 direct Python tests and that CTest. Two source-built same-basename archives give three exact matches in a specified input order, including two ordinals in one store. Changing either half of the test key selects the expected separate record. The maximum uint64 key also resolves, and the absent key returns an empty list. ## Evidence and follow-up The MIT-licensed fixtures build all bytes from Python source. The profile accepts ETPF version 0x27a and derives the key array from the descriptor count. A guarded input with 65,536 records permits reads only in the headers and key array and only up to 4 KiB per call. Oversized descriptor counts, unsupported versions and a key table past the first range are rejected. The output identifies candidate descriptors and leaves the choice between them to the caller. The reader shares header validation with [#266](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/266) and operates independently of the raw-page mapping change in [#290](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/290). [Parallel key table](https://github.com/holdmysocks/SixNG/blob/2f672555819f96993adeed3273653ad53eeb1d81/crates/sixng-core/src/ttpf.rs#L112-L123). AI-assisted contribution. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the commands and results for the public fixture checks. - [x] I included negative controls for collisions, input aliases, unsupported profiles and bounds. - [x] I updated the README experiment row and its linked commands. - [x] I did not include game files, dumps, distribution links or secrets.
A 64-bit texture key can identify multiple descriptors. Preserve every store and ordinal so the caller can distinguish a unique reference from an ambiguous one.
Keep the documentation for shader digest selection alongside the texture key command and integrate padded raw page mapping.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:41:07 +00:00
github manually merged commit 661a539c10 into gh-pr/298/base 2026-11-26 21:41:10 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:14 UTC · original · edited 2026-11-21 21:35 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-21T21:35:02.394470Z 661a539 Manual request
ℹ️ 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 21:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069332053) · edited 2026-11-21 21:35 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"661a539c100bf4d22ed3b0067f377b5064ce319d","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-21T21:35:02.394470Z">2026-11-21T21:35:02.394470Z</relative-time> | `661a539` | Manual request | <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>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 21:28 UTC · original

At 99193fd, the merge conflicts are in README.md. Please keep both the landed raw-padding capability and the new multi-match lookup documented.

**@⁠R0Y00** on GitHub · 2026-11-21 21:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069500322) At `99193fd`, the merge conflicts are in `README.md`. Please keep both the landed raw-padding capability and the new multi-match lookup documented.
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:30 UTC · original

Merged upstream in 661a539c100bf4d22ed3b0067f377b5064ce319d. The README keeps the upstream shader selection instructions and links the texture experiment. That section documents the padded raw-page map from #290 and the multi-store texture-key lookup together. Both commands

All 17 tests passed with python -B tests/resource_ranges_check.py -v and with ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V after a fresh configure. Those tests cover declared zero padding and exact key matches across same-named archives in different directories.

**@⁠Vonsek** on GitHub · 2026-11-21 21:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069527739) Merged upstream in `661a539c100bf4d22ed3b0067f377b5064ce319d`. The README keeps the upstream shader selection instructions and links the texture experiment. That section documents the padded raw-page map from #290 and the multi-store texture-key lookup together. [Both commands](https://github.com/Vonsek/Xbox2Windows/blob/661a539c100bf4d22ed3b0067f377b5064ce319d/docs/experiments.md#L1292-L1296) All 17 tests passed with `python -B tests/resource_ranges_check.py -v` and with `ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V` after a fresh configure. Those tests cover declared zero padding and exact key matches across same-named archives in different directories.
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 21:31 UTC · original

@⁠codex review the merged head 661a539c10.

**@⁠Vonsek** on GitHub · 2026-11-21 21:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069539739) @⁠codex review the merged head 661a539c100bf4d22ed3b0067f377b5064ce319d.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 21:35 UTC · original

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 661a539c10

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 21:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069575702) <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Keep them coming! **Reviewed commit:** `661a539c10` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.