pe_shader_containers: parse and validate multi-image container layouts (OLD-9775) #694

Merged
abnalstlll-byte merged 2 commits from upstream-pr/694 into main 2026-11-29 14:38:36 +00:00
abnalstlll-byte commented 2026-11-24 12:16:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:16:46Z.


Related issues: #14, #17, #18 (restoring old upstream PR 9775, author restoration for draft PR #53).

What and why

Restores original pull request OLD-9775 authored by @abnalstlll-byte:

  • Extends \ ools/pe_shader_containers.py\ to support multi-image container layout parsing and sequential stem numbering across multi-image extract passes.
  • Fixes stem collision when multiple shader container images are extracted into the same target directory.
  • Fully compatible with \ ools/pe_inspect.py\ and \make_game.py\ extraction pipelines.
  • Comprehensive unit test coverage in \ ests/test_pe_shader_containers.py\ (21/21 PASS).

Tested

  • Windows 11 x64, Python 3.14 / 3.12:
    • \python -I tests/test_pe_shader_containers.py: 21/21 PASS.
    • \python -I scripts/check_no_game_data.py\ on changed files: PASS.
  • Clean merge against \ubi/main\ (0 conflicts).

Checklist

  • No proprietary payloads, game-derived files, keys, or protection workarounds.
  • Standard library only (\python -I).
  • Preserves author attribution and original PR commit provenance.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5471972656 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/694). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:16:46Z. --- Related issues: #14, #17, #18 (restoring old upstream PR 9775, author restoration for draft PR #53). ### What and why Restores original pull request **OLD-9775** authored by @abnalstlll-byte: - Extends \ ools/pe_shader_containers.py\ to support multi-image container layout parsing and sequential stem numbering across multi-image extract passes. - Fixes stem collision when multiple shader container images are extracted into the same target directory. - Fully compatible with \ ools/pe_inspect.py\ and \make_game.py\ extraction pipelines. - Comprehensive unit test coverage in \ ests/test_pe_shader_containers.py\ (21/21 PASS). ### Tested - Windows 11 x64, Python 3.14 / 3.12: - \python -I tests/test_pe_shader_containers.py\: 21/21 PASS. - \python -I scripts/check_no_game_data.py\ on changed files: PASS. - Clean merge against \ubi/main\ (0 conflicts). ### Checklist - [x] No proprietary payloads, game-derived files, keys, or protection workarounds. - [x] Standard library only (\python -I\). - [x] Preserves author attribution and original PR commit provenance.
OreoFR commented 2026-11-28 21:43:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:43:13Z.


Verified by OreoFR

  • Base: main 5cb45921e + PR head 9a118b856
  • Test: python -I tests/test_pe_shader_containers.py
  • Red on main: 1 FAIL + 1 ERROR: the FAIL is the missing function (container_00_00 names instead of container_01 for several images); the ERROR is a missing symbol (replace_retry, an import the PR adds with write_json_report, the atomic report write, also absent from main)
  • Green with the PR: 22 OK
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246222010 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/694#issuecomment-7246222010). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:43:13Z. --- **Verified by OreoFR** - Base: main `5cb45921e` + PR head `9a118b856` - Test: `python -I tests/test_pe_shader_containers.py` - Red on main: 1 FAIL + 1 ERROR: the FAIL is the missing function (container_00_00 names instead of container_01 for several images); the ERROR is a missing symbol (replace_retry, an import the PR adds with write_json_report, the atomic report write, also absent from main) - Green with the PR: 22 OK - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 21:46:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:46:21Z.


#694 | head 9a118b856c (merged cleanly with main a8465211fb) | python -I tests/test_pe_shader_containers.py | red on main: FAILED (failures=1, errors=1) (extract reset enumerate(records) to 0 on each PE image, colliding container_00.dxbc -> container_00_00.dxbc instead of container_01.dxbc, and --json wrote directly without write_json_report staging) | green on PR+main: 22 ran, OK | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/pe_shader_containers.py and tests/test_pe_shader_containers.py on Windows 11, confirming sequential start_index=len(index) numbering across multi-image --extract runs and staged --json publishing via write_json_report + replace_retry. Minor non-blocking follow-up note for Windows NTFS parity (matching #752): write_json_report currently skips published_mode(destination) on os.name == "nt" and omits os.chmod(staged.name, 0o600) before os.unlink(staged.name) in finally:. Also verified tests/test_ci_registration.py, tests/test_text_write_line_endings.py, and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246259936 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/694#issuecomment-7246259936). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:46:21Z. --- #694 | head 9a118b856c5a6806a7e29f3172f50d2b93dfc384 (merged cleanly with main a8465211fb) | `python -I tests/test_pe_shader_containers.py` | red on main: `FAILED (failures=1, errors=1)` (`extract` reset `enumerate(records)` to `0` on each PE image, colliding `container_00.dxbc` -> `container_00_00.dxbc` instead of `container_01.dxbc`, and `--json` wrote directly without `write_json_report` staging) | green on PR+main: `22 ran, OK` | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/pe_shader_containers.py` and `tests/test_pe_shader_containers.py` on Windows 11, confirming sequential `start_index=len(index)` numbering across multi-image `--extract` runs and staged `--json` publishing via `write_json_report` + `replace_retry`. Minor non-blocking follow-up note for Windows NTFS parity (matching `#752`): `write_json_report` currently skips `published_mode(destination)` on `os.name == "nt"` and omits `os.chmod(staged.name, 0o600)` before `os.unlink(staged.name)` in `finally:`. Also verified `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`, and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-29 14:38:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:38:39Z.


Merged at head 9a118b8. Tested on this head by OreoFR, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257463351 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/694#issuecomment-7257463351). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:38:39Z. --- Merged at head 9a118b8. Tested on this head by OreoFR, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.
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
ProjectLeonida/mandy!694
No description provided.