"""Static, bounded member-layout leads for original camera smoothing/matrix work."""
from pathlib import Path
import importlib.util,json
from capstone.x86 import X86_OP_MEM,X86_REG_RSP,X86_REG_RBP
from capstone import CS_AC_READ
spec=importlib.util.spec_from_file_location('audit',Path(__file__).with_name('Audit-GalaxyClientCompatibility.py'))
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
image=m.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
seen=set();rows=[];wanted={0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0x100,0x110,0x120}
for start,finish,unwind in image.functions:
if not 0x3A00000<=start<0x3C90000:continue
span=image.function(start)
if not span or span[0] in seen:continue
seen.add(span[0]);instructions=image.instructions(span[0],span[1]-span[0]);offsets=set();references=[]
for instruction in instructions:
for operand in instruction.operands:
if operand.type==X86_OP_MEM and operand.access&CS_AC_READ and instruction.mnemonic!='lea' and operand.mem.base not in (X86_REG_RSP,X86_REG_RBP) and operand.mem.disp in wanted:
offsets.add(operand.mem.disp);references.append(dict(rva=hex(instruction.address-image.base),instruction=instruction.mnemonic+' '+instruction.op_str))
if {0x50,0x60,0xD0,0xE0}<=offsets and len(offsets)>=6:
rows.append(dict(function=hex(span[0]),bytes=span[1]-span[0],score=len(offsets),offsets=list(map(hex,sorted(offsets))),references=references))
rows.sort(key=lambda row:(-row['score'],row['bytes']))
out=Path('artifacts/galaxy-query-research/constellations/camera-layout-leads.json');out.write_text(json.dumps(dict(scope='Static layout leads only; no implied class identity',rows=rows),indent=2)+'\n')
print(json.dumps([(r['function'],r['bytes'],r['score']) for r in rows[:35]],indent=2))
"""Static, bounded member-layout leads for original camera smoothing/matrix work."""
from pathlib import Path
import importlib.util,json
from capstone.x86 import X86_OP_MEM,X86_REG_RSP,X86_REG_RBP
from capstone import CS_AC_READ
spec=importlib.util.spec_from_file_location('audit',Path(__file__).with_name('Audit-GalaxyClientCompatibility.py'))
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
image=m.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
seen=set();rows=[];wanted={0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0x100,0x110,0x120}
for start,finish,unwind in image.functions:
if not 0x3A00000<=start<0x3C90000:continue
span=image.function(start)
if not span or span[0] in seen:continue
seen.add(span[0]);instructions=image.instructions(span[0],span[1]-span[0]);offsets=set();references=[]
for instruction in instructions:
for operand in instruction.operands:
if operand.type==X86_OP_MEM and operand.access&CS_AC_READ and instruction.mnemonic!='lea' and operand.mem.base not in (X86_REG_RSP,X86_REG_RBP) and operand.mem.disp in wanted:
offsets.add(operand.mem.disp);references.append(dict(rva=hex(instruction.address-image.base),instruction=instruction.mnemonic+' '+instruction.op_str))
if {0x50,0x60,0xD0,0xE0}<=offsets and len(offsets)>=6:
rows.append(dict(function=hex(span[0]),bytes=span[1]-span[0],score=len(offsets),offsets=list(map(hex,sorted(offsets))),references=references))
rows.sort(key=lambda row:(-row['score'],row['bytes']))
out=Path('artifacts/galaxy-query-research/constellations/camera-layout-leads.json');out.write_text(json.dumps(dict(scope='Static layout leads only; no implied class identity',rows=rows),indent=2)+'\n')
print(json.dumps([(r['function'],r['bytes'],r['score']) for r in rows[:35]],indent=2))