Skip to content

Instantly share code, notes, and snippets.

@qguv
Created January 14, 2024 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qguv/129a28225142c7638f547b2e7870ca76 to your computer and use it in GitHub Desktop.
Save qguv/129a28225142c7638f547b2e7870ca76 to your computer and use it in GitHub Desktop.
Parser for Unity Engine 5 save files (tested on Pseudoregalia saves)
meta:
id: pseudoregalia_save
endian: le
seq:
- id: magic
contents: GVAS
- id: unknown1
size: 22
- id: version
type: strn
- id: unknown2
size: 1268
- id: blueprint
type: strn
- id: props
type: ntv
repeat: eos
types:
strn:
seq:
- id: size
type: u4
- id: str
type: strz
encoding: utf-8
if: size > 0
ustrz:
seq:
- id: str
type: strz
encoding: utf-8
empty:
seq: []
ntv:
seq:
- id: name
type: strn
- id: type
type: strn
- id: value
type:
switch-on: type.str
cases:
'"MapProperty"': map_prop
'"IntProperty"': int_prop
'"StrProperty"': str_prop
'"StructProperty"': struct_prop
'"ArrayProperty"': array_prop
'"NameProperty"': str_prop
'"DoubleProperty"': double_prop
'"BoolProperty"': bool_prop
bool_prop:
seq:
- id: size
type: u8
- id: value
type: u1
- id: barrier
contents: [0]
double_prop:
seq:
- id: size
type: u8
- id: barrier
contents: [0]
- id: value
type: f8
array_prop:
seq:
- id: size
type: u8
- id: type
type: strn
- id: barrier
contents: [0]
- id: data
type: array_data
size: size
array_data:
seq:
- id: length
type: u4
- id: entries
type:
switch-on: _parent.type.str
cases:
'"NameProperty"': strn
# TODO '"StructProperty"'
repeat: expr
repeat-expr: length
int_prop:
seq:
- id: size
type: u8
- id: barrier
contents: [0]
- id: value
type: u4
str_prop:
seq:
- id: size
type: u8
- id: barrier
contents: [0]
- id: value
type: strn
struct_prop:
seq:
- id: size
type: u8
- id: name
type: strn
- id: unknown
size: 16
- id: barrier
contents: [0]
- id: value
size: size
map_prop:
seq:
- id: size
type: u8
- id: key_type
type: strn
- id: value_type
type: strn
- id: barrier
contents: [0]
- id: data
type: map_data
size: size
map_data:
seq:
- id: unknown
type: u4
- id: length
type: u4
- id: entries
type: kvp
repeat: expr
repeat-expr: length
kvp:
seq:
- id: key
type: strn
- id: val
type: u4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment