Crate gvas

source ·
Expand description

Gvas

UE4 Save File parsing library

§Examples

use gvas::{error::Error, GvasFile};
use std::{
    fs::File,
};
use gvas::game_version::GameVersion;

let mut file = File::open("save.sav")?;
let gvas_file = GvasFile::read(&mut file, GameVersion::Default);

println!("{:#?}", gvas_file);

§Hints

If your file fails while parsing with a DeserializeError::MissingHint error you need hints. When a struct is stored inside ArrayProperty/SetProperty/MapProperty in GvasFile it does not contain type annotations. This means that a library parsing the file must know the type beforehand. That’s why you need hints.

The error usually looks like this:

MissingHint(
        "StructProperty" /* property type */,
        "UnLockedMissionParameters.MapProperty.Key.StructProperty" /* property path */,
        120550 /* position */)

To get a hint type you need to look at the position of DeserializeError::MissingHint error. Then you go to that position in the file and try to determine which type the struct has. Afterwards you parse the file like this:

use gvas::{error::Error, GvasFile};
use std::{
    collections::HashMap,
    fs::File,
};
use gvas::game_version::GameVersion;

let mut file = File::open("save.sav")?;

let mut hints = HashMap::new();
hints.insert("UnLockedMissionParameters.MapProperty.Key.StructProperty".to_string(), "Guid".to_string());

let gvas_file = GvasFile::read_with_hints(&mut file, GameVersion::Default, &hints);

println!("{:#?}", gvas_file);

Modules§

Structs§

Enums§

  • Stores information about GVAS file, engine version, etc.

Constants§

  • The four bytes ‘GVAS’ appear at the beginning of every GVAS file.