XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
"""Read local signed resource names to locate the game's material and rarity icons."""
import concurrent.futures, importlib.util, json, pathlib, re, sys
spec=importlib.util.spec_from_file_location('local_assets','research/galaxy_asset_inventory.py')
saved=sys.argv;sys.argv=['inventory','artifacts/checklist-0415-20261022/unused.json']
assets=importlib.util.module_from_spec(spec);spec.loader.exec_module(assets);sys.argv=saved
pattern=re.compile(sys.argv[1].encode() if len(sys.argv)>1 else rb'material|rarity|grade|inventory|synthesis|internalpanel',re.I)
out=pathlib.Path(sys.argv[2] if len(sys.argv)>2 else 'artifacts/checklist-0415-20261022/material-assets.json')
def scan(directory):
    found=[]
    for path in directory.iterdir():
        if not path.is_file():continue
        with path.open('rb') as f:header=f.read(262)
        if header[:4]!=b'FREA':continue
        raw=pow(int.from_bytes(header[6:262],'big'),assets.E,assets.N).to_bytes(256,'big');sep=raw.find(b'\0',2)
        if sep<10 or not pattern.search(raw[sep+37:]):continue
        prefix=assets.decode(path,262+8192)
        strings=[m.group().decode('ascii') for m in re.finditer(rb'[A-Za-z_][A-Za-z0-9_.:/ -]{3,}',prefix[:6000])]
        found.append(dict(path=str(path),bytes=path.stat().st_size,strings=strings[:20]))
    return found
rows=[]
with concurrent.futures.ThreadPoolExecutor(max_workers=6) as pool:
    for found in pool.map(scan,sorted(p for p in assets.ROOT.iterdir() if p.is_dir())):
        rows+=found;out.write_text(json.dumps(rows,indent=2),encoding='utf8')
print('Material/rarity candidates:',len(rows),flush=True)