#!/usr/bin/env python3 """Guarded Rocketship ownership/attachment evidence and bounded projections. Reads originals without executing them. Projections describe loader selection, engine transitions and the normal impact tail; they are not live-game probes. """ from __future__ import annotations import argparse 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 ROCKET_ID = 0x33524f43 BODIES = ( ('owned_setup',0x422420,0x4224ee,'97380f20076b8ff8851f74727fc17d3ba41b2c2b7e56c16bd410baf031fe3898'), ('ship_ctor',0x43d840,0x43da40,'33d27053c2070f0c278bf3e14808d16c4479893d1ccb16c1ac8e199dfd9e53ba'), ('postload',0x43db10,0x43dcf4,'af2007e942ed715ce8dd03bb725a7ab10bb536444a88f227c25f83527d18c15b'), ('ship_update',0x43df70,0x43e7db,'707073786f6b19d6f77624ba4804376685652cfbd6dc3443143ca533e266de09'), ('engine',0x43ea80,0x43eb31,'c154bb368050f16079288ee806be45879b219d2de7446672d7b1eb60d572ea09'), ('class_id',0x462220,0x46222e,'8ae2a2a865683cb6583081b67d18ed787f53e6eeb3266a24bd6b9ed46df0ad80'), ('reuse',0x46e6a0,0x46e70c,'bd2f9447ddcfbce9c1a58382d027a7450ea898ebd616d81a581a3ba5c9d5df8f'), ('mount',0x42944d,0x429686,'2e8e15c52bf02a06afe2a56ccf8b31551368aefcde046c444ddb01a3ef978c70'), ('cleanup',0x4284fb,0x42871d,'0474c58185373ce9e7a546ddaf47790bbb5193ecaa4fc9223bbecef9eead2c21'), ('rider_damage',0x42a870,0x42a8c7,'59bfbe871fba2dea6bdbfca97db6fa8296db51b8b561582cda69f68ca7021efd'), ('jimmy_drive_alias',0x422b04,0x422b18,'12f09afaef07ba842d5b0897ac8bba5223a4b59a9e58d7b4bc38f55c61955d89'), ('dog_rock_alias',0x41ce2c,0x41ce40,'94fe59a673561374f0f3b3ec1b6dd1eb8dabbdc45e926c0463e670a616df56af'), ('engine_input',0x41ab12,0x41ac0e,'ec4cf4afb58528ca0baf325869ad78d9d6753ab13efdd5a95b2b815bf5f5bbc8'), ('control_store',0x475a40,0x475a4c,'d397cb6847c4ff58e32aac989afc348612b5285a4f03538ea6c016a4fdddda3c'), ('dynamic_inhibit',0x471940,0x47194d,'fa5b69a6074a26a0b8dd535d288645d2875039673639282571e029a60479cd37'), ) def f32(value): return struct.unpack('duration: active=impulse_flag=False scale=(1.,1.,1.,1.) drive=True else: pulse=f32((math.sin(source_time*20.)+1.)*.5) scale=(1.,pulse,pulse,1.) if drive_burst:impulses.append(-750.) return dict(active=active,timer=timer,impulse_flag=impulse_flag,scale=scale, select_drive=drive,queued_y=impulses) def impact_probe_source(original): collect(original) pe=PE(find_case(Path(original),'Neutron.exe')) code=read_va(pe,0x43e6e8,0x43e7db-0x43e6e8) pairs=[] for target in (0x495324,0x492a58,0x48e5d0): encoded=struct.pack(' #include #include #include #include #define TC __attribute__((thiscall)) #define AT(a) (mapped+(a)-0x400000) #define F(g,o) (*(float*)((g)+(o))) static unsigned char*mapped,*thunk,object[0x1000],rider[0x200],render[0x100]; static uintptr_t table[0x400/4],rider_table[0x200/4]; static int selected,impulse_count;static float impulses[4]; static void require(int ok,const char*what){if(!ok){fprintf(stderr,"FAIL %s\n",what);exit(2);}} static void TC missing(void*self){(void)self;require(0,"unexpected virtual");} static void TC select_drive(void*self,const char*name,int restart){(void)self;(void)name;(void)restart;selected++;} static void TC impulse(void*self,float x,float y,float z){(void)self;require(x==0&&z==0&&impulse_count<4,"impulse shape");impulses[impulse_count++]=y;} static void map_copy(void){ mapped=VirtualAlloc(NULL,0x299000,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);require(mapped!=NULL,"map source"); FILE*f=fopen("Neutron.exe","rb");require(f!=NULL,"copied EXE");fseek(f,0,SEEK_END);long size=ftell(f);rewind(f);require(size==1019904,"source size"); unsigned char*d=malloc(size);require(d!=NULL,"source buffer");require(fread(d,1,size,f)==(size_t)size,"read source");fclose(f); require(*(uint16_t*)d==IMAGE_DOS_SIGNATURE,"DOS");uint32_t off=*(uint32_t*)(d+0x3c);require(off<(uint32_t)size-sizeof(IMAGE_NT_HEADERS32),"NT bounds"); IMAGE_NT_HEADERS32*nt=(void*)(d+off);require(nt->Signature==IMAGE_NT_SIGNATURE&&nt->FileHeader.Machine==IMAGE_FILE_MACHINE_I386&&nt->OptionalHeader.ImageBase==0x400000&&nt->OptionalHeader.SizeOfImage==0x299000,"PE identity"); IMAGE_SECTION_HEADER*s=IMAGE_FIRST_SECTION(nt);require((unsigned char*)(s+nt->FileHeader.NumberOfSections)<=d+size,"section table"); for(unsigned i=0;iFileHeader.NumberOfSections;i++){require((uint64_t)s[i].PointerToRawData+s[i].SizeOfRawData<=(uint64_t)size&&(uint64_t)s[i].VirtualAddress+s[i].SizeOfRawData<=0x299000,"section bounds");memcpy(mapped+s[i].VirtualAddress,d+s[i].PointerToRawData,s[i].SizeOfRawData);}free(d); static const struct{uint32_t va,target;} patches[]={/* RELOCATIONS */}; for(unsigned i=0;i