Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Warning: EOF not reached #181

Open
Kixel opened this issue Jul 3, 2024 · 7 comments
Open

Exception: Warning: EOF not reached #181

Kixel opened this issue Jul 3, 2024 · 7 comments

Comments

@Kixel
Copy link

Kixel commented Jul 3, 2024

535B443E41FFDEC2FDD2948D25DAC75F.zip
This save file will trigger this exception:
image
I updated palworld-save-tools to 0.23.0, still no dice.
I mentioned this issue here as well:
cheahjs/palworld-save-tools#178 (comment)

@tsayao
Copy link

tsayao commented Jul 3, 2024

Level.zip

Also happens to me.

@etopsirhc
Copy link

same issue here, also late game save with all but one person over level 40
462706A34B5CFD58551E0AB5A008F56D.zip

@inspectorgadjet7
Copy link

I have the same issue too, but I figured out a manual workaround.

First, I manually converted Level.sav and the player .sav files to json using the palworld save tools.

Then I updated the script to change level_sav_path to level_json_path and old_sav_path to old_json path here:

    # Convert save files to JSON so it is possible to edit them.
    level_json = sav_to_json(level_json_path)
    old_json = sav_to_json(old_json_path)

And then I changed the sav_to_json function to this (original code commented so I could change it back):

def sav_to_json(filepath):
    print(f'Converting {filepath} to JSON...', end='', flush=True)
#    with open(filepath, 'rb') as f:
#        data = f.read()
#        raw_gvas, _ = decompress_sav_to_gvas(data)
#    gvas_file = GvasFile.read(
#        raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES, allow_nan=True
#    )
#    json_data = gvas_file.dump()
    f = open(filepath)
    json_data = json.load(f)
    print('Done!', flush=True)
    return json_data

After that I ran the script and it worked. I then removed the .json files that I converted at the start.

It's not ideal, but until the script is fixed hopefully this can help someone else too.

@xtian525
Copy link

xtian525 commented Jul 8, 2024

I have the same issue too, but I figured out a manual workaround.

First, I manually converted Level.sav and the player .sav files to json using the palworld save tools.

Then I updated the script to change level_sav_path to level_json_path and old_sav_path to old_json path here:

    # Convert save files to JSON so it is possible to edit them.
    level_json = sav_to_json(level_json_path)
    old_json = sav_to_json(old_json_path)

And then I changed the sav_to_json function to this (original code commented so I could change it back):

def sav_to_json(filepath):
    print(f'Converting {filepath} to JSON...', end='', flush=True)
#    with open(filepath, 'rb') as f:
#        data = f.read()
#        raw_gvas, _ = decompress_sav_to_gvas(data)
#    gvas_file = GvasFile.read(
#        raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES, allow_nan=True
#    )
#    json_data = gvas_file.dump()
    f = open(filepath)
    json_data = json.load(f)
    print('Done!', flush=True)
    return json_data

After that I ran the script and it worked. I then removed the .json files that I converted at the start.

It's not ideal, but until the script is fixed hopefully this can help someone else too.

I had the same issue but this manual workaround worked for me.

@CorLeonas
Copy link

I have the same issue too, but I figured out a manual workaround.

First, I manually converted Level.sav and the player .sav files to json using the palworld save tools.

Then I updated the script to change level_sav_path to level_json_path and old_sav_path to old_json path here:

    # Convert save files to JSON so it is possible to edit them.
    level_json = sav_to_json(level_json_path)
    old_json = sav_to_json(old_json_path)

And then I changed the sav_to_json function to this (original code commented so I could change it back):

def sav_to_json(filepath):
    print(f'Converting {filepath} to JSON...', end='', flush=True)
#    with open(filepath, 'rb') as f:
#        data = f.read()
#        raw_gvas, _ = decompress_sav_to_gvas(data)
#    gvas_file = GvasFile.read(
#        raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES, allow_nan=True
#    )
#    json_data = gvas_file.dump()
    f = open(filepath)
    json_data = json.load(f)
    print('Done!', flush=True)
    return json_data

After that I ran the script and it worked. I then removed the .json files that I converted at the start.

It's not ideal, but until the script is fixed hopefully this can help someone else too.

I'm a little confused with how to do this. I'm not sure where to update the script and what function you're changing. Could you provide a step by step guide? I apologize for my lack of knowledge

@inspectorgadjet7
Copy link

Hi.

The code above is pretty much a guide. you find the lines that match in the script, and make them look like the lines I shared.

E.g. look for level_json = sav_to_json(level_sav_path) and change the level_sav_path bit to level_json_path, etc.

The function being changed is the sav_to_json function. The line that says def sav_to_json(filepath): is the start of the function.

Hope that helps.

@wrlcke
Copy link

wrlcke commented Jul 14, 2024

Thank you @inspectorgadjet7 for suggesting the workaround. I reviewed the latest changes in the palworld-save-tools repository and found that it simply removed some newly ineffective DISABLED_PROPERTIES, defined as follows, when passing PALWORLD_CUSTOM_PROPERTIES.

# List of properties that are not working with newer versions
DISABLED_PROPERTIES = {
    ".worldSaveData.BaseCampSaveData.Value.ModuleMap",
    ".worldSaveData.MapObjectSaveData",
}

@CorLeonas To apply the fix, you only need to modify two places in the fix_host_save.py file:

  1. Change the import statement (line 9 in fix_host_save.py) to include DISABLED_PROPERTIES:
from palworld_save_tools.paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS, DISABLED_PROPERTIES
  1. Adjust the sav_to_json function (starting from line 125 in fix_host_save.py) as follows:
def sav_to_json(filepath):
    print(f'Converting {filepath} to JSON...', end='', flush=True)
    with open(filepath, 'rb') as f:
        data = f.read()
        raw_gvas, _ = decompress_sav_to_gvas(data)     
    # gvas_file = GvasFile.read(
    #     raw_gvas, PALWORLD_TYPE_HINTS, PALWORLD_CUSTOM_PROPERTIES, allow_nan=True
    # )
    custom_properties = {prop: PALWORLD_CUSTOM_PROPERTIES[prop] for prop in set(PALWORLD_CUSTOM_PROPERTIES) - DISABLED_PROPERTIES}
    gvas_file = GvasFile.read(
        raw_gvas, PALWORLD_TYPE_HINTS, custom_properties, allow_nan=True
    )
    json_data = gvas_file.dump()
    print('Done!', flush=True)
    return json_data

These changes will implement the necessary adjustments to the fix_host_save.py file as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants