Skip to content

feat: add safe Level.sav editing support - #218

Open
bvoo wants to merge 1 commit into
EternalWraith:mainfrom
bvoo:feat/level-save-support
Open

feat: add safe Level.sav editing support#218
bvoo wants to merge 1 commit into
EternalWraith:mainfrom
bvoo:feat/level-save-support

Conversation

@bvoo

@bvoo bvoo commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds safe Palworld 1.0 Level.sav editing while preserving the existing GlobalPalStorage.sav workflow.

  • Loads local player Palboxes, party/travel Pals, and working/base Pals from Level.sav with matching Players/*.sav context.
  • Clones/imports Pals by updating the character map, target container slot, and guild handle together.
  • Deletes Pals only when character, container, and guild references are structurally consistent.
  • Fails closed for missing/stale player saves, full or malformed containers, player-shaped sources, duplicate IDs, and duplicate guild references.
  • Caps compressed save input and decompressed GVAS output at 512 MiB for world and player saves.
  • Writes through an exclusive same-directory temporary file, verifies the loaded target immediately before replacement, and installs with an atomic filesystem replace. A narrow race with an uncooperative external writer remains a documented platform limitation.

Save-integrity behavior

  • Capacity is bounded by SlotNum, with unique in-range slot indexes.
  • Batch imports preflight the entire operation and roll back if any insertion fails.
  • Unknown and untouched save properties remain preserved.
  • Existing backups remain part of the normal save flow.
  • Serialization is verified by compressing, decompressing, byte-comparing, fully reparsing, and serializing the reparsed GVAS again before disk replacement.

Verification

  • python -m unittest discover -v — 51 tests passed.
  • python -m compileall -q PalEdit.py palworld_pal_edit palworld_save_tools tests — passed.
  • git diff --check — passed.
  • Source GUI startup smoke test — passed.
  • Static added-line security scan — no secrets, shell execution, eval/exec, unsafe pickle, or SQL construction found.
  • Public v1_relics/Level.sav fixture:
    • no-op output was byte-identical;
    • clone output reparsed with matching character/container/guild references;
    • deleting the clone restored the original raw GVAS bytes exactly.

Packaging note

The repository's pre-existing PyInstaller one-file build still does not bundle the native ooz module. Source execution and save verification work; this PR does not claim to fix that separate packaging issue.

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

Successfully merging this pull request may close these issues.

1 participant