ps2mc 0.1.0

A Rust library for reading, extracting, and rewriting PlayStation 2 memory card images.
Documentation
  • Coverage
  • 28.32%
    32 out of 113 items documented1 out of 1 items with examples
  • Size
  • Source code size: 58.48 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.18 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • caol64

ps2mc

ps2mc 是一个面向 PlayStation 2 记忆卡镜像的 Rust 库,用于读取 .ps2 内存卡文件、遍历存档目录、导出存档内容,并解析 icon.sys 与 3D 图标资源。

功能特性

  • 读取并校验 PS2 memory card super block
  • 遍历根目录与子目录条目
  • 导出指定存档目录下的文件
  • 读取或覆写指定文件数据
  • 解析 icon.sys
  • 解析存档 3D 图标与纹理数据

安装

[dependencies]
ps2mc = "0.1.0"

快速开始

use ps2mc::MemoryCard;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut card = MemoryCard::open("memcard.ps2")?;

    for entry in card.entries() {
        println!("{}", entry.decode_name());
    }

    if let Some(save) = card.lookup_entry("BISLPM-65109SAKA_G44") {
        println!("save size: {}", save.length);
    }

    card.export_file("BISLPM-65109SAKA_G44", "./output")?;

    let icon_set = card.get_icon("BISLPM-65109SAKA_G44")?;
    println!("icons: {}", icon_set.icons.len());

    Ok(())
}

对外 API

  • MemoryCard: 打开、遍历、读取、导出、写回记忆卡镜像
  • Entry: 表示目录项/文件项元数据
  • IconSys: 表示 icon.sys 内容
  • Icon: 表示存档 3D 图标与纹理
  • Ps2mcError: 统一错误类型

发布到 crates.io

仓库已包含 GitHub Actions 工作流,支持两种发布方式:

  1. 手动触发:在 GitHub Actions 页面执行 Publish crate
  2. 推送标签:推送形如 v0.1.0 的 tag 会自动发布;工作流会校验 tag 与 Cargo.toml 里的版本一致。

发布前请在仓库 Secrets 中配置:

  • CRATES_IO_TOKEN

工作流会先执行 cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test,然后再执行发布。