#!/usr/bin/env python3 """Guard and execute original normal callbacks on bounded synthetic actors.""" import argparse import hashlib import json from pathlib import Path import struct from dynamic_context import collect as dynamic_collect from collision_response import header from checkpoint_script_state import find_case,read_va from pe_inspect import PE from physical_registration import CLASSES from dynamic_reclip import differences CALLBACKS=(('jimmy_wall',0x42a660,0x42a714),('player_wall',0x43aa40,0x43afe3), ('base_ceiling',0x472690,0x47274a),('base_wall',0x458890,0x4588cd), ('reflection',0x472750,0x472970),('soldier_wall',0x409590,0x4095ee)) # Complete operands reviewed within individual instructions in retained REA # ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904. # A numeric scan across instruction boundaries incorrectly selected4095BE. CALLBACK_OPERANDS=( (0x42a663,0x4f0588),(0x42a678,0x4f8210),(0x42a69d,0x4f82bc), (0x42a6a3,0x4f82c0),(0x42a6b1,0x4f82bc),(0x42a6bb,0x4f82c0), (0x42a6cd,0x49d5b4),(0x43aa52,0x48e5a0),(0x43ab58,0x48d400), (0x43abd2,0x4f0668),(0x43ac25,0x48d108),(0x43ac3c,0x48e5b4), (0x43acb9,0x4f0668),(0x43ad05,0x4afd40),(0x43ad9d,0x48e5ec), (0x43adbd,0x48d400),(0x43ae4c,0x48e5ec),(0x43ae6c,0x48d400), (0x43af16,0x48d108),(0x43af30,0x48e5b4),(0x43afd1,0x4f0670), (0x4726ac,0x48d914),(0x472703,0x48d914),(0x47278f,0x48d104), (0x47279d,0x48d104),(0x4727a3,0x48d924),(0x472882,0x48d108), (0x4728b1,0x48e5b4),(0x4728bb,0x48d104),(0x4728c1,0x48d924), (0x472900,0x48e5b4),(0x47290a,0x48d914),(0x472917,0x48e5b0), (0x472924,0x48e5c4),(0x47292c,0x48e5c0),(0x472939,0x48e5c4), (0x47294a,0x4d5fd8)) GETTERS=((0x1d0,0x4718f0,'8a813c010000c3',0x13c), (0x1d8,0x471910,'8a813d010000c3',0x13d), (0x1e0,0x471930,'8a8137010000c3',0x137), (0x248,0x471ad0,'d98150010000c3',0x150), (0x260,0x471b30,'d9815c010000c3',0x15c)) SLOTS=(0x370,0x374,0x378,0x1d0,0x1d8,0x1e0,0x248,0x260,0x270,0x274,0x2b8,0x2bc,0x2c0,0x2c4) CASES=('jimmy_null','jimmy_jetpack','jimmy_ordinary_polygon','jimmy_elapsed_gate', 'jimmy_mode1','jimmy_mode2','jimmy_uncontrolled','jimmy_gadget7_inactive', 'jimmy_gadget7_equal','jimmy_gadget7_large','ceiling_positive','ceiling_negative', 'ceiling_velocity_only','ceiling_acceleration_only','generic_disabled','generic_axis', 'generic_no_damping','generic_excess_damping','generic_oblique','generic_fresh_y', 'soldier_mode0','soldier_mode10','soldier_mode10_disabled','dynamic_jimmy', 'dynamic_generic','dynamic_soldier','late_inhibition','late_radius','late_geometry','late_force') def collect(original): report=dynamic_collect(original);pe=PE(find_case(Path(original),'Neutron.exe')) for name,start,end in CALLBACKS: code=read_va(pe,start,end-start) report['bodies'].append(dict(name=name,va=hex(start),file_offset=hex(pe.offset(start-pe.base)), length=end-start,sha256=hashlib.sha256(code).hexdigest())) for va,target in CALLBACK_OPERANDS: if read_va(pe,va,4)!=struct.pack('