Skip to content

Commit

Permalink
fix: don't error out on not reading eof for item containers (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheahjs committed Apr 5, 2024
1 parent 2094fa8 commit c004d0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion palworld_save_tools/rawdata/item_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def decode_bytes(
"item_static_ids": reader.tarray(lambda r: r.fstring()),
}
if not reader.eof():
raise Exception("Warning: EOF not reached")
data["trailing_unparsed_data"] = [b for b in reader.read_to_end()]
return data


Expand All @@ -51,5 +51,7 @@ def encode_bytes(p: dict[str, Any]) -> bytes:
writer.tarray(
lambda w, d: (w.fstring(d), None)[1], p["permission"]["item_static_ids"]
)
if "trailing_unparsed_data" in p:
writer.write(bytes(p["trailing_unparsed_data"]))
encoded_bytes = writer.bytes()
return encoded_bytes

0 comments on commit c004d0c

Please sign in to comment.