KAZIK/tools/tests/prepare_arrival_fixtures.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

45 lines
1.5 KiB
Python

"""Deterministic old/current profile files inside the test-only workspace directory."""
import struct
from pathlib import Path
def signature(words):
value = 0x0A57C0DE
for word in words:
value = ((value << 5) | (value >> 27)) & 0xFFFFFFFF
value ^= word
value ^= value >> 16
value = (value + 0x9E3779B9) & 0xFFFFFFFF
return value
def main():
root = Path(__file__).resolve().parents[2]
target = root / "build/arrival/fixtures"
target.mkdir(parents=True, exist_ok=True)
words = [0] * 69
words[0] = 0x31435653
words[1] = 45000
words[8] = 2
words[9] = 300000
words[10] = (1 << 5) | 1
words[11] = 5
words[64] = 10
words[67] = words[68] = 1
current = struct.pack("<70I", *words, signature(words))
(target / "valid.dat").write_bytes(current)
(target / "tampered.dat").write_bytes(current[:-4] + b"\0\0\0\0")
(target / "wrong-magic.dat").write_bytes(b"BAD!" + current[4:])
(target / "truncated.dat").write_bytes(current[:15])
(target / "zero.dat").write_bytes(struct.pack("<8I", 0x31435653, 0, *([0] * 6)))
# Reset just our own repeatable creation-test file, never a real profile directory.
created = target / "FreshPlayer.dat"
if created.exists():
created.unlink()
(target / "broken-animation.bin").write_bytes(struct.pack("<4sIIII", b"ANM1",
0xFFFFFFFF, 480, 32, 16))
print("Prepared assembly profile fixtures in build/arrival/fixtures")
if __name__ == "__main__":
main()