883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
94 lines
4.9 KiB
Python
94 lines
4.9 KiB
Python
"""Actual qualified model-texture family; no models or skins registered."""
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
from unittest.mock import patch
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'ops'))
|
|
import casc_asset_package as c
|
|
import casc_tvfs as t
|
|
from item_model_assets import stage_registered
|
|
import octo_icon_assets
|
|
|
|
def check(job):
|
|
load = lambda p: json.loads(p.read_text())
|
|
parameters = load(job / 'ordinary379-stage-inputs.json')
|
|
source = Path(parameters['source'])
|
|
conversion = Path(parameters['conversion'])
|
|
parent = Path(parameters['baseline'])
|
|
output = Path(parameters['output'])
|
|
new_files = set(parameters['new379_files'])
|
|
forbidden = set(parameters['local161_parent_payloads'])
|
|
real_read = Path.read_bytes
|
|
real_decode = octo_icon_assets.decode_blp
|
|
reads = {}
|
|
decodes = []
|
|
current = [None]
|
|
|
|
def read(path):
|
|
name = str(path.resolve())
|
|
assert name not in forbidden, 'Unchanged161 local texture body read'
|
|
raw = real_read(path)
|
|
if name in new_files:
|
|
reads[name] = reads.get(name, 0) + 1
|
|
current[0] = name
|
|
return raw
|
|
|
|
def decode(raw):
|
|
row = dict(file=current[0])
|
|
try:
|
|
result = real_decode(raw)
|
|
except ValueError as error:
|
|
row.update(status='HELD', reason=str(error))
|
|
decodes.append(row)
|
|
raise
|
|
row['status'] = 'PASS'
|
|
decodes.append(row)
|
|
return result
|
|
with patch.object(Path, 'read_bytes', read), patch.object(octo_icon_assets, 'decode_blp', decode):
|
|
result = stage_registered(source, conversion, parent, Path(parameters['native_root']), output, frozen_parent_manifest_sha256=parameters['baseline_sha256'])
|
|
assert len(reads) == 379 and all((n == 1 for n in reads.values())) and (len(decodes) == 379)
|
|
before = load(parent)
|
|
old = {r['path']: r for r in before['assets']}
|
|
after = {r['path']: r for r in result['assets']}
|
|
assert all((after[p] == r for p, r in old.items()))
|
|
delta = [r for p, r in after.items() if p not in old]
|
|
assert all((r['kind'] == 'texture' for r in delta))
|
|
assert len(delta) + len(result['excluded']) == 379
|
|
alias = load(job / 'actual161-TVFS-alias-rows.json')
|
|
mp = Path(alias['parent_framing_manifest'])
|
|
m = load(mp)
|
|
raw = (mp.parent / m['tvfs']['child']['decoded_file']).read_bytes()
|
|
proof = Path(alias['local_encoding_proof']).read_bytes()
|
|
child, audit = t.extend_file_aliases(raw, alias['rows'], expected_md5=alias['expected_child_md5'], local_encoding_proof=proof, local_encoding_proof_sha256=alias['local_encoding_proof_sha256'])
|
|
assert audit['new_paths'] == 161
|
|
a = t.layout(raw)
|
|
b = t.layout(child)
|
|
for name in ('container', 'vfs', 'specs'):
|
|
x = a['tables'][name]
|
|
y = b['tables'][name]
|
|
assert raw[x['offset']:x['offset'] + x['size']] == child[y['offset']:y['offset'] + y['size']]
|
|
(job / 'TVFS-child-with161-reused-containers.bin').write_bytes(child)
|
|
(job / 'actual161-TVFS-alias-audit.json').write_text(json.dumps(audit, indent=2) + '\n')
|
|
originals = load(Path(parameters['original9431_manifest']))
|
|
original_paths = {r['path'] for r in originals['assets']}
|
|
changed = [r for r in result['assets'] if r['path'] not in original_paths]
|
|
assert len(changed) == 161 + len(delta)
|
|
root = (output / 'root.bin').read_bytes()
|
|
layout = c.root_groups(root)
|
|
for start in range(0, len(changed), 26):
|
|
controls = c.root_controls(root, layout, {r['file_data_id'] for r in changed[start:start + 26]})
|
|
for r in changed[start:start + 26]:
|
|
assert len(controls[r['file_data_id']]) == 1
|
|
assert controls[r['file_data_id']][0]['content_key'] == r['content_key']
|
|
report = dict(status='PASS_QUALIFIED551_MODEL_TEXTURE_RESOURCE_FAMILY', scope=540, existing_local_container_aliases=161, new_physical_texture_payloads=len(delta), ordinary_first_decode_scope=379, ordinary_decode_results=decodes, decode_holds=result['excluded'], stage_assets=len(result['assets']), all9344_parent_asset_identities_retained=True, Source35_body_reads_or_frames=0, old_Model800_conversions_repeated=False, Model_or_SKIN_imports=0, CFT_VFS_ESpec_bytes_and_relative_offsets_exact=True, prior_alias_refusals_reused=True, Native_SDK_or_Game_queries=0, candidate_manifest=str(output / 'manifest.json'), candidate_manifest_sha256=hashlib.sha256((output / 'manifest.json').read_bytes()).hexdigest())
|
|
(job / 'completed-model-texture551-family-focused-check.json').write_text(json.dumps(report, indent=2) + '\n')
|
|
return report
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--job', type=Path, required=True)
|
|
args = parser.parse_args()
|
|
check(args.job)
|
|
print('PASS:161 native container aliases +379 first-decoded texture partition; no Model/SKIN imports.')
|