MCPcopy Create free account
hub / github.com/JRickey/BattleShip / write_save

Function write_save

tools/save_editor.py:495–503  ·  view source on GitHub ↗
(path: Path, data: BackupData)

Source from the content-addressed store, hash-verified

493
494
495def write_save(path: Path, data: BackupData) -> None:
496 blob = data.pack()
497 # Build the full 32 KiB SRAM image with both slots populated.
498 out = bytearray(SRAM_FILE_SIZE)
499 out[SLOT_A_OFFSET:SLOT_A_OFFSET + BACKUP_SIZE] = blob
500 out[SLOT_B_OFFSET:SLOT_B_OFFSET + BACKUP_SIZE] = blob
501
502 path.parent.mkdir(parents=True, exist_ok=True)
503 path.write_bytes(bytes(out))
504
505
506# ---------------------------------------------------------------------------

Callers 1

cmd_writeFunction · 0.85

Calls 1

packMethod · 0.45

Tested by

no test coverage detected