Skip to content

Add tools/hdpack_convert.py: texture packs made for 1.6.0 as 1.9.0 mods - #1136

Closed
Zarigis wants to merge 1 commit into
Revivedx:testfrom
Zarigis:hdpack-convert
Closed

Zarigis wants to merge 1 commit into
Revivedx:testfrom
Zarigis:hdpack-convert

Conversation

@Zarigis

@Zarigis Zarigis commented Nov 26, 2026

Copy link
Copy Markdown

Adds tools/hdpack_convert.py, which turns a texture pack made for the game's 1.6.0 update into a 1.9.0 mod for the Mods tab. It works from the player's own game files. HDPacks.com's 4K pack is the one tested.

python3 tools/hdpack_convert.py <game files folder> <pack's RomFS folder> mods/<name> [--no-terrain] [--no-fonts] [--copy]

As distributed, the pack can't be used on 1.9.0. Besides its textures, it carries 1.6.0 copies of whole packs, Pack/Bootup.pack and a 1.6.0 ResourceSizeTable. Loaded as a mod, it crashes at boot, or never finishes loading once those are removed. The tool makes a mod of only the pack's textures, on top of the player's 1.9.0 files.

The pack also needs more game memory than the game's own heap. That's #1135 (game_memory_mb), and the two PRs are independent.

What this changes

New tool, test, Makefile target (make test-hdpack-convert), and a paragraph in the FAQ under "Can I use mods?". No runtime changes.

What the tool does
  • Loose files (Model/*.Tex*.sbfres, UI/StockItem/…, Terrain/…) that 1.9.0 or its DLC also has are hard-linked, or copied across drives or with --copy. Files 1.9.0 doesn't have are left out.
  • Pack/*.pack: the player's 1.9.0 pack, with only its texture files (*.Tex*.sbfres) taken from the pack's copy. The archive's tables and each file's alignment stay as they are. DLC packs go under aoc/0010/. Pack/Bootup.pack is left out: it holds 1.6.0 game data, and Savage Wind patches its own.
  • Font/Font_US.sbfarc: the 1.9.0 archive with the pack's fonts, except External_00.bffnt, the button icons, which Savage Wind draws itself. --no-fonts leaves the fonts out.
  • ResourceSizeTable: the 1.9.0 table, where each grown file's entry is the largest of three sizes: the 1.9.0 one, the pack's own table's, and the 1.9.0 one plus what the file grew by plus 4 KB. Without this table, the converted pack never leaves the loading screen. Savage Wind's own growing (Support for custom Arabic fonts and text mods (LayeredFS font rendering issue) #898) covers the loose files (about 3,440 entries for this pack), but not the texture files inside packs.
  • --no-terrain leaves out the 4K terrain: Terrain/ and Model/Terrain.Tex*, which make Pack/TitleBG.pack grow from 80 to 287 MB.

The output holds parts of the player's game files (the packs), so the tool's help and the FAQ say not to share it. Nothing is downloaded, and nothing outside <mod folder>/romfs is written.

The code is self-contained: Yaz0 decompress and uncompressed store, a SARC reader and in-place replacer, and an RSTB reader and writer. Standard library only.

How it was tested

Windows 11, RTX 4080 SUPER, NVIDIA 617.42, 3840×2160, game 1.9.0 with both DLC, on test at 2a51d02 with #1135's game_memory_mb = 6144.

Mod loaded Result
The pack as distributed Crashes at boot (read at 0xef8a699dbc)
The pack without its ResourceSizeTable and Bootup.pack Crashes at boot (read at 0xa8)
Converted, but without the tool's ResourceSizeTable Stays on the loading screen
Converted by this tool Loads the save into the world, about 102 fps (101 without any mod)

make test-hdpack-convert builds a small synthetic game and pack, with no game files involved. It checks 24 cases: the containers, the files the mod gets, which pack files are swapped, the DLC paths, the fonts, the size table entries, --no-terrain, --no-fonts, --copy, and that nothing outside the mod's romfs/ is written.

More detail
  • On the real pack, the tool kept 3,531 loose files and 142 packs with 217 textures, and grew 3,738 table entries, in 13 seconds with hard links.
  • Its output is identical, file for file after decompressing (3,675 files), to an overlay built with the script this tool was written from. That overlay was played by hand: the Shrine of Resurrection, the Great Plateau, Hyrule Castle (inside), Zora's Domain and Gerudo Town.
  • The game runs in this table used SAVAGEWIND_ROMFS_OVERLAY on the mod's romfs/ folder, not the Mods tab. Both load through the same overlay layers.
  • The test isn't in CI yet. It's a plain python3 script, like tools/test_feedback_alias.py, so it can be added as a job in tests.yml.

Checklist

  • Based on the latest test and opened against test
  • Built and run locally, and checked in the game
  • No game files, keys, firmware, generated game code or save files in the changes

A texture pack made for the 1.6.0 update (HDPacks.com's 4K pack) can't be
loaded on 1.9.0 as it is: next to its textures it has 1.6.0 copies of
whole packs, Pack/Bootup.pack and a 1.6.0 ResourceSizeTable, and the game
crashes or never finishes loading.

The tool makes a Mods tab mod of only the pack's textures, from the
player's own files: loose files 1.9.0 also has, each 1.9.0 pack with only
its texture files swapped (DLC packs under aoc/0010/), the fonts except
External_00.bffnt, and the 1.9.0 ResourceSizeTable with the grown entries.
Savage Wind's own growing doesn't reach the files inside packs: without
the table the converted pack stays on the loading screen.

tools/test_hdpack_convert.py checks it on a synthetic game and pack
(make test-hdpack-convert). The FAQ points to it from "Can I use mods?".
@Zarigis
Zarigis marked this pull request as ready for review November 26, 2026 01:57
@Revivedx

Copy link
Copy Markdown
Owner

Thanks @Zarigis, this is careful work, and the converted pack loading at about the same fps is great to see. Mod conversion lives in SWMM+ (https://github.com/Revivedx/SWMMPlus), our mod manager, rather than in Savage Wind itself: it already converts mods and is where players prepare them, so the converter belongs there. Could you open it as a PR on SWMMPlus? When you do, please leave the pack site's name out of the docs and the tool's help. Savage Wind only links to the player's own files, never to sites that host texture packs.

The memory side, #1135 (game_memory_mb), is going into our next batch, so a converted pack has the room it needs. Closing here in favour of SWMM+.

@Revivedx Revivedx closed this Nov 26, 2026
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