Skip to content

tombox-xshader: read the root-signature table in the FSSM header (GTA VI) - #41

Open
fffluffy-dev wants to merge 1 commit into
mainfrom
claude/fssm-root-table
Open

fffluffy-dev wants to merge 1 commit into
mainfrom
claude/fssm-root-table

Conversation

@fffluffy-dev

Copy link
Copy Markdown
Owner

Step 1 of #40.

meta::fssm_root_table(fssm) reads the root-signature table that GTA VI keeps in the FSSM header. The format comes from upstream omonkeyz/xbox-emulator#54:

  • u8[0xD6] is the user SGPR count;
  • u32[0xF8] is the entry count;
  • u32[0xE8] == 0xDEADBEEF means there is no table;
  • u32[0xF0] points 4 bytes into the last entry;
  • each entry is 5 dwords: kind, offset, count, register, loc, with loc = rootParam << 8 | userSgpr.

It returns None for a blob that is not FSSM, for a table outside the blob, and for more than 4096 entries. fssm_user_data_base returns s8 for merged and NGG stages. xshader prints the table.

Nothing consumes the table yet. The translator keeps the memory-descriptor path for these shaders until step 3 of #40.

Tests: 4 new unit tests (cargo test -p tombox-xshader --lib fssm_root) cover entries, no table, refusals, and kinds with the user-data base. No real GTA VI shader was used: none is in the repo, and checking on the package is step 2 of #40.


Generated by Claude Code

GTA VI's shaders carry no RTS0 chunk; their root-signature layout is a table
inside the FSSM header (format from omonkeyz#54, validated there
on 26,502 GTA VI shaders):

- u8[0xD6] user SGPR count, u32[0xF8] entry count, u32[0xE8] = 0xDEADBEEF for
  no table, u32[0xF0] points 4 bytes into the last 20-byte entry;
- an entry is kind, offset in dwords, count, register, loc, where
  loc = rootParam << 8 | userSgpr;
- kinds: 0 root constants, 1 root descriptor, 3 descriptor in a table,
  4 static sampler, 5 resource heap base, 6 sampler heap base;
- merged and NGG stages start user data at s8.

meta::fssm_root_table parses it and refuses tables that fall outside the blob;
xshader prints it. Nothing consumes it yet: the translator still takes the
memory-descriptor path for these shaders (#24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014vTZArnDeG1xtBcLprpoCq
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