Trace post-skip tilt and gate gameplay changes on original lifecycle recovery
This commit is contained in:
1 parent
a2e89c625a
commit
68154dffce
15 files changed
+752
-6
No files matched your search
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only source ordering and actual lab camera graph; no gameplay mutation."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
from checkpoint_script_state import EXE_SHA256, find_case, read_va, rel_call_target
|
||||
from pe_inspect import PE
|
||||
import gam
|
||||
|
||||
REA_ID = 'ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904'
|
||||
CALLS = (('physics before registry', 0x47e554, 0x479bc0),
|
||||
('registry callbacks', 0x47e582, 0x473740),
|
||||
('dynamic contact notification', 0x479c83, 0x47a430),
|
||||
('AI trigger base contact', 0x40c209, 0x470a90),
|
||||
('AI trigger synchronous action', 0x40c21f, 0x40c300),
|
||||
('Carl inherited AI before talk', 0x41b95d, 0x408000))
|
||||
SITES = (('first dynamic enter', 0x47a555, 'ff5040'),
|
||||
('second dynamic enter', 0x47a578, 'ff5240'),
|
||||
('registry per-object update', 0x473758, 'ff5010'),
|
||||
('Carl talk in ordinary actor update', 0x41b988, 'ff9240010000'),
|
||||
('MCA shot complete', 0x430ed8, 'ff92e4000000'),
|
||||
('MCA skip input-latch write', 0x430f37, 'c680001e000001'),
|
||||
('MCA shared skip flag', 0x430f3e, 'c605e4834f0001'),
|
||||
('MCA skip finish', 0x431012, 'ff90e4000000'),
|
||||
('CAM skip input-latch write', 0x41613b, 'c680001e000001'),
|
||||
('CAM shared skip flag', 0x416142, 'c605e4834f0001'),
|
||||
('DEFAULT clears shared skip', 0x447f89, 'c605e4834f0000'))
|
||||
SLOTS = (('AI trigger enter, game interface+C8', 0x48f8c0, 0x40, 0x40c200),
|
||||
('Carl enter, game interface+C0', 0x495364, 0x40, 0x40a3c0),
|
||||
('Carl update', 0x495364, 0x3c4, 0x41b950),
|
||||
('CAM update, game interface+C8', 0x497bfc, 0x3c4, 0x415f90),
|
||||
('MCA update, game interface+C8', 0x4a8f64, 0x3c4, 0x430da0),
|
||||
('MCA finish, complete table', 0x4a93c8, 0xe4, 0x4311f0))
|
||||
RANGES = ((0x47e554, 0x47e58c), (0x479c7e, 0x479c8c),
|
||||
(0x47a488, 0x47a57c), (0x40c200, 0x40c227),
|
||||
(0x41b950, 0x41b98e), (0x41b7b0, 0x41b810),
|
||||
(0x473740, 0x473768), (0x430da0, 0x430ef2),
|
||||
(0x430eed, 0x431027), (0x4160f1, 0x4161cd),
|
||||
(0x447f73, 0x447fc5))
|
||||
FIELDS = {'ObjectTag','NextTrigger','PlayerControlled','DeactivateInv','AITarget',
|
||||
'AIAnim','AIState','AINewPos','AINewRotY','AIHideObj','ActivateBy',
|
||||
'ActivateByAnim','TaskName','TimesToTrigger','TouchActivated',
|
||||
'TargetActAnim','TargetDeactAnim','FaceObject'}
|
||||
|
||||
|
||||
def collect(original, rea=None):
|
||||
original = Path(original)
|
||||
pe = PE(find_case(original, 'Neutron.exe'))
|
||||
if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256:
|
||||
raise ValueError('Unexpected original executable')
|
||||
calls=[]
|
||||
for name, va, target in CALLS:
|
||||
if rel_call_target(pe,va) != target:
|
||||
raise ValueError(name)
|
||||
calls.append(dict(name=name,va=hex(va),file_offset=hex(pe.offset(va-pe.base)),target=hex(target)))
|
||||
sites=[]
|
||||
for name,va,expected in SITES:
|
||||
if read_va(pe,va,len(bytes.fromhex(expected))).hex()!=expected:
|
||||
raise ValueError(name)
|
||||
sites.append(dict(name=name,va=hex(va),file_offset=hex(pe.offset(va-pe.base)),bytes=expected))
|
||||
slots=[]
|
||||
for name,table,slot,target in SLOTS:
|
||||
if struct.unpack('<I',read_va(pe,table+slot,4))[0]!=target:
|
||||
raise ValueError(name)
|
||||
slots.append(dict(name=name,table=hex(table),slot=hex(slot),target=hex(target),
|
||||
file_offset=hex(pe.offset(table+slot-pe.base))))
|
||||
gam_path=find_case(original,'gam/level1b.gam')
|
||||
level=gam.parse(gam_path.read_bytes())
|
||||
by={}
|
||||
for index,e in enumerate(level.entities):
|
||||
by.setdefault(str(e.values().get('ObjectTag','')).casefold(),(index,e))
|
||||
route=[]
|
||||
pending=['teleportexplanation','neutron1a'];seen=set()
|
||||
while pending:
|
||||
tag=pending.pop(0).casefold()
|
||||
if tag in seen or tag in ('none','default'):continue
|
||||
seen.add(tag)
|
||||
index,e=by[tag];v=e.values()
|
||||
route.append(dict(index=index,kind=e.kind,offset=hex(e.offset),fields={k:x for k,x in v.items()
|
||||
if k in FIELDS or k.startswith(('ActivateState','ActivateObject','CameraTarget','TargetAnim'))}))
|
||||
pending.extend(str(x) for k,x in v.items() if k=='NextTrigger' or k.startswith('ActivateObject'))
|
||||
result=dict(source_sha256=EXE_SHA256,rea_evidence_id=REA_ID,calls=calls,sites=sites,slots=slots,
|
||||
ranges=[dict(va=hex(a),file_offset=hex(pe.offset(a-pe.base)),length=b-a,
|
||||
sha256=hashlib.sha256(read_va(pe,a,b-a)).hexdigest()) for a,b in RANGES],
|
||||
gam_sha256=hashlib.sha256(gam_path.read_bytes()).hexdigest(),route=route,
|
||||
scope='Static source and data partial order; no runtime chain, full registry or causal fix proven.')
|
||||
if rea:
|
||||
record=next(r for r in json.loads(Path(rea).read_text())['records'] if r['evidence_id']==REA_ID)
|
||||
if record['subject']['digest']['sha256']!=EXE_SHA256:raise ValueError('REA identity mismatch')
|
||||
rows=[]
|
||||
for line in record['raw_result']['stdout'].splitlines():
|
||||
m=re.match(r'\s*([0-9a-f]+):',line)
|
||||
if m:rows.append((int(m[1],16),line))
|
||||
result['rea_extracts']={hex(a):'\n'.join(l for va,l in rows if a<=va<b)+'\n' for a,b in RANGES}
|
||||
return result
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
cli=argparse.ArgumentParser(description=__doc__)
|
||||
cli.add_argument('original',type=Path)
|
||||
cli.add_argument('--rea-disassembly',type=Path)
|
||||
args=cli.parse_args()
|
||||
print(json.dumps(collect(args.original,args.rea_disassembly),indent=2))
|
||||
@@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only guards for cutscene completion and the first resumed Jimmy input.
|
||||
|
||||
This inventories exact original boundaries. It does not project a hypothetical
|
||||
state reset or certify the original whole-frame schedule.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
|
||||
from checkpoint_script_state import EXE_SHA256, find_case, read_va
|
||||
from pe_inspect import PE
|
||||
|
||||
REA_ID = 'ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904'
|
||||
RANGES = (
|
||||
('control pointer setter', 0x475a40, 0x475a4c),
|
||||
('DEFAULT Jimmy control and camera restore', 0x447d34, 0x447fc5),
|
||||
('MCA completion', 0x4311f0, 0x43127f),
|
||||
('Jimmy script cleanup', 0x42ae00, 0x42ae29),
|
||||
('gadget cleanup prelude', 0x427ff0, 0x428037),
|
||||
('gadget cleanup common epilogue and dispatch table', 0x42882f, 0x428864),
|
||||
('menu selection callback', 0x405fb0, 0x4061a0),
|
||||
('menu resource close', 0x406590, 0x406645),
|
||||
('Jimmy active input guards', 0x426030, 0x4260a6),
|
||||
('movement input dispatch', 0x438a60, 0x438ba2),
|
||||
('player raw identity and movement dispatch', 0x437a15, 0x437c33),
|
||||
('neutral keyboard air-turn recovery', 0x439989, 0x439a69),
|
||||
('ordinary air target publication', 0x439db7, 0x439e33),
|
||||
)
|
||||
SITES = (
|
||||
('control pointer store', 0x475a44, 'a3e4995000'),
|
||||
('DEFAULT control grant', 0x447e27, 'ff9018010000'),
|
||||
('MCA named control grant', 0x431222, 'ff9218010000'),
|
||||
('cleanup unsigned raw-mode rejection', 0x428027, '83f8070f87ff070000'),
|
||||
('cleanup common selected-gadget reset', 0x428832, '66c70588054f00ffff'),
|
||||
('input-global suppression', 0x426062, 'a030844f00'),
|
||||
('input-actor suppression', 0x42606f, '8a862d1d0000'),
|
||||
('camera-bump dispatch gate', 0x438ab3, 'd986c8070000'),
|
||||
('input dispatch reads stored movement mode', 0x438b1e, '0fbf8604070000'),
|
||||
('air input dispatch', 0x438b76, 'ff9228010000'),
|
||||
('grounded mode reset', 0x437ba5, '66899e04070000'),
|
||||
('grounded turn reset', 0x437bac, '899e14060000'),
|
||||
)
|
||||
SLOTS = (
|
||||
('Jimmy ground input', 0x4a3bdc, 0x124, 0x438bc0),
|
||||
('Jimmy air input', 0x4a3bdc, 0x128, 0x439900),
|
||||
('Jimmy alternate input', 0x4a3bdc, 0x12c, 0x43a120),
|
||||
('Jimmy ground apply', 0x4a3bdc, 0x130, 0x437c40),
|
||||
('Jimmy air apply', 0x4a3bdc, 0x134, 0x437f90),
|
||||
('Jimmy landing helper', 0x4a3bdc, 0x140, 0x429910),
|
||||
('Jimmy active input callback', 0x4a373c, 0x3cc, 0x426030),
|
||||
('Jimmy frame callback', 0x4a373c, 0x3c4, 0x424600),
|
||||
('Jimmy cleanup', 0x4a373c, 0x438, 0x42ae00),
|
||||
('Lab control setter', 0x4c3cd0, 0x118, 0x475a40),
|
||||
('VR04 control setter', 0x4ce910, 0x118, 0x475a40),
|
||||
('Outside control setter', 0x4c5a80, 0x118, 0x475a40),
|
||||
)
|
||||
|
||||
|
||||
def collect(original, rea=None):
|
||||
pe = PE(find_case(Path(original), 'Neutron.exe'))
|
||||
if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256:
|
||||
raise ValueError('Unexpected original executable')
|
||||
sites = []
|
||||
for name, va, expected in SITES:
|
||||
actual = read_va(pe, va, len(bytes.fromhex(expected))).hex()
|
||||
if actual != expected:
|
||||
raise ValueError(f'Changed {name} at {va:#x}: {actual}')
|
||||
sites.append(dict(name=name, va=hex(va), file_offset=hex(pe.offset(va-pe.base)), bytes=actual))
|
||||
slots = []
|
||||
for name, table, slot, expected in SLOTS:
|
||||
actual, = struct.unpack('<I', read_va(pe, table+slot, 4))
|
||||
if actual != expected:
|
||||
raise ValueError(f'Changed {name} binding')
|
||||
slots.append(dict(name=name, table=hex(table), slot=hex(slot), target=hex(actual),
|
||||
file_offset=hex(pe.offset(table+slot-pe.base))))
|
||||
dispatch, = struct.unpack('<I', read_va(pe, 0x428844 + 3*4, 4))
|
||||
if dispatch != 0x42882f:
|
||||
raise ValueError('Jetpack cleanup no longer targets common epilogue')
|
||||
result = dict(source_sha256=EXE_SHA256, rea_evidence_id=REA_ID, sites=sites, slots=slots,
|
||||
raw3_cleanup_target=hex(dispatch),
|
||||
ranges=[dict(name=name, va=hex(a), file_offset=hex(pe.offset(a-pe.base)), length=b-a,
|
||||
sha256=hashlib.sha256(read_va(pe, a, b-a)).hexdigest())
|
||||
for name, a, b in RANGES],
|
||||
scope='Static exact boundaries; no original completion-frame execution or proven remedy for post-cutscene tilt.')
|
||||
if rea:
|
||||
records = json.loads(Path(rea).read_text())['records']
|
||||
record = next(r for r in records if r['evidence_id'] == REA_ID)
|
||||
if record['subject']['digest']['sha256'] != EXE_SHA256:
|
||||
raise ValueError('Retained REA subject mismatch')
|
||||
rows = []
|
||||
for line in record['raw_result']['stdout'].splitlines():
|
||||
match = re.match(r'\s*([0-9a-f]+):', line)
|
||||
if match:
|
||||
rows.append((int(match[1], 16), line))
|
||||
result['rea_extracts'] = {name: '\n'.join(line for va, line in rows if a <= va < b) + '\n'
|
||||
for name, a, b in RANGES}
|
||||
if any(not value.strip() for value in result['rea_extracts'].values()):
|
||||
raise ValueError('Retained REA lacks an inspected boundary')
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli = argparse.ArgumentParser(description=__doc__)
|
||||
cli.add_argument('original', type=Path)
|
||||
cli.add_argument('--rea-disassembly', type=Path)
|
||||
args = cli.parse_args()
|
||||
print(json.dumps(collect(args.original, args.rea_disassembly), indent=2))
|
||||
Reference in new issue
Block a user