Kakoen / valheim-save-tools

Exports Valheim save data (maps and characters) to JSON and back, and processes them.
75 stars 8 forks source link

Error converting to json #79

Closed spackonaut closed 5 months ago

spackonaut commented 1 year ago

I get following error when converting to json. It used to work fine with the same version of java and valheim-save-tools. Just the valheim.db file was changed while playing.

java -version:

openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1) OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb11u1, mixed mode, sharing)

stdout:

WARN WARNING: world version is 31, the maximum tested world version is 27 WARN Object at 44 with size -595574258 was not fully read, -595576116 bytes remain WARN At net.kakoen.valheim.save.archive.save.Zdo.(Zdo.java:79) WARN Fixed size object at 44 was read past expected size -595574258, 595576116 extra bytes were read WARN At net.kakoen.valheim.save.archive.save.Zdo.(Zdo.java:79) WARN File not fully read, 38154174 bytes remain Exception in thread "main" java.lang.IllegalArgumentException: newPosition < 0: (-595574214 < 0) at java.base/java.nio.Buffer.createPositionException(Buffer.java:341) at java.base/java.nio.Buffer.position(Buffer.java:316) at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1516) at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:321) at java.base/java.nio.MappedByteBuffer.position(MappedByteBuffer.java:73) at net.kakoen.valheim.save.parser.ZPackage.setPosition(ZPackage.java:130) at net.kakoen.valheim.save.parser.ZPackage.readFixedSizeObject(ZPackage.java:173) at net.kakoen.valheim.save.parser.ZPackage.readLengthPrefixedObject(ZPackage.java:187) at net.kakoen.valheim.save.archive.save.Zdo.(Zdo.java:79) at net.kakoen.valheim.save.archive.ValheimSaveArchive.loadZdos(ValheimSaveArchive.java:101) at net.kakoen.valheim.save.archive.ValheimSaveArchive.(ValheimSaveArchive.java:57) at net.kakoen.valheim.cli.SaveToolsCLI.readValheimArchive(SaveToolsCLI.java:114) at net.kakoen.valheim.cli.SaveToolsCLI.main(SaveToolsCLI.java:52)

Tennessene commented 1 year ago

I also have this error. valheim-save-tools needs to be updated to support the latest world version

spackonaut commented 1 year ago

Thanks for your feedback. I tried with the latest release (v1.1.1) and it didn't help. But I also tried with a .db file from a server that is already running longer and that indeed did work. So I guess I have a somehow borked db. The valheim server is running fine though. I don't know if there was an update of valheim that changed the db. We also deleted any special characters in portal names as a wild guess try.

Kakoen commented 1 year ago

Looks like there has been a save version bump with breaking changes. I will have a look when I have some spare time. It would help me with testing if you could upload / link to a db file that fails.

spackonaut commented 1 year ago

Thanks, can I send you the file in private? Don't know what data of other people is in there.

Kakoen commented 1 year ago

I received a mail with a save to test with.

Today I've worked on experimental support for the new save file version (32). A snapshot build is available at https://github.com/Kakoen/valheim-save-tools/actions/runs/6066187151 (see artifacts section for a download of the jar)

Please check if that version works for you.

The devs seem to have optimized the space needed to store game objects. It also seems some properties have been removed. So there might be some breaking changes for the processors, but I'll have to check that another time before I release this version.

spackonaut commented 1 year ago

The new snapshot build works with my save :+1

wittrock96 commented 9 months ago

I have just this amazing Java File of yours so thank you for making it. I have a server that I was running a while back and I wanted to try and reset the world for the new updates however for some reason I still get this error when trying to run your experimental File on the DB file. I've tried it on a different DB file from another save and it worked fine but on this main file that I wanted to have edited it just gives me the following Error: INFO World version: 31 WARN File not fully read, 45190689 bytes remain Exception in thread "main" java.lang.IllegalStateException: Unable to read char at position 657890, not a valid UTF-8 character at net.kakoen.valheim.save.parser.ZPackage.readChar(ZPackage.java:322) at net.kakoen.valheim.save.archive.save.Zdo.(Zdo.java:144) at net.kakoen.valheim.save.archive.ValheimSaveArchive.loadZdos(ValheimSaveArchive.java:99) at net.kakoen.valheim.save.archive.ValheimSaveArchive.(ValheimSaveArchive.java:58) at net.kakoen.valheim.cli.SaveToolsCLI.readValheimArchive(SaveToolsCLI.java:114) at net.kakoen.valheim.cli.SaveToolsCLI.main(SaveToolsCLI.java:52)

maleneDev commented 8 months ago

I received a mail with a save to test with.

Today I've worked on experimental support for the new save file version (32). A snapshot build is available at https://github.com/Kakoen/valheim-save-tools/actions/runs/6066187151 (see artifacts section for a download of the jar)

Please check if that version works for you.

The devs seem to have optimized the space needed to store game objects. It also seems some properties have been removed. So there might be some breaking changes for the processors, but I'll have to check that another time before I release this version.

file expired, can you please re-upload it? looking forward to use your tool!

Kakoen commented 5 months ago

Closing this. The version has been released by now.