367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
55 lines
3.1 KiB
Python
55 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Read-only original-engine texture lookup/request probe in the local client.
|
|
|
|
No asset install, CVar write, CASC edit or engine function pointer calls.
|
|
SetTexture's success and returned FileDataID are NOT proof of pixel loading.
|
|
"""
|
|
import argparse,json,re,secrets,time
|
|
from pathlib import Path
|
|
from client_session import Session
|
|
from console_report import parse
|
|
from native_engine_character_test import Controller,ROOT,local_listeners
|
|
from native_test_guard import require_authenticated_turtle_realm,require_local_turtle_ports
|
|
|
|
|
|
def commands(entries,run):
|
|
if not isinstance(entries,list)or not 1<=len(entries)<=4 or not re.fullmatch('[0-9a-f]{8}',run):raise ValueError('Bounded texture probe required')
|
|
seen=set()
|
|
for row in entries:
|
|
if (not isinstance(row,dict)or type(row.get('id'))is not int or not 0<row['id']<2**31 or row['id']in seen or
|
|
not isinstance(row.get('path'),str)or len(row['path'])>100 or not re.fullmatch(r'(?:spells|interface/icons)/[a-z0-9_/-]+\.blp',row['path'])or
|
|
'//'in row['path']or '..'in row['path']):raise ValueError('Unique bounded texture identity/path required')
|
|
seen.add(row['id'])
|
|
rows=['/gwdiag texture-test '+run+' '+' '.join(str(row['id'])for row in entries)]
|
|
if any(len(row)>255 for row in rows):raise ValueError('Actual macro edit limit exceeded')
|
|
return rows
|
|
|
|
|
|
def main():
|
|
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--entries',type=Path,required=True);p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
|
output=a.output.resolve()
|
|
if not output.is_relative_to(ROOT/'runtime')or output.exists()or output.with_suffix('.png').exists():p.error('Use a fresh runtime evidence path')
|
|
entries=json.loads(a.entries.read_text());run=secrets.token_hex(4);macros=commands(entries,run)
|
|
require_local_turtle_ports(local_listeners());pid=int((ROOT/'runtime/native-client.pid').read_text());c=Controller(pid);require_authenticated_turtle_realm(c.rpc('inspect-wire-account'))
|
|
saved=ROOT/'runtime/native-client/_classic_beta_/WTF/Account/SavedVariables/GatewayDiagnostics.lua';output.parent.mkdir(parents=True,exist_ok=True)
|
|
with Session(pid)as session:
|
|
session.wait_world()
|
|
try:
|
|
for macro in macros:session.macro(macro)
|
|
session.shot(output.with_suffix('.png'))
|
|
finally:
|
|
# Never submit a partial previous macro; Session cancels it first.
|
|
session.macro('/gwdiag texture-hide')
|
|
session.macro('/reload')
|
|
def observed():
|
|
try:
|
|
value=parse(saved.read_text()).get('textureProbe',{})
|
|
return value if value.get('run')==run else None
|
|
except (OSError,ValueError):return None
|
|
value=c.wait(observed,15)
|
|
report=dict(kind='original-native-texture-request-probe',pid=pid,external_gateway_running=False,local_only=True,results=value,client_assets_modified=False,cvars_modified=False,payload_loaded_verified=False,visual_review_required=True)
|
|
output.write_text(json.dumps(report,indent=2)+'\n');print(json.dumps(report,indent=2))
|
|
|
|
|
|
if __name__=='__main__':main()
|