Compare commits

...
Author SHA1 Message Date
waozi a0f8946692 Release Arcade 0.7.96 with the latest game releases 2026-10-27 20:48:00 +00:00
waozi fb5d8d0af8 Keep Arcade browser runtime files on one cache revision 2026-10-27 17:26:02 -03:00
waozi 37f11bfe0b Release Arcade 0.7.95 with Shovey 0.6.157
Pip's tips keep what he points at in view: his card moves under the top
bar when it would cover it, such as the home in level 1.
2026-10-27 17:11:36 -03:00
waozi f687a500e7 Load arcade.waozi.xyz's runtime and Apps library sooner
The page fetched apps.zx (1.9 MB) uncompressed, since Cloudflare Pages does
not compress binary files, and only then started the 3.6 MB runtime. The
build now writes gzip copies beside apps.zx and runtime.data, which the page
unpacks with DecompressionStream (apps.zx 1.9 MB -> 0.24 MB), falling back
to the plain files; the file package is handed to the runtime rather than
fetched again. runtime.js and runtime.wasm are preloaded, so they download
while the page fetches the collection's files and waits for the sign-in.
2026-10-27 16:51:12 -03:00
waozi 7d5789d34d Release Arcade 0.7.94 with smaller library covers
The library downloaded 3.2 MB of art from the node before its covers
showed: six 640-pixel covers stored as lossless PNG made up 2.7 MB of it.
Opaque cover art is now a JPEG at quality 85 (445 KiB for all six), so the
art bundle is about a quarter of its size. Logos keep their transparency
and previews their pixel art as PNG. Every host decodes these JPEGs:
browsers, GdkPixbuf on Linux, and raylib with JPEG on Android and Windows.
2026-10-27 16:40:15 -03:00
waozi 732f28e025 Sign in once for every waozi.xyz site 2026-10-27 16:35:20 -03:00
waozi f4725cbf21 Rank Apfelwurm's best run by level and score, and open the Profile when a saved key is unreadable 2026-10-27 16:23:42 -03:00
waozi f52111be88 Compile the released Shovey into its browser page
scripts/build-web.py --shovey now passes the release's shovey.zx and
entity.zx to Entity's --linked, so the page compiles their programs, and the
game and Apps controller packed in shovey.zx, as Ziran's linked code
(Ziran 2e2fea84, Entity 9a88349). The page still opens those exact bytes;
the Shovey editor, which needs the game as a library, stays on the VM.
Walking in level 1 at 6x CPU throttle: 33 fps on the VM, 59 fps linked.

The lock follows Ziran and Entity master, which moved liboqs main too.
2026-10-27 16:10:43 -03:00
waozi cd64689a93 Repaint only damaged pixels in Arcade's browser edition
The browser host ended every frame with EndFrame, which repainted the whole
page: in a Shovey level that was 235 images and 1157 fills a frame, against
12 and 26 with Kryon's damage-only EndCanvasUiFrame (Kryon e09f3816).

The host can also run the released Shovey player, as the downloads do: a
receipt whose id is arcade.shovey-player opens Shovey's covers, and
scripts/build-web.py --shovey DIR --site DIR builds that page from a Shovey
download's shovey.zx, shovey.json and entity.zx, for shovey.waozi.xyz.
2026-10-27 15:07:33 -03:00
waozi d53446a2a6 Open dew.waozi.xyz from the Profile's Top up 2026-10-27 14:30:44 -03:00
25 changed files with 294 additions and 102 deletions

No files matched your search

+13
View File
@@ -1,5 +1,18 @@
# Arcade changelog
## 0.7.96
- Shovey 0.6.157: Pip's tips keep what he points at in view: his card moves under the top bar when it would cover it, such as the home in level 1.
- Apfelwurm 0.2.4: Play on the whole page at wurm.waozi.xyz, without a title bar above the game.
## 0.7.95
- Shovey 0.6.157: Pip's tips keep what he points at in view: his card moves under the top bar when it would cover it, such as the home in level 1.
## 0.7.94
- The library's game covers download about four times faster.
## 0.7.93
- Shovey 0.6.156: Finishing all 175 levels opens a reward window: press Claim to get your Dew. The first 10 players to finish get 100 Dew, the next 20 get 50, players up to the 100th get 20, and everyone after gets 5.
+1 -1
View File
@@ -1 +1 @@
0.7.93
0.7.96
+6 -6
View File
@@ -13,8 +13,8 @@
"shovey": {
"id": "arcade.shovey",
"title": "Shovey",
"version": "0.6.156",
"sequence": 164,
"version": "0.6.157",
"sequence": 165,
"host_api": 12
},
"shovey-island": {
@@ -34,15 +34,15 @@
"arcade": {
"id": "inbe.arcade",
"title": "Arcade",
"version": "0.7.93",
"sequence": 172,
"version": "0.7.96",
"sequence": 175,
"host_api": 36
},
"wurm": {
"id": "xyz.waozi.wurm",
"title": "Apfelwurm",
"version": "0.2.2",
"sequence": 9,
"version": "0.2.4",
"sequence": 10,
"host_api": 12
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

+13 -9
View File
@@ -22,14 +22,18 @@ def digest(path):
def library_art(root, name, key, source):
"""Arcade's committed library thumbnails (scripts/library-art.py).
Never pack a copy of outdated art."""
"""Arcade's committed library thumbnail (scripts/library-art.py), as
(bytes, suffix): a PNG, or a JPEG for opaque cover art. Never pack a copy
of outdated art."""
library = Path(root) / "assets/arcade/library"
sources = json.loads((library / "sources.json").read_text())
copy = f"{name}-{key}"
if sources.get(copy, {}).get("source_sha256") != hashlib.sha256(source).hexdigest():
raise ValueError(f"{copy} art changed; run scripts/library-art.py")
return (library / f"{copy}.png").read_bytes()
for suffix in (".png", ".jpg"):
if (library / (copy + suffix)).is_file():
return (library / (copy + suffix)).read_bytes(), suffix
raise ValueError(f"{copy} has no library copy; run scripts/library-art.py")
def stage(root, controller, expected_controller_digest, output):
@@ -75,7 +79,7 @@ def stage(root, controller, expected_controller_digest, output):
bundle_bytes, preview_bytes = bundle.read_bytes(), preview.read_bytes()
if not bundle_bytes or not preview_bytes:
raise ValueError("Game bundles and previews must be built first")
preview_bytes = library_art(root, name, "preview", preview_bytes)
preview_bytes, preview_suffix = library_art(root, name, "preview", preview_bytes)
total += len(bundle_bytes) + len(preview_bytes)
child = dict(
id=identifier, title=game["title"],
@@ -83,8 +87,8 @@ def stage(root, controller, expected_controller_digest, output):
expected_id=name, version=component["version"],
sha256=hashlib.sha256(bundle_bytes).hexdigest(),
bytes=len(bundle_bytes),
preview=f"assets/arcade/previews/{name}.png",
icon=f"assets/arcade/previews/{name}.png")
preview=f"assets/arcade/previews/{name}{preview_suffix}",
icon=f"assets/arcade/previews/{name}{preview_suffix}")
# A thin add-on links its required games' verified code as libraries.
if app.get('shared_code'):
child['shared_code'] = True
@@ -107,8 +111,8 @@ def stage(root, controller, expected_controller_digest, output):
relative = Path(cover[key])
if relative.is_absolute() or ".." in relative.parts or relative.suffix != ".png":
raise ValueError("Invalid cover asset path")
contents = library_art(root, name, key, (app["source"] / relative).read_bytes())
destination = Path("arcade/covers") / f"{name}-{key}.png"
contents, suffix = library_art(root, name, key, (app["source"] / relative).read_bytes())
destination = Path("arcade/covers") / f"{name}-{key}{suffix}"
packed_cover[key] = "assets/" + destination.as_posix()
copies.append((contents, destination))
total += len(contents)
@@ -116,7 +120,7 @@ def stage(root, controller, expected_controller_digest, output):
children.append(child)
package["children"].append(identifier)
copies += [(bundle_bytes, Path("arcade/games") / (name + ".zx")),
(preview_bytes, Path("arcade/previews") / (name + ".png"))]
(preview_bytes, Path("arcade/previews") / (name + preview_suffix))]
if total > MAX_PAYLOAD_BYTES:
raise ValueError("Arcade collection exceeds the host's payload limit")
catalog = dict(schema=1, id=arcade["id"], title=arcade["title"],
+65 -8
View File
@@ -6,8 +6,15 @@ the website passes the published one Inner Breeze downloads. Arcade's own host
is compiled to WebAssembly with the account Profile. The receipt names the
collection's digest and the Apps library it trusts. Arcade's own copy of that
library goes beside it for collections that do not pack one.
With --shovey the page is shovey.waozi.xyz: the same host runs a released
Shovey download's own shovey.zx, shovey.json and entity.zx, unchanged, on the
page files --site names. Their programs, and the game and Apps controller
packed in shovey.zx, are compiled into the page, so they run as fast as a
native build of them; the page still opens those exact bytes.
"""
import argparse
import gzip
import hashlib
import json
import os
@@ -25,6 +32,35 @@ def package(name):
return Path(subprocess.check_output([ZIRAN, 'pkg', 'path', name, *flags], cwd=ROOT, text=True).strip())
def compress(path):
"""A gzip copy beside path, which the page fetches first: Cloudflare
Pages does not compress binary files (apps.zx 1.9 MB -> 0.24 MB)."""
with open(path.with_name(path.name + '.gz'), 'wb') as raw:
with gzip.GzipFile(filename='', mode='wb', compresslevel=9, fileobj=raw, mtime=0) as packed:
packed.write(path.read_bytes())
def version_assets(output, receipt):
"""Keep the runtime, its data and the verified collection on one cache key."""
page = output / 'index.html'
html = page.read_text()
if '__ARCADE_ASSET_REVISION__' not in html:
return
digest = hashlib.sha256()
for name in ('runtime.js', 'runtime.wasm', 'runtime.data', 'arcade.json', 'apps.zx'):
path = output / name
if path.is_file():
digest.update(name.encode() + b'\0')
digest.update(path.read_bytes())
revision = digest.hexdigest()
page.write_text(html.replace('__ARCADE_ASSET_REVISION__', revision))
source = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip()
(output / 'build.json').write_text(json.dumps({
'source_revision': source, 'version': receipt['version'],
'assets_sha256': revision,
}, indent=2) + '\n')
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--bundle', type=Path, default=ROOT / 'build/node-apps/arcade.zx')
@@ -33,32 +69,53 @@ def main():
parser.add_argument('--profile', type=Path, default=ROOT / 'build/entity.zx')
parser.add_argument('--controller', type=Path, default=ROOT / 'build/apps-ui/apps.zx')
parser.add_argument('--output', type=Path, default=ROOT / 'build/web-site')
parser.add_argument('--shovey', type=Path, help='a released Shovey download folder')
parser.add_argument('--site', type=Path, default=ROOT / 'site')
args = parser.parse_args()
bundle = args.bundle.resolve()
receipt = dict(id='inbe.arcade', version=args.version,
sha256=hashlib.sha256(bundle.read_bytes()).hexdigest(),
apps_sha256=args.controller_sha256)
if args.shovey:
bundle = (args.shovey / 'shovey.zx').resolve()
receipt = json.loads((args.shovey / 'shovey.json').read_text())
if receipt.get('id') != 'arcade.shovey-player' or \
hashlib.sha256(bundle.read_bytes()).hexdigest() != receipt.get('sha256'):
raise SystemExit('The Shovey download does not match its shovey.json')
args.profile = args.shovey / 'entity.zx'
args.controller_sha256 = receipt['apps_sha256']
args.version = receipt['version']
else:
bundle = args.bundle.resolve()
receipt = dict(id='inbe.arcade', version=args.version,
sha256=hashlib.sha256(bundle.read_bytes()).hexdigest(),
apps_sha256=args.controller_sha256)
# The host reads the receipt into a 4 KiB buffer.
text = json.dumps(receipt, separators=(',', ':')) if args.shovey else json.dumps(receipt, indent=2) + '\n'
if len(text.encode()) >= 4096:
raise SystemExit('The receipt exceeds the host buffer')
work = ROOT / 'build/web'
work.mkdir(parents=True, exist_ok=True)
env = {**os.environ, 'ZIRAN': str(package('ziran') / 'build/bin/ziran')}
linked = [item for path in (bundle, args.profile.resolve()) for item in ('--linked', str(path))] \
if args.shovey else []
subprocess.run([sys.executable, str(package('entity') / 'scripts/build-web.py'),
'--bundle', str(bundle), '--profile', str(args.profile.resolve()),
'--output', str(work / 'runtime.html'),
'--output', str(work / 'runtime.html'), *linked,
'--entry', 'runtime:main', '--source', 'src/web/runtime.zi'], cwd=ROOT, env=env, check=True)
output = args.output.resolve()
if output.exists():
shutil.rmtree(output)
shutil.copytree(ROOT / 'site', output)
shutil.copytree(args.site, output)
for name in ('runtime.js', 'runtime.wasm', 'runtime.data'):
shutil.copyfile(work / name, output / name)
(output / 'arcade.json').write_text(json.dumps(receipt, indent=2) + '\n')
compress(output / 'runtime.data')
(output / 'arcade.json').write_text(text)
# Only the library the receipt trusts; the host refuses any other.
controller = args.controller.read_bytes() if args.controller.is_file() else b''
if hashlib.sha256(controller).hexdigest() == args.controller_sha256:
(output / 'apps.zx').write_bytes(controller)
compress(output / 'apps.zx')
else:
print('No matching Apps controller beside the collection; it must pack its own')
print(f'Arcade {args.version} for the browser in {output}')
version_assets(output, receipt)
print(f'{"Shovey" if args.shovey else "Arcade"} {args.version} for the browser in {output}')
if __name__ == '__main__':
+33 -10
View File
@@ -1,8 +1,10 @@
#!/usr/bin/env python3
"""Stage bounded thumbnails for every game's library covers and previews.
Library covers retain full colour and transparency at thumbnail resolution.
Games keep their own original title artwork. Arcade downloads this small art
Library covers retain full colour and transparency at thumbnail resolution:
opaque cover art is a JPEG, a sixth of its PNG size, while logos keep their
transparency and previews their pixel art as PNG. Games keep their own
original title artwork. Arcade downloads this small art
bundle separately from its launcher and caches it by its content digest.
The copies and sources.json, which records the SHA-256 of the art each copy
@@ -24,14 +26,28 @@ COVER_LONGEST = 640
LOGO_LONGEST = 512
COVER_QUALITY = 85
SUFFIXES = ('.png', '.jpg')
def copy_path(name):
"""The committed copy for name, whichever format it was made in."""
for suffix in SUFFIXES:
if (LIBRARY / (name + suffix)).is_file():
return LIBRARY / (name + suffix)
raise FileNotFoundError(f'{name} has no library copy; run scripts/library-art.py')
def small_copy(data, key):
"""(bytes, suffix) of the library's copy of one picture."""
image = Image.open(io.BytesIO(data))
image.load()
longest = PREVIEW_LONGEST if key == 'preview' else LOGO_LONGEST if key == 'logo' else COVER_LONGEST
scale = min(1.0, longest / max(image.size))
if scale == 1.0 and key != 'preview':
return data
alpha = 'A' in image.getbands() or 'transparency' in image.info
photo = key in ('portrait', 'landscape') and not alpha
if scale == 1.0 and key != 'preview' and not photo:
return data, '.png'
image = image.convert('RGBA' if alpha else 'RGB')
if scale < 1.0:
size = (max(1, round(image.width * scale)), max(1, round(image.height * scale)))
@@ -42,8 +58,11 @@ def small_copy(data, key):
else:
image = image.quantize(256, dither=Image.Dither.FLOYDSTEINBERG)
output = io.BytesIO()
if photo:
image.save(output, 'JPEG', quality=COVER_QUALITY, optimize=True, progressive=True)
return output.getvalue(), '.jpg'
image.save(output, 'PNG', optimize=True)
return output.getvalue()
return output.getvalue(), '.png'
def art(root=ROOT):
@@ -62,15 +81,19 @@ def art(root=ROOT):
def main():
LIBRARY.mkdir(parents=True, exist_ok=True)
sources = {}
written = set()
for name, key, data in art():
copy = f'{name}-{key}'
(LIBRARY / f'{copy}.png').write_bytes(small_copy(data, key))
contents, suffix = small_copy(data, key)
(LIBRARY / (copy + suffix)).write_bytes(contents)
written.add(copy + suffix)
sources[copy] = {'source_sha256': hashlib.sha256(data).hexdigest()}
for stale in LIBRARY.glob('*.png'):
if stale.stem not in sources:
stale.unlink()
for suffix in SUFFIXES:
for stale in LIBRARY.glob('*' + suffix):
if stale.name not in written:
stale.unlink()
(LIBRARY / 'sources.json').write_text(json.dumps(dict(sorted(sources.items())), indent=2) + '\n')
total = sum((LIBRARY / f'{copy}.png').stat().st_size for copy in sources)
total = sum((LIBRARY / name).stat().st_size for name in written)
print(f'{len(sources)} library images, {total / 1048576:.1f} MiB')
+55 -9
View File
@@ -10,6 +10,9 @@
<link rel="icon" href="icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="manifest" href="manifest.webmanifest">
<!-- The runtime downloads while the page fetches the collection's files. -->
<link rel="preload" href="runtime.js?v=__ARCADE_ASSET_REVISION__" as="script">
<link rel="preload" href="runtime.wasm?v=__ARCADE_ASSET_REVISION__" as="fetch" type="application/wasm" crossorigin>
<meta property="og:type" content="website">
<meta property="og:url" content="https://arcade.waozi.xyz/">
<meta property="og:title" content="Arcade">
@@ -41,6 +44,12 @@
(function () {
var loading = document.getElementById('loading');
var bar = loading.querySelector('.bar');
var assetRevision = '__ARCADE_ASSET_REVISION__';
function assetUrl(name) {
var url = new URL(name, document.baseURI);
url.searchParams.set('v', assetRevision);
return url.href;
}
function failed() { loading.classList.add('error'); }
// Arcade's Profile reports ready once the library is about to draw.
function watch() {
@@ -49,6 +58,7 @@
}
window.Module = {
canvas: document.getElementById('canvas'),
locateFile: assetUrl,
setStatus: function (text) {
var match = /\((\d+(?:\.\d+)?)\/(\d+)\)/.exec(text || '');
if (match) bar.style.width = Math.min(100, 100 * match[1] / match[2]) + '%';
@@ -56,26 +66,62 @@
onAbort: failed,
onExit: function (code) { if (code !== 0) failed(); }
};
// Bundles travel gzip-compressed beside their plain copies: Cloudflare
// does not compress binary files. Browsers without DecompressionStream,
// or a missing .gz, take the plain file; null when neither exists.
function plain(name) {
return fetch(assetUrl(name)).then(function (response) {
return response.ok ? response.arrayBuffer() : null;
});
}
function bundle(name) {
if (typeof DecompressionStream !== 'function') return plain(name);
return fetch(assetUrl(name + '.gz')).then(function (response) {
if (!response.ok) throw new Error(response.status);
return response.arrayBuffer();
}).then(function (packed) {
var head = new Uint8Array(packed, 0, Math.min(2, packed.byteLength));
// A server that already decoded it hands over the plain bytes.
if (head[0] !== 0x1f || head[1] !== 0x8b) return packed;
return new Response(new Blob([packed]).stream()
.pipeThrough(new DecompressionStream('gzip'))).arrayBuffer();
}).catch(function () { return plain(name); });
}
// The build receipt names the collection's digest and its trusted Apps
// library; Arcade's own copy of that library goes in beside it.
Promise.all([
fetch('arcade.json', { cache: 'no-cache' }).then(function (response) {
fetch(assetUrl('arcade.json'), { cache: 'no-cache' }).then(function (response) {
if (!response.ok) throw new Error(response.status);
return response.text();
}),
fetch('apps.zx').then(function (response) {
return response.ok ? response.arrayBuffer() : null;
})
bundle('apps.zx'),
bundle('runtime.data')
]).then(function (loaded) {
Module.arcadeReceipt = loaded[0];
if (loaded[1]) {
Module.preRun = [function () { FS.writeFile('/apps.zx', new Uint8Array(loaded[1])); }];
}
var script = document.createElement('script');
script.src = 'runtime.js';
script.onerror = failed;
document.body.appendChild(script);
watch();
// The runtime's file package, already here, is not fetched again.
if (loaded[2]) {
Module.getPreloadedPackage = function () { return loaded[2]; };
}
function start() {
var script = document.createElement('script');
script.src = assetUrl('runtime.js');
script.onerror = failed;
document.body.appendChild(script);
watch();
}
// One sign-in for every waozi.xyz site: account.waozi.xyz hands over
// the shared profile before Arcade starts, or Arcade starts without it.
var started = false;
function go() { if (!started) { started = true; start(); } }
var shared = document.createElement('script');
shared.src = 'https://account.waozi.xyz/share.js';
shared.onload = function () { WaoziAccount.attach(Module, 2500).then(go, go); };
shared.onerror = go;
setTimeout(go, 4000);
document.head.appendChild(shared);
}).catch(failed);
})();
</script>
+7
View File
@@ -493,6 +493,13 @@ CollectionOpenShovey :: (directory: string, data: string) -> bool {
return found && metadata_found && CollectionOpenShoveyBytes(bytes, metadata, data)
}
// Metadata of the standalone Shovey player, as the downloads and
// shovey.waozi.xyz carry it, rather than of Arcade's collection.
CollectionShoveyReceipt :: (metadata: string) -> bool {
id: [128]u8
return AppsReadText(metadata, 0, "id", id[:]) && TextUntilNul(id[:]) == "arcade.shovey-player"
}
CollectionOpenShoveyBytes :: (bytes: string, metadata: string, data: string) -> bool {
if collection_ready { return false }
leaderboard_installed = CollectionLeaderboardInstalled
+9 -3
View File
@@ -1,6 +1,8 @@
// Arcade in the browser: the same arcade.zx Inner Breeze downloads, with its
// shared Apps library, the account Profile and each game downloaded from the
// node when someone opens it. Saves stay in the page's persistent storage.
// Given the released Shovey player instead, the shovey.zx and shovey.json of
// the downloads, it is shovey.waozi.xyz and opens on Shovey's covers.
using Canvas :: #import "kryon/Canvas";
#import "kryon/bundle_storage_web"
#import "kryon/app_files"
@@ -54,7 +56,8 @@ ArcadeFrame :: (session: Session) -> bool {
TreeCancel(session)
return false
}
if EndFrame(session) != FrameStatus.FrameOk { return false }
// Only damaged pixels are cleared and repainted; the rest of the page stays.
if EndCanvasUiFrame(session) != FrameStatus.FrameOk { return false }
TestDriverFrame(session)
CanvasCursor(session)
ok := EndCanvasFrame()
@@ -78,8 +81,11 @@ main :: () -> s32 {
// The page writes Arcade's own Apps controller beside the collection.
controller, controller_found := ReadEntireFile("/apps.zx")
if controller_found { collection_controller = controller } else { AppFileFree(controller) }
if !found || !profile_found || receipt == "" || !CollectionOpenBytes(bytes, receipt, data) { return 1 }
if !EntityOpen(profile, data) { unused CollectionClose(); return 1 }
if !found || !profile_found || receipt == "" { return 1 }
shovey := CollectionShoveyReceipt(receipt)
opened := ifx shovey then CollectionOpenShoveyBytes(bytes, receipt, data) else CollectionOpenBytes(bytes, receipt, data)
if !opened { return 1 }
if !EntityOpen(profile, data, shovey) { unused CollectionClose(); return 1 }
session := SessionOpen()
if !SessionValid(session) { unused CollectionClose(); return 1 }
defer { SessionClose(session) }
+25 -8
View File
@@ -78,11 +78,11 @@ class CollectionTests(unittest.TestCase):
self.assertEqual(child["protocol"], "node/2")
# The library packs its own small copy of each game's art.
self.assertEqual((self.output / child["preview"]).read_bytes(),
(ROOT / f"assets/arcade/library/{name}-preview.png").read_bytes())
artist.copy_path(f"{name}-preview").read_bytes())
for key, path in child["cover"].items():
if key in ("portrait", "landscape", "logo"):
self.assertEqual((self.output / path).read_bytes(),
(ROOT / f"assets/arcade/library/{name}-{key}.png").read_bytes())
artist.copy_path(f"{name}-{key}").read_bytes())
self.assertEqual((self.output / catalog["harness"]).read_bytes(), self.controller.read_bytes())
def test_changed_game_art_needs_fresh_library_copies(self):
@@ -115,6 +115,9 @@ class CollectionTests(unittest.TestCase):
self.assertAlmostEqual(thumbnail.width / thumbnail.height,
source.width / source.height, delta=0.01)
self.assertIn(thumbnail.mode, ('RGB', 'RGBA'))
# Opaque cover art is a JPEG; transparency stays PNG.
self.assertEqual(thumbnail.format, 'JPEG' if key != 'logo' and
thumbnail.mode == 'RGB' else 'PNG')
def test_editor_download_reuses_verified_shovey_assets(self):
catalog = self.stage()
@@ -249,7 +252,7 @@ class CollectionTests(unittest.TestCase):
(self.root / "games.json").write_text(json.dumps({"packages": []}))
self.assertEqual(self.stage()["children"], [])
self.assertFalse((self.output / "assets/arcade/games/shovey.zx").exists())
self.assertFalse((self.output / "assets/arcade/covers/shovey-portrait.png").exists())
self.assertFalse((self.output / "assets/arcade/covers/shovey-portrait.jpg").exists())
def test_unknown_declaration_field_rejected(self):
declaration = json.loads((self.root / "apps.json").read_text())
@@ -267,7 +270,10 @@ class LibraryThumbnailTests(unittest.TestCase):
for y in range(1200) for x in range(900)])
data = io.BytesIO()
source.save(data, 'PNG')
with Image.open(io.BytesIO(artist.small_copy(data.getvalue(), 'portrait'))) as thumbnail:
contents, suffix = artist.small_copy(data.getvalue(), 'portrait')
self.assertEqual(suffix, '.jpg')
with Image.open(io.BytesIO(contents)) as thumbnail:
self.assertEqual(thumbnail.format, 'JPEG')
self.assertEqual(thumbnail.size, (480, 640))
self.assertEqual(thumbnail.mode, 'RGB')
self.assertIsNone(thumbnail.getcolors(256))
@@ -277,23 +283,34 @@ class LibraryThumbnailTests(unittest.TestCase):
source.paste((200, 35, 100, 255), (100, 50, 1100, 350))
data = io.BytesIO()
source.save(data, 'PNG')
with Image.open(io.BytesIO(artist.small_copy(data.getvalue(), 'logo'))) as thumbnail:
contents, suffix = artist.small_copy(data.getvalue(), 'logo')
self.assertEqual(suffix, '.png')
with Image.open(io.BytesIO(contents)) as thumbnail:
self.assertEqual(thumbnail.size, (512, 171))
self.assertEqual(thumbnail.mode, 'RGBA')
self.assertEqual(thumbnail.getpixel((0, 0))[3], 0)
self.assertEqual(thumbnail.getpixel((256, 85))[3], 255)
def test_small_covers_are_neither_enlarged_nor_reencoded(self):
def test_small_covers_are_not_enlarged(self):
source = Image.new('RGB', (120, 180), (25, 50, 75))
data = io.BytesIO()
source.save(data, 'PNG')
self.assertEqual(artist.small_copy(data.getvalue(), 'portrait'), data.getvalue())
contents, suffix = artist.small_copy(data.getvalue(), 'portrait')
self.assertEqual(suffix, '.jpg')
with Image.open(io.BytesIO(contents)) as thumbnail:
self.assertEqual(thumbnail.size, (120, 180))
def test_small_transparent_art_is_not_reencoded(self):
source = Image.new('RGBA', (120, 60), (25, 50, 75, 128))
data = io.BytesIO()
source.save(data, 'PNG')
self.assertEqual(artist.small_copy(data.getvalue(), 'logo'), (data.getvalue(), '.png'))
def test_thin_logos_keep_at_least_one_pixel(self):
source = Image.new('RGBA', (4096, 1), (25, 50, 75, 255))
data = io.BytesIO()
source.save(data, 'PNG')
with Image.open(io.BytesIO(artist.small_copy(data.getvalue(), 'logo'))) as thumbnail:
with Image.open(io.BytesIO(artist.small_copy(data.getvalue(), 'logo')[0])) as thumbnail:
self.assertEqual(thumbnail.size, (512, 1))
+20 -1
View File
@@ -12,8 +12,16 @@ if (!site) throw new Error('Usage: node tests/web_site_test.mjs SITE_DIR');
const types = { '.html': 'text/html', '.js': 'text/javascript', '.wasm': 'application/wasm', '.json': 'application/json',
'.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.webmanifest': 'application/manifest+json' };
const server = createServer(async (request, response) => {
const path = normalize(decodeURIComponent(new URL(request.url, 'http://x').pathname)).replace(/^\/+/, '') || 'index.html';
const url = new URL(request.url, 'http://x');
const path = normalize(decodeURIComponent(url.pathname)).replace(/^\/+/, '') || 'index.html';
try {
// Model the previous runtime still cached under its unversioned URL.
// A new deployment must request its coherent runtime revision instead.
if (path === 'runtime.js' && !url.searchParams.has('v')) {
response.writeHead(200, { 'Content-Type': 'text/javascript', 'Cache-Control': 'public, max-age=14400' });
response.end('console.error("Stale cached Arcade runtime"); Module.onAbort();');
return;
}
const body = await readFile(join(site, path));
response.writeHead(200, { 'Content-Type': types[extname(path)] || 'application/octet-stream' });
response.end(body);
@@ -69,6 +77,17 @@ try {
if (!ready) await delay(250);
}
if (!ready && !failure) failure = 'the library never became ready';
if (ready) {
const resources = await command('Runtime.evaluate', {
expression: 'performance.getEntriesByType("resource").map(entry=>entry.name)', returnByValue: true });
const runtime = resources.result.value.map(name=>new URL(name)).filter(url=>
/\/(runtime\.(js|wasm|data)(\.gz)?|arcade\.json|apps\.zx(\.gz)?)$/.test(url.pathname));
const revisions = new Set(runtime.map(url=>url.searchParams.get('v')));
if (!runtime.some(url=>url.pathname.endsWith('/runtime.js')) ||
!runtime.some(url=>url.pathname.endsWith('/runtime.wasm')) ||
revisions.size !== 1 || !/^[a-f0-9]{64}$/.test([...revisions][0]))
failure = 'the runtime and collection files did not use one coherent cache revision';
}
// Let the library draw several frames before judging them.
await delay(3000);
const failed = console_lines.find(line => /frame failed|portable execution failed/.test(line));
+45 -45
View File
@@ -18,17 +18,9 @@
"ref": "master",
"url": "https://github.com/ziranlang/qrcode.git"
},
{
"commit": "818916db6cbd42034bf869899feb75be8829d42e",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p3127065409ca96f6"},
"id": "p15331309f570593d",
"name": "Apps",
"ref": "master",
"url": "https://github.com/waozixyz/apps.git"
},
{
"commit": "d74348c2e288ac55740461f7e106cda365b4db4a",
"dependencies": {"apps": "p15331309f570593d", "crypto": "pc23fbf455e97614d", "curl": "p1ca0e8d3c19dbe4c", "daochi_client": "p9972fcdd2d5ba999", "entity": "p52862c0351d05875", "game2d": "pf2f54c7603f6e861", "kryon": "p3127065409ca96f6", "kss": "p1b13dda539ed2a39", "liboqs": "pe6e1a0c8fb76aa60", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "p9079dde0fcc11248", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "p1d80baafaa5fa18a"},
"dependencies": {"apps": "pfb2b063c26a84c8b", "crypto": "pc23fbf455e97614d", "curl": "p1ca0e8d3c19dbe4c", "daochi_client": "p9972fcdd2d5ba999", "entity": "p6a3a2bd6315ab909", "game2d": "pf2f54c7603f6e861", "kryon": "p974af619ca377b85", "kss": "p1b13dda539ed2a39", "liboqs": "pecdb097af6ab16f7", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "p9079dde0fcc11248", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "p1d80baafaa5fa18a"},
"id": "p183b01bccc6424e7",
"name": "Inbe",
"ref": "master",
@@ -36,7 +28,7 @@
},
{
"commit": "1cb9df183089a77c8a16448a556186f30b261a98",
"dependencies": {"kryon": "p3127065409ca96f6"},
"dependencies": {"kryon": "p974af619ca377b85"},
"id": "p1b13dda539ed2a39",
"name": "Kss",
"ref": "master",
@@ -60,22 +52,6 @@
"source": true,
"url": "https://github.com/sqlite/sqlite.git"
},
{
"commit": "0931212f92d5f1a3f8b1be80abab7a9695bda50e",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p3127065409ca96f6",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "ca637d08b0d6b54ab6bb56bbfd9a25d7fb70f56c",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p3127065409ca96f6", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p52862c0351d05875",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
"dependencies": {},
@@ -85,9 +61,17 @@
"source": true,
"url": "https://github.com/raysan5/raylib.git"
},
{
"commit": "90cee1066a51e1f8961de06515f6e50bdaaf4490",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p974af619ca377b85", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p6a3a2bd6315ab909",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "22d2ddbdc236796953c905a05a2cebf5ab1b4ff3",
"dependencies": {"liboqs": "pe6e1a0c8fb76aa60"},
"dependencies": {"liboqs": "pecdb097af6ab16f7"},
"id": "p7098ac9cd92f7e5f",
"name": "Oqs",
"ref": "master",
@@ -111,6 +95,14 @@
"source": true,
"url": "https://github.com/waozixyz/practices.git"
},
{
"commit": "3fad22341997f7c58ed1b11b1e88217358e51af5",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p974af619ca377b85",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "25d9f649c43a8de44a5fea602d2835e33e6ca999",
"dependencies": {"crypto": "pc23fbf455e97614d", "oqs": "p7098ac9cd92f7e5f"},
@@ -121,7 +113,7 @@
},
{
"commit": "3f888653b6b97010163d824c4cc72476be3214f3",
"dependencies": {"kryon": "p3127065409ca96f6"},
"dependencies": {"kryon": "p974af619ca377b85"},
"id": "pab5377a2950368a2",
"name": "plot",
"ref": "master",
@@ -144,45 +136,53 @@
"url": "https://github.com/kryonlabs/mingcute.git"
},
{
"commit": "c98cd0cff056978d63b18fad8d013d58bacd9b5d",
"commit": "b9ca6de322881b40139ba6d19a0744eda1128db0",
"dependencies": {"apps": "pfb2b063c26a84c8b", "entity": "p6a3a2bd6315ab909", "kryon": "p974af619ca377b85", "mingcute": "pe1027b9d16704793"},
"id": "pe8259811ea138316",
"name": "Apfelwurm",
"ref": "b9ca6de322881b40139ba6d19a0744eda1128db0",
"url": "https://github.com/waozixyz/wurm.git"
},
{
"commit": "4778aa5044bf119c30df54219fa89357080af27f",
"dependencies": {},
"id": "pe6e1a0c8fb76aa60",
"id": "pecdb097af6ab16f7",
"name": "liboqs",
"ref": "main",
"source": true,
"url": "https://github.com/open-quantum-safe/liboqs.git"
},
{
"commit": "3cead1f21720258c0acffa84c8625579d68c3a9e",
"dependencies": {"apps": "p15331309f570593d", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
"id": "peafb3c123b12e97a",
"name": "Apfelwurm",
"ref": "3cead1f21720258c0acffa84c8625579d68c3a9e",
"url": "https://github.com/waozixyz/wurm.git"
},
{
"commit": "cee04692f3461dcb098833472f071c434980debb",
"dependencies": {"kryon": "p3127065409ca96f6"},
"dependencies": {"kryon": "p974af619ca377b85"},
"id": "pf2f54c7603f6e861",
"name": "Game2D",
"ref": "master",
"url": "https://github.com/kryonlabs/game2d.git"
},
{
"commit": "82bf0955674c8afc6f6b85df86e59c46cfbe43ee",
"dependencies": {"apps": "p15331309f570593d", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
"id": "pf5159eeee3cf1d66",
"commit": "2419a7c645d3e2cfe904fc98763e06ee57cabbde",
"dependencies": {"apps": "pfb2b063c26a84c8b", "entity": "p6a3a2bd6315ab909", "kryon": "p974af619ca377b85", "mingcute": "pe1027b9d16704793"},
"id": "pf9aaac00f44c39f6",
"name": "Shovey",
"ref": "82bf0955674c8afc6f6b85df86e59c46cfbe43ee",
"ref": "2419a7c645d3e2cfe904fc98763e06ee57cabbde",
"url": "https://github.com/waozixyz/shovey.git"
},
{
"commit": "dc6b743b5299318fa74bd32854b0eff0046d24a2",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p974af619ca377b85"},
"id": "pfb2b063c26a84c8b",
"name": "Apps",
"ref": "master",
"url": "https://github.com/waozixyz/apps.git"
}
],
"root": {
"dependencies": {"apps": "p15331309f570593d", "entity": "p52862c0351d05875", "inbe": "p183b01bccc6424e7", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793", "shovey": "pf5159eeee3cf1d66", "wurm": "peafb3c123b12e97a"},
"dependencies": {"apps": "pfb2b063c26a84c8b", "entity": "p6a3a2bd6315ab909", "inbe": "p183b01bccc6424e7", "kryon": "p974af619ca377b85", "mingcute": "pe1027b9d16704793", "shovey": "pf9aaac00f44c39f6", "wurm": "pe8259811ea138316"},
"name": "Arcade"
},
"toolchain": {
"commit": "5efa24f818485cf265bdd5c066a4e2150175ac0e",
"commit": "2e2fea84d91ead3c5af4a105c7d716cfa8bb6a31",
"ref": "master",
"url": "https://github.com/ziranlang/ziran.git"
}
+2 -2
View File
@@ -39,7 +39,7 @@ ref = "master"
# Shovey's editions and editor are available as separate downloads.
[dependencies.shovey]
git = "https://github.com/waozixyz/shovey.git"
ref = "82bf0955674c8afc6f6b85df86e59c46cfbe43ee"
ref = "2419a7c645d3e2cfe904fc98763e06ee57cabbde"
# Compatibility tooling runs Inner Breeze's host checks; releases check its publisher pins.
[dependencies.inbe]
@@ -56,4 +56,4 @@ ref = "master"
[dependencies.wurm]
git = "https://github.com/waozixyz/wurm.git"
ref = "3cead1f21720258c0acffa84c8625579d68c3a9e"
ref = "b9ca6de322881b40139ba6d19a0744eda1128db0"