Skip to content

[Bug] NSOs with ZBIC compression (NsoFlags_UseZbicCompression) fail to load #492

Description

@Appealpotato

Prerequisites

  • I am confident that my issue has not been reported already in open OR closed issues.
  • I am able to reliably reproduce the issue on the latest stable or canary version.
  • I am not using an unofficial build (Flatpak, Emudeck, etc.).
  • I am a silly goose and didn't read these boxes.
  • I am a silly goose and DID read these boxes.

Description of the issue

Environment

  • Ryujinx Canary 1.3.351 (2026-08-26) — latest as of 2026-09-01
  • OS: Windows x64
  • Firmware installed in Ryujinx: 22.1.0
  • Game: Can I Not Fall for Idols? (アイドルと〇〇しちゃダメですか) — [0100C6B028F38000][v0][BASE] (eShop, released 2026-08-27)

Symptom

The game fails to load immediately:

Unhandled exception caught: System.ArgumentOutOfRangeException: srcOffset ('-38731')
   at Lz4.Decompress ... NsoReader.ReadSegmentImpl ... NsoExecutable.DecompressSection

The main NSO cannot be loaded by LibHac's NSO reader.

Root cause

This title is built with FS SDK 22.2.0 and its main NSO uses the new ZBIC compression (modified Zstandard) instead of LZ4 for its segments.

NSO flags of the shipped main: 0xBF (0b10111111), which includes NsoFlags_UseZbicCompression = BIT(7) (naming per nxdumptool's nso_zbic.h):

NsoFlags_TextCompress       = BIT(0)
NsoFlags_RoCompress         = BIT(1)
NsoFlags_DataCompress       = BIT(2)
NsoFlags_TextHash           = BIT(3)
NsoFlags_RoHash             = BIT(4)
NsoFlags_DataHash           = BIT(5)
NsoFlags_ExecuteOnlyMemory  = BIT(6)
NsoFlags_UseZbicCompression = BIT(7)

LibHac's NSO reader has no ZBIC handling: when bit 7 is set it still tries to LZ4-decompress the segment, which fails with the srcOffset exception above.

Notes

  • Only main uses ZBIC in this title. rtld, sdk, subsdk0, subsdk1 all use flags 0x3F (plain LZ4 + hash checks) and load fine.
  • nxdumptool already implements ZBIC decompression (nso_zbic.c/h, ZSTD with decompression margin) — useful as a reference.
  • Workaround for testing: decompress the ZBIC segments, rebuild main as an uncompressed NSO (flags 0x38 = no compression + hash checks on; segment content verified against the SHA-256 hashes baked in the NSO header) and replace ExeFS via a mod exefs.nsp. With that workaround the game loads fully — but then hits a second, separate crash (see the SDK 22.2.0 module-init issue).

Expected behavior

NSOs with NsoFlags_UseZbicCompression should be decompressed with Zstandard (or the appropriate ZBIC variant) instead of LZ4.

Reproduction steps

  • Launch game normally through the emulator.
  • It crashes before even getting to the boot screen.

Log file

Ryujinx_Canary_1.3.351_2026-09-01_14-04-46.log

OS

Windows 10 x64

Ryujinx version

1.3.351, Canary

Game version

No response

CPU

Ryzen 5600x

GPU

RTX 3060Ti

RAM

32GB

List of applied mods

No response

Additional context?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions