16 lines
646 B
Python
16 lines
646 B
Python
import struct,sys
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
|
import frozen_store as fs
|
|
store=fs.Store();root=store.root;lay=store.layout
|
|
want={int(a) for a in sys.argv[2:]};done=set()
|
|
for g in lay['groups']:
|
|
f=0
|
|
for i,(d,) in enumerate(struct.iter_unpack('<I',memoryview(root)[g['ids_offset']:g['ckeys_offset']])):
|
|
f+=d
|
|
if f in want and f not in done:
|
|
r=store.read(root[g['ckeys_offset']+i*16:g['ckeys_offset']+i*16+16].hex())
|
|
if r:(Path(sys.argv[1])/f'{f}.bin').write_bytes(r[2]);done.add(f)
|
|
f+=1
|
|
print('got',sorted(done),'missing',sorted(want-done))
|