cheahjs / palworld-save-tools

Tools for converting Palworld .sav files to JSON and back
MIT License
781 stars 67 forks source link

Transfer from Level.sav to Level.sav.json not possible #69

Closed luxx912 closed 6 months ago

luxx912 commented 6 months ago

Hi! Thank you for the great tool, it has worked very well for me a couple of times. Unfortunately, I wanted to use it right now to roll back the latest players and now converting the Level.sav to Level.sav.json does not work anymore.

That is the errorcode:

C:\Users\User\Downloads\yml_to_sav>python convert.py luggi/Level.sav --minify-json Converting luggi/Level.sav to JSON, saving to luggi/Level.sav.json Decompressing sav file Loading GVAS file Traceback (most recent call last): File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 108, in read_fstring return data.decode(encoding) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\encodings\utf_16_le.py", line 16, in decode return codecs.utf_16_le_decode(input, errors, True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 8-9: unexpected end of data decoding with 'utf-16-le' codec failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\User\Downloads\yml_to_sav\convert.py", line 118, in main() File "C:\Users\User\Downloads\yml_to_sav\convert.py", line 52, in main convert_sav_to_json(args.filename, output_path, args.minify_json) File "C:\Users\User\Downloads\yml_to_sav\convert.py", line 77, in convert_sav_to_json gvas_file = GvasFile.read(raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\gvas.py", line 124, in read gvas_file.properties = reader.read_properties_until_end() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 168, in read_properties_until_end properties[name] = self.read_property(type_name, size, f"{path}.{name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 177, in read_property value = self.read_struct(path) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 289, in read_struct value = self.read_struct_value(struct_type, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 325, in read_struct_value return self.read_properties_until_end(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 168, in read_properties_until_end properties[name] = self.read_property(type_name, size, f"{path}.{name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 174, in read_property value = self.custom_properties[path][0](self, type_name, size, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\rawdata.py", line 16, in decode_group_data group["value"]["RawData"]["value"] = decode_group_data_bytes( ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\rawdata.py", line 67, in decode_group_data_bytes "player_name": reader.read_fstring(), ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Downloads\yml_to_sav\lib\archive.py", line 110, in read_fstring raise Exception( Exception: Error decoding utf-16-le string of length 6: b'@\xdbs\xdcg g 5\xd8'

I will add the zipped Level.sav Level.zip Can you please assist?

cheahjs commented 6 months ago

If you update to v0.14.0, it should handle this case now.