#!/usr/bin/env python3 """Identity-guarded Baseball evidence and bounded arithmetic projections. No original code executes. The yaw-only launch projection uses continuous host trig; source full-Euler table quantization remains a separate precision boundary. """ from __future__ import annotations import argparse from dataclasses import dataclass, replace import hashlib import json import math from pathlib import Path import struct from checkpoint_script_state import EXE_SHA256, find_case, read_va from pe_inspect import PE BODIES = ( ('constructor', 0x40fc50, 0x40fe67, 'f539ae6099b61f9f1f7007cd185f211b3165dc484cf502c80eb4b5dfc1c2ef0b'), ('pool', 0x422609, 0x4226a3, '8324ec8b6bd8d9ce6c65782611781d2a5e990e8f73359fd0403e6795ba1a9771'), ('primary', 0x426566, 0x4268b4, 'be39a4022aaaf35b9e629597bd04a50e957dcdbe8c8e64fd6ca91e7060b66565'), ('equip', 0x4296f8, 0x4297dd, '2c530179e91a377e31e9bc169c25332bf3821cec614e927d3d5bc51871d69d10'), ('cleanup', 0x42871d, 0x4287ac, '7fdcf6718f6a53a5136240894dbd8c9f840968afbf7c5e10f2d2f766da48a3dd'), ('launch', 0x429a30, 0x429c03, 'fb35366b25c4a6b1503a8028aeb354d8bbfc8d32f60a850a2fde109913e34a53'), ('ball_callbacks', 0x40fee0, 0x410020, '0b0a8ca521c8f92583a57586af945860bb21042240b72b8bc57ff13e061ac45c'), ('jimmy_contact', 0x423014, 0x423080, '997533ba4cd830f11af35b19aa926ebc52a5fce2ee394a7da2c0b82410d9b4d3'), ('aim_input', 0x438bc0, 0x438cd0, '329acdc727d4d68fcc7d2cc85dcfe408f6e18700574af891d889673a780ec7d5'), ('support_order', 0x47bb10, 0x47bba7, '7f34edef3fad0a511d8af4ff8add816d9169b8407b05f1093683969ee4a21669'), ('wall_reflection', 0x472750, 0x472970, 'cae4ae6987680cb97264a918efc33e5bdd25f3b419096d201fc948130bc52315'), ('defaults', 0x46fd90, 0x46fe49, 'c04ff2c68b8b2ce5cbee48675a54e73f85dcf3014c9b9efd93a42213c75792ab'), ('aim_art', 0x402084, 0x402107, '4a839c828fe971f0629796f8dfe5523e695a448bd5812768a74f3976071b561e'), ('stop_sound', 0x429a00, 0x429a25, '09501f7e7ec80126459cd211ad9520f65c66d1ca4c6e644781a05137d620c3fd'), ('energy_gate', 0x4269d0, 0x426a69, '0a97a24b016fa6743b518cd6ebadce5966a717b84e4ca0bdfa583bcdc65d16b5'), ) VTABLES = ( (0x4a3bdc, 0x174, 0x428d50), (0x4a3bdc, 0x178, 0x427ff0), (0x4a3bdc, 0x180, 0x429a30), (0x4a3bdc, 0x148, 0x429a00), (0x4a3bdc, 0x170, 0x437740), (0x49141c, 0x370, 0x40ff50), (0x49141c, 0x374, 0x40fee0), (0x49141c, 0x378, 0x472750), (0x49141c, 0x37c, 0x40ff80), (0x49141c, 0x3c4, 0x40ff40), (0x49141c, 0x40c, 0x410000), (0x49141c, 0x288, 0x471cc0), (0x49141c, 0x2c4, 0x471f40), ) CONSTANTS = ((0x49195c, 'f', -0.6499999761581421), (0x49fabc, 'f', 0.02222222276031971), (0x4a311c, 'f', 1800.), (0x49d5c8, 'f', 45.), (0x48d404, 'f', 30.), (0x4a3e40, 'd', 4.3), (0x4a3130, 'd', 100.), (0x495324, 'f', 20.)) def collect(original: Path | str): pe = PE(find_case(Path(original), 'Neutron.exe')) digest = hashlib.sha256(pe.data).hexdigest() if digest != EXE_SHA256: raise ValueError('Unexpected original EXE identity') bodies = [] for name, start, end, expected in BODIES: actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest() if actual != expected: raise ValueError(f'Changed source span {name}') bodies.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)), length=end-start, sha256=actual)) for table, slot, target in VTABLES: if struct.unpack('