Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
23 lines
1.4 KiB
Python
23 lines
1.4 KiB
Python
import sys,struct,zlib,re
|
|
from pathlib import Path
|
|
sys.path.insert(0,'/home/jakub/devel/escapistsrereintroduced/tools')
|
|
from pak_inventory import parse_tree,Limits
|
|
root=Path('/home/jakub/.local/share/Steam/steamapps/compatdata/1874880/pfx/drive_c/users/steamuser/Documents/My Games/ArmaReforger/addons')
|
|
mods=['RHS-StatusQuo_595F2BF2F44836FB','RHS-ContentPack01_1337C0DE5DABBEEF','RHS-ContentPack02_BADC0DEDABBEDA5E','WCS_Armaments_629B2BA37EFFD577','WCS_Core_64610AFB74AA9842','BMP-1IFV_5E524E4FEECCA92B']
|
|
for mod in mods:
|
|
count=0;hits=0
|
|
for p in (root/mod).glob('*.pak'):
|
|
with p.open('rb') as f:
|
|
chunks={};off=12
|
|
for _ in range(3):
|
|
f.seek(off);tag,size=struct.unpack('>4sI',f.read(8));chunks[tag]=(off+8,size);off+=8+size
|
|
f.seek(chunks[b'FILE'][0]);tree=f.read(chunks[b'FILE'][1]);start,size=chunks[b'DATA']
|
|
entries,_,_=parse_tree(tree,start,start+size,Limits(archive_bytes=16*1024**3,total_bytes=32*1024**3))
|
|
for e in entries:
|
|
if 'entitycatalog' not in e['path'].lower() or not e['path'].endswith('.conf'):continue
|
|
f.seek(e['offset']);b=f.read(e['stored_bytes']);b=zlib.decompress(b) if e['compression']=='zlib' else b
|
|
count+=1;s=b.decode('utf-8',errors='replace')
|
|
for m in re.finditer('(?i)PMN4|B05A816C0BF50802',s):
|
|
hits+=1;print(mod,e['path'],s[max(0,m.start()-100):m.end()+350])
|
|
print('SCANNED',mod,count,'catalogs; exact PMN4 matches',hits)
|