ages-ice-archive

Crates.ioages-ice-archive
lib.rsages-ice-archive
version0.3.2
sourcesrc
created_at2020-06-27 06:00:30.899841
updated_at2022-05-16 22:34:01.099682
descriptionFunctions for packing and unpacking SEGA's ICE archive format, used in Phantasy Star Online 2.
homepage
repositoryhttps://github.com/HybridEidolon/rust-ages-ice-archive
max_upload_size
id258588
size750,674
Eidolon (HybridEidolon)

documentation

README

ages-ice-archive: ICE archive library for Rust

CI Crate API

Types for loading and writing ICE archives.

ICE is an asset storage format used by SEGA's Phantasy Star Online 2, named after its magic prefix in its header.

This crate should work out-of-the-box on WebAssembly.

You may also install this crate via cargo install to get CLI utilities for unpacking and packing ICE files from the filesystem. These are examples within this package's repository, named agesdeice and agesice respectively.

Usage

Add to your Cargo.toml:

[dependencies]
ages-ice-archive = "0.1"

Within your code:

use std::fs::File;
use std::error::Error;

use ages_ice_archive::{Group, IceArchive};

fn main() -> Result<(), Box<dyn Error>> {
    let file = File::open("my.ice")?;
    let mut archive = IceArchive::new(file)?;

    archive.unpack_group(Group::Group1)?;
    println!("Files in Group 1:");
    for f in archive.iter_group(Group::Group1).unwrap() {
        if let Ok(name) = f.name() {
            println!("\t{} ({} bytes)", name, f.data().len());
        } else {
            println!("\t(non-ascii file name)");
        }
    }

    archive.unpack_group(Group::Group2)?;
    println!("Files in Group 2:");
    for f in archive.iter_group(Group::Group2).unwrap() {
        if let Ok(name) = f.name() {
            println!("\t{} ({} bytes)", name, f.data().len());
        } else {
            println!("\t(non-ascii file name) ({} bytes)", f.data().len());
        }
    }

    Ok(())
}

License

ages-ice-archive is dual-licensed for compatibility with the rest of the Rust public ecosystem.

ages-ice-archive is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Commit count: 35

cargo fmt