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 · 12 comments
Open

Exception: Warning: EOF not reached #181

Kixel opened this issue Jul 3, 2024 · 12 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.

@GizmoTheGreen
Copy link

GizmoTheGreen commented Jul 17, 2024

Hey, perhaps you can help @wrlcke ?
I have a bit of an off problem, I haven't played since. I was runnign dedicated server the whole time, and after an update it made me create a new character, problem is the GUID is the same. (so my old character and new character somehow live in the same file??)
the older GUI fork https://github.com/JannikBirn/palworld-host-save-fix by JannikBirn DOES find both characters, Gizmo at lvl 33 and one at lvl 0. but I can't migrate since it's outdated. (EOF error, and character save is lost.)

this newer script here with your fixes doesn't find my new character, only the old, so I can't fix it? trying to compare the two scripts and figure out what is done different in the other fork but it's beyond me, since it uses an older version of the lib it seems to do things very differently.
2024.05.11-23.59.36.zip

attached zip of one of my backups that display the lv0 character in the other old GUI tool.

Any help appreciated. otherwise I'll just have to start over. lol.

Coconutat added a commit to Coconutat/palworld-host-save-fix_mod that referenced this issue Jul 18, 2024
Fix issues:xNul#181
***
By  [@wrlcke](https://github.com/wrlcke)

Co-Authored-By: wrlcke <82268354+wrlcke@users.noreply.github.com>
@wemlk
Copy link

wemlk commented Jul 19, 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.

Sorry, but I am still very new to coding anything, could you explain where I go to do these changes?

@wrlcke
Copy link

wrlcke commented Jul 22, 2024

Hey, perhaps you can help @wrlcke ? I have a bit of an off problem, I haven't played since. I was runnign dedicated server the whole time, and after an update it made me create a new character, problem is the GUID is the same. (so my old character and new character somehow live in the same file??) the older GUI fork https://github.com/JannikBirn/palworld-host-save-fix by JannikBirn DOES find both characters, Gizmo at lvl 33 and one at lvl 0. but I can't migrate since it's outdated. (EOF error, and character save is lost.)

this newer script here with your fixes doesn't find my new character, only the old, so I can't fix it? trying to compare the two scripts and figure out what is done different in the other fork but it's beyond me, since it uses an older version of the lib it seems to do things very differently. 2024.05.11-23.59.36.zip

attached zip of one of my backups that display the lv0 character in the other old GUI tool.

Any help appreciated. otherwise I'll just have to start over. lol.

@GizmoTheGreen It looks like both developers didn't think about what should be done when two saves share the same GUID. XNuls gets all GUIDs from the names of .sav files in the ./Player/ folder, while JannikBirn gets them from the data in ./Level.sav. So, there are two characters with the same GUID in ./Level.sav, but only one save in ./Player/, that's why JannikBirn's version finds both characters.

However, their migration process involves a similar approach: updating GUID information in ./Level.sav and ./player/old_guid.sav to new_guid, but that might not fix your issue since for you it just changes the GUID to the same GUID (and also delete the new_guid so your save would be lost). Sorry that I've only guessed at how their code works and haven't dug into how the save data is structured, so I'm not sure how to fix your save.

@wrlcke
Copy link

wrlcke commented Jul 22, 2024

@wemlk Just locate where you downloaded/unzipped/cloned this repository and find the file named fix_host_save.py. Open the file using an editor, find sections that looks like the code I provided, by navigating to specified line numbers or searching keywords or just browsing through the code, and edit them. If you're new to this, some steps that might seem straightforward to me could be a bit confusing. You might find it helpful to check out some coding tutorials.

@ninikhun
Copy link

hi guys i think its not working anymore do you have new solutions to correct the eof not reached when it's decoding map model py ?

File "C:\Users\jessy\AppData\Local\Programs\Python\Python312\Lib\site-packages\palworld_save_tools\rawdata\map_model.py", line 42, in decode_bytes
raise Exception("Warning: EOF not reached")
Exception: Warning: EOF not reached

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

10 participants