EU4 Save
EU4 Save is a library to ergonomically work with EU4 saves (ironman + mp).
use ;
use Cursor;
let data = read?;
let = extract_save?;
assert_eq!;
assert_eq!;
Eu4Extractor
will deserialize both plaintext (used for mods, multiplayer,
non-ironman saves) and binary (ironman) encoded saves into the same structure.
Querying
Even once decoded, the data might be too low level. For example a country can have an income ledger that looks like:
income = { 1.000 0 2.000 0.000 1.500 }
While the structure will decoded successfully into a vector, the context of what each index means is missing. What value represents the income from trade?
To help solve questions like these, the Query
API was created
use ;
use Cursor;
let data = read?;
let = extract_save?;
let save_query = from_save;
let trade = save_query.save.game.countries.get
.map
.map;
assert_eq!;
Ironman
By default, ironman saves will not be decoded properly.
To enable support, one must supply an environment variable
(EU4_IRONMAN_TOKENS
) that points to a newline delimited
text file of token descriptions. For instance:
0xffff my_test_token
0xeeee my_test_token2
PDS has declared that in order to comply with EU4's terms of use, the list of tokens must not be shared. I am also restricted from divulging how the list of tokens can be derived.
You may look to other projects EU4 ironman projects like ironmelt or paperman for inspiration.