367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
46 lines
2.7 KiB
Python
46 lines
2.7 KiB
Python
"""Observed Octo object-cache prefixes, never a native-template converter."""
|
|
import argparse
|
|
from collections import Counter
|
|
import hashlib,json,struct
|
|
from pathlib import Path
|
|
from classic_query_cache import read_classic_query_cache
|
|
|
|
|
|
def read_gameobject_cache_prefix(path):
|
|
raw,records=read_classic_query_cache(path,signature=b'BOGW')
|
|
rows=[];holds=[]
|
|
for entry,body in records:
|
|
try:
|
|
if len(body)<8:raise ValueError('Truncated cached query prefix')
|
|
kind,display=struct.unpack_from('<II',body);cursor=8;labels=[]
|
|
for _ in range(5):
|
|
end=body.find(b'\0',cursor,min(cursor+1025,len(body)))
|
|
if end<0:raise ValueError('Unterminated cached query string')
|
|
labels.append(body[cursor:end].decode('utf-8'));cursor=end+1
|
|
if not labels[0]:raise ValueError('Cached object has no name')
|
|
if cursor+96!=len(body):raise ValueError('Unreviewed cached query data length')
|
|
words=struct.unpack_from('<24I',body,cursor)
|
|
rows.append(dict(entry=entry,type=kind,display_id=display,names=labels[:4],
|
|
extra_string=labels[4],data24_source_wire_words=list(words),
|
|
cached_payload_sha256=hashlib.sha256(body).hexdigest(),cached_body_bytes=len(body)))
|
|
except (ValueError,UnicodeDecodeError,struct.error)as error:
|
|
holds.append(dict(entry=entry,reason=str(error),cached_body_bytes=len(body),
|
|
cached_payload_sha256=hashlib.sha256(body).hexdigest()))
|
|
return dict(kind='observed-classic-gameobject-query-prefixes',schema_version=1,
|
|
source_path=str(Path(path)),sha256=hashlib.sha256(raw).hexdigest(),build=5875,
|
|
locale_bytes_hex=raw[8:12].hex(),framed_records=len(records),decoded_records=len(rows),
|
|
type_counts=dict(Counter(x['type'] for x in rows)),records=rows,holds=holds,
|
|
template_size_available=False,native_templates_ready=0,
|
|
complete_server_catalogue=False,live_server_equality_verified=False,
|
|
contract='Pinned original source query grammar: type/display,4 names,extra string,24 source data words; no Size. Typed native references require separate proof.')
|
|
|
|
|
|
def main():
|
|
ap=argparse.ArgumentParser();ap.add_argument('--cache',required=True);ap.add_argument('--output',required=True);a=ap.parse_args()
|
|
report=read_gameobject_cache_prefix(a.cache);out=Path(a.output);out.parent.mkdir(parents=True,exist_ok=True);out.write_text(json.dumps(report,indent=2)+'\n')
|
|
print('Observed object prefixes: '+str(report['decoded_records'])+'; holds: '+str(len(report['holds']))+'.')
|
|
print('Native template/Size/material identity and live catalogue equality remain unproved.')
|
|
|
|
|
|
if __name__=='__main__':main()
|