3 unstable releases
0.2.1 | May 18, 2020 |
---|---|
0.2.0 | Aug 4, 2019 |
0.1.1 | Apr 9, 2019 |
#2318 in Parser implementations
Used in genie
30KB
623 lines
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
Dependencies
~0.4–0.8MB
~19K SLoC