psarc2 0.1.0

PlayStation archive reader
Documentation
//! Playstation Archive reader (`*.psarc`).
//!
//! # Features
//!
//! - Easy to use interface, inspired by [zip2](https://github.com/zip-rs/zip2).
//! - Supports decrypting AES-256 encrypted table of content.
//! - Streaming reader, only reads bytes that it needs.
//!
//! # Unimplemented
//!
//! PR's for these unimplemented features are welcome!
//!
//! - LZMA decoding.
//! - Writing.
//!
//! # Credits
//!
//! - [PS3 Developer Wiki](https://www.psdevwiki.com/ps3/PlayStation_archive_%28PSARC%29)

mod compression;
mod error;
mod file;
mod path;
pub mod read;
pub mod toc;

use std::{
    io::{Read, Seek},
    path::PathBuf,
};

use crate::{compression::CompressionType, file::FileEntry, read::BlockSize};

/// Playstation archive reader.
#[derive(Clone)]
pub struct PlaystationArchive<R: Read + Seek> {
    /// How the data is compressed.
    compression_type: CompressionType,
    /// Files in the archive.
    file_entries: Vec<FileEntry>,
    /// How big the file block is.
    block_size: BlockSize,
    /// The reader.
    reader: R,
    /// Sizes of the blocks.
    block_sizes: Vec<u32>,
}

/// A parsed raw archive file.
#[derive(Clone)]
pub struct PlaystationFile {
    /// Read file bytes.
    bytes: Vec<u8>,
    /// Path of the file from the manifest.
    path: PathBuf,
}