Skip to content

Wizzel1/mpqrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpqrs

mpqrs is a Rust library for reading MPQ (MoPaQ) archives used in many of Blizzard's games. It is a port of the Python library mpyq and was originally developed for data mining StarCraft II replay files.

Only files compressed with DEFLATE or bzip2 are supported. This means that this library cannot be used to extract most large game asset archives that Blizzard's games use.

Disclaimer: This is a learning project. It was built as an exercise in porting a Python library to Rust. It is not intended for production use.

Installation

Add mpqrs as a dependency in your Cargo.toml:

[dependencies]
mpqrs = { git = "https://github.com/Wizzel1/mpqrs" }

Usage

use std::fs::File;
use mpqrs::MPQArchive;

let file = File::open("game.SC2Replay").unwrap();
let archive = MPQArchive::from_replay_file(file).unwrap();

// List files in the archive
if let Some(files) = &archive.files {
    for filename in files {
        println!("{}", String::from_utf8_lossy(filename));
    }
}

// Read a specific file from the archive
if let Ok(Some(data)) = archive.read_file("replay.details", false) {
    println!("Read {} bytes", data.len());
}

Running tests

cargo test

Acknowledgements

This project is a Rust port of mpyq by Aku Kotkavuo.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages