[PR #1361] shader_carve: exclude the length byte from shader names (SHADER-CARVE-NAME-LENGTH) #1392

Open
opened 2026-11-26 20:21:06 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1361
Author: @x2Tweek
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix-carve-name


📝 Commits (1)

  • 4adb409 Exclude the length byte from carved shader names

📊 Changes

4 files changed (+80 additions, -14 deletions)

View changed files

📝 make_game.py (+14 -2)
📝 tests/test_shader_carve.py (+22 -0)
📝 tests/test_shader_stage_resume.py (+33 -10)
📝 tools/shader_carve.py (+11 -2)

📄 Description

Claimed in the coordination issue as: SHADER-CARVE-NAME-LENGTH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146324024)

What and why

A printable name-length byte can be captured as the first letter of a shader name. Interpret the length after matching the candidate header so both the Python and optional native scanners use the same name handling. Check for a length field immediately before the match to preserve a real first character that happens to have the same value as the matched name length.

The correction changes some output filenames and translation-index keys. Existing work folders need the shaders stage again. Run python -I make_game.py --stages shaders with your usual game and work-folder options. A missing or stale carve-source digest tells that stage to recarve, unpack, disassemble and translate.

Tested

  • python -I tests/test_shader_carve.py, python -I tests/test_shader_stage_resume.py, python -I tests/test_shader_stage_manifest.py, python -I tests/test_shader_library.py, and python -I tests/test_text_write_line_endings.py.
  • Built the optional scanner with cargo build --release --offline --manifest-path tools/shader_carve_native/Cargo.toml and ran python -I tests/test_shader_carve_native.py with LEONIDA_TEST_REQUIRE_SHADER_CARVE_NATIVE=1. Also ran the new carve regression with LEONIDA_SHADER_CARVE_NATIVE=0.
  • Measured on one 1.0.2.1 translation index (counts only): 6,275 of 26,503 shader names (24%) have a first character whose code equals the name's own length, which is the stray length byte this change removes; chance alone would give about 1-2%. Those names, and the index keys built from them, change; the shaders stage must therefore run again (carve, then translation) on existing work folders.
  • 126 targeted tests passed. One shader-library symlink subtest was skipped because Windows denied symlink creation. Python compilation, make_game.py --help, the game-data check and git diff --check passed.

GPUs tested: n/a. CPU-only synthetic fixtures and mocked pipeline tools on Windows. No retail corpus run.

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.

🔄 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/1361 **Author:** [@x2Tweek](https://github.com/x2Tweek) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-carve-name` --- ### 📝 Commits (1) - [`4adb409`](https://github.com/ubiquitarianism/leonida/commit/4adb4098845de6f841f0a622dee7580e47832313) Exclude the length byte from carved shader names ### 📊 Changes **4 files changed** (+80 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+14 -2) 📝 `tests/test_shader_carve.py` (+22 -0) 📝 `tests/test_shader_stage_resume.py` (+33 -10) 📝 `tools/shader_carve.py` (+11 -2) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-CARVE-NAME-LENGTH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146324024) ### What and why A printable name-length byte can be captured as the first letter of a shader name. Interpret the length after matching the candidate header so both the Python and optional native scanners use the same name handling. Check for a length field immediately before the match to preserve a real first character that happens to have the same value as the matched name length. The correction changes some output filenames and translation-index keys. Existing work folders need the shaders stage again. Run `python -I make_game.py --stages shaders` with your usual game and work-folder options. A missing or stale carve-source digest tells that stage to recarve, unpack, disassemble and translate. ### Tested - `python -I tests/test_shader_carve.py`, `python -I tests/test_shader_stage_resume.py`, `python -I tests/test_shader_stage_manifest.py`, `python -I tests/test_shader_library.py`, and `python -I tests/test_text_write_line_endings.py`. - Built the optional scanner with `cargo build --release --offline --manifest-path tools/shader_carve_native/Cargo.toml` and ran `python -I tests/test_shader_carve_native.py` with `LEONIDA_TEST_REQUIRE_SHADER_CARVE_NATIVE=1`. Also ran the new carve regression with `LEONIDA_SHADER_CARVE_NATIVE=0`. - Measured on one 1.0.2.1 translation index (counts only): 6,275 of 26,503 shader names (24%) have a first character whose code equals the name's own length, which is the stray length byte this change removes; chance alone would give about 1-2%. Those names, and the index keys built from them, change; the shaders stage must therefore run again (carve, then translation) on existing work folders. - 126 targeted tests passed. One shader-library symlink subtest was skipped because Windows denied symlink creation. Python compilation, `make_game.py --help`, the game-data check and `git diff --check` passed. GPUs tested: n/a. CPU-only synthetic fixtures and mocked pipeline tools on Windows. No retail corpus run. AI-assisted: yes. ### Checklist - [x] Based on current main. - [x] One topic. - [x] No game data, keys or decryption. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1392
No description provided.