On this page

Install pipeline

Once CyberFoil has a byte stream, this is the rest of the story: containers, NCA write, tickets, and the live queue. Transports live on the network page.

Overview

Every source ends up in the same installer. The transfer runs on a worker; the UI stays on its own thread:

  1. Prepare - read CNMT NCAs, install content meta to NCM DB, push application record to NS
  2. Begin - import tickets/certs via ES, stream each content NCA into storage

.nsz / .xcz are not decompressed as whole files - they use the same PFS0/HFS0 layout with .ncz entries instead of .nca.

NSP / NSZ - PFS0 container

  • Magic PFS0 (0x30534650)
  • File table: PFS0BaseHeader + entries + string table
  • NCA entries: {id}.nca, {id}.cnmt.nca, {id}.ncz, {id}.cnmt.ncz
  • Ticket pairs: .tik + .cert → esImportTicket

Streaming (HTTP / USB)

A dual-thread pipeline keeps the read ahead of the write:

  • Thread 1: HTTP/USB range read → BufferedPlaceholderWriter
  • Thread 2: flush 8 MB segments → NcaWriter → NCM placeholder
  • Ring buffer: 8 MB × 128 segments (2 in applet mode)

Per-NCA steps

  1. Delete stale placeholder
  2. Optional RSA-PSS signature verify (validateNCAs)
  3. Stream to placeholder via NcaWriter
  4. Register placeholder → final NCA id
  5. Delete placeholder; rollback on error

XCI / XCZ - HFS0 container

  • Root HFS0 at offset 0xF000 or 0x10000, magic HFS0 (0x30534648)
  • secure partition holds NCAs, tickets, certs
  • Same Prepare/Begin flow as NSP but reads HFS0 entries

Streaming differences

  • HTTP XCI: 4 MB chunks, NcaWriter direct (no ring buffer)
  • SD/USB XCI: same pattern as a local NSP

NCZ decompression (.nsz / .xcz inner NCAs)

Handled inside NcaWriter while the stream is still moving:

MagicFormat
NCZSECTNSectioned NCZ - ZSTD or NCZBLOCK per section
NCZBLOCKBlock-compressed ZSTD stream
0xFD2FB528Raw ZSTD stream
(none)Plain NCA - direct body write

After decompress, section data is re-encrypted (AES-128-CTR) and written to the NCM placeholder in 8 MB flushes.

NCM placeholder API

Wrapper around Switch ncmContentStorage*:

MethodAPI
CreatePlaceholderncmContentStorageCreatePlaceHolder
WritePlaceholderncmContentStorageWritePlaceHolder
RegisterncmContentStorageRegister - finalize NCA
DeletePlaceholderCleanup incomplete install
Content metancmContentMetaDatabase Set + Commit
ApplicationnsPushApplicationRecord

NCA signature verification

When validateNCAs is true (default in config):

  • Decrypt NCA header (AES-XTS with headerKey)
  • Check magic NCA3
  • RSA-2048-PSS verify first 0x200 bytes of header
  • On failure: warning dialog - user can abort or continue

Install queue

Catalog indices stay stable for the session. The active title is never in the editable pending list.

  • States: Available → Pending → Active → Completed
  • Screen: active-title card and six pending rows (art, type, size). ↑/↓ select, ←/→ page
  • A removes a pending title. Y opens the Remote catalog or the current SD/USB folder to append more
  • B requests cancel of the active title and stops the rest of the batch. Placeholders for that title are removed; finished titles stay
  • X blanks the handheld backlight. Wake does not activate a control. Screen also wakes when the batch ends
  • PC USB, LAN list, and MTP batches cannot grow from the Switch UI

Remote XCI - special HTTP stream

Remote XCI items skip the generic XCI task and use a dedicated HTTP stream:

  • Detect XCI: extension .xci/.xcz or HFS0 magic at 0xF000/0x10000
  • Parse HFS0 via HTTP range with 16 MB read-ahead cache
  • Write NCAs through NcaWriter, commit CNMT incrementally
  • Import tickets at end - single continuous HTTP connection

NSP/NSZ Remote items use standard HTTPNSP + NSPInstall.