feat: add gated CH5 quiver support and unified regression runner
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Resolve quiver motion/effect dependencies without replacing existing artwork."""
|
||||
import hashlib
|
||||
import posixpath
|
||||
import re
|
||||
|
||||
TEXT_EXTENSIONS=('.msa','.msf','.mse','.mde','.mss')
|
||||
REFERENCE=re.compile(rb'["\']([^"\'\r\n]+\.(?:msa|msf|mse|mde|mss|gr2|dds|tga|jpg|png|wav|mp3))["\']',re.I)
|
||||
MOTIONS=('wait.msa','wait_1.msa','walk.msa','run.msa','damage.msa',
|
||||
'damage_1.msa','damage_2.msa','damage_3.msa','attack_special.msa')
|
||||
|
||||
|
||||
def dependencies(path,raw):
|
||||
out=[]
|
||||
for value in REFERENCE.findall(raw):
|
||||
name=value.decode('ascii').lower().replace('\\','/')
|
||||
if not name.startswith(('d:/','sound/','icon/')):
|
||||
name=posixpath.dirname(path)+'/'+name
|
||||
name=posixpath.normpath(name)
|
||||
if not name.startswith(('d:/ymir work/','sound/','icon/')):
|
||||
raise ValueError('invalid quiver dependency: '+name)
|
||||
out.append(name)
|
||||
return out
|
||||
|
||||
|
||||
def collect(read_current,read_reference,maximum=256):
|
||||
queue=['d:/ymir work/%s/assassin/bow/%s'%(sex,name)
|
||||
for sex in ('pc','pc2') for name in MOTIONS]
|
||||
records={};missing={}
|
||||
while queue:
|
||||
path=queue.pop()
|
||||
if path in records:continue
|
||||
if len(records)>=maximum:raise ValueError('quiver resource closure exceeds limit')
|
||||
raw=read_current(path);origin='registered_client'
|
||||
if raw is None:
|
||||
raw=read_reference(path);origin='ava2_reference'
|
||||
if raw is None:raise ValueError('missing quiver dependency: '+path)
|
||||
missing[path]=raw
|
||||
records[path]={'origin':origin,'sha256':hashlib.sha256(raw).hexdigest(),'bytes':len(raw)}
|
||||
if path.endswith(TEXT_EXTENSIONS):queue.extend(dependencies(path,raw))
|
||||
return missing,records
|
||||
Reference in New Issue
Block a user