feat: add isolated Liam square540 head-chest build preset

This commit is contained in:
zenord
2026-10-15 11:43:38 +08:00
parent f705c27eee
commit 2405026402
16 changed files with 379 additions and 35 deletions
+25 -3
View File
@@ -34,10 +34,31 @@ def digest(data):
def catalog():
data = json.loads(CATALOG.read_bytes())
require(data['schemaVersion'] == 1 and set(data['profiles']) == {'main', 'lvbu-test', 'liam-test'}, 'unsupported profile catalog')
require(data['schemaVersion'] == 1 and set(data['profiles']) == {'main', 'lvbu-test', 'liam-test', 'liam-test-square540'}, 'unsupported profile catalog')
return data
def framing(profile, media_bundle, preset=None):
data = catalog(); role = data['profiles'][profile]
expected = role.get('framingPreset', 'legacy')
preset = expected if preset is None else preset
require(preset == expected, 'profile/framing preset mismatch')
if preset == 'legacy':
return {'id': preset, 'zoom': 1, 'centerY': .5}
row = data['framingPresets'][preset]
require(row['profile'] == profile and row['mediaBundle'] == media_bundle and
row['indexSha256'] == data['mediaBundles'][media_bundle]['indexSha256'], 'preset/media pin mismatch')
return {'id': preset, **row}
def build_directory(profile, preset=None):
role = catalog()['profiles'][profile]
expected = role.get('framingPreset', 'legacy')
require(preset is None or preset == expected, 'profile/framing build directory mismatch')
base = ROOT / ('app/build' if profile == 'main' else 'app/build/characters/' + profile)
return base if expected == 'legacy' else base / 'framing' / expected
def authorized_debug_sha(pin):
return any(row.get('userAuthorizedDebug') is True and row['indexSha256']==pin
for row in catalog()['mediaBundles'].values())
@@ -53,6 +74,7 @@ def selection(assets, profile='main', *, emotion_sha='', user_assets=False, mout
allowed = [role['mediaSelection'], *role.get('additionalMediaSelections', [])]
require((role['mediaSelection'] == 'existing-build-flags' and bundle_id in (None,'black-correct03','white-full04')) or
bundle_id in allowed and mouth and startup, 'profile/media flags mismatch')
preset = framing(profile, bundle_id)
bundle = data['mediaBundles'][bundle_id] if bundle_id else None
if bundle:
require(emotion_sha == bundle['indexSha256'], 'selected exact index mismatch')
@@ -126,13 +148,13 @@ def selection(assets, profile='main', *, emotion_sha='', user_assets=False, mout
resource = ROOT / bundle.get('resourceDirectory','app/src/main/res') / 'drawable-nodpi' / (bundle['posterResource'] + '.png')
require(resource.read_bytes() == poster, 'drawable/bootstrap poster mismatch')
return {'schemaVersion': 1, 'profile': profile, 'application_id': role['applicationId'],
'persona': role['persona'], 'media_bundle': bundle_id, 'media_identity': bundle['identityId'] if bundle else 'a01',
'persona': role['persona'], 'framing_preset': preset['id'], 'media_bundle': bundle_id, 'media_identity': bundle['identityId'] if bundle else 'a01',
'index_sha256': emotion_sha, 'files': files, 'file_count': len(files)}
def stage(assets, output, report):
output = Path(output)
expected = ROOT / ('app/build' if report['profile'] == 'main' else 'app/build/characters/' + report['profile']) / 'generated/packagedAssets'
expected = build_directory(report['profile'], report.get('framing_preset')) / 'generated/packagedAssets'
require(not output.is_symlink() and output.resolve() == expected, 'staging must use isolated app build output')
output.parent.mkdir(parents=True, exist_ok=True)
temporary = Path(tempfile.mkdtemp(prefix='.character-assets-', dir=output.parent))