Expand description
§Imperator Save
Imperator Save is a library to ergonomically work with Imperator Rome saves (debug + standard).
ⓘ
use imperator_save::{ImperatorFile, Encoding, EnvTokens, models::Save};
let data = std::fs::read("assets/saves/observer1.5.rome")?;
let file = ImperatorFile::from_slice(&data[..])?;
assert_eq!(file.encoding(), Encoding::BinaryZip);
let mut zip_sink = Vec::new();
let parsed_file = file.parse(&mut zip_sink)?;
let save = Save::from_deserializer(&parsed_file.deserializer(), &EnvTokens)?;
assert_eq!(save.meta.version, String::from("1.5.3"));
§Ironman
By default, standard saves will not be decoded properly.
To enable support, one must supply an environment variable
(IMPERATOR_TOKENS
) that points to a newline delimited
text file of token descriptions. For instance:
ⓘ
0xffff my_test_token
0xeeee my_test_token2
In order to comply with legal restrictions, I cannot share the list of tokens. I am also restricted from divulging how the list of tokens can be derived.
Modules§
Structs§
- EnvTokens
- Builtin token resolver based on
IMPERATOR_TOKENS
- Imperator
Date - A date without a time component
- Imperator
Error - A Imperator Error
- Imperator
File - Entrypoint for parsing Imperator saves
- Imperator
Melter - Convert a binary save to plaintext
- Melted
Document - Output from melting a binary save to plaintext
- Save
Header - The first line of the save file
Enums§
- Encoding
- Describes the format of the save before decoding
- Failed
Resolve Strategy - Customize how the deserializer reacts when a token can’t be resolved
- Imperator
Error Kind - Specific type of error
- Save
Header Kind - The kind of save file
Traits§
- PdsDate
- Common set of methods between all the date components