Documentation
¶
Overview ¶
Package nstools provides tools for working with Nintendo Switch files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidMagic = errors.New("invalid magic signature") ErrUnknownFile = errors.New("unknown file type") ErrInvalidSig = errors.New("invalid signature type") ErrNotFound = errors.New("file not found") ErrInvalidKey = errors.New("invalid key") )
Errors
View Source
var ( MagicPFS0 = [...]byte{0x50, 0x46, 0x53, 0x30} // PFS0 MagicNCA2 = [...]byte{0x4E, 0x43, 0x41, 0x32} // NCA2 MagicNCA3 = [...]byte{0x4E, 0x43, 0x41, 0x33} // NCA3 )
Magic signatures
Functions ¶
Types ¶
type CNMT ¶
type CNMT struct {
Type string
ID string `xml:"Id"`
Version int
RequiredDownloadSystemVersion int
RequiredSystemVersion int
KeyGenerationMin int
}
func CnmtFromXML ¶
CnmtFromXML tries to parse the XML data and populate the CNMT struct. it returns an ErrNotFound error if the cnmt.xml file is not found.
type ContentType ¶
type ContentType uint8
const ( ContentTypeProgram ContentType = iota ContentTypeMeta ContentTypeControl ContentTypeManual ContentTypeData ContentTypePublicData )
type DistributionType ¶
type DistributionType uint8
const ( DistributionTypeDownload DistributionType = iota DistributionTypeGameCard )
type Keys ¶
type Keys struct {
HeaderKey []byte
}
type NCAHeader ¶
type NCAHeader struct {
FirstSignature [0x100]byte
SecondSignature [0x100]byte
Magic [4]byte
DistributionType DistributionType
ContentType ContentType
KeyGenerationOld uint8
KeyIndex uint8
ContentSize uint64
ProgramID string
ContentIndex uint32
SDKVersion uint32 // {byte3}.{byte2}.{byte1}, byte0 is always 0
KeyGeneration uint32
RigthsID string
SectionTables [4]FSEntry
SectionHashes [4][0x20]byte
}
type PFS0 ¶
type PFS0 struct {
Magic [4]byte
HeaderSize uint32
Files []Partition
// contains filtered or unexported fields
}
PFS0 is a file system, a container that holds multiple files.
Click to show internal directories.
Click to hide internal directories.