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

Merged
Vonsek merged 2 commits from upstream-pr/298 into main 2026-11-21 21:55:54 +00:00
Vonsek commented 2026-11-21 21:14:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:14:12Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6534473660 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:14:12Z. --- ## 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://github.com/R0Y00/Xbox2Windows/pull/266) and operates independently of the raw-page mapping change in [#290](https://github.com/R0Y00/Xbox2Windows/pull/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.
upstream-sync closed this pull request 2026-11-24 06:42:18 +00:00
R0Y00 commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:36Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069500322 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069500322). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:28:36Z. --- At `99193fd`, the merge conflicts are in `README.md`. Please keep both the landed raw-padding capability and the new multi-match lookup documented.
Vonsek commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:30:55Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069527739 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069527739). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:30:55Z. --- 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.
Vonsek commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:31:58Z.


@codex review the merged head 661a539c10.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069539739 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069539739). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:31:58Z. --- @codex review the merged head 661a539c100bf4d22ed3b0067f377b5064ce319d.
chatgpt-codex-connector[bot commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T21:35:01Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069575702 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069575702). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T21:35:01Z. --- <!-- 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>
chatgpt-codex-connector[bot commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T21:14:21Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069332053 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/298#issuecomment-7069332053). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T21:14:21Z. --- <!-- 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>
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
R0Y00/Xbox2Windows!294
No description provided.