xNul / palworld-host-save-fix

Fixes the bug which forces a player to create a new character when they already have a save. Useful for migrating maps from co-op to dedicated servers and from one dedicated server to another.
MIT License
887 stars 68 forks source link

FileNotFoundError on old_json_path #104

Closed Mozza7 closed 5 months ago

Mozza7 commented 5 months ago

As far as I can tell I followed all the steps just fine, but getting the below error:

C:\Users\user\Desktop\deleteme>python fix-host-save.py "C:\Users\user\.cargo\bin\uesave.exe" "C:\Users\user\Desktop\deleteme\temporary\8679728E496289B6027B5BA895F11B2D" 00B0C511000000000000000000000000 00000000000000000000000000000001
WARNING: Running this script WILL change your save files and could potentially corrupt your data. It is HIGHLY recommended that you make a backup of your save folder before continuing. Press enter if you would like to continue.
>
File C:\Users\user\Desktop\deleteme\temporary\8679728E496289B6027B5BA895F11B2D/Level.sav uncompressed successfully
File C:\Users\user\Desktop\deleteme\temporary\8679728E496289B6027B5BA895F11B2D/Level.sav (type: 50) converted to JSON successfully
File C:\Users\user\Desktop\deleteme\temporary\8679728E496289B6027B5BA895F11B2D/Players/00000000000000000000000000000001.sav has an incorrect compressed length: 538973438
Converted save files to JSON
Traceback (most recent call last):
  File "C:\Users\user\Desktop\deleteme\fix-host-save.py", line 244, in <module>
    main()
  File "C:\Users\user\Desktop\deleteme\fix-host-save.py", line 80, in main
    with open(old_json_path) as f:
         ^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\Desktop\\deleteme\\temporary\\8679728E496289B6027B5BA895F11B2D/Players/00000000000000000000000000000001.sav.json'    
VictorVeom commented 5 months ago

To fix this error, you need to get or generate the file 00000000000000000000000000000001.sav, to do this you need to create a new local world and get it in a directory similar to this AppData\Local\Pal\Saved\SaveGames\76561197998204477\5C1A14084FCFF23B1EF03D98018DDE38\Players

And place it inside the players folder you are temporarily using C:\Users\user\Desktop\deleteme\temporary\8679728E496289B6027B5BA895F11B2D/Players/

Mozza7 commented 5 months ago

It is there already for me, my structure is:

C:\Users\Andrew\Desktop\deleteme\8679728E496289B6027B5BA895F11B2D\Players\
   >00000000000000000000000000000001.sav
   >00B0C511000000000000000000000000.sav

I've run it again with the same error, attached some screenshots incase I'm just being dumb or something. image

image

image

I've tried CMD in admin and outside of admin

omgomghax commented 5 months ago

Weird, seems like a permissions issue. Did you restart your pc after python installation?

Try to create a folder on your desktop, having inside the python script, uesave and your gamefolder (the folder with the big name like 2e2c3c3233464461652c3c2c613b2e2e2f). Hold Shift and Right click inside an empty spot in the folder and select Open Powershell window here.

Then paste the command

Mozza7 commented 5 months ago

I had python installed since before, I use it occasionally - only issues I've run into tend to be of my own doing.

So, I created a folder on my desktop "test" and put the game folder in (8679728E496289B6027B5BA895F11B2D in my case), which I have confirmed has 00000000000000000000000000000001.sav and 00B0C511000000000000000000000000.sav in it under Players. In the test folder, I have moved only fix-host-save.py and uesave.exe, so it looks like

8679728E496289B6027B5BA895F11B2D fix-host-save.py uesave.exe

and ran the command

python fix-host-save.py uesave.exe C:\Users\Andrew\Desktop\test\8679728E496289B6027B5BA895F11B2D 00B0C511000000000000000000000000 00000000000000000000000000000001

and got the exact same same error again. I don't see 00000000000000000000000000000001.sav.json get created at all. I have checked permissions, for SYSTEM, my user, Administrators it is full control, and for users it has all but full control and special permissions checked. My user is the owner of the file. This was done via powershell this time.

omgomghax commented 5 months ago

From the way you describe things, it could indeed be something you have messed somehow. I'd try on Windows Sandbox if you have Windows Pro (and have virtualization) or on another computer.

Or, have a try with other tools that do the same job. https://github.com/JannikBirn/palworld-host-save-fix/tree/main https://github.com/cheahjs/palworld-save-tools

EDIT: I also read your terminal, looks like you did everything right.

Mozza7 commented 5 months ago

I've just tried it on my server (separate machine, I can attempt on a virtual machine too if needed) and got the exact same result. I even tried the tool by JannikBirn but it fails too. The gui tool detects the player accounts and the levels etc, but selected to migrate my main one to a level 0 one fails. That one gives me

Exception: incorrect compressed length: 538973438

So I also tried the other tool (cheahjs') and got the same exception.

I'm guessing it's something screwy with my sav file instead, not the end of the world I wasn't incredibly far in but would have been nice to move everything over

omgomghax commented 5 months ago

Yes it appears there must be something wrong with your .sav as I was re-reading the code, and it seems your save type is 0x31 and the compression length is wrong. The error you get is actually caused because the code does not Break properly.

Mozza7 commented 5 months ago

OK so I was able to fix this, I loaded into my original co-op world and just saved again, and used JannikBirn's tool for ease of use and it's working now - something messed up in the previous save clearly. thank you