KAZIK/tools/generators/pack_startup.py
Artvasil09 3ad5bf4c9d Develop assembly-only casino scenes and native games
Add native Durak, poker, blackjack, roulette, Buckshot and billiards scenes with animation assets and regression tests. Improve arrival, city, hall, profiles, shops, audio and exit handling; remove the portable C game core and refresh shipping executables.
2026-10-08 22:39:19 +03:00

26 lines
1 KiB
Python

"""Pack the graphical studio ident for the MASM renderer (offline only)."""
import argparse
import json
import struct
from pathlib import Path
from PIL import Image
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--source", type=Path, default=Path("assets/sprites/intro/eblan-games-v1.png"))
parser.add_argument("--output", type=Path, default=Path("assets/animations/intro/eblan-games.bin"))
args = parser.parse_args()
image = Image.open(args.source).convert("RGB")
if abs(image.width / image.height - 4 / 3) > 0.02:
raise ValueError("The intro must use a 4:3 composition, not a stretched crop")
image = image.resize((640, 480), Image.Resampling.LANCZOS).convert("RGBA")
payload = image.tobytes("raw", "BGRA")
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_bytes(struct.pack("<4sIII", b"EBG1", 640, 480, len(payload)) + payload)
print(json.dumps({"output": str(args.output), "size": args.output.stat().st_size}))
if __name__ == "__main__":
main()