Replace rejected GUI with owner-supplied painted DuneMenus ZIP

This commit is contained in:
unimatrixgit 2026-11-28 22:04:20 +01:00
commit aca4e5e168

View file

@ -0,0 +1,30 @@
"""Build the supplied menu artwork into the pinned shared pack; emit hashed release files."""
from pathlib import Path
import hashlib, io, json, shutil, subprocess, sys, urllib.request, zipfile
root=Path(__file__).resolve().parents[1]
out=Path(sys.argv[1]);out.mkdir(parents=True,exist_ok=True)
url='https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip'
baseline=urllib.request.urlopen(url,timeout=90).read()
assert hashlib.sha1(baseline).hexdigest()=='f86189d72abc0690a08e01b7707998fabd961b8d','Pinned pack differs'
with zipfile.ZipFile(io.BytesIO(baseline)) as z:
entries={n:z.read(n) for n in z.namelist() if not n.endswith('/')}
art=root/'network/resource-pack/shared'
assets=[art/'assets/dunerealms/font/gui.json',*sorted((art/'assets/dunerealms/textures/gui/bg').glob('*.png'))]
assert len(assets)==13
font=json.loads(assets[0].read_text(encoding='utf-8'))
for p in assets:entries[p.relative_to(art).as_posix()]=p.read_bytes()
for provider in font['providers']:
if provider.get('type')=='bitmap':
namespace,path=provider['file'].split(':',1)
assert f'assets/{namespace}/textures/{path}' in entries
pack=out/'DuneRealms-Painted-Menus-20261128.zip'
with zipfile.ZipFile(pack,'w',zipfile.ZIP_DEFLATED,compresslevel=9) as z:
for name,data in sorted(entries.items()):
zi=zipfile.ZipInfo(name,(2026,11,28,0,0,0));zi.compress_type=zipfile.ZIP_DEFLATED;z.writestr(zi,data)
shutil.copy2(root/'DuneMenus/build/libs/DuneMenus.jar',out/'DuneMenus.jar')
manifest={'source':subprocess.check_output(['git','rev-parse','HEAD'],cwd=root,text=True).strip(),'input_zip_sha256':'6d3cde343ba09fb7088a3a07b0c54c96eeb629c82c527993a76000013c305b60','pack_url':'https://www.dunerealms.com/downloads/'+pack.name,'files':{}}
for p in sorted(out.iterdir()):
if p.is_file() and p.name!='release.json':
data=p.read_bytes();manifest['files'][p.name]={'sha1':hashlib.sha1(data).hexdigest(),'sha256':hashlib.sha256(data).hexdigest(),'bytes':len(data)}
(out/'release.json').write_text(json.dumps(manifest,indent=2)+'\n')
print(json.dumps(manifest,indent=2))