[][src]Crate smash_arc

A library for working with the data.arc file from Smash Ultimate.

use smash_arc::{ArcFile, ArcLookup, FileNode, Hash40, Region};

// Load the hashes needed to list directories (file format restriction)
Hash40::set_global_labels_file("hash_labels.txt").unwrap();

// Parse the arc from a file
let arc = ArcFile::open("data.arc").unwrap();

// loop over every file in the root
for node in arc.get_dir_listing("/").unwrap() {
    match node {
        FileNode::Dir(dir) => {
            // print out name of directory
            println!("directory: {}", dir.global_label().unwrap());
        }
        FileNode::File(file) => {
            // extract file
            let path = file.global_label().unwrap();
            std::fs::write(path, arc.get_file_contents(file, Region::UsEnglish).unwrap()).unwrap();
        }
    }
}

Cargo Features

  • network (enabled by default) = Ability to parse the file over the network

  • dir-listing (enabled by default) = List directories

  • global-hashes (enabled by default) = Enable a global table for cracking hashes

  • smash-runtime = Enables features for running under the context of Smash Ultimate itself (enable Aarch64 crc32 hardware acceleration, enable parsing the Arc from the game's memory layout)

  • ZSTD backends

    • libzstd - Recommended for use on platforms it builds for
    • rust-zstd - Increased portability (Recommended for use on switch)
    • nozstd - Provide no zstd backend, panic on ZSTD decompression

Structs

ArcFile

A struct representing the data.arc file

CompTableHeader
DirInfo

Various info about a directory. This can either represent a "real" directory, or merely a mass-loading group.

DirectoryOffset

Represents the location of a directory, both within the FileSystem::file_info_indices and within the data.arc relative to [ArcFile::file_section_offset]

FileData

The data backing any number of files

FileDataFlags

Flags indicating the type of compression, if any, to use

FileInfo

Information about a given file

FileInfoBucket

A range within the file info list

FileInfoFlags

Flags related to a given FileInfo

FileInfoIndex

A collection of indices representing a pair of DirectoryOffset and FileInfo as retrieved by index. These can be used together to retrieve the actual file itself in various ways (either by loading the full directory or the individual file).

FileInfoToFileData

An entry in a map between FileInfos and FileDatas

FilePath

A set of hashes representing the components of a path

FileSystem

The filesystem itself. Includes all the linking between paths, file data, directories, and mass-loading groups.

FileSystemHeader

Header to the filesystem, primarily just various counts

GLOBAL_LABELS

A set of global strings for reverse hash lookup

Hash40

A hash consisting of a crc32 and a 8-bit length. Used within Smash Ultimate as a unique identifier for various strings.

HashLabels

A map for looking up the string a Hash40 represents

HashToIndex

A mapping from a hash to an index into another list, used for the hash lookup tables in the format

LoadedArc
LoadedSearchSection
QuickDir

Directory listing for stream files

SearchSectionBody
SearchSectionHeader
StreamData

A range of offsets within the data.arc relative to the start of the ArcFile::stream_section_offset. This data is never compressed.

StreamEntry

An entry representing a single stream file

StreamHeader

Header for the sizes of various stream lists in the filesystem

Enums

FileNode

A node in the file tree, the hash of which can be used to handle lookups.

LookupError

An error occuring during the lookup of a file

Region

A region representing a country alongside a language.

Traits

ArcLookup

The trait that allows different implementations of the arc to share the same code for making lookups into the filesystem use the same logic.

SeekRead

A trait representing seekable readers

Functions

hash40

Find the Hash40 of a given string