Reset cutscene facing destination with original camera rotation handoff
This commit is contained in:
1 parent
7818cc8d64
commit
dae13ace73
24 files changed
+2864
-9
No files matched your search
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only landing/idle ownership guards and bounded original-code probe."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
import subprocess
|
||||
from checkpoint_script_state import EXE_SHA256,find_case,read_va
|
||||
from pe_inspect import PE
|
||||
REA_ID='ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904'
|
||||
RANGES=((0x438bc0,0x4398f2),(0x437940,0x437c3a),(0x437c40,0x437f7f),
|
||||
(0x429910,0x429963),(0x43aff0,0x43b5a0),(0x4260a6,0x426264),
|
||||
(0x43a420,0x43a5cd),(0x458f90,0x458fb6),(0x472480,0x472570),
|
||||
(0x472660,0x472685),(0x40dd90,0x40df7c))
|
||||
SITES=(('neutral_skips_destination',0x43951e,'3bf70f84a9000000'),
|
||||
('grounded_old_mode1_helper140',0x437b12,'ff9240010000'),
|
||||
('grounded_reset_mode',0x437ba5,'66899e04070000'),
|
||||
('grounded_reset_turn',0x437bac,'899e14060000'),
|
||||
('destination_sets_dirty',0x47267e,'c6410a01'),
|
||||
('fall_impact_latch',0x4261c5,'c686981d000001'),
|
||||
('impact_latch_clear',0x42623f,'c686981d000000'))
|
||||
def collect(original,rea=None):
|
||||
p=PE(find_case(Path(original),'Neutron.exe'))
|
||||
if hashlib.sha256(p.data).hexdigest()!=EXE_SHA256:raise ValueError('Original EXE identity')
|
||||
sites=[]
|
||||
for name,va,b in SITES:
|
||||
if read_va(p,va,len(bytes.fromhex(b))).hex()!=b:raise ValueError(name)
|
||||
sites.append(dict(name=name,va=hex(va),file_offset=hex(p.offset(va-p.base)),bytes=b))
|
||||
slots=[]
|
||||
for table,slot,target in ((0x4a3bdc,0x140,0x429910),(0x4a3bdc,0xe0,0x40dd90),(0x4a373c,0x37c,0x472970),(0x4a373c,0x3d8,0x43a420),(0x4a373c,0x36c,0x472660)):
|
||||
if struct.unpack('<I',read_va(p,table+slot,4))[0]!=target:raise ValueError('Virtual binding')
|
||||
slots.append(dict(table=hex(table),slot=hex(slot),target=hex(target),file_offset=hex(p.offset(table+slot-p.base))))
|
||||
result=dict(source_sha256=EXE_SHA256,rea_evidence_id=REA_ID,sites=sites,slots=slots,
|
||||
ranges=[dict(va=hex(a),file_offset=hex(p.offset(a-p.base)),length=b-a,sha256=hashlib.sha256(read_va(p,a,b-a)).hexdigest()) for a,b in RANGES],
|
||||
scope='Static bounded path evidence; no whole-game absence proof or original gameplay observation.')
|
||||
if rea:
|
||||
r=json.loads(Path(rea).read_text())['records'][0]
|
||||
if r['evidence_id']!=REA_ID or r['subject']['digest']['sha256']!=EXE_SHA256:raise ValueError('REA identity')
|
||||
rows=[]
|
||||
for l in r['raw_result']['stdout'].splitlines():
|
||||
m=re.match(r'\s*([0-9a-f]+):',l)
|
||||
if m:rows.append((int(m[1],16),l.strip()))
|
||||
result['ground_prefix_calls']=[dict(va=hex(a),instruction=l) for a,l in rows if 0x438bc0<=a<0x43915d and '\tcall ' in l]
|
||||
return result
|
||||
|
||||
def generate(original,out,rea=None):
|
||||
original=Path(original).resolve();out=Path(out).resolve()
|
||||
if out.is_relative_to(original) or original.is_relative_to(out):raise ValueError('Separate generated output required')
|
||||
report=collect(original,rea);p=PE(find_case(original,'Neutron.exe'))
|
||||
targets={0x5099e4,0x50985e,0x50985d,0x50985f,0x4f0588}
|
||||
for a,b in ((0x43915d,0x4395cf),(0x43a420,0x43a5cd),(0x472480,0x472570)):
|
||||
asm=subprocess.run(['objdump','-d','-Mintel',f'--start-address={a}',f'--stop-address={b}',str(p.path)],capture_output=True,text=True,check=True).stdout
|
||||
targets.update(int(x,16) for x in re.findall(r'ds:0x([a-f0-9]+)',asm))
|
||||
out.mkdir(parents=True,exist_ok=True)
|
||||
body=Path(__file__).with_name('jimmy_landing_rotation_probe.c').read_text().replace('/* RELOCATIONS */',','.join(hex(t) for t in sorted(targets)))
|
||||
(out/'jimmy_landing_rotation_probe.c').write_text(body)
|
||||
(out/'source.json').write_text(json.dumps(report,indent=2)+'\n');return report
|
||||
if __name__=='__main__':
|
||||
c=argparse.ArgumentParser();c.add_argument('original',type=Path);c.add_argument('--generate-probe',type=Path);c.add_argument('--rea-disassembly',type=Path);a=c.parse_args()
|
||||
print(json.dumps(generate(a.original,a.generate_probe,a.rea_disassembly) if a.generate_probe else collect(a.original,a.rea_disassembly),indent=2))
|
||||
Reference in new issue
Block a user