Hook the byte and text validators for the supported game build while retaining original validation for unknown paths and non-project records. Pin executable and UE4SS hashes, provide an MIT-licensed source package, and verify native adapters, supported prologues, import symbols and unsupported-build refusal. In-game startup and gameplay verification remain pending.
32 lines
1.6 KiB
Python
32 lines
1.6 KiB
Python
"""Prepare local binary/source archives; performs no publishing or deployment."""
|
|
from pathlib import Path
|
|
import hashlib
|
|
import json
|
|
import zipfile
|
|
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
out=ROOT/'dist'
|
|
version=json.loads((ROOT/'mod.json').read_text())['version']
|
|
stem=f'phantombladezero_scriptcompat_{version}_experimental'
|
|
binary=out/(stem+'.zip')
|
|
source=out/(stem+'_source.zip')
|
|
binary_files=[out/'README.md',out/'LICENSE',out/'THIRD_PARTY_NOTICES.md',
|
|
out/'MINHOOK-LICENSE.txt',out/'UE4SS-SDK-LICENSE.txt']
|
|
binary_files+=list((out/'ue4ss').rglob('*'))
|
|
with zipfile.ZipFile(binary,'w',zipfile.ZIP_DEFLATED) as z:
|
|
for path in sorted(binary_files):
|
|
if path.is_file():z.write(path,path.relative_to(out).as_posix())
|
|
files=[ROOT/name for name in ['README.md','LICENSE','THIRD_PARTY_NOTICES.md','mod.json','.gitignore','.gitattributes']]
|
|
for folder in ['src','tests','tools/vendor/minhook-1.3.4','tools/vendor/ue4ss-sdk']:
|
|
files.extend(p for p in (ROOT/folder).rglob('*') if p.is_file())
|
|
files.append(ROOT/'tools/build.py')
|
|
with zipfile.ZipFile(source,'w',zipfile.ZIP_DEFLATED) as z:
|
|
for path in sorted(files):z.write(path,path.relative_to(ROOT).as_posix())
|
|
for archive in [binary,source]:
|
|
with zipfile.ZipFile(archive) as z:
|
|
assert z.testzip() is None
|
|
assert all('\\' not in n and not n.startswith('/') and '..' not in Path(n).parts for n in z.namelist())
|
|
print(archive.name,archive.stat().st_size,hashlib.sha256(archive.read_bytes()).hexdigest())
|
|
(out/'SHA256SUMS.txt').write_text(''.join(
|
|
f'{hashlib.sha256(a.read_bytes()).hexdigest()} {a.name}\n' for a in [binary,source]),encoding='ascii')
|