Skip to content

Read short ARC directories and control-first MT Framework shaders - #967

Open
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/mt-framework-shader-layouts
Open

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/mt-framework-shader-layouts

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Refs #960 (the shader extraction part). PikaMan80’s report and attached patch identify two differences in Ultra Street Fighter II: ARC v7 has 64-byte member paths, and its SPK shader controls precede their code. The splitter expected the 128-byte paths and code-first shaders used by The Great Ace Attorney Chronicles. On a synthetic short archive, main read past the directory; on a wide archive with a control-first package, it rejected the first shader.

The reader checks member offsets and lengths before selecting a directory width. Padding after the last member and empty files do not determine the width. In an SPK it uses the first control’s declared code length and the graphics header to establish the order, then checks contiguous pairs through EOF. It does not switch orders halfway through a damaged package: doing that could associate a vertex shader’s control with the next pixel shader’s code. Both existing formats are inferred from the bytes, without a profile setting.

Revision 2ae9ca3fef489d17e93ab7259c921650f2bc2f03 includes main 65501fbbaf8526f7aab0a1edd028135888590f8e. Main’s MT Framework extractor still assumes wide ARC member paths and code-first shader packages.

Validation on 2ae9ca3fef48. DM_GAME=010015100B514000 python3 -m unittest dm.tools.tests.test_docs dm.gfx.tests.test_mt_framework dm.tools.tests.test_split_unreadable — 22 tests passed.

GitHub checks for this revision

Author validation before this rebase

  • Tested with synthetic stored and zlib members, both path widths crossed with both section orders, exact vertex/pixel bytes, empty members, padding, invalid member offsets, and truncated/gapped/trailing shader sections. The known wide, code-first control passed on main. Three valid combinations failed before the change and pass now. A directed check of 12,000 byte mutations of the ARC and SPK fixtures produced only parsed output or explicit parser rejections.
  • Python suites: 197 graphics tests (18 skipped), 902 tool tests (16 skipped), 42 iOS packaging tests. Pinned ruff/pyright: 391 existing findings, zero new or stale. The general shader-split fuzz harness ran 381,249 cases over 45 seconds; it doesn't target ARC/SPK, which the directed check exercises. The native Metal suite (make -C dm/gfx/tests GAME=010036E00FB20000 run) also passed, with six optional external reflection samples missing. The documentation now distinguishes the layouts.
  • Regression scope: the splitter’s broad impact rule names Breath of the Wild, Pokémon Scarlet and Tears of the Kingdom, without establishing ARC/SPK use. The Great Ace Attorney Chronicles is the existing profiled consumer of these readers; USF II has no repository profile. scripts/regress.py check --games 010036E00FB20000 exited 2 because no regression root or game directories are configured. Neither game's archives or gameplay were tested. This change does not modify the shader translator or its chain version.

PR #966 handles the separate movie-buffer ABI. This PR does not address the rewriter, audio renderer, or full game bring-up.

@thehobbit85
thehobbit85 force-pushed the codex/mt-framework-shader-layouts branch from 9025b4b to b4b9f57 Compare November 2, 2026 15:48
PikaMan80 documented the two layouts in seedds#960. Match member bounds and graphics headers in the package rather than a game ID, retaining the existing code-first shader pairs.
@thehobbit85
thehobbit85 force-pushed the codex/mt-framework-shader-layouts branch from b4b9f57 to 2ae9ca3 Compare November 2, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants