localcc / gvas

GVAS file format parsing library for rust
MIT License
20 stars 2 forks source link

Unable to open Palworld player files #53

Closed xAt0mZ closed 8 months ago

xAt0mZ commented 8 months ago

Similarly to #44 I tried to open various files of the Palworld savedGames directory with gvas2json

However for most of the files, I'm getting various Error: Invalid header: File type XXXX not recognized errors (the XXX number varies for each file). Some files like UserOption.sav are parsed without issues.

Is there a way to help gvas lib understand the inner format?

files.zip

localcc commented 8 months ago

The file looks like it's compressed/encrypted, currently investigating.

localcc commented 8 months ago

The file uses simple zlib compression, should be fairly trivial to add support

localcc commented 8 months ago

The format is as follows:

<decompressed length> <compressed length> <"PlZ1" constant> <zlib stream>

Compressed length only includes the zlib stream length

localcc commented 8 months ago

Decompressing it as zlib only works for some files, and even then the gvas file is not read correctly by the lib, the game itself uses FCompression::CompressMemory for compressing the save file, will look more into it in the morning.

trumank commented 8 months ago

ref https://github.com/trumank/uesave-rs/issues/22

localcc commented 8 months ago

The game also saves most of the character data inside of an array and then serializes this into this gvas file, the array is the RawData field inside of the CharacterSaveParameterMap. This array includes properties for character nickname, exp, etc.

xAt0mZ commented 8 months ago

You are a legend dude. Thanks a lot!

xAt0mZ commented 8 months ago

@localcc so, all files seem to be converted correctly both ways, but this one: Level.zip Getting Error: Missing hint for struct StructProperty at path worldSaveData.StructProperty.CharacterSaveParameterMap.MapProperty.Key.StructProperty, cursor position: 1773

I built a new version of gvas2json targeting the latest main commit of this repo and temporarily fixed the code to read using GameVersion::Palworld. I wish I know more about gvas and Rust to handle it by myself but unfortunately this is a bit too much for my skills...

localcc commented 8 months ago

You can find the required hints here https://github.com/localcc/gvas/blob/main/tests/palworld.rs

xAt0mZ commented 8 months ago

Thanks! I added the following 2 hints that were missing for this specific file

    (
        String::from("worldSaveData.StructProperty.WorkSaveData.ArrayProperty.WorkAssignMap.MapProperty.Value.StructProperty"),
        String::from("StructProperty")
    ), (
        String::from("worldSaveData.StructProperty.DungeonSaveData.ArrayProperty.MapObjectSaveData.ArrayProperty.ConcreteModel.StructProperty.ModuleMap.MapProperty.Value.StructProperty"),
        String::from("StructProperty")
    ),

However JSON format of this file is 2.94GB so I'd suggest not including it in tests 😁

scottanderson commented 8 months ago

MapProperty and ArrayProperty have redundant type annotations in the binary save format as well as in the gvas memory representation, which results in these property types taking a lot of JSON text to represent. I am working on a custom serializer and deserializer which will result in a more compact JSON representation.

On Sun, Jan 21, 2024, 1:00 PM LP B @.***> wrote:

Thanks! I added the following 2 hints that were missing for this specific file

(
    String::from("worldSaveData.StructProperty.WorkSaveData.ArrayProperty.WorkAssignMap.MapProperty.Value.StructProperty"),
    String::from("StructProperty")
), (
    String::from("worldSaveData.StructProperty.DungeonSaveData.ArrayProperty.MapObjectSaveData.ArrayProperty.ConcreteModel.StructProperty.ModuleMap.MapProperty.Value.StructProperty"),
    String::from("StructProperty")
),

However JSON format of this file is 2.94GB so I'd suggest not including it in tests 😁

— Reply to this email directly, view it on GitHub https://github.com/localcc/gvas/issues/53#issuecomment-1902711302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFBWNMLKDOMN2YLW2ARSKTYPVJTNAVCNFSM6AAAAABCDLBLTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG4YTCMZQGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>