Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2f5c252a |
No files matched your search
@@ -1,5 +1,9 @@
|
||||
# Arcade changelog
|
||||
|
||||
## 0.7.113
|
||||
|
||||
- Choano 0.1.3 loads its artwork and sound from the paths the game requests.
|
||||
|
||||
## 0.7.112
|
||||
|
||||
- Every library cover shows its declared app title, including Apfelwurm Editor.
|
||||
|
||||
+4
-4
@@ -13,8 +13,8 @@
|
||||
"choano": {
|
||||
"id": "xyz.waozi.choano",
|
||||
"title": "Choano",
|
||||
"version": "0.1.2",
|
||||
"sequence": 1,
|
||||
"version": "0.1.3",
|
||||
"sequence": 2,
|
||||
"host_api": 41
|
||||
},
|
||||
"shovey": {
|
||||
@@ -34,8 +34,8 @@
|
||||
"arcade": {
|
||||
"id": "inbe.arcade",
|
||||
"title": "Arcade",
|
||||
"version": "0.7.112",
|
||||
"sequence": 191,
|
||||
"version": "0.7.113",
|
||||
"sequence": 192,
|
||||
"host_api": 41
|
||||
},
|
||||
"wurm": {
|
||||
|
||||
@@ -20,9 +20,51 @@ spec.loader.exec_module(builder)
|
||||
art_spec = importlib.util.spec_from_file_location("library_art", ROOT / "scripts/library-art.py")
|
||||
artist = importlib.util.module_from_spec(art_spec)
|
||||
art_spec.loader.exec_module(artist)
|
||||
spec = importlib.util.spec_from_file_location("published_games", ROOT / "scripts/wait-published-games.py")
|
||||
published_games = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(published_games)
|
||||
|
||||
|
||||
def bundle_asset_paths(path):
|
||||
"""Read the actual bundle index without loading its images or executing it."""
|
||||
with published_games.Reader(path) as reader:
|
||||
if reader.take(8) != b"ZX\0\0\x1a\0\0\0":
|
||||
raise ValueError("Unsupported game bundle")
|
||||
reader.text()
|
||||
reader.text()
|
||||
for _ in range(reader.number()):
|
||||
reader.text()
|
||||
reader.text()
|
||||
for _ in range(reader.number()):
|
||||
for _ in range(7):
|
||||
reader.text()
|
||||
reader.take(8)
|
||||
reader.text()
|
||||
reader.take(4)
|
||||
for _ in range(reader.number()):
|
||||
for _ in range(3):
|
||||
reader.text()
|
||||
reader.skip(reader.number())
|
||||
paths = set()
|
||||
for _ in range(reader.number()):
|
||||
name = reader.text().decode()
|
||||
if name in paths:
|
||||
raise ValueError("Duplicate game asset: " + name)
|
||||
paths.add(name)
|
||||
reader.skip(reader.number())
|
||||
reader.finish()
|
||||
return paths
|
||||
|
||||
|
||||
class CollectionTests(unittest.TestCase):
|
||||
def test_choano_runtime_images_are_packed_at_their_runtime_paths(self):
|
||||
# Fixed runtime references catch a doubled namespace in the real
|
||||
# compiled payload, independently of the packaging declaration.
|
||||
assets = bundle_asset_paths(ROOT / "build/games/choano.zx")
|
||||
for path in ("assets/choano/background-inside.png", "assets/choano/organisms-hd.png",
|
||||
"assets/choano/title-landscape.jpg", "assets/choano/fish/sea.png"):
|
||||
self.assertTrue(path in assets, "Choano runtime image missing from its bundle: " + path)
|
||||
|
||||
def setUp(self):
|
||||
self.directory = tempfile.TemporaryDirectory(prefix="collection-", dir=ROOT / "build")
|
||||
self.addCleanup(self.directory.cleanup)
|
||||
@@ -194,7 +236,7 @@ class CollectionTests(unittest.TestCase):
|
||||
self.assertEqual(wurm_package["children"], ["xyz.waozi.wurm", "xyz.waozi.wurm-editor"])
|
||||
children = {child["id"]: child for child in catalog["children"]}
|
||||
self.assertEqual(children["xyz.waozi.choano"]["title"], "Choano")
|
||||
self.assertEqual(children["xyz.waozi.choano"]["version"], "0.1.2")
|
||||
self.assertEqual(children["xyz.waozi.choano"]["version"], "0.1.3")
|
||||
self.assertEqual(children["xyz.waozi.choano"]["expected_id"], "choano")
|
||||
self.assertEqual(children["xyz.waozi.wurm"]["version"], wurm_version)
|
||||
self.assertEqual(children["xyz.waozi.wurm-editor"]["version"], "0.1.0")
|
||||
|
||||
+31
-7
@@ -4,9 +4,12 @@
|
||||
// and the covers must draw from the site's own copies or its exact art.
|
||||
// Usage: node tests/web_site_test.mjs SITE_DIR
|
||||
// ARCADE_TEST_LIBRARY_ONLY=1 checks painted library covers and titles without downloading games.
|
||||
// ARCADE_TEST_PACKAGES=DIR serves local packages by their verified SHA-256 for unpublished builds.
|
||||
import { spawn } from 'node:child_process';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { createReadStream } from 'node:fs';
|
||||
import { createServer } from 'node:http';
|
||||
import { access, mkdtemp, readFile, rm } from 'node:fs/promises';
|
||||
import { access, mkdtemp, readFile, rm, stat } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { extname, join, normalize } from 'node:path';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
@@ -15,6 +18,7 @@ const site = process.argv[2];
|
||||
const libraryOnly = process.env.ARCADE_TEST_LIBRARY_ONLY === '1';
|
||||
const requiredTitles = ['Apfelwurm', 'Apfelwurm Editor', 'Choano'];
|
||||
const game = process.env.ARCADE_TEST_GAME || 'Apfelwurm';
|
||||
const packages = process.env.ARCADE_TEST_PACKAGES;
|
||||
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', '.webp': 'image/webp',
|
||||
@@ -28,6 +32,19 @@ const server = createServer(async (request, response) => {
|
||||
const url = new URL(request.url, 'http://x');
|
||||
const path = normalize(decodeURIComponent(url.pathname)).replace(/^\/+/, '') || 'index.html';
|
||||
try {
|
||||
const fixture = packages && /^test-packages\/([a-f0-9]{64})\.zx$/.exec(path);
|
||||
if (fixture) {
|
||||
const file = join(packages, fixture[1] + '.zx');
|
||||
const size = (await stat(file)).size;
|
||||
if (size > 64 * 1024 * 1024) throw new Error('Oversized local package');
|
||||
const hash = createHash('sha256');
|
||||
for await (const chunk of createReadStream(file)) hash.update(chunk);
|
||||
if (hash.digest('hex') !== fixture[1]) throw new Error('Local package does not match requested digest');
|
||||
response.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Content-Length': size,
|
||||
'Access-Control-Allow-Origin': '*' });
|
||||
createReadStream(file).pipe(response);
|
||||
return;
|
||||
}
|
||||
// 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')) {
|
||||
@@ -93,6 +110,12 @@ try {
|
||||
const { requestId, request } = message.params;
|
||||
const refuse = library && request.url.includes(library.art);
|
||||
if (refuse) refusedArt.push(request.url);
|
||||
const fixture = packages && /\/api\/v2\/packages\/inbe\.arcade\/([a-f0-9]{64})\.zx(?:\?|$)/.exec(request.url);
|
||||
if (fixture && !refuse) {
|
||||
socket.send(JSON.stringify({ id: ++sequence, method: 'Fetch.continueRequest', params: {
|
||||
requestId, url: `http://127.0.0.1:${server.address().port}/test-packages/${fixture[1]}.zx` } }));
|
||||
return;
|
||||
}
|
||||
socket.send(JSON.stringify(refuse
|
||||
? { id: ++sequence, method: 'Fetch.failRequest', params: { requestId, errorReason: 'BlockedByClient' } }
|
||||
: { id: ++sequence, method: 'Fetch.continueRequest', params: { requestId } }));
|
||||
@@ -172,14 +195,15 @@ try {
|
||||
};
|
||||
const button = (nodes, label) => nodes.find(node => node.kind === 'button' && node.label === label && node.visible);
|
||||
const waitButton = async label => {
|
||||
const labels = Array.isArray(label) ? label : [label];
|
||||
let nodes;
|
||||
for (const end = Date.now() + 60000; Date.now() < end;) {
|
||||
nodes = await tree();
|
||||
const found = button(nodes, label);
|
||||
const found = nodes.find(node => node.kind === 'button' && labels.includes(node.label) && node.visible);
|
||||
if (found) return found;
|
||||
await delay(150);
|
||||
}
|
||||
throw new Error('Game did not show ' + label + ': ' + nodes.filter(node => node.kind === 'button').map(node => node.label).join(', '));
|
||||
throw new Error('Game did not show ' + labels.join(' or ') + ': ' + nodes.filter(node => node.kind === 'button').map(node => node.label).join(', '));
|
||||
};
|
||||
const pageReady = async () => {
|
||||
for (const end = Date.now() + 60000; Date.now() < end;) {
|
||||
@@ -255,12 +279,12 @@ try {
|
||||
const download = (await tree()).findLast(node => node.kind === 'button' && node.label === 'Download');
|
||||
if (!download) throw new Error('The cover did not offer its download');
|
||||
await click(download);
|
||||
await waitButton(game === 'Apfelwurm' ? 'Play' : 'Back');
|
||||
await waitButton(game === 'Apfelwurm' ? 'Play' : ['Play', 'Back']);
|
||||
const play = button(await tree(), 'Play');
|
||||
if (play) await click(play);
|
||||
const swipe = button(await tree(), 'Swipe');
|
||||
if (swipe) await click(swipe);
|
||||
if (game === 'Apfelwurm') await waitButton('Pause');
|
||||
if (play || game === 'Apfelwurm') await waitButton('Pause');
|
||||
// Flush the actual control record before a cold restart.
|
||||
await evaluate(`new Promise((resolve,reject) => FS.syncfs(false,error => error ? reject(error) : resolve(true)))`);
|
||||
await command('Page.reload');
|
||||
@@ -269,7 +293,7 @@ try {
|
||||
const installed = button(reloaded, game);
|
||||
if (!installed) throw new Error('Installed cover missing after reload');
|
||||
await click(installed);
|
||||
await waitButton(game === 'Apfelwurm' ? 'Play' : 'Back');
|
||||
await waitButton(game === 'Apfelwurm' ? 'Play' : ['Play', 'Back']);
|
||||
console.log(game + ' downloaded, opened its game and reopened from its installed cover');
|
||||
if (game === 'Apfelwurm') {
|
||||
await command('Page.reload');
|
||||
@@ -369,4 +393,4 @@ if (failure) {
|
||||
console.error(console_lines.slice(-20).join('\n'));
|
||||
throw new Error(failure);
|
||||
}
|
||||
console.log('Arcade opened its library in the browser');
|
||||
console.log('Arcade opened its library in the browser' + (packages ? ' using local packages verified by SHA-256' : ''));
|
||||
+9
-9
@@ -160,6 +160,14 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "528618898db605b0f2960759d49871cde2209086",
|
||||
"dependencies": {"apps": "p9928fc15e7b93288", "entity": "pb6d17ac2aeb5844f", "game2d": "pf2f54c7603f6e861", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793"},
|
||||
"id": "pba7b4d6a4dcf84ae",
|
||||
"name": "Choano",
|
||||
"ref": "528618898db605b0f2960759d49871cde2209086",
|
||||
"url": "https://github.com/waozixyz/choano.git"
|
||||
},
|
||||
{
|
||||
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
|
||||
"dependencies": {},
|
||||
@@ -176,14 +184,6 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/mingcute.git"
|
||||
},
|
||||
{
|
||||
"commit": "b7cfb33ab6f6d5fc0bcf472282d507ada42d0702",
|
||||
"dependencies": {"apps": "p9928fc15e7b93288", "entity": "pb6d17ac2aeb5844f", "game2d": "pf2f54c7603f6e861", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793"},
|
||||
"id": "pe128e00fa98e0676",
|
||||
"name": "Choano",
|
||||
"ref": "b7cfb33ab6f6d5fc0bcf472282d507ada42d0702",
|
||||
"url": "https://github.com/waozixyz/choano.git"
|
||||
},
|
||||
{
|
||||
"commit": "d32e4b606ece83e8869c954f66c334f44f7b4838",
|
||||
"dependencies": {"kryon": "p43481d12b77897ce"},
|
||||
@@ -202,7 +202,7 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p6a59d2d6364debd6", "choano": "pe128e00fa98e0676", "entity": "pb6d17ac2aeb5844f", "game2d": "pe878ed78ee9f8300", "inbe": "p183b01bccc6424e7", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793", "shovey": "p1b5832789c5a5053", "wurm": "pb4256918f4b7855d"},
|
||||
"dependencies": {"apps": "p6a59d2d6364debd6", "choano": "pba7b4d6a4dcf84ae", "entity": "pb6d17ac2aeb5844f", "game2d": "pe878ed78ee9f8300", "inbe": "p183b01bccc6424e7", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793", "shovey": "p1b5832789c5a5053", "wurm": "pb4256918f4b7855d"},
|
||||
"name": "Arcade"
|
||||
},
|
||||
"toolchain": {
|
||||
|
||||
+1
-1
@@ -64,4 +64,4 @@ ref = "d32e4b606ece83e8869c954f66c334f44f7b4838"
|
||||
|
||||
[dependencies.choano]
|
||||
git = "https://github.com/waozixyz/choano.git"
|
||||
ref = "b7cfb33ab6f6d5fc0bcf472282d507ada42d0702"
|
||||
ref = "528618898db605b0f2960759d49871cde2209086"
|
||||
Reference in new issue
Block a user