883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
40 lines
2.6 KiB
Python
40 lines
2.6 KiB
Python
"""One focused offline GO create: original no-animation sentinel and unchanged Source state/lock flags."""
|
|
import struct, subprocess, sys, ctypes, os
|
|
from pathlib import Path
|
|
P=struct.pack
|
|
header=P('<QHIIIII',4509,70,0x46010046,1,12,2,2)+b'Gatewaytest\0'+bytes([1,1,0])+P('<I',0xA9)
|
|
expected=1880
|
|
codec=Path(sys.argv[1]).resolve()
|
|
if codec.suffix.lower()=='.dll':
|
|
dll_directory=os.add_dll_directory(str(codec.parent))
|
|
library=ctypes.CDLL(str(codec));function=library.gw_codec_serialize
|
|
function.argtypes=[ctypes.c_uint32,ctypes.c_void_p,ctypes.c_uint32,ctypes.c_uint32,ctypes.c_void_p,ctypes.c_uint32,ctypes.POINTER(ctypes.c_uint32)]
|
|
function.restype=ctypes.c_int
|
|
def serialize(data):
|
|
source=ctypes.create_string_buffer(data);out=ctypes.create_string_buffer(1048576);written=ctypes.c_uint32()
|
|
assert function(4,source,len(data),0,out,len(out),ctypes.byref(written))==0
|
|
return out.raw[:written.value]
|
|
else:
|
|
def serialize(data):
|
|
r=subprocess.run([str(codec),'--gameobjects'],input=data,capture_output=True,timeout=15)
|
|
assert r.returncode==0,r.stderr
|
|
return r.stdout
|
|
for typ,state,flags in [(0,1,32),(0,0,32),(0,1,34),(1,1,2),(3,1,2),(10,1,0)]:
|
|
fields={3:177928,4:0x3f800000,8:3492,9:flags,13:0x3f800000,14:state,21:typ}
|
|
mask=sum(1<<i for i in fields)
|
|
# Existing independent legacy static fixture framing; only actual GO fields vary.
|
|
guid=P('<Q',(0xF110<<48)|(177928<<24)|9091);packed=bytes([sum(1<<i for i,v in enumerate(guid) if v)])+bytes(v for v in guid if v)
|
|
raw=P('<IBB',1,0,3)+packed+bytes([5,0x40])+P('<4f',-4722.5,-3737.8,56,.6196)
|
|
raw+=bytes([1])+P('<I',mask)+b''.join(P('<I',fields[i]) for i in sorted(fields))
|
|
packet=serialize(header+raw);assert struct.unpack_from('<HIBI',packet)[:3]==(1,1,0x80)
|
|
at=12;at+=2+int.from_bytes(packet[at:at+2],'little').bit_count()
|
|
assert packet[at:at+4]==bytes([8,0x81,8,0]);at+=8+16+8
|
|
size=struct.unpack_from('<I',packet,at)[0];at+=4
|
|
assert at+size==len(packet) and packet[at:at+5]==bytes([0,3,206,255,1])
|
|
go=at+5+12 # fragment prefix + original ObjectData(entry,dynamicFlags,scale)
|
|
assert struct.unpack_from('<I',packet,go+12)[0]==expected,('no-animation sentinel',typ,state,flags,struct.unpack_from('<I',packet,go+12)[0],expected)
|
|
assert struct.unpack_from('<I',packet,go+16)[0]==0,'no invented animation kit'
|
|
assert struct.unpack_from('<I',packet,go+32)[0]==flags,'Source lock/no-despawn flags retained'
|
|
assert packet[go+64:go+67]==bytes([state,typ,100]),'Source state/type and health retained'
|
|
print('PASS six shared stationary GO creates: native empty-animation sentinel; Source state/locked flags preserved')
|