"""Check an actual VPK exported by the native Windows editor.""" import hashlib import io import json from pathlib import Path import struct import zipfile import xml.etree.ElementTree as ET from PIL import Image ROOT = Path(__file__).resolve().parents[4] OUT = ROOT / "editor-vita-integrado" vpk = OUT / "Exports/Exemplo.vpk" with zipfile.ZipFile(OUT / "vita/templates/vita_release.zip") as template, zipfile.ZipFile(vpk) as exported: assert exported.testzip() is None manifest = json.loads(template.read("vita-template.json")) for name in ("eboot.bin", "libgodot.so", "boot_anim.dat"): assert hashlib.sha256(exported.read(name)).hexdigest() == manifest["sha256"][name] for name, size in (("sce_sys/icon0.png", (128,128)), ("sce_sys/livearea/contents/bg0.png", (840,500)), ("sce_sys/livearea/contents/startup.png", (280,158))): raw = exported.read(name) assert raw[24:26] == bytes([8, 3]) image = Image.open(io.BytesIO(raw)) assert image.size == size image.verify() assert ET.fromstring(exported.read("sce_sys/livearea/contents/template.xml")).get("style") == "a5" assert exported.read("gxm_texture_format.cfg") == b"RGBA4444\n" assert manifest['external_game_data'] is True assert exported.read('game_data_folder.cfg') == b'exemplovita' assert not any(n.startswith('game_data/') for n in exported.namelist()) game = OUT / 'Exports/exemplovita' assert (game/'project.binary').is_file() assert list(game.rglob('*.ctex')) assert not (game/'addons/psvita').exists() raw = exported.read("sce_sys/param.sfo") assert struct.unpack_from("