Skip to main content

Python-GVAS-JSON-Converter (SavConverter) is a library designed to convert Unreal Engine's Game Variable and Attribute System (GVAS) files between .sav and .json formats.

Project description


Python-GVAS-JSON-Converter

Python-GVAS-JSON-Converter (SavConverter) is a library designed to convert Unreal Engine's Game Variable and Attribute System (GVAS) files between .sav and .json formats. It provides a way to read and interpret the binary structure of .sav files and translate them into human-readable JSON format, as well as convert JSON back to the original .sav format.

Features

  • Convert from .sav to .json: Supports converting Unreal Engine's .sav files into .json format.
  • Convert from .json to .sav: Includes the ability to convert .json files back to the original .sav format.
  • JSON Editing Functions: Offers a range of functions to navigate, manipulate, and modify the specific JSON structure with ease.
  • Tested Games: The conversion has been tested with the following games (and may work for others):
    • Crab Champions
    • Deep Rock Galactic
    • High On Life
    • Hogwarts Legacy
    • Stray
  • Actively Developed: This project is actively being developed, with new features and improvements being added.

Warning

  • Untested .sav Files: Some classes in SavProperties.py may not function correctly with untested .sav files, and certain SavReader.py code segments may be broken for untested datatypes. While the library has been designed with flexibility in mind, full compatibility with all .sav files cannot be guaranteed at this stage. Efforts will continue to progressively test other games' .sav files and refine the code accordingly.

Using the Conversion Functions

The conversion functions provide an easy way to translate between Unreal Engine's .sav and .json formats.

Converting from .sav to .json

  1. Read .sav: Use read_sav(file_path) to get the property instances from the .sav file.
  2. Convert to JSON: Use sav_to_json(props, string=True) to convert properties to JSON. Use the string parameter to return a JSON string or object.
  3. Write to File: Write the JSON string output to a .json file.

Converting from .json to .sav

  1. Load JSON: Use load_json(file_path) to read a JSON file.
  2. Convert to Binary: Use json_to_sav(json_string) to convert JSON to binary data.
  3. Write to File: Write the binary data to a .sav file.

Using JSON Editing Functions

The JSON editing functions allow users to navigate and manipulate the JSON structure using paths, providing functions like:

Finding Objects

  • get_object_by_path(data, path): Locate objects in JSON by specifying the path. Returns the object found at the specified path or None if the path is not found.

Inserting Objects

  • insert_object_by_path(data, path, new_object, position='after'): Add a new object at the specified location. Use the position parameter to insert before or after the targeted object.

Replacing Objects

  • replace_object_by_path(data, path, new_object): Replace an object at the specified path with a new object.

Updating Properties

  • update_property_by_path(data, path, new_value): Modify specific keys within an object at the given full path to the property.

Loading JSON

  • load_json(file_path): Load a JSON file from the specified file path.

Converting Object to JSON String

  • obj_to_json(obj): Convert an object into a JSON string with proper indentation.

Printing JSON

  • print_json(data): Print a JSON object with indentation for better readability.

Understanding the Path Structure

  • path: A list that describes the path to the object you're looking for. Each element in the list can be:
    • A dictionary, to match a specific key-value pair.
    • A string, to reference a key.
    • An integer, to reference an index in a list.

Example path:

path_to_find = [{"name": "RankedWeapons"}, "value", 0, {'name': 'Rank'}, 'value']

Let's break down the example path:

  • {"name": "RankedWeapons"}: Look for an object with a key "name" and a value "RankedWeapons".
  • "value": Inside the found object, look for the key "value".
  • 0: Inside the value, look for the first element in the list (index 0).
  • {'name':'Rank'}: Look for an object within that element with a key "name" and a value "Rank".
  • "value": Inside the found object, look for the key "value".

This path leads you directly to a specific part of the JSON structure

Example Code

A comprehensive usage example for all the available functions is provided in the Example.py file. This example was developed using the Crab Champions .sav and .json files, which you can find in the ExampleSavFiles directory.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SavConverter-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

SavConverter-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file SavConverter-0.1.1.tar.gz.

File metadata

  • Download URL: SavConverter-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for SavConverter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a364644492d221539747a4efa0e9eb4d4e2eadde4fb46f6b824bcb03cfdc7f19
MD5 81b911af8adb0e0b8518ac42905c99d6
BLAKE2b-256 89b7ea19ce3e877bf4ca17f9795940ffb8019c90fd790b87901df0a27273ffb8

See more details on using hashes here.

File details

Details for the file SavConverter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for SavConverter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc0580d9ef6ac103069d078e8c081532a88e6dd2ad46b3d5c3be96181168b63
MD5 cd56165d869dc470b91702fb1c4c474f
BLAKE2b-256 e457d8edc8d9c4082e760b14a176ed0fedee0f777e62c11227d2aeaed939bc07

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page