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

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
"""Native ABI/lifecycle fixtures in this Python process's own allocations; never attaches to a game."""
import argparse
import ctypes
import hashlib
import json
from pathlib import Path

p=argparse.ArgumentParser(description=__doc__)
p.add_argument('--dll',type=Path,required=True)
p.add_argument('--output',type=Path,required=True)
a=p.parse_args()
dll_path=a.dll.resolve(strict=True)
if not dll_path.is_relative_to(Path('artifacts/navigation-native-build').resolve()):
    raise SystemExit('Only the task-built standalone fixture DLL is permitted')
library=ctypes.WinDLL(str(dll_path))
checks={}
for suffix,expected in [('Observer',7),('ShipHealth',255),('LocalTargets',255),('LocalEntityDirectory',255),('OverlayLifetime',31),('ComponentLookup',63),('FsdCancellation',127),('ThrottleControl',255),('TargetLookup',63),('ActorSelection',63),('FsdReturn',3),('CommitGate',31),('OutwardThrottle',31),('RouteArguments',31),('StellarSpeed',255),('ReferenceGeometry',8191),('AdaptiveMotion',1023),('ScoopGeometry',63),('HeatNormalization',31),('ApplicationAxes',31)]:
    name=f'XFENavigation{suffix}SelfTest'
    print(f'Testing {name}',flush=True)
    function=getattr(library,name)
    function.argtypes=[]
    function.restype=ctypes.c_uint
    masks=[function() for _ in range(8)]
    checks[name]={'expected':expected,'masks':masks}
passed=all(all(mask==row['expected'] for mask in row['masks']) for row in checks.values())
result={'checks':checks,'passed':passed,'dllSha256':hashlib.sha256(dll_path.read_bytes()).hexdigest(),'processScope':'own fixture memory','gameAccess':False}
with a.output.open('x',encoding='utf-8') as out:json.dump(result,out,indent=2)
print(json.dumps(result))
raise SystemExit(0 if passed else 1)