#!/usr/bin/env python3 """Read-only Jimmy destination-Euler and retained air-pitch ownership evidence.""" import argparse import hashlib import json import re import struct from pathlib import Path from checkpoint_script_state import EXE_SHA256, find_case, read_va from pe_inspect import PE from retained_streamer import collect as collect_streamer REA_ID = 'ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904' SITES = ( ('constructor_forward_pitch', 0x437445, 'c785ec070000000020c2'), ('constructor_backward_pitch', 0x43744f, 'c785f007000000002041'), ('ordinary_apply_forward_pitch', 0x437fbc, 'c786ec070000000020c2'), ('ordinary_apply_backward_pitch', 0x437fc6, 'c786f007000000002041'), ('bubble_apply_forward_pitch', 0x43880a, 'c787ec070000000020c1'), ('bubble_apply_backward_pitch', 0x438814, 'c787f007000000002041'), ('destination_x', 0x472668, '898174020000'), ('destination_y', 0x472672, '899178020000'), ('destination_z', 0x472678, '89817c020000'), ('destination_marks_dirty', 0x47267e, 'c6410a01'), ('init_clears_destination_x', 0x4709ca, '898674020000'), ('init_clears_destination_y', 0x4709d0, '898678020000'), ('init_clears_destination_z', 0x4709d6, '89867c020000'), ('init_enables_facing', 0x4709e2, 'c6460501'), ('init_clears_facing_dirty', 0x4709e6, '88460a'), ('init_other_yaw_scalar', 0x4378c1, '89961c060000'), ('ground_auto_turn_destination', 0x43957c, 'ff926c030000'), ('ground_auto_destination', 0x439599, 'ff926c030000'), ('ground_ordinary_destination', 0x4395c9, 'ff936c030000'), ('air_destination', 0x439e2d, 'ff956c030000'), ('base_update_before_owner_gate', 0x43796a, 'e8e166fdff'), ('raw_owner_gate', 0x437a1b, '8b0de4995000'), ('facing_enabled_read', 0x43a433, '8a4605'), ('facing_dirty_read', 0x43a43e, '8a460a'), ('facing_clears_dirty', 0x43a44f, 'c6460a00'), ('bubble_cleanup_mode', 0x42804f, '66899ec4070000'), ('start_authored_rotation_get', 0x4239b2, 'ff9070010000'), ('start_full_rotation_set', 0x4239e6, 'ff9674010000'), ('authored_rotation_calls_current', 0x471702, 'ff9030030000'), ('current_euler_x', 0x472428, '898124020000'), ('current_euler_y', 0x472432, '899128020000'), ('current_euler_z', 0x472438, '89812c020000'), ) SLOTS = ((0x28,0x437890),(0x170,0x4716a0),(0x174,0x4716d0), (0x328,0x4723f0),(0x330,0x472420),(0x334,0x458f90), (0x36c,0x472660),(0x3d8,0x43a420),(0x410,0x42afc0)) RANGES = ((0x437890,0x4378cc),(0x437c40,0x437f7f), (0x43915d,0x4395cf),(0x439900,0x439e33), (0x472660,0x472685),(0x43a420,0x43a5cd), (0x4709c8,0x4709f8),(0x428037,0x4280cc), (0x4239a3,0x4239ec),(0x4716d0,0x471716), (0x472420,0x472441)) def collect(root, rea_disassembly=None): root=Path(root) pe=PE(find_case(root,'Neutron.exe')) if hashlib.sha256(pe.data).hexdigest()!=EXE_SHA256: raise ValueError('Unsupported original EXE identity') sites=[] for name,va,expected in SITES: actual=read_va(pe,va,len(bytes.fromhex(expected))).hex() if actual!=expected:raise ValueError(f'Changed source {name} at {va:#x}') sites.append(dict(name=name,va=hex(va),file_offset=hex(pe.offset(va-pe.base)),bytes=actual)) slots=[] for slot,target in SLOTS: actual=struct.unpack('