Documentation
¶
Index ¶
- Variables
- func ReadDSARChunkData(r io.ReadSeeker, chunk DSARChunk) ([]byte, error)
- type Archive
- type DSAA
- type DSAAArchiveItem
- type DSAAArchiveItemHeader
- type DSAAEntry
- type DSAAHeader
- type DSARChunk
- type DSARCompressionType
- type DSARHeader
- type DSARResourceFlags
- type DSARStructure
- type DataDir
- type DataType
- type FileData
- type FileID
- type FileInfo
- type Hash
- type HeaderData
- type Locus
- type NXABundleInfo
- type ThinHash
- type TypeData
Constants ¶
This section is empty.
Variables ¶
var ( // Returned when the file exists, but doesn't have the // requested data type. ErrFileDataTypeNotExist = errors.New("file data type doesn't exist") // Returned when the file doesn't exist. ErrFileNotExist = errors.New("file doesn't exist") )
Functions ¶
func ReadDSARChunkData ¶ added in v0.7.8
func ReadDSARChunkData(r io.ReadSeeker, chunk DSARChunk) ([]byte, error)
Types ¶
type Archive ¶ added in v0.6.17
type Archive struct {
ID Hash
Header HeaderData
Types []TypeData
Files []FileData
}
type DSAA ¶ added in v0.7.8
type DSAA struct {
Header DSAAHeader
Archives []DSAAArchiveItem
NXAFilenames []string
}
DSAA is the type of the only file contained inside "bundles.nxa".
type DSAAArchiveItem ¶ added in v0.7.8
type DSAAArchiveItem struct {
Header DSAAArchiveItemHeader
Filename string
Entries []DSAAEntry
}
type DSAAArchiveItemHeader ¶ added in v0.7.8
type DSAAHeader ¶ added in v0.7.8
type DSARChunk ¶ added in v0.7.8
type DSARChunk struct {
UncompressedOffset uint64
CompressedOffset uint64
UncompressedSize uint32
CompressedSize uint32
Compression DSARCompressionType
ResourceType DSARResourceFlags
Padding00 [6]byte
}
type DSARCompressionType ¶ added in v0.7.8
type DSARCompressionType uint8
const ( DSARCompressionUncompressed DSARCompressionType = 0x00 DSARCompressionLZ4 DSARCompressionType = 0x03 )
type DSARHeader ¶ added in v0.7.8
type DSARResourceFlags ¶ added in v0.7.8
type DSARResourceFlags uint8
const ( DSARResourceUnk0x01 DSARResourceFlags = 1 << iota DSARResourceStart DSARResourceMulti )
type DSARStructure ¶ added in v0.7.8
type DSARStructure struct {
Header DSARHeader
Chunks []DSARChunk
}
DSARStructure holds the metadata of a DSAR file (without the actual data contents).
DSAR is the format of .nxa bundles, as well as the files named after archive files in the prod_slim edition.
func LoadDSARStructure ¶ added in v0.7.8
func LoadDSARStructure(reader io.Reader) (*DSARStructure, error)
type DataDir ¶
type DataDir struct {
// Base directory path
Path string
// Archive ID to files in that archive
Archives map[Hash][]FileID
// File ID to all file info (according to testing,
// all file info structs in the slice should refer
// to the same data).
Files map[FileID][]FileInfo
// Whether the edition of the
// game is prod_slim.
IsSlimEdition bool
// === SLIM EDITION ONLY FIELDS === //
DSAA *DSAA
ArchiveDSAAIndices map[Hash][NumDataType]int
Bundles []NXABundleInfo
SingleArchiveBundles map[Hash][NumDataType]*DSARStructure // single-archive DSAR bundles that are non-NXA, e.g. localized audio
}
DataDir represents the collection of game files.
func OpenDataDir ¶
func OpenDataDir(ctx context.Context, dirPath string, onProgress func(curr, total int)) (_ *DataDir, err error)
Opens the "data" game directory, reading all file metadata. Ctx allows for rough cancellation (before each archive open). onProgress is optional.
func (*DataDir) ReadAtMost ¶ added in v0.7.0
Attempts to read at most nBytes from the given file, or all bytes if nBytes is -1. Returns ErrFileNotExist if id doesn't exist and ErrFileDataTypeNotExist if the file exists, but doesn't have the requested data type.
type FileData ¶
type FileData struct {
ID FileID
Offsets [NumDataType]uint64
MainBufferOffset uint64
GPUBufferOffset uint64
Sizes [NumDataType]uint32
MainAlignment uint32
GPUAlignment uint32
Index uint32
}
type FileInfo ¶ added in v0.6.17
type FileInfo struct {
ArchiveID Hash
Files [NumDataType]Locus
}
FileInfo represent the component locations of a single game file.
type Hash ¶
type Hash struct{ Value uint64 }
func ParseHash ¶ added in v0.5.20
ParseHash parses a big endian murmur64 hash. Ignores 0x prefix if present.
func (Hash) MarshalText ¶ added in v0.6.0
func (Hash) StringEndian ¶ added in v0.1.7
type HeaderData ¶
type Locus ¶ added in v0.6.17
Locus represents the location of a single partial game file (i.e. just main, stream or GPU) within an archive.
type NXABundleInfo ¶ added in v0.7.9
type NXABundleInfo struct {
DSAR *DSARStructure
Filename string
}
type ThinHash ¶
type ThinHash struct{ Value uint32 }
func ParseThinHash ¶ added in v0.7.0
ParseHash parses a big endian murmur32 hash. Ignores 0x prefix if present.