Skip to content

Instantly share code, notes, and snippets.

@cheahjs
Last active February 11, 2024 01:13
Show Gist options
  • Save cheahjs/300239464dd84fe6902893b6b9250fd0 to your computer and use it in GitHub Desktop.
Save cheahjs/300239464dd84fe6902893b6b9250fd0 to your computer and use it in GitHub Desktop.
Converting PalWorld saves to JSON and back
@Busterblader7
Copy link

I need a video guide 😵

@Romafrique
Copy link

I have some trouble from the start: Dropping the file on the bat program and its teling me python not instaled...
BTW i got the latest release 3.12.1

Modifying "python" into "python3" or "py" should help... Worked for me as it may not recognize the command on your system

I'll try as soon as I get off work, thanks !

@Kakaka999
Copy link

error 13 permission denied still happening to me for convert sav to json

@Kakaka999
Copy link

I've downloaded a older version and tried it again and got this error
Python 3.12.1
This will convert the save files in "D:\SteamLibrary\steamapps\common\PalServer\Pal\Saved\SaveGames\0\0150E669444CD2C49BCC7E94832F116C" to JSON format.
Continue? [Y,N]?Y
Converting .sav files in D:\SteamLibrary\steamapps\common\PalServer\Pal\Saved\SaveGames\0\0150E669444CD2C49BCC7E94832F116C to JSON (using uesave.exe)
File D:\SteamLibrary\steamapps\common\PalServer\Pal\Saved\SaveGames\0\0150E669444CD2C49BCC7E94832F116C\Level.sav uncompressed successfully
Traceback (most recent call last):
File "C:\Users\AdminK\Downloads\300239464dd84fe6902893b6b9250fd0-b2dfb811a281ff33d9edc5cd8253716c794888b2\300239464dd84fe6902893b6b9250fd0-b2dfb811a281ff33d9edc5cd8253716c794888b2\convert-to-json.py", line 94, in
main()
File "C:\Users\AdminK\Downloads\300239464dd84fe6902893b6b9250fd0-b2dfb811a281ff33d9edc5cd8253716c794888b2\300239464dd84fe6902893b6b9250fd0-b2dfb811a281ff33d9edc5cd8253716c794888b2\convert-to-json.py", line 73, in main
uesave_run = subprocess.run(uesave_params(uesave_path, file+'.json'), input=uncompressed_data, capture_output=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

@iebb
Copy link

iebb commented Jan 24, 2024

Created a website for this - https://palworld.tf/ , where you can do this conversion in-browser by dragging files with wasm-compiled uesave-rs without downloading these.

@KrisDevel0pment
Copy link

Created a website for this - https://palworld.tf/ , where you can do this conversion in-browser by dragging files with wasm-compiled uesave-rs without downloading these.

Doesn't work.

@iebb
Copy link

iebb commented Jan 25, 2024

Created a website for this - https://palworld.tf/ , where you can do this conversion in-browser by dragging files with wasm-compiled uesave-rs without downloading these.

Doesn't work.

wait a moment, just messed up with the latest commit... should work now

@bhaktas
Copy link

bhaktas commented Jan 26, 2024

is there a way to convert steam save to xgp save?

@DKingAlpha
Copy link

Script to find PlayerUId (Players/<GUID>.sav)

#!/usr/bin/python3

from pathlib import Path
from struct import unpack_from
import json

j = json.loads(Path('temp/Level.2.json').read_text())
CharacterSaveParameterMap = j['root']['properties']['worldSaveData']['Struct']['value']['Struct']['CharacterSaveParameterMap']['Map']['value']

def find_user(name: str) -> str:
    for item in CharacterSaveParameterMap:
        key = item['key']
        value = item['value']
        PlayerUId = key['Struct']['Struct']['PlayerUId']['Struct']['value']['Guid']
        PlayerUIdInt = int(PlayerUId.replace('-', ''), 16)
        if PlayerUIdInt == 0:
            continue
        RawDataBytes = bytes(value['Struct']['Struct']['RawData']['Array']['Base']['Byte']['Byte'])
        pattern = b'\x4E\x69\x63\x6B\x4E\x61\x6D\x65\x00\x0C\x00\x00\x00\x53\x74\x72\x50\x72\x6F\x70\x65\x72\x74\x79\x00'
        offset = RawDataBytes.find(pattern)
        off_size = 0x22
        if offset == -1:
            print('not found')
            continue
        NickNameSize = unpack_from('<i', RawDataBytes, offset+off_size)[0]
        if NickNameSize >= 0:
            NickName = RawDataBytes[offset+off_size+4:offset+off_size+4+NickNameSize].decode('utf-8')
        else:
            max_bytes = (-NickNameSize) * 4
            NickName = RawDataBytes[offset+off_size+4:offset+off_size+4+max_bytes].decode('utf-16-le')[:-NickNameSize]
        NickName = NickName.rstrip('\x00')
        print(PlayerUId, NickName, end='')
        if NickName == name:
            print('\t\t\tFOUND')
        else:
            print('')

find_user('DKingAlpha')

@DKingAlpha
Copy link

@ShadyGame
Copy link

Got an error when trying to convert from sav to json.

Converting .sav files in ...\4790F9AF9E344A9987A3DE28B3762C72 to JSON (using uesave.exe)
Traceback (most recent call last):
File "...\convert-to-json.py", line 94, in
main()
File "...\convert-to-json.py", line 57, in main
uncompressed_data = zlib.decompress(data[12:])
^^^^^^^^^^^^^^^^^^^^^^^^^^
zlib.error: Error -3 while decompressing data: invalid stored block lengths

Env info

  • Python: 3.11.4
  • Game Ver: Steam Dedicated Server v0.1.2.0
  • Server: Ubuntu 22.04
  • Script running machine: Windows 11

i have the same error any solution ?

@Croock92
Copy link

Croock92 commented Feb 7, 2024

Got a keyerror: 'groupsavedatamap' someone can help me ? :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment