Skip to content

decomp-assets 0.7.0: textures and sprites in a table of relocatable files, VPK0 unpacked - #6

Merged
RetroGameDeveloper merged 1 commit into
mainfrom
feat/reloc-file-textures
Nov 14, 2026
Merged

RetroGameDeveloper merged 1 commit into
mainfrom
feat/reloc-file-textures

Conversation

@RetroGameDeveloper

Copy link
Copy Markdown
Contributor

What

  • n64/vpk0.py: VPK0 unpacking, ported from the game's own decoder (both sample methods).
  • n64/reloc_files.py: a table of relocatable files (12-byte entries: data offset with a VPK0 flag, internal-chain start, packed words, external-chain start, unpacked words).
    • Following each file's internal and external pointer chains (external file ids follow the packed data) names each texture's file and offset exactly. Only images a chain points at are taken.
    • libultra Sprite/Bitmap structs are found by their bitmap pointer (+0x34) and buffer pointers (+8). Strips are stacked into one image, and their odd rows are swapped back from TMEM order: measured on the game, nearly every sprite, every format, is stored that way.
  • display_lists._textures: tiles are now resolved at draw time (the ones sized since the last draw, plus the tile G_TEXTURE or a texture rectangle uses), from what TMEM holds then. Block loads with dxt 0 are flagged swapped. New test for a tile sized before its texels load.

Results (read-only, the user's own ROMs)

  • A fighting game (both releases): 1,422 textures in 140 files. Contact sheets checked by eye: fighters' faces, icons, menu text, logos.
  • Display-list textures in the other games, compared with v0.6.0: 8 identical; one gains 6, one gains 8.
  • No file table found in the other 50 N64 ROMs.

Tests

tests/test_reloc_files.py (homemade table: chains, external chain, VPK0 file, swapped sprite, rejections) and the walker test. 162 pass, ruff clean.

🤖 Generated with Claude Code

…iles, VPK0 unpacked

A fighting game keeps its assets in a table of relocatable files, many packed
with VPK0 (ported from the game's own decoder). Following each file's internal
and external pointer chains names every display-list texture's file and offset
exactly, and finds libultra sprites by their bitmap pointers: 1,422 textures,
sprites stacked from their strips with their TMEM-swapped rows put back.

The display-list walker now reads a tile when it is drawn, from what TMEM holds
then (that game sizes a tile before loading its texels), and records block
loads with no row step. Other games' results are unchanged, two gain a few.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RetroGameDeveloper
RetroGameDeveloper merged commit ecb3a3d into main Nov 14, 2026
1 check passed
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.

1 participant