367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
28 lines
1.6 KiB
Python
28 lines
1.6 KiB
Python
"""Observe original EnterWorld realm comparison; public routing scalars only."""
|
|
import os,struct
|
|
from pathlib import Path
|
|
ENTRY=0x142429ba0
|
|
PREFIX=bytes.fromhex('48895c2410574883ec20')
|
|
def capture(pid,registers):
|
|
fd=os.open(f'/proc/{pid}/mem',os.O_RDONLY)
|
|
try:
|
|
def read(address,size):
|
|
if size not in (1,4,8):raise ValueError('Fixed public scalar sizes only')
|
|
data=os.pread(fd,size,address)
|
|
if len(data)!=size:raise ValueError('Incomplete public scalar')
|
|
return data
|
|
owner=struct.unpack('<Q',read(0x145e7a098,8))[0]
|
|
selected=struct.unpack('<I',read(registers.rcx,4))[0]
|
|
callback=struct.unpack('<Q',read(registers.rdx,8))[0]
|
|
# Original character-login caller's fixed code page, no closure data.
|
|
code=os.pread(fd,4096,0x1423f9000)
|
|
path=Path(__file__).resolve().parents[1]/'runtime/native-handler-code/1423f9000.bin'
|
|
if len(code)==4096 and (not path.exists() or path.read_bytes()==code):path.write_bytes(code);path.chmod(0o600)
|
|
return dict(kind='original-world-realm-comparison',selected_virtual_realm=hex(selected),
|
|
continuation_callback=hex(callback) if 0x140001000<=callback<0x144a00000 else None,
|
|
current_virtual_realm=hex(struct.unpack('<I',read(owner+0x898,4))[0]),
|
|
connected=bool(read(owner+0xc49,1)[0]),realm_change_pending=bool(read(owner+0xc4a,1)[0]),
|
|
engine_state=struct.unpack('<I',read(owner+0x98,4))[0],
|
|
authentication_buffers_read=False,engine_calls_made=False)
|
|
finally:os.close(fd)
|