smodusermc/offline-games / _tools /repair_crashout_loader.py
smodusermc's picture
download
raw
1.84 kB
"""Repair the explicitly declared missing Crashout loader; retain original capture-limit history."""
import os,json,hashlib,requests,tempfile
from pathlib import Path
from huggingface_hub import HfApi
R=Path('/home/user/game-archive/reports');B='smodusermc/offline-games';api=HfApi(token=os.environ['HF_TOKEN'])
p=R/'game-111.json';m=json.loads(p.read_text());url='https://garbsoftball.com/games/crashout/Build/WebGL.loader.js';key='site/games/crashout/Build/WebGL.loader.js'
r=requests.get(url,timeout=60);r.raise_for_status();data=r.content
assert not data.lstrip().lower().startswith((b'<!doctype',b'<html'))
sha=hashlib.sha256(data).hexdigest();api.batch_bucket_files(B,add=[(data,key)])
with tempfile.TemporaryDirectory() as d:
f=Path(d)/'loader.js';api.download_bucket_files(B,[(key,f)],raise_on_missing_files=True);assert hashlib.file_digest(f.open('rb'),'sha256').hexdigest()==sha
m['files']=[f for f in m['files'] if f['path']!=key]+[{'url':url,'path':key,'bytes':len(data),'sha256':sha,'content_type':r.headers.get('Content-Type','')}]
m['capture_limit_history']=m.get('limits',[]);m['limits']=['Original interrupted capture repaired for explicit loader; StreamingAssets/runtime completeness remains unverified.']
m['repair_note']='Added original loader with source and bucket read-back SHA-256 agreement. Existing data, framework and WASM already present. No gameplay pass claimed.'
p.write_text(json.dumps(m,indent=2));report={'id':111,'added':key,'bytes':len(data),'sha256':sha,'bucket_readback_match':True,'scope':m['repair_note'],'historical_limits':m['capture_limit_history']};q=R/'crashout-loader-repair.json';q.write_text(json.dumps(report,indent=2))
api.batch_bucket_files(B,add=[(p,'_reports/games/0111.json'),(q,'_verification/crashout-loader-repair.json')]);print('CRASHOUT LOADER REPAIRED',len(data),flush=True)

Xet Storage Details

Size:
1.84 kB
·
Xet hash:
f8c4a875fc93c06f527b9db21b906b5f1183b939b11ef92398aa8a991ef15762

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.