#sega #modding #archive-format #pso2

ages-ice-archive

Functions for packing and unpacking SEGA's ICE archive format, used in Phantasy Star Online 2

7 releases

0.3.2 May 16, 2022
0.3.1 Jun 18, 2021
0.2.1 Jun 8, 2021
0.2.0 May 12, 2021
0.1.0 Jun 27, 2020

#471 in Compression

40 downloads per month

MIT/Apache

605KB
15K SLoC

C++ 13K SLoC // 0.0% comments Rust 1K SLoC // 0.1% comments Visual Studio Project 197 SLoC Visual Studio Solution 28 SLoC

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.

Dependencies

~3.5MB
~71K SLoC