61 lines
2.7 KiB
Python
61 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Read-only evidence: sound completion uses inherited software timing, not GetStatus."""
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import struct
|
|
|
|
from pe_inspect import PE
|
|
from checkpoint_camera_audio_ui import EXE_SHA256, DLL_SHA256
|
|
|
|
ANCHORS = [
|
|
(0x10071E50, '8b461c85c0', 'duration field guards status'),
|
|
(0x10071E65, 'e8866e0800', 'status uses engine millisecond clock'),
|
|
(0x10071E7C, '8b4e1c3bc17602b301', 'strict elapsed greater than duration expires'),
|
|
(0x10071E87, '890f', 'second output is duration, not hardware status'),
|
|
(0x1003B32B, '8a9c24f4000000', 'DX repeat argument'),
|
|
(0x1003B338, '84db0f95c1516a006a0057ff5030', 'repeat boolean sent to buffer play flags'),
|
|
(0x1003B46B, '885e30', 'DX stores repeat flag at30'),
|
|
(0x1003B46E, 'd94544dc0d50541110dc0548541110', 'sound duration seconds times1000 plus.5'),
|
|
(0x1003B657, '885f30895f1c', 'DX stop clears repeat and duration'),
|
|
(0x100F8893, '8a5c2424', 'Win repeat argument'),
|
|
(0x100F8917, '885e30', 'Win stores repeat flag at30'),
|
|
(0x100F8996, 'c6463000', 'Win stop clears repeat'),
|
|
]
|
|
|
|
|
|
def collect(original):
|
|
original = Path(original)
|
|
dll = PE(original / 'OMT2.dll')
|
|
exe = PE(original / 'Neutron.exe')
|
|
if hashlib.sha256(dll.data).hexdigest() != DLL_SHA256 or hashlib.sha256(exe.data).hexdigest() != EXE_SHA256:
|
|
raise ValueError('Unsupported original identity')
|
|
result = {'anchors': [], 'vtables': [], 'constants': []}
|
|
for va, expected, label in ANCHORS:
|
|
off = dll.offset(va - dll.base)
|
|
raw = bytes.fromhex(expected)
|
|
if dll.data[off:off + len(raw)] != raw:
|
|
raise ValueError(f'Changed {label} at {va:#x}')
|
|
result['anchors'].append(dict(va=hex(va), file_offset=hex(off), bytes=expected, label=label))
|
|
for table in [0x10115420, 0x1011629C, 0x10116B3C]:
|
|
va = table + 0x14
|
|
off = dll.offset(va - dll.base)
|
|
target = dll.u32(off)
|
|
if target != 0x10071E40:
|
|
raise ValueError('SoundChannel slot14 no longer inherited software clock')
|
|
result['vtables'].append(dict(va=hex(va), file_offset=hex(off), target=hex(target)))
|
|
for va, expected in [(0x10115448, .5), (0x10115450, 1000.0)]:
|
|
off = dll.offset(va - dll.base)
|
|
actual = struct.unpack_from('<d', dll.data, off)[0]
|
|
if actual != expected:
|
|
raise ValueError('Duration constant changed')
|
|
result['constants'].append(dict(va=hex(va), file_offset=hex(off), value=actual))
|
|
return result
|
|
|
|
|
|
if __name__ == '__main__':
|
|
cli = argparse.ArgumentParser(description=__doc__)
|
|
cli.add_argument('original', type=Path)
|
|
print(json.dumps(collect(cli.parse_args().original), indent=2))
|