decomp(ezitext): recover PUD byte contracts and packed header decoding #1023

Merged
coah80 merged 1 commits from agent/bittle/pud-header-reconstruction into main 2026-10-03 02:26:07 +00:00
coah80 commented 2026-10-03 02:25:02 +00:00 (Migrated from github.com)

Source reconstruction

Reconcile the PUD producer/wrapper/dispatcher byte-return chain with existing callers, then recover halfword promotions and grouped big-endian count/offset decoding from the packed section header. No caller or shared header changes.

Independent parent verification

  • ZHS: 98.32204% → 99.717514%, 349 → 353 instructions against 354
  • Unit: 98.88764% → 99.81274%; all six exact functions, 720 exact code bytes and 48 matched data bytes preserved
  • Every remaining instruction agrees with original after accounting only for one missing target workspace store and its four-byte branch displacement. This is explicitly not an exact match
  • The missing store has no proven source-visible use; no dummy local, volatile or forced spill added
  • All 65,536 packed count values and 524,288 wrapping offset/base combinations verified independently
  • Parent compared all 1027 objects and reports: no regressions; only owned .text and existing extabindex extent change. extabindex remains 72 bytes and its producer extent changes 0x574 → 0x584, target 0x588; relocation identities preserved
  • Six exact function streams independently compared with original; empty pool identical
  • Full 43U all_source/report/progress/DOL and worktree checks pass

The byte-return-only checkpoint is completely object-neutral. Producer values are already limited to zero, one or the explicitly byte-narrowed count. Evidence and isolated trials are documented in separate concise logs.

No linking, configuration, metadata, table padding, new storage, assembly or compiler-setting changes. No whole-engine/Wii runtime equivalence claim.

Base: 5e0816c3f1
Tested tree: bf7823f374
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

No merge performed or requested by this author.

Note

Fix PUD byte contracts in Zi8MatchPUDdata and packed header decoding

  • Changes the return type of Zi8MatchPUDdata_ZHS, its wrapper, and the Zi8_8147FD7C forwarding wrapper from ziU32 to ziU8 in zi8pud2.c, matching the original byte-return contract
  • Adds explicit ziU16 promotions when decoding the packed big-endian section count and offset, and groups the decoded offset before adding the table base
  • Adds engineering reports in allhands-ezitext-pud-byte-contract.attempts.md and allhands-ezitext-pud-packed-header.attempts.md documenting the recovered contracts, decoding approach, and validation results
  • Validation shows unchanged compiled output, disassembly, callers, data sections, and build artifacts; the packed-header report notes one unresolved dead store

Macroscope summarized 94b1c4d.

## Source reconstruction Reconcile the PUD producer/wrapper/dispatcher byte-return chain with existing callers, then recover halfword promotions and grouped big-endian count/offset decoding from the packed section header. No caller or shared header changes. ## Independent parent verification - ZHS: 98.32204% → 99.717514%, 349 → 353 instructions against 354 - Unit: 98.88764% → 99.81274%; all six exact functions, 720 exact code bytes and 48 matched data bytes preserved - Every remaining instruction agrees with original after accounting only for one missing target workspace store and its four-byte branch displacement. This is explicitly not an exact match - The missing store has no proven source-visible use; no dummy local, volatile or forced spill added - All 65,536 packed count values and 524,288 wrapping offset/base combinations verified independently - Parent compared all 1027 objects and reports: no regressions; only owned .text and existing extabindex extent change. extabindex remains 72 bytes and its producer extent changes 0x574 → 0x584, target 0x588; relocation identities preserved - Six exact function streams independently compared with original; empty pool identical - Full 43U all_source/report/progress/DOL and worktree checks pass The byte-return-only checkpoint is completely object-neutral. Producer values are already limited to zero, one or the explicitly byte-narrowed count. Evidence and isolated trials are documented in separate concise logs. No linking, configuration, metadata, table padding, new storage, assembly or compiler-setting changes. No whole-engine/Wii runtime equivalence claim. Base: 5e0816c3f138027ced9240c617641ded5d4bcc78 Tested tree: bf7823f3744cacda7ba23ccc0b72bb769c15b520 DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d No merge performed or requested by this author. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Fix PUD byte contracts in `Zi8MatchPUDdata` and packed header decoding > - Changes the return type of `Zi8MatchPUDdata_ZHS`, its wrapper, and the `Zi8_8147FD7C` forwarding wrapper from `ziU32` to `ziU8` in [zi8pud2.c](https://github.com/coah80/wii-ipl/pull/1023/files#diff-a23a191f84a7a6c42f42863c6554cfcfa7835101dc59d431724673bfe6f93422), matching the original byte-return contract > - Adds explicit `ziU16` promotions when decoding the packed big-endian section count and offset, and groups the decoded offset before adding the table base > - Adds engineering reports in [allhands-ezitext-pud-byte-contract.attempts.md](https://github.com/coah80/wii-ipl/pull/1023/files#diff-88883ad370d376d8ae7a7bf12d6bfbea812ba2d04f0ae6b12a9d519c016907ae) and [allhands-ezitext-pud-packed-header.attempts.md](https://github.com/coah80/wii-ipl/pull/1023/files#diff-abcba92318da82a8fb609b79ff66dc3b11038ad41fefb301505a4dab63f48737) documenting the recovered contracts, decoding approach, and validation results > - Validation shows unchanged compiled output, disassembly, callers, data sections, and build artifacts; the packed-header report notes one unresolved dead store > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 94b1c4d.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 02:26:04 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.