genie-drs

Crates.iogenie-drs
lib.rsgenie-drs
version0.2.1
sourcesrc
created_at2019-04-09 08:22:18.713552
updated_at2020-05-18 10:02:57.596244
descriptionRead .drs archive files from the Genie Engine, used in Age of Empires 1/2 and SWGB
homepagehttps://github.com/SiegeEngineers/genie-rs
repositoryhttps://github.com/SiegeEngineers/genie-rs
max_upload_size
id126781
size64,393
(simonsan)

documentation

README

genie-drs

.drs is the resource archive file format for the Genie Engine, used by Age of Empires 1/2 and Star Wars: Galactic Battlegrounds. .drs files contain tables, each of which contain resources of a single type. Resources are identified by a numeric identifier.

This crate only supports reading files right now.

Install

Add to Cargo.toml:

[dependencies]
genie-drs = "^0.1.1"

Example

use std::fs::File;
use genie_drs::DRSReader;

let mut file = File::open("test.drs")?;
let drs = DRSReader::new(&mut file)?;

for table in drs.tables() {
    for resource in table.resources() {
        let content = drs.read_resource(&mut file, table.resource_type, resource.id)?;
        println!("{}: {:?}", resource.id, std::str::from_utf8(&content)?);
    }
}

Wishlist

  • An API that doesn't require passing in the file handle manually
  • A file mapping counterpart for the read_resource API, using memmap probably.

License

GPL-3.0 or later

Commit count: 165

cargo fmt