Network & download

How CyberFoil moves bytes from a source to the installer. NSP/XCI parsing: Install pipeline. Shop HTTP API: Shop.

Connection modes

UI sourceTransportReaderSource
LAN installTCP :2000 then HTTP rangeHTTPNSP / HTTPXCInetInstall.cpp
URL / Google DriveHTTP(S) rangeHTTPNSP / HTTPXCInetInstPage.cpp
eShopHTTP(S) + shop authHTTPNSP / shop XCI streamshopInstall.cpp
SD cardLocal fileSDMCNSP / SDMCXCIsdInstall.cpp
USB HDDUSB volume fileSDMCNSP / SDMCXCIhddInstall.cpp
NS-USBloaderUSB bulk TUC0/TUL0USBNSP / USBXCIusbInstall.cpp
MTPPush to install/MtpNspStreammtp_install.cpp

Target storage: 0 = SD (NcmStorageId_SdCard), else internal (NcmStorageId_BuiltInUser).

URL & path types

KindExampleHandling
HTTP(S) directhttps://host/a.nspcurl Range, expect 206
Name fragmenturl#Display%20NameFragment = label only
Google DriveFile ID (keyboard)drive/v3/files/{id}?key=…&alt=media
Shop relative/files/x.nspJoined to shop base URL
JBODjbod:{chunk}/{url}/…Virtual multi-URL file
Local pathSD / USB filesystemNo HTTP
LAN listURLs over TCP :2000Newline-separated

network_util.cpp, util/util.cpp, shopInstall.cpp

HTTP streaming download

Remote installs stream into NCM placeholders - the full file is not saved to SD first.

  • Range: offset-(offset+size-1) → HTTP 206
  • Accept-Encoding: identity
  • 3 retries / segment, 2 s delay; user retry dialog after exhaustion
  • NSP vs XCI: bytes 0x100-0x103 == HEAD → XCI, else NSP

Install requests may add Tinfoil headers (Theme, UID, HAUTH, UAUTH, …) plus HTTP Basic when configured.

network_util.cpp, curl.cpp, netInstall.cpp

LAN protocol - port 2000

  1. Client → <switch-ip>:2000
  2. Receive u32 size, then payload (newline-separated URLs, max ~262 KB)
  3. Each URL installed via HTTP range
  4. Done: 1-byte 0x00 ack + HTTP DROP to host

Y on net screen: manual URL or Google Drive ID.

netInstall.cpp - REMOTE_INSTALL_PORT = 2000

USB protocol

TUL0 - title list (magic 0x304C5554). TUC0 - file range commands, 8 MB bulk reads.

XCI if title name ends with xc.

usb_util.cpp, usbInstall.cpp

Local & MTP

Extensions .nsp .nsz .xci .xcz. SD/HDD: 4 MB sequential reads. MTP: incremental parse on upload to install/.

sdInstall.cpp, mtp_install.cpp