#!/usr/bin/env python3 """Reads and writes level WADs of "Ein Königreich für ein Lama" (Argonaut). Layout: u32 total length (excluding this field), then chunks: 4-byte tag (stored reversed, e.g. 'OFNI' = INFO), u32 length, data up to the chunk 'END '. wadtool.py list level.wad wadtool.py name level.wad new.wad "New level name" wadtool.py extract level.wad CHUNK file.bin wadtool.py replace level.wad new.wad CHUNK file.bin """ import struct import sys def read(path): d = open(path, 'rb').read() total = struct.unpack_from('