Files

163 lines
20 KiB
Python

"""#88 #109 freeze: native sequence hash on live converted M2 on ebc152d7. Before: #36 shop/creator skins class-gate Reqs on 0a453ab8. Before: #36 Grimtotem HD pigment on e860fb66. Before: #70 Stand on dd40. Before: #157 HD HE face/skin gaps on 7dc7fc4e. Before: #157 HE skin-10 faces on cb40376b. Before: #151 /h /i on d8f7fd4a. Before: #137 A/B: bubble kits 252/271128 Flags 0x100000 cleared on d8f7fd4a. Before: #144 Turtle-overridden creature models on ec5d5c31. Before: #122 Goblin skin SD on 4b192ae3. #121 Tauren lean (rude + dancespecial) on d5c863cd. Before: #121 Tauren /rude from Octo Undead on 1e410e62. Before: #120 /dancespecial grounded on 8b2953ab. Before: #75 SD faces/underwear per Octo skin on ee92d560. Before: #75 SD skins on d20a. Before: #82 HE creation camera on 96505ea8. Before: #82 race trait icons on 1d3508bb. Before: #88/HE chat: Turtle race skills (Common for High Elf) on 6cdffd10. Before: #93 gamepad bag bar hidden without gamepad UI on fd4cde9b. Before: #71 stage198 item icons (8790000-8790010) on af2ddfbb. Before: #109 survival on 8988e4b6. Before: #113/#114 spellbook Professions + Mounts tabs on d6e928ae. Before: #113 professions book 3rd button on 742c822f. Before: #115 SLA revert on 1bd1b939. Before: #107 hidden keyring leaves the bag bar on d985a325. Before: #112 native bottom-row fit in Edit Mode layout on a5b6d300. Before: #105 SkillLineAbility rank links (SupercedesSpell from Turtle spell_chain) on 358abf40. Before: #107/#1 native bag bar + micro menu (Blizzard Lua) on 3bc6a314. Before: #84 shop addon join on ab75b6b0. Before: #76 item paint (all item types) on 50ca70b5. Before: #76 helm paint (item-slot materials) on 294c9b3d. Before: #64 autocomplete name trim on edadc83e. Before: #73 whisper-inform tab filter trimmed on d157e44a. Before: #63 spell row dedupe on 2213d98f. Before: #56 dance211 Undead full model on 77ddf8d6. Before: #56 dance211 fix (client lookup probe + Undead normal model variant) on bccb5019. Before: dance211 on a2f86df2 (helmnat). Earlier: #12 Octo spell presentation rows on c2bf052d (GO models step). Read the selected e250 indices and locally archived immutable physical extents."""
from bisect import bisect_left, bisect_right
from functools import lru_cache
from hashlib import md5, sha256
from pathlib import Path
import json
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[5]/'ops'))
import casc_asset_package as casc
from casc_local_archive import parse_index, lookup3_api, encoding_bucket
HERE = Path(__file__).resolve().parent
BUS = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/codex')
PARENT = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/wmoout-7f04-frozen-candidate')
PREVCB40 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/slashhi-cb40-frozen-candidate')
PREVD8F7 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/crmodels-d8f7-frozen-candidate')
PREVEC5D = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdgob-ec5d-frozen-candidate')
PREV4B19 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdfaces2-4b19-frozen-candidate')
PREVBC71 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/lean5-bc71-frozen-candidate')
PREVD5C8 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/rude4-d5c8-frozen-candidate')
PREV1E41 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/dancegnd-1e41-frozen-candidate')
PREV8B29 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdfaces-8b29-frozen-candidate')
PREVEE92 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdskins-ee92-frozen-candidate')
PREVD20A = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/hecam-d20a-frozen-candidate')
PREV9650 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/racetraits-9650-frozen-candidate')
PREV1D35 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/langrace-1d35-frozen-candidate')
PREV6CDF = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/gamepadbag-6cdf-frozen-candidate')
PREVFD4C = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/icons-fd4c-frozen-candidate')
PREVAF2D = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/survival-af2d-frozen-candidate')
PREV8988 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/gkick-8988-frozen-candidate')
PREVF641 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sbgeneral-f641-frozen-candidate')
PREV0B14 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sbtabs-0b14-frozen-candidate')
PREVD6E9 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/profbook3-d6e9-frozen-candidate')
PREV742C = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/slarevert-742c-frozen-candidate')
PREV1BD1 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/keyringbar-1bd1-frozen-candidate')
PREVD985 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/editmodefit-d985-frozen-candidate')
PREVA5B6 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/slarank-a5b6-frozen-candidate')
PREV358A = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/nativebars-358a-frozen-candidate')
PREV3BC6 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/shopjoin-3bc6-frozen-candidate')
PREVAB75 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/itempaint-ab75-frozen-candidate')
PREV50CA = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/helmpaint-50ca-frozen-candidate')
PREV294C = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/whispertrim-294c-frozen-candidate')
PREVEDAD = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/whisperinform-edad-frozen-candidate')
PREVD157 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/spelldedup-d157-frozen-candidate')
PREV2213 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/dance211und-2213-frozen-candidate')
PREV77DD = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/dance211fix-77dd-frozen-candidate')
PREVBCCB = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/dance211-bccb-frozen-candidate')
PREVA2F8 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/helmnat-a2f8-frozen-candidate')
PREV6784 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/wmoscale-6784-frozen-candidate')
PREV5492 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/boats-5492-frozen-candidate')
PREVE64B = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/rude2-e64b-frozen-candidate')
PREVB982 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/detail-b982-frozen-candidate')
PREV5DCE = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/startkit-5dce-frozen-candidate')
PREV300B = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdmap-300b-frozen-candidate')
PREV5002 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdopt-5002-frozen-candidate')
PREV7ADF = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/hebody-7adf-frozen-candidate')
PREV5D37 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/sdrace-5d37-frozen-candidate')
PREVF59E = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/animfix-f59e-frozen-candidate')
PREVF72D = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/spellvis-f72d-frozen-candidate')
PREVE961 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/spellport-e961-frozen-candidate')
PREVC2BF = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/gomodels-c2bf-frozen-candidate')
PREV2AD1 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/actionbar-2ad1-frozen-candidate')
PREV8AB7 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/version-8ab7-frozen-candidate')
PREV2076 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/models8-2076-frozen-candidate')
PREV265F = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/prune-265f-frozen-candidate')
PREV56EC = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/whisper-56ec-frozen-candidate')
PREV3510 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/version-3510-frozen-candidate')
PREVB95E = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/shipne-b95e-frozen-candidate')
PREVF521 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/taxiroutes-f521-frozen-candidate')
PREV5647 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/drakeswap-5647-frozen-candidate')
PREV4983 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/mailrealm-4983-frozen-candidate')
CODEX9547 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/codex/nightelf-swatches-on-bd711-20261122/candidate')
CLIENT = Path('/mnt/Games/OctoWoW-LOCAL-Client/Data/data')
PORT1 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/octo-port1-1ebe-20261122/candidate')
RUDE = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/emote-rude-9e58-20261122/candidate')
DRAKE = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/drake-anim-dece-20261122/candidate')
BLOB = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/model-blob-ee45-20261122/candidate')
BAKE45 = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/db2-bake-cf2c-20261122/candidate')
HELM = Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/helm-alias-cb30-20261122/candidate')
ROOT = '72a9a8b1dfe98f696d19319f8412aa35'
BUILD = '7f04174c37e2b79df37171244cc6fc81'
OLDER = Path('/mnt/Games/@wowhybrid/builds/Forever-Local-Disposable-20261110/runtime/faf3-combined-local-gm-20261121')
def read(path):
return json.loads(path.read_bytes())
class Store:
def __init__(self):
meta=read(PARENT/'metadata.json')
assert meta['key']==BUILD
raw=(PARENT/'decoded/encoding.bin').read_bytes()
assert md5(raw).hexdigest()==meta['encoding']['content_key']
layout=casc.encoding_layout(raw)
self.sections=layout['sections']
self.first={t:[k for k,_ in v] for t,v in self.sections.items()}
self.specs=layout['specs'][:-1].split(b'\0')
plan=read(PARENT/'stage-plan.json')
self.root=(PARENT/'decoded/root.bin').read_bytes()
self.layout=casc.root_groups(self.root)
assert self.layout['root_md5']==ROOT
api,_=lookup3_api()
self.archives=[d/'physical/Data/data' for d in (PARENT,Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/wmofog-6536-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/seqfix-1186-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/custreq2-ebc1-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/grimtotem-0a45-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/stand-e860-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q106-coefficients-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q105-realms-only-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q103-charges-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q61-fog-lighting-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q86-he-sd-faces-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/q97-take-position-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/hdfaces-1be1-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/hefaces-7dc7-frozen-candidate'),PREVCB40,PREVD8F7,PREVEC5D,PREV4B19,PREVBC71,PREVD5C8,PREV1E41,PREV8B29,PREVEE92,PREVD20A,PREV9650,PREV1D35,PREV6CDF,PREVFD4C,PREVAF2D,PREV8988,PREVF641,PREV0B14,PREVD6E9,PREV742C,PREV1BD1,PREVD985,PREVA5B6,PREV358A,PREV3BC6,PREVAB75,PREV50CA,PREV294C,PREVEDAD,PREVD157,PREV2213,PREV77DD,PREVBCCB,PREVA2F8,PREV6784,PREV5492,PREVE64B,PREVB982,PREV5DCE,PREV300B,PREV5002,PREV7ADF,PREV5D37,PREVF59E,PREVF72D,PREVE961,PREVC2BF,PREV2AD1,PREV8AB7,PREV2076,PREV265F,PREV56EC,PREV3510,PREVB95E,PREVF521,PREV5647,PREV4983,Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-sickle7-0f89-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-helms6-2ecc-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-helms5-8b18-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-models4-8491-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/client-version-049a-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-modelmat-8931-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-displays3-200f-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-displays2-76ed-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/item-displays-aba0-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/loadscreens-f301-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/shop-previews-1106-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/octoshop-49a1-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/db2-rebake-3c64-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/roar-sync-fe8c-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/onyx-roar-3aa0-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/mount-sounds-3e57-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/helm-hd-78ff-frozen-candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/drake-roar-4371-20261122/candidate'),Path('/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/wmo-outdoor-9547-20261122/candidate'),CODEX9547,PORT1,RUDE,DRAKE,BLOB,BAKE45,HELM,BUS/'post-431f-content-20261121/candidate',BUS/'e250-grouped-physical-successor-20261121/candidate',BUS/'catalogue-physical-ac99-20261121/candidate',BUS/'next-content-child-c425-20261121/candidate',BUS/'next-content-child-23f6-20261121/candidate',BUS/'linux-combined-faf3-20261121/candidate')]
self.archives.append(CLIENT)
from casc_compact import read_indexes
self.local_rows={}
for _,_,lay in read_indexes(CLIENT,api).values():
for r in lay['rows']:self.local_rows.setdefault(r[:9],r)
self.archives.extend(OLDER/n/'Data/data' for n in ('combined-client','charselect-ready-candidate/store','native-client'))
self.index={}
self.index_paths={}
guards={r['target']:r['sha256'] for r in plan['preconditions']['existing_exact_sha256']+plan['forward']['copy_verified_files']}
for b,name in plan['forward']['selected_index_generation_exact'].items():
path=next(p for d in (self.archives[0],PARENT/'rollback-preimages/Data/data') if (p:=d/name).is_file())
raw=path.read_bytes()
assert sha256(raw).hexdigest()==guards['Data/data/'+name]
self.index_paths[int(b)]=path
self.index[int(b)]=parse_index(raw,int(b),api)['rows']
@lru_cache(maxsize=128)
def page(self,section,index):
return dict(casc._encoding_entries(self.sections[section][index][1],section))
def entry(self,section,key):
ix=bisect_right(self.first[section],key)-1
if ix>=0:return self.page(section,ix).get(key)
def read(self,ck,ek=None):
rec=self.entry('content',bytes.fromhex(ck))
if not rec:return
for i in range(rec[0]):
key=rec[22+16*i:38+16*i]
if ek and key.hex()!=ek:continue
rows=self.index[encoding_bucket(key)]
ix=bisect_left(rows,key[:9]); enc=self.entry('encoded',key)
if not enc:continue
size=int.from_bytes(enc[20:25],'big')
lr=self.local_rows.get(key[:9])
if lr:
pos=int.from_bytes(lr[9:14],'big');path=CLIENT/f'data.{pos>>30:03d}';off=pos%2**30;sp=int.from_bytes(lr[14:18],'little')
with path.open('rb') as f:
f.seek(off);block=f.read(sp)
frame=block if block[:4]==b'BLTE' else block[30:]
try:
if len(frame)==size and casc.blte_encoding_key(frame)==key:
body=casc.decode_blte(frame,encoding_key=key.hex(),content_key=ck,max_decoded=536870912)
spec=self.specs[int.from_bytes(enc[16:20],'big')].decode()
return dict(content_key=ck,encoding_key=key.hex(),encoded_size=size,decoded_size=len(body),encoding_spec=spec),frame,body,dict(file=str(path),offset=off,span=sp)
except ValueError:pass
while ix<len(rows) and rows[ix][:9]==key[:9]:
r=rows[ix];ix+=1
pos=int.from_bytes(r[9:14],'big')
seg=f'data.{pos>>30:03d}'; off=pos%2**30; span=int.from_bytes(r[14:18],'little')
for folder in self.archives:
path=folder/seg
if not path.is_file() or path.stat().st_size < off+span:continue
with path.open('rb') as f:
f.seek(off);block=f.read(span)
if block[:4]==b'BLTE':skip=0
elif block[30:34]==b'BLTE':skip=30
else:continue
frame=block[skip:]
try:
if len(frame)!=size or casc.blte_encoding_key(frame)!=key:continue
body=casc.decode_blte(frame,encoding_key=key.hex(),content_key=ck,max_decoded=536870912)
except ValueError:continue
spec=self.specs[int.from_bytes(enc[16:20],'big')].decode()
return dict(content_key=ck,encoding_key=key.hex(),encoded_size=size,decoded_size=len(body),encoding_spec=spec),frame,body,dict(file=str(path),offset=off,span=span)