[PR #583] [CLOSED] fspx_unpack: test and document the 24-byte prologue (FSPX-SHORT-PROLOGUE) #626

Closed
opened 2026-11-26 20:18:30 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/583
Author: @Tyrannys
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: fix/fspx-short-prologue


📝 Commits (1)

  • 3af97a1 fspx_unpack: test and document the 24-byte prologue main already takes (FSPX-SHORT-PROLOGUE)

📊 Changes

2 files changed (+22 additions, -0 deletions)

View changed files

📝 docs/fspx.md (+8 -0)
📝 tests/test_fspx_unpack.py (+14 -0)

📄 Description

Claimed in the coordination issue as: FSPX-SHORT-PROLOGUE (claimed in #14)

Item: FSPX-SHORT-PROLOGUE (claimed in #14).

tools/fspx_unpack.py code_range only knew the 36-byte prologue (VOP3 opcode 0x180, bits 31..16 = 0xD580, at words 0, 3 and 6). Some programs of the pipeline library in shaders.rpf carry only words 0 and 3: a 24-byte prologue, with the code starting at word 6 (s_inst_prefetch in all of them). Read from word 0 they never decode.

Counted over the whole 1.0.2.1 library (2,684 programs): 50 have the 24-byte form; before this change 1 of the 50 translated. With it, all 50 disassemble with 0 invalid words, and 49 translate and pass spirv-val (the last stops at s_sethalt). A program whose words 0, 3 and 6 are all prologue words still takes the 36-byte form. shader_library.py writes "prologue": start > 0 for both forms. The runtime needs no change: the game passes these programs as FSPX payloads, which it reads by directory.

Found while booting the retail executable: four of the slot-67 compute pipelines the title creates were these programs.

Changes:

  • tools/fspx_unpack.py: SHORT_PROLOGUE_WORDS / SHORT_PROLOGUE_SIZE, code_range falls back to them.
  • tools/shader_library.py: the prologue flag covers both sizes.
  • tests/test_fspx_unpack.py: test_short_prologue (synthetic words, no game data).
  • docs/fspx.md: the 24-byte variant and the counts.

Tested (Windows 11, Python 3.12): python -I tests/test_fspx_unpack.py, tests/test_shader_library.py, tests/test_fspx_unpack_out.py, tests/test_fspx_shaders_stage.py, tests/test_text_write_line_endings.py, all OK. The corpus counts come from a local work folder on an RTX 4070 SUPER box; no GPU test involved.

AI-assisted (Claude Code).

GPUs tested: n/a (CPU-only Python tests)

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/583 **Author:** [@Tyrannys](https://github.com/Tyrannys) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/fspx-short-prologue` --- ### 📝 Commits (1) - [`3af97a1`](https://github.com/ubiquitarianism/leonida/commit/3af97a1ec325bf917ac2d1515a55f8b3503e7793) fspx_unpack: test and document the 24-byte prologue main already takes (FSPX-SHORT-PROLOGUE) ### 📊 Changes **2 files changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/fspx.md` (+8 -0) 📝 `tests/test_fspx_unpack.py` (+14 -0) </details> ### 📄 Description Claimed in the coordination issue as: FSPX-SHORT-PROLOGUE (claimed in #14) Item: FSPX-SHORT-PROLOGUE (claimed in #14). `tools/fspx_unpack.py` `code_range` only knew the 36-byte prologue (VOP3 opcode 0x180, bits 31..16 = `0xD580`, at words 0, 3 and 6). Some programs of the pipeline library in `shaders.rpf` carry only words 0 and 3: a 24-byte prologue, with the code starting at word 6 (`s_inst_prefetch` in all of them). Read from word 0 they never decode. Counted over the whole 1.0.2.1 library (2,684 programs): 50 have the 24-byte form; before this change 1 of the 50 translated. With it, all 50 disassemble with 0 invalid words, and 49 translate and pass `spirv-val` (the last stops at `s_sethalt`). A program whose words 0, 3 and 6 are all prologue words still takes the 36-byte form. `shader_library.py` writes `"prologue": start > 0` for both forms. The runtime needs no change: the game passes these programs as FSPX payloads, which it reads by directory. Found while booting the retail executable: four of the slot-67 compute pipelines the title creates were these programs. Changes: - `tools/fspx_unpack.py`: `SHORT_PROLOGUE_WORDS` / `SHORT_PROLOGUE_SIZE`, `code_range` falls back to them. - `tools/shader_library.py`: the `prologue` flag covers both sizes. - `tests/test_fspx_unpack.py`: `test_short_prologue` (synthetic words, no game data). - `docs/fspx.md`: the 24-byte variant and the counts. Tested (Windows 11, Python 3.12): `python -I tests/test_fspx_unpack.py`, `tests/test_shader_library.py`, `tests/test_fspx_unpack_out.py`, `tests/test_fspx_shaders_stage.py`, `tests/test_text_write_line_endings.py`, all OK. The corpus counts come from a local work folder on an RTX 4070 SUPER box; no GPU test involved. AI-assisted (Claude Code). GPUs tested: n/a (CPU-only Python tests) AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:30 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#626
No description provided.