XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
"""Pair the original radius-gated colonisation highlight with the installed PE."""
import hashlib, importlib.util, json, struct
from pathlib import Path

spec=importlib.util.spec_from_file_location('audit',Path(__file__).with_name('Audit-GalaxyClientCompatibility.py'))
a=importlib.util.module_from_spec(spec);spec.loader.exec_module(a)
old=a.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
new=a.Image(Path('D:/SteamLibrary/steamapps/common/Elite Dangerous/Products/elite-dangerous-odyssey-64/EliteDangerous64.exe'))
hashes=[hashlib.sha256(im.raw).hexdigest() for im in (old,new)]
assert hashes==['6891f70a021fa9f3a0e00458c284f48d1226e68ae7fc02ad48081aed47857e93','ed5a8f8cd10f9a80d3bda5badd7ba1d4fcfc15996c8c7e018852cb170e264b63']
functions=[];refs=[]
for before in [0x3B428E0,0x3B26BD0,0x3B3E6F0]:
    span=old.function(before);assert span and span[0]==before
    row=a.match(old,new,before,span[1]-before);assert row['status']=='unique',row
    row['oldRva']=hex(before);functions.append(row)
    refs+=a.references(old,new,before,int(row['newRva'],16),row['length'])
scale_refs={r[1] for r in refs if r[0]==0x5192F68};assert len(scale_refs)==1
scale=scale_refs.pop()
assert struct.unpack('<f',old.data(0x5192F68,4))[0]==struct.unpack('<f',new.data(scale,4))[0]==0.03125
owner=json.loads(Path('artifacts/galaxy-query-research/colonisation-colour/compatibility.json').read_text(encoding='utf-8'))
assert owner['sourceHashes']==hashes
for row in functions[1:]:
    existing=next(r for r in owner['functions'] if r['oldRva']==row['oldRva'])
    assert existing['newRva']==row['newRva'] and existing['length']==row['length']
out=Path('artifacts/galaxy-query-research/colonisation-highlight');out.mkdir(exist_ok=True)
result=dict(sourceHashes=hashes,functions=functions,globals={hex(0x5192F68):hex(scale)},
    fields=dict(providerCentreObject='0x178',providerNavigation='0x160',radiusSquared='0x1a0',greenRgb='0x11c..0x124'),
    contract='Colonisation view only: exact original float packed-coordinate distance <= provider radiusSquared AND mode1 eligibility raw0 (classifier secondary category1). Never infer green from raw0 alone. Centre/cache/source identity and copied bytes must remain stable.',
    gameProcessAccess=False,gameCalls=0,runtimeValidated=False)
(out/'compatibility.json').write_text(json.dumps(result,indent=2)+'\n',encoding='utf-8')
print(json.dumps(dict(functions=len(functions),scaleGlobal=hex(scale),scale=0.03125)))