StardewXnbHack is a one-way XNB unpacker for Stardew Valley. It supports every Stardew Valley asset type, is very easy to update for game changes, and is quick at unpacking many files at once.
To install it:
- Install Stardew Valley and SMAPI.
- From the releases page, download the
StardewXnbHack *.zip
file for your operating system under 'assets'. - Unzip it into your Stardew Valley folder,
so
StardewXnbHack.exe
(Windows) orStardewXnbHack
(Linux/macOS) is in the same folder asStardew Valley.dll
.
To unpack the entire Content
folder into Content (unpacked)
, just double-click on
StardewXnbHack.exe
(Windows) or StardewXnbHack
(Linux/macOS).
StardewXnbHack reads files through a temporary game instance, unlike other unpackers which read them directly. That lets it support custom Stardew Valley formats, but it can't repack files (which is rarely needed anyway) or support other games.
The main differences at a glance:
StardewXnbHack | xnbcli | XNBExtract | |
---|---|---|---|
Supported asset types | ✓ images ✓ maps ✓ dictionary data ✓ font texture ✓ font XML data ✓ structured data |
✓ images ✓ maps ✓ dictionary data ✓ font textures ✓ font XML data ❑ structured data |
✓ images ✓ maps ✓ dictionary data ✓ font textures ❑ font XML data ❑ structured data |
Export formats | ✓ .png for images✓ .tmx for maps✓ .json for data (CP-compatible) |
✓ .png for images✓ .tbin for maps¹❑ .json for data (custom format) |
✓ .png for images✓ .tbin for maps¹❑ .yaml for data |
Supported platforms | ✓ Windows ✓ Linux ✓ Mac |
✓ Windows ✓ Linux ✓ Mac |
✓ Windows ❑ Linux ❑ Mac |
Supported operations | ✓ unpack ❑ pack |
✓ unpack ✓ pack (uncompressed) |
✓ unpack ✓ pack |
Maintainable | ✓ easy to update | ❑ complex | ❑ complex, closed-source |
Sample unpack time (full Content folder) |
≈0m 43s | ≈6m 5s | ≈2m 20s |
License | MIT | GPL | n/a |
¹ .tmx
is the preferred map format, but you can open the .tbin
file in Tiled and export it as .tmx
.
That means it crashed for some reason.
First, make sure you have the latest versions of SMAPI and Stardew Valley.
If it still happens, here's how to see what the error is:
- Find your game folder.
- Open a terminal in the game folder.
- Type this command:
- Windows:
StardewXnbHack.exe
(for Command Prompt) or./StardewXnbHack.exe
(for PowerShell or Windows Terminal) - Linux or macOS:
./StardewXnbHack
- Windows:
- Press enter to run the command.
That should run StardewXnbHack in the same terminal, and the window will stay open if it crashes.
You can ask for help in #making-mods on the Stardew Valley Discord. If you're sure it's a StardewXnbHack bug (and not a usage error), you can report it on the issues page.
By default, unpacked data files include all of the fields. This can be very noisy, and doesn't really match how the data assets are formatted in the original code.
You can omit the default fields instead:
- Open a terminal in your game folder.
- Run
StardewXnbHack.exe --clean
to omit the default fields.
This is still experimental, but it may become the default behavior in future versions.
This section explains how to edit or compile StardewXnbHack from the source code. Most users should use the release version instead.
- Install Stardew Valley and SMAPI.
- Open the
.sln
solution file in Visual Studio. - Click Build > Build Solution. (If it doesn't find the Stardew Valley folder automatically, see custom game path in the mod build package readme.)
Just launch the project via Debug > Start Debugging. It will run from your bin
folder, but
should auto-detect your game folder and unpack its Content
folder.
To prepare a crossplatform SMAPI release:
- Update the semantic version in
StardewXnbHack.csproj
. - Run the
build-scripts/prepare-release-packages.sh
on Linux or macOS.
See the equivalent documentation for SMAPI for the first-time setup (including using WSL on Windows). - Release the zip files created in the root
bin
folder.