Skip to content

Add opt-in XNB compression for round-trip packing - #40

Open
zrckr wants to merge 4 commits into
FEZModding:mainfrom
zrckr:xnb-compress
Open

zrckr wants to merge 4 commits into
FEZModding:mainfrom
zrckr:xnb-compress

Conversation

@zrckr

@zrckr zrckr commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

This PR:

  • Adds XnbCompress library for compression and decompression, replacing the bundled LZX decoder.
  • Adds --compress flag for --pack and --convert-to-xnb actions. Generated XNBs are compressed only when the complete file is at least 5% smaller. Sound assets remain uncompressed.
  • Preserves all texture mipmap levels during XNB-to-XNB serialization, but not PNG serialization. We need to figure out the best way to extract and store these mipmaps.

List of files that were not compressed in original PAK files:

background planes/dent_square
background planes/sewer/drips_small
other textures/end_cutscene/purple_gradient
other textures/glow/code_machine_glowbit
other textures/glow/code_machine_glowbit_anti
other textures/glow/small_glowbit
other textures/glow/small_glowbit_anti
other textures/horizontalgradient
other textures/reboot/hat
other textures/verticalgradient
other textures/waterhorizgradient
skies/above/cloudtinting
skies/black/black
skies/cave/caveback
skies/cmy/cmy_back
skies/crypt/crypt
skies/grave/grave
skies/indust_cave/indust_cave_back
skies/lava/lava_back
skies/lib_int_sky/black
skies/mine/caveback
skies/obs_sky/black
skies/orr_sky/black
skies/roots/caveback
skies/sewer/sewer
skies/waterfront/cloudtinting
skies/waterwheel/caveback
sounds/**/*

Closes #20, maybe #36

zrckr added 4 commits October 3, 2026 23:27
BREAKING CHANGE: The repacker project now targets .NET Standard 2.1
Read and write pixel data for every declared mipmap level while
keeping TextureData as the first level for image converters.

Some FEZ textures contain additional levels. Dropping them left
XNB payloads incomplete while still declaring the full count.

NOTE: XNB-to-XNB serialization now preserves all levels.
PNG conversion still exports only the first level and creates
single-level XNBs.
Replace the bundled LZX decoder with XMemDecompressor so compression
and decompression use the same dependency.
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.

Lack of compression in repacking process

1 participant