"""Extract original ServicesOption indices/colours from the pinned offline image."""
import hashlib,json,struct
from pathlib import Path
import pefile
image=Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe');raw=image.read_bytes()
expected='6891f70a021fa9f3a0e00458c284f48d1226e68ae7fc02ad48081aed47857e93'
if hashlib.sha256(raw).hexdigest()!=expected:raise ValueError('Expected fixed old image')
pe=pefile.PE(data=raw,fast_load=True);base=pe.OPTIONAL_HEADER.ImageBase;rows=[]
for index in range(10):
pointer=struct.unpack('<Q',pe.get_data(0x5e9d550+8*index,8))[0]
name=pe.get_data(pointer-base,128).split(b'\0',1)[0].decode('ascii')
colour=struct.unpack('<4f',pe.get_data(0x5e9d5a0+16*index,16))
rows.append(dict(index=index,name=name,rgba=colour))
out=Path('artifacts/galaxy-query-research/service-options');out.mkdir(parents=True,exist_ok=True)
result=dict(gameImageSha256=expected,constructor='3AD17F0',settingsSlot=34,sourceTable='5E9D550',colourTable='5E9D5A0',rows=rows)
(out/'service-options.json').write_text(json.dumps(result,indent=2),encoding='utf-8');print(json.dumps(result,indent=2))
"""Extract original ServicesOption indices/colours from the pinned offline image."""
import hashlib,json,struct
from pathlib import Path
import pefile
image=Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe');raw=image.read_bytes()
expected='6891f70a021fa9f3a0e00458c284f48d1226e68ae7fc02ad48081aed47857e93'
if hashlib.sha256(raw).hexdigest()!=expected:raise ValueError('Expected fixed old image')
pe=pefile.PE(data=raw,fast_load=True);base=pe.OPTIONAL_HEADER.ImageBase;rows=[]
for index in range(10):
pointer=struct.unpack('<Q',pe.get_data(0x5e9d550+8*index,8))[0]
name=pe.get_data(pointer-base,128).split(b'\0',1)[0].decode('ascii')
colour=struct.unpack('<4f',pe.get_data(0x5e9d5a0+16*index,16))
rows.append(dict(index=index,name=name,rgba=colour))
out=Path('artifacts/galaxy-query-research/service-options');out.mkdir(parents=True,exist_ok=True)
result=dict(gameImageSha256=expected,constructor='3AD17F0',settingsSlot=34,sourceTable='5E9D550',colourTable='5E9D5A0',rows=rows)
(out/'service-options.json').write_text(json.dumps(result,indent=2),encoding='utf-8');print(json.dumps(result,indent=2))