Compare commits

..
Author SHA1 Message Date
waozi 3c405887b8 Release Arcade 0.7.91 with the latest game releases 2026-10-27 06:34:13 +00:00
waozi 0c747f2c49 Release Arcade 0.7.90 with Shovey 0.6.155
Entity ca637d0 saves account aliases typed with capitals, an @ or spaces
and says when an alias is taken, in Arcade and its games.
2026-10-27 02:17:30 -03:00
waozi bc5606e32c Pin the shared Profile and verify installed-only game boards 2026-10-27 01:14:32 -03:00
waozi 37a0d8b0a7 Merge remote-tracking branch 'origin/master' 2026-10-27 00:58:42 -03:00
waozi 8452563b03 Release Arcade 0.7.89 with the latest game releases 2026-10-27 02:51:10 +00:00
waozi 96932541db Connect installed Arcade games to Profile leaderboards 2026-10-26 23:47:05 -03:00
waozi a442fe0621 Release Arcade 0.7.88 with the latest game releases 2026-10-27 01:41:10 +00:00
waozi d6ebf18af2 Preserve manifest sections while pinning game releases 2026-10-26 22:17:34 -03:00
waozi 84b3fd552a Use smaller cached thumbnails for every Arcade library cover 2026-10-26 22:06:28 -03:00
waozi 1239df4855 Resolve released game dependencies through Ziran 2026-10-26 22:01:00 -03:00
waozi 476e38ca41 Release Arcade 0.7.86 with the latest game releases 2026-10-27 00:26:50 +00:00
waozi 0b07d0d374 Follow published game source after recording release metadata 2026-10-26 20:56:33 -03:00
waozi 48d2216394 Record synchronized Shovey chests and current game releases 2026-10-26 20:42:19 -03:00
waozi bd5f4a4ccb Disable Dew funding in Google Play builds 2026-10-26 16:54:18 -03:00
waozi 9d050ff20b Include verified live legacy reward recovery in the shared host 2026-10-26 14:36:10 -03:00
waozi 6e835a5dad Ship legacy Shovey reward migration in the shared game host 2026-10-26 14:29:42 -03:00
waozi 4592ce5d95 Acknowledge Pip before testing native gameplay 2026-10-26 14:01:13 -03:00
waozi 1889eff0b7 Use the published game controls and reward dialog updates 2026-10-26 13:55:39 -03:00
waozi e4c52c82fe Merge the published Arcade release with title screen improvements 2026-10-26 13:53:43 -03:00
waozi 3fa55eb32f Show full-colour startup previews before original title art 2026-10-26 13:15:07 -03:00
waozi 11fce1e7db Keep original colours and resolution in game title screens 2026-10-26 12:58:20 -03:00
waozi 3616bce66d Release Arcade 0.7.82 with the latest game releases 2026-10-26 08:57:17 +00:00
waozi de3144d420 Match the Editor release ledger to its locked Apfelwurm package 2026-10-26 04:40:56 -03:00
waozi 34768b446a Keep the Editor release on the published Kryon revision 2026-10-26 04:24:19 -03:00
waozi 465a962f58 Release Arcade 0.7.81 with the updated Shovey Editor 2026-10-26 04:16:46 -03:00
waozi addc24b60c Release Arcade 0.7.80 with complete game pictures and reopenable chests 2026-10-26 02:45:49 -03:00
waozi 46113fc833 Release Arcade 0.7.79 with small phone covers
Pins Apps with the phone cover grid and trusts its controller; the UI test
expects all three covers in one row of small cards on a phone.
2026-10-26 02:26:48 -03:00
waozi 34cc6c7481 Draw covers while their art downloads and wait for shared-code games to open
Pins Kryon and Apps with the pending-art fix. A game opened by name waits
for its background verification, which shared-code games now use. The
receipt names the art bundle; the UI test counts only game downloads and
answers Apfelwurm's controls question.
2026-10-26 01:06:42 -03:00
waozi 401181824c Supply Arcade's own controller from a typed host asset
collection_host.zi now imports the hosted app types its controller
callback returns, so the desktop and browser hosts build again.
2026-10-26 00:48:57 -03:00
waozi 0770c94f84 Release Arcade 0.7.78 as a launcher under one megabyte
The published Arcade carries only its catalog: hosts supply the shared Apps
controller, and the games' covers and previews download once as a separate
art bundle beside the games. Covers show only the art. Pins the shared-code
toolchain, the Apps host that supports both, and Shovey's thin Editor;
Arcade now needs host interface 35. Release builds print and keep their
candidate so its exact bytes can be checked before publishing.
2026-10-26 00:33:45 -03:00
waozi df26351d07 Show only the art on Arcade's covers
A game's size stays in its download dialog; the covers no longer repeat it.
2026-10-26 00:23:43 -03:00
waozi 98851c8ddd Release Arcade 0.7.77 with the latest game releases 2026-10-26 03:13:21 +00:00
waozi c4c7563c20 Rebuild Arcade's website after automatic releases and let running builds finish 2026-10-26 00:01:14 -03:00
waozi 22da143027 Release Arcade automatically when a game publishes an update 2026-10-25 23:57:15 -03:00
waozi a3a87aa868 Build add-ons against their declared portable code libraries 2026-10-25 23:52:52 -03:00
waozi 9f7f8896f3 Wait for the page before reading Arcade's browser start state 2026-10-25 23:51:29 -03:00
waozi 6e53534df7 Run the real Arcade at arcade.waozi.xyz
The website is now Arcade itself: the published arcade.zx Inner Breeze
downloads, run by Arcade's own host compiled to WebAssembly, with the
account Profile, game downloads from the node and saves in the browser.
Kryon is pinned to the fix that lets games read records that do not exist
yet in the browser; the Apps library it packs is unchanged.
2026-10-25 23:43:36 -03:00
waozi 63367ececb Pack small copies of each game's art instead of full-size images
Arcade showed the games' full-size cover PNGs, 18 MB of its 20 MB package.
It now packs committed screen-sized copies with a 256-colour palette,
2.6 MB in all, made by scripts/library-art.py. The build stops when a
game's art changes until the copies are refreshed.
2026-10-25 23:23:01 -03:00
waozi e9c6684b40 Publish Arcade's website to arcade.waozi.xyz on every push
The page shows the games' covers on Arcade's dark library, each opening that
game's own site, in English, German and Spanish. The workflow creates the
Pages project when it is missing, deploys site/ and connects the domain.
2026-10-25 23:09:19 -03:00
63 changed files with 1887 additions and 139 deletions

No files matched your search

+127
View File
@@ -0,0 +1,127 @@
name: Game updates
# Arcade follows its games by itself. When a game package (Shovey, Apfelwurm)
# publishes a GitHub release, this pins Arcade to that release, adds the
# game's notes to Arcade's changelog, builds and checks the collection,
# commits the new Arcade version and attaches its catalog and game archive to
# the node-arcade-VERSION release. Inner Breeze's node follower then signs
# that release and publishes it to Waozi's node, where Arcade downloads games.
on:
schedule:
- cron: '7,22,37,52 * * * *'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: arcade-node-release
cancel-in-progress: false
jobs:
follow:
runs-on: ubuntu-latest
timeout-minutes: 45
defaults:
run:
working-directory: waozixyz/arcade
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
path: waozixyz/arcade
- name: Check release following
run: python3 tests/game_updates_test.py
- name: Find newer game releases
id: updates
env:
GH_TOKEN: ${{ github.token }}
run: |
python3 scripts/follow-game-releases.py check
if [ "$(python3 -c 'import json; print(len(json.load(open("build/game-updates.json"))))')" = 0 ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "Arcade already pins every game's latest release."
exit 0
fi
echo "changed=true" >> "$GITHUB_OUTPUT"
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json
lock = json.load(open('ziran.lock'))
print('toolchain=' + lock['toolchain']['commit'])
PY
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
if: steps.updates.outputs.changed == 'true'
with:
repository: ziranlang/ziran
ref: ${{ steps.updates.outputs.toolchain }}
path: ziranlang/ziran
- name: Install build dependencies
if: steps.updates.outputs.changed == 'true'
working-directory: .
run: sh ziranlang/ziran/scripts/ci_packages.sh build-essential python3-pil python3-cryptography
- name: Build the locked toolchain and pin game dependencies
id: pin
if: steps.updates.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
make -j2 -C ../../ziranlang/ziran
echo "$GITHUB_WORKSPACE/ziranlang/ziran/build/bin" >> "$GITHUB_PATH"
python3 scripts/follow-game-releases.py pin --ziran ../../ziranlang/ziran/build/bin/ziran
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json
lock = json.load(open('ziran.lock'))
shovey = lock['root']['dependencies']['shovey']
print('shovey=' + next(p['commit'] for p in lock['packages'] if p['id'] == shovey))
PY
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
if: steps.updates.outputs.changed == 'true'
with:
repository: waozixyz/shovey
ref: ${{ steps.pin.outputs.shovey }}
path: waozixyz/shovey
- name: Fetch the updated packages
if: steps.updates.outputs.changed == 'true'
run: |
# The game is generated in its own checkout at the pinned release.
printf '[overrides]\nshovey = "../shovey"\nziran = "../../ziranlang/ziran"\n' > ziran.local.toml
../../ziranlang/ziran/build/bin/ziran fetch
- name: Write the Arcade release
id: release
if: steps.updates.outputs.changed == 'true'
run: |
python3 scripts/follow-game-releases.py changelog --ziran ../../ziranlang/ziran/build/bin/ziran
sh update_version.sh
python3 scripts/follow-game-releases.py art
echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
head -12 CHANGELOG.md
- name: Build and check the collection
if: steps.updates.outputs.changed == 'true'
run: |
make -C ../shovey levels landscape
make collection
python3 tests/collection_test.py
python3 tests/publisher_test.py
- name: Commit the release
id: commit
if: steps.updates.outputs.changed == 'true'
env:
VERSION: ${{ steps.release.outputs.version }}
run: |
git config user.name Waozi
git config user.email [email protected]
git add ziran.toml ziran.lock CHANGELOG.md VERSION apps/versions.json assets/arcade/library
git commit -q -m "Release Arcade $VERSION with the latest game releases"
git push origin HEAD:master
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Attach the checked catalog and game archive
if: steps.updates.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.release.outputs.version }}
SHA: ${{ steps.commit.outputs.sha }}
run: |
set -eu
gh release create "node-arcade-$VERSION" build/node-apps/arcade.zx build/node-apps/arcade.games.tar build/games/wurm.zx \
--target "$SHA" --title "Arcade $VERSION" \
--notes 'Arcade downloads the selected game separately and preserves earned progress.'
echo "Arcade $VERSION is ready for the node: sha256 $(sha256sum build/node-apps/arcade.zx | cut -d' ' -f1)"
+17
View File
@@ -69,7 +69,24 @@ jobs:
make collection
python3 tests/collection_test.py
python3 tests/publisher_test.py
# The candidate's digest, so a local check can compare the exact bytes.
sha256sum build/node-apps/arcade.zx
echo "$EXPECTED_SHA256 build/node-apps/arcade.zx" | sha256sum --check --strict
# When the digest is not the expected one, keep the candidate for a local
# check; nothing is published.
- name: Keep the unpublished candidate
if: failure()
uses: actions/upload-artifact@v4
with:
name: arcade-candidate
path: |
waozixyz/arcade/build/node-apps/arcade.zx
waozixyz/arcade/build/node-apps/arcade.json
waozixyz/arcade/build/node-apps/arcade.games.tar
waozixyz/arcade/build/games/wurm.zx
waozixyz/arcade/build/apps-ui/apps.zx
if-no-files-found: ignore
retention-days: 1
- name: Publish the checked catalog and game archive
env:
GH_TOKEN: ${{ github.token }}
+123
View File
@@ -0,0 +1,123 @@
name: Website
# https://arcade.waozi.xyz runs Arcade in the browser: the latest published
# arcade.zx, the same one Inner Breeze downloads, with Arcade's own host
# compiled to WebAssembly. Every push to master and every Arcade release,
# manual or automatic, rebuilds and publishes it.
on:
push:
branches: [master]
workflow_run:
workflows: [Arcade node release, Game updates]
types: [completed]
workflow_dispatch:
permissions:
contents: read
# A running build finishes; only the newest waiting one follows it.
concurrency:
group: arcade-site
cancel-in-progress: false
jobs:
build:
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-24.04
timeout-minutes: 45
defaults:
run:
working-directory: waozixyz/arcade
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
path: waozixyz/arcade
ref: master
fetch-depth: 0
- name: Read the locked toolchain
id: toolchain
run: |
python3 -c 'import json,os; open(os.environ["GITHUB_OUTPUT"],"a").write("commit="+json.load(open("ziran.lock"))["toolchain"]["commit"]+"\n")'
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ziranlang/ziran
ref: ${{ steps.toolchain.outputs.commit }}
path: ziranlang/ziran
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install build dependencies
working-directory: .
run: sh ziranlang/ziran/scripts/ci_packages.sh build-essential cmake pkg-config
- uses: mymindstorm/setup-emsdk@v14
with:
version: '6.0.6'
actions-cache-folder: emsdk-cache
- name: Build the locked toolchain and fetch packages
run: |
make -j2 -C ../../ziranlang/ziran
echo "$GITHUB_WORKSPACE/ziranlang/ziran/build/bin" >> "$GITHUB_PATH"
printf '[overrides]\nziran = "../../ziranlang/ziran"\n' > ziran.local.toml
../../ziranlang/ziran/build/bin/ziran fetch
- name: Download the published Arcade
id: published
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh release list --repo waozixyz/arcade --limit 50 --json tagName,isDraft \
-q '[.[] | select(.isDraft | not) | .tagName | select(startswith("node-arcade-"))][0]')
test -n "$tag"
mkdir -p build/published
gh release download "$tag" --repo waozixyz/arcade --pattern arcade.zx --dir build/published
# The Apps library that release packs, by the digest its own commit trusts.
git show "$tag:apps-controller.sha256" > build/published/apps-controller.sha256
echo "version=${tag#node-arcade-}" >> "$GITHUB_OUTPUT"
- name: Build the browser edition
run: |
python3 scripts/build-entity.py
python3 scripts/build-apps.py --output build/apps-ui
python3 scripts/build-web.py --bundle build/published/arcade.zx \
--controller-sha256 "$(cat build/published/apps-controller.sha256)" \
--version '${{ steps.published.outputs.version }}'
rm -f build/web-site/runtime.html
- name: Open Arcade in a private browser
run: |
export CHROMIUM="$(command -v google-chrome || command -v chromium)"
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS node tests/web_site_test.mjs build/web-site
- uses: actions/upload-artifact@v4
with:
name: arcade-site
path: waozixyz/arcade/build/web-site
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 10
environment:
name: cloudflare-pages
url: https://arcade.waozi.xyz
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
ref: master
- uses: actions/download-artifact@v4
with:
name: arcade-site
path: build/web-site
- name: Prepare the Pages project
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: python3 scripts/cloudflare-site.py prepare
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build/web-site --project-name=arcade --branch=master --commit-hash=${{ github.sha }}
- name: Connect arcade.waozi.xyz
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: python3 scripts/cloudflare-site.py connect
+80
View File
@@ -1,5 +1,85 @@
# Arcade changelog
## 0.7.91
- Shovey 0.6.155: Set an account alias with capitals, an @ or spaces; a taken alias now says so.
- Apfelwurm 0.2.2: Set an account alias with capitals, an @ or spaces; a taken alias now says so.
## 0.7.90
- Set an account alias with capitals, an @ or spaces; a taken alias now says so.
- Shovey 0.6.155: Set an account alias with capitals, an @ or spaces; a taken alias now says so.
## 0.7.89
- Apfelwurm 0.2.1: Use Arcade or Inner Breeze's Profile, Dew and navigation when playing inside them, without duplicate title controls or an extra Back button.
- Apfelwurm 0.2.1: Open the shared Profile reliably from the skin shop's sign-in button.
## 0.7.88
- Apfelwurm 0.2.0: Play with softer Dusk, Forest and Sage themes, with saved sound and control settings.
- Apfelwurm 0.2.0: See a continuous painted meadow instead of a repeating grass grid, and clear Profile and Dew icons on the title.
- Apfelwurm 0.2.0: Sign in through the shared Profile to sync completed levels, playtime, settings and your chosen character across devices.
- Apfelwurm 0.2.0: Browse the skin shop from the title beside Profile and your Dew balance. Mint, Berry and Rose cost 10, 20 and 30 Dew, with confirmation before buying.
- Apfelwurm 0.2.0: Earn Night owl after five hours of active play, Golden apple by reaching level 40, and Explorer by visiting waozi.xyz. Purchased skins belong to your account.
- Apfelwurm 0.2.0: Unlock all 200 levels by playing. The mobile selector shows large previews for unlocked levels and only a lock for later ones. Dew is used for optional cosmetics.
## 0.7.87
- Open the game library faster with smaller cached cover thumbnails for every game.
- Keep covers sharp and logos transparent while downloading much less artwork.
## 0.7.86
- Shovey 0.6.154: Keep opened chests open across restarts and account sync; show the blue Dew diamond only while their reward is unclaimed.
- Shovey 0.6.154: Show an empty open chest after its Dew is claimed.
- Shovey 0.6.154: Use corrected campaign boards after an update, including level 29 when an older campaign was cached offline.
## 0.7.85
- Shovey keeps opened and claimed chests synchronized, with a blue diamond only for an unclaimed reward.
- Shovey uses corrected boards after an update instead of an older cached campaign.
- Apfelwurm shows level previews only after they are unlocked.
## 0.7.84
- Complete automatic reward recovery for older Shovey saves.
## 0.7.83
- Preserve earned Shovey reward eligibility when upgrading older synced saves.
## 0.7.82
- Apfelwurm 0.1.6: Try again after game over starts the furthest unlocked level with three lives and a fresh score.
- Apfelwurm 0.1.6: Choose level from the title to browse all five landscapes, preview each board and replay any unlocked level. Future levels remain locked until you reach them.
- Apfelwurm 0.1.6: Use Escape to pause or go back in the browser without stopping the game.
## 0.7.81
- Update Shovey to the approved campaign and solve puzzles using wooden crates as water bridges.
- Shovey Editor recognizes device unlocks, returns to the title, accepts right-click movement and shows a clearer object palette.
## 0.7.80
- Keep games covered until their first board is ready and keep complete pictures visible while animation sprites load.
- Shovey’s secret chest reopens for unclaimed Dew and shows an empty chest after a confirmed claim.
## 0.7.79
- On phones the library shows small covers, two or three in a row.
## 0.7.78
- Download Arcade itself in under one megabyte: it lists the games, and their covers and each game arrive separately when you need them.
- Covers show only the game art; the download dialog shows the size.
- Shovey Editor downloads as a small add-on that reuses Shovey’s game.
## 0.7.77
- Apfelwurm 0.1.4: Press Play and go straight into the game: no stage or level select. Play every level in order through all five landscapes, earning lives as your score grows; a game over starts again from level 1.
- Apfelwurm 0.1.4: Continue your run from the start of the level you reached; existing stage progress continues from your first uncleared level.
## 0.7.76
- Install Shovey Editor as an add-on and reuse Shovey’s art and sounds.
+5
View File
@@ -54,15 +54,18 @@ run: all
./build/arcade
test: all
python3 tests/game_updates_test.py
$(ZIRAN) fmt --check src/*.zi apps/chess/*.zi tests/chess_engine_behavior.zi tests/chess_app_behavior.zi
python3 tests/chess_locale_test.py
INBE_SOURCE='$(INBE_SOURCE)' python3 tests/catalog_test.py
python3 tests/publisher_test.py
python3 tests/apps_controller_test.py
python3 tests/startup_art_test.py
./build/arcade --list
sh tests/chess_engine_zi_test.sh '$(ZIRAN)'
sh tests/chess_app_test.sh '$(ZIRAN)'
python3 tests/sound_test.py
sh tests/collection_loading_test.sh
chess-engine-test:
sh tests/chess_engine_zi_test.sh '$(ZIRAN)'
@@ -110,6 +113,7 @@ install-arcade: collection build/entity.zx build/arcade
install -m 0755 build/arcade '$(LIB_DIR)/arcade.new'
mv -f '$(LIB_DIR)/arcade.new' '$(LIB_DIR)/arcade'
install -m 0644 build/entity.zx build/arcade.zx build/arcade.json '$(LIB_DIR)/'
install -m 0644 '$(APPS_BUNDLE)' '$(LIB_DIR)/apps.zx'
ln -sfn '$(LIB_DIR)/arcade' '$(BIN_DIR)/arcade'
install -m 0644 packaging/xyz.waozi.arcade.desktop '$(DATA_DIR)/applications/'
@@ -122,6 +126,7 @@ install: all install-arcade
install -m 0755 build/shovey '$(LIB_DIR)/shovey.new'
mv -f '$(LIB_DIR)/shovey.new' '$(LIB_DIR)/shovey'
install -m 0644 build/entity.zx build/arcade.zx build/arcade.json build/shovey.zx build/shovey.json '$(LIB_DIR)/'
install -m 0644 '$(APPS_BUNDLE)' '$(LIB_DIR)/apps.zx'
ln -sfn '$(LIB_DIR)/arcade' '$(BIN_DIR)/arcade'
ln -sfn '$(LIB_DIR)/shovey' '$(BIN_DIR)/shovey'
mkdir -p '$(DATA_DIR)/icons/hicolor/256x256/apps'
+25 -1
View File
@@ -6,12 +6,14 @@ title-screen covers from the shared Apps controller. Click a cover to open
an installed game or download it first. There are no separate launch buttons.
Standalone Shovey opens on its own cover carousel;
swipe, use the arrows or scroll the wheel to choose, then press Play/Open.
Its desktop startup first draws a small full-colour title preview, then uses
the original artwork when the collection is ready.
Chess is temporarily disabled in Arcade; its code and
existing saved games remain available for a later return.
Each edition has a separate save and earned unlocks. Unlocked puzzles show
their whole board; locked puzzles keep their lock until earned.
Arcade carries only its catalog and covers first. Each game
The published Arcade carries only its catalog, well under one megabyte. Its host supplies the shared Apps controller (Inner Breeze its own, standalone Arcade the `apps.zx` installed beside it), and the covers and previews download once as one separate art bundle. Library covers use thumbnails up to 640 pixels on their longest side, and logos up to 512 pixels, preserving full colours and transparency. Games keep their original artwork. The verified art bundle stays cached across restarts and is replaced when its content changes. The art lives in `assets/arcade/library/` (`python3 scripts/library-art.py` refreshes it when a game's art changes; the build stops until it does). Inner Breeze needs host interface 35 for it. Each game
downloads when opened, with its existing identity and saved progress. This
catalog requires Inner Breeze host API 34. Downloaded games work offline;
standalone Shovey keeps its complete offline collection. Apfelwurm comes from
@@ -81,6 +83,22 @@ bundle, so Inbe supplies its existing profile and account. Inbe retains its
existing game sync and friend games. Arcade and Inbe keep separate
saved games; this version does not migrate or synchronize games between them.
## Website
https://arcade.waozi.xyz runs Arcade in the browser: the latest published
`arcade.zx`, the same collection Inner Breeze downloads, with Arcade's own host
(`src/web/runtime.zi`) compiled to WebAssembly by Entity's web build. Games
download from the node when someone opens them; saves stay in the browser.
`.github/workflows/site.yml` rebuilds and publishes it after every push to
master and every Arcade release, after `tests/web_site_test.mjs` opens the
library in a private browser. `scripts/cloudflare-site.py` creates the Pages
project and connects the domain with the repository's `CLOUDFLARE_API_TOKEN`
and `CLOUDFLARE_ACCOUNT_ID` secrets.
Build it locally from this checkout's collection with `make collection`,
`python3 scripts/build-entity.py` and `python3 scripts/build-web.py`, then serve
`build/web-site`.
## Build and run
Dependencies are Git repositories pinned in `ziran.lock`. The toolchain
@@ -182,6 +200,12 @@ puzzle. Shovey also runs as its own desktop app.
## Shared Entity profile
Leaderboard is inside the shared Profile, including standalone Arcade and
Shovey. Games report their own level totals under their verified identity;
Profile shows only games that are installed, with friend rankings for a
connected account. Removing a game hides its board while retaining its save
and reported score. Account switches keep rankings separate.
Standalone Shovey's Profile control on its covers opens the shared `entity.zx`
supplied by the Entity package. The host keeps account keys and native file
access behind Entity's versioned management service. Returning from Profile
+1 -1
View File
@@ -1 +1 @@
0.7.76
0.7.91
+1 -1
View File
@@ -1 +1 @@
5490a8e61f5fa218e813b6e3d78bece6198d2ed935c42fc77b7d5e4aeed9bfe3
a81eb5b14d2066925d19c3fd922865af40c90673cf54fb11bd7f9bf89a29cb98
+9 -9
View File
@@ -13,8 +13,8 @@
"shovey": {
"id": "arcade.shovey",
"title": "Shovey",
"version": "0.6.148",
"sequence": 156,
"version": "0.6.155",
"sequence": 163,
"host_api": 12
},
"shovey-island": {
@@ -27,22 +27,22 @@
"shovey-editor": {
"id": "arcade.shovey-editor",
"title": "Shovey Editor",
"version": "0.2.140",
"sequence": 142,
"version": "0.2.144",
"sequence": 146,
"host_api": 12
},
"arcade": {
"id": "inbe.arcade",
"title": "Arcade",
"version": "0.7.76",
"sequence": 155,
"host_api": 33
"version": "0.7.91",
"sequence": 170,
"host_api": 36
},
"wurm": {
"id": "xyz.waozi.wurm",
"title": "Apfelwurm",
"version": "0.1.2",
"sequence": 2,
"version": "0.2.2",
"sequence": 9,
"host_api": 12
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+35
View File
@@ -0,0 +1,35 @@
{
"shovey-editor-landscape": {
"source_sha256": "7b1eae4209ede14807806a4cbce1e2bf7a14d342e75c89042958a524cf60d67e"
},
"shovey-editor-logo": {
"source_sha256": "5417341ed432c49d4ce1df45e5e6bf7e07e11a81face45cb93d7cc9fa976f7a5"
},
"shovey-editor-portrait": {
"source_sha256": "bf0bbeb15249f3d73c1b410e9737f7fd207310dcb5f28b7c3ce45401b77c8f9e"
},
"shovey-editor-preview": {
"source_sha256": "1846b823110fffe82a3dbb319960ce768eefc16699d507d48b8608151eaff430"
},
"shovey-landscape": {
"source_sha256": "40c01eb8300e4c5db52b2d75373e17cdaf7f68140c33c0a225613fc174660747"
},
"shovey-logo": {
"source_sha256": "e47781aa3328f68077589f95d813e9c2e6fff10ebd62a9d003773bb2c2f7a092"
},
"shovey-portrait": {
"source_sha256": "ddcbf989eab5971157d8cdc73494ed03660bb4c7a7679543248f45be260777e3"
},
"shovey-preview": {
"source_sha256": "b1f2e5662cb96f2f5062cb0e5a8cd8ede153173ebc32ad17e26b404f3baf5924"
},
"wurm-landscape": {
"source_sha256": "472773b7c106325e12777a81a29209496e22e0853782ca76955b6587824b1b30"
},
"wurm-portrait": {
"source_sha256": "e8962c969f554567d598eb0b54db5836f7f1ed7462619463040c6cc2887a5a47"
},
"wurm-preview": {
"source_sha256": "472773b7c106325e12777a81a29209496e22e0853782ca76955b6587824b1b30"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

+12 -1
View File
@@ -50,6 +50,9 @@ Unknown languages fall back to the game's English text.
Arcade and Inbe still provide separate local/account storage. Sharing one
game implementation does not silently merge or migrate their saved games.
Host API 36 adds read-only records explicitly exported to verified direct
dependencies. Shovey exports its local campaign so Editor can display device
unlocks alongside account progress without uploading device-only progress.
## Updates and publication gate
@@ -87,7 +90,15 @@ Host API numbers alone do not prove compatibility: the intended host must
also understand the bundle's VM format. Test each platform and oldest host
version a release is intended to support. An unsupported VM format requires
a compatible build or a host update; never relabel a package to bypass it.
Passing checks prepares a release; the owner still approves publication.
Passing checks prepares a release.
Game releases reach Arcade players automatically. Every fifteen minutes the
Game updates workflow compares each game package's latest published GitHub
release with Arcade's pin (`scripts/follow-game-releases.py`). For a newer
version it pins that release, adds the game's notes as a new Arcade version,
builds and checks the collection, commits it and attaches the catalog to the
`node-arcade-VERSION` release. Inner Breeze's Node app follower then signs
that release and publishes it to Waozi's node.
Chess 1.1.0 requires host API 12. Public Inbe 2.1.34 supplies API 11 and
predates installable Chess apps, so it is outside the declared range. The
+2 -1
View File
@@ -47,7 +47,8 @@ android {
'-DZIRAN_DIR=' + ziranDir,
'-DRAYLIB_DIR=' + raylibDir,
'-DAPP_CODEGEN=' + appCodegen,
'-DSHOVEY_STANDALONE=' + (standaloneShovey ? 'ON' : 'OFF')
'-DSHOVEY_STANDALONE=' + (standaloneShovey ? 'ON' : 'OFF'),
'-DGOOGLE_PLAY=' + (project.findProperty('app.googlePlay') == 'true' ? 'ON' : 'OFF')
}
}
}
+3
View File
@@ -26,6 +26,9 @@ set(APP_ZIRAN_DEFINES --define ANDROID_BUILD)
if(SHOVEY_STANDALONE)
list(APPEND APP_ZIRAN_DEFINES --define SHOVEY_STANDALONE)
endif()
if(GOOGLE_PLAY)
list(APPEND APP_ZIRAN_DEFINES --define GOOGLE_PLAY)
endif()
if(NOT DEFINED APP_CODEGEN)
set(APP_CODEGEN c99)
endif()
+1
View File
@@ -49,6 +49,7 @@ def main():
LIBOQS_DIR=str(package('liboqs')), MONOCYPHER_DIR=str(package('monocypher')))
command = ['sh', str(ROOT / 'droid/gradlew'), '-p', str(ROOT / 'droid'), '--no-daemon', '--max-workers=2',
'-Papp.product=shovey', '-Papp.abis=' + args.abis,
'-Papp.googlePlay=' + ('true' if args.bundle else 'false'),
'-Pkryon.dir=' + str(package('kryon')), '-Pziran.dir=' + str(package('ziran')),
'-Praylib.dir=' + str(package('raylib') / 'src'),
'-Papp.versionName=' + metadata['version'], '-Papp.versionCode=' + str(release['sequence']),
+57 -10
View File
@@ -21,6 +21,17 @@ def digest(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
def library_art(root, name, key, source):
"""Arcade's committed library thumbnails (scripts/library-art.py).
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()
def stage(root, controller, expected_controller_digest, output):
"""Validate before replacing a previously staged collection. Returns the
catalog and each game package with the IDs of its packed apps."""
@@ -64,6 +75,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)
total += len(bundle_bytes) + len(preview_bytes)
child = dict(
id=identifier, title=game["title"],
@@ -73,6 +85,11 @@ def stage(root, controller, expected_controller_digest, output):
bytes=len(bundle_bytes),
preview=f"assets/arcade/previews/{name}.png",
icon=f"assets/arcade/previews/{name}.png")
# A thin add-on links its required games' verified code as libraries.
if app.get('shared_code'):
child['shared_code'] = True
if app.get('shared_records'):
child['shared_records'] = app['shared_records']
if app.get('requires'):
shared = json.loads((root / 'build/games' / (name + '-resources.json')).read_text())
if shared['dependencies'] != app['requires']:
@@ -90,7 +107,7 @@ 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 = (app["source"] / relative).read_bytes()
contents = library_art(root, name, key, (app["source"] / relative).read_bytes())
destination = Path("arcade/covers") / f"{name}-{key}.png"
packed_cover[key] = "assets/" + destination.as_posix()
copies.append((contents, destination))
@@ -122,11 +139,14 @@ def stage(root, controller, expected_controller_digest, output):
return catalog, packages[1:]
def stage_downloads(catalog, source, output, games):
"""Keep Arcade's catalog and art together; serve each game separately.
def stage_downloads(catalog, source, output, games, art):
"""Keep only Arcade's catalog; serve each game and the library art separately.
The full staging directory is also used by standalone players, which
keep their bundled games. Validate every game before replacing outputs.
The published Arcade is a launcher: the host supplies the shared Apps
controller, and the games' covers and previews go to ART for one separate
download. The full staging directory is also used by standalone players,
which keep their bundled games, art and controller. Validate every game
before replacing outputs.
"""
payloads = {}
for child in catalog["children"]:
@@ -134,17 +154,38 @@ def stage_downloads(catalog, source, output, games):
if hashlib.sha256(data).hexdigest() != child["sha256"]:
raise ValueError("Game differs from the collection's declared digest")
payloads[child["sha256"]] = data
for directory in (output, games):
for directory in (output, games, art):
if directory.exists():
shutil.rmtree(directory)
shutil.copytree(source, output)
games.mkdir(parents=True)
(output / catalog["harness"]).unlink()
for child in catalog["children"]:
(output / child["bundle"]).unlink()
pictures = [child["preview"]] + [path for key, path in child.get("cover", {}).items()
if key in ("portrait", "landscape", "logo")]
for relative in pictures:
if not (output / relative).exists():
continue
destination = art / relative
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.move(output / relative, destination)
for digest, data in payloads.items():
(games / (digest + ".zx")).write_bytes(data)
def add_art(output, games, art_bundle):
"""Publish the art bundle beside the games and name it in the catalog."""
data = art_bundle.read_bytes()
digest = hashlib.sha256(data).hexdigest()
(games / (digest + ".zx")).write_bytes(data)
path = output / "assets/apps/catalog.json"
catalog = json.loads(path.read_text())
catalog["art"] = dict(sha256=digest, bytes=len(data))
path.write_text(json.dumps(catalog, indent=2) + "\n")
return catalog["art"]
def archive_downloads(games, archive):
"""The release asset contains only the immutable game payloads."""
with tarfile.open(archive, "w") as output:
@@ -204,18 +245,24 @@ def main():
sha256=digest(ROOT / f"build/{name}.zx"), apps_sha256=args.apps_sha256,
children=children, source_mode="project")
(ROOT / f"build/{name}.json").write_text(json.dumps(metadata, indent=2) + "\n")
# Arcade carries the catalog and artwork. Standalone players keep their
# offline games; Arcade downloads exactly the game the person selects.
# Arcade carries only its catalog. Standalone players keep their offline
# games; Arcade downloads the library art once and exactly the game the
# person selects.
node_apps = ROOT / "build/node-apps"
catalog_assets = node_apps / "arcade-catalog"
game_downloads = node_apps / "arcade.games"
stage_downloads(catalog, output, catalog_assets, game_downloads)
art_assets = node_apps / "arcade-art"
stage_downloads(catalog, output, catalog_assets, game_downloads, art_assets)
bundle("art.zi", "art:Main", art_assets / "assets", node_apps / "arcade-art.zx")
art = add_art(catalog_assets, game_downloads, node_apps / "arcade-art.zx")
archive_downloads(game_downloads, node_apps / "arcade.games.tar")
bundle("collection.zi", "collection:Main", catalog_assets / "assets", node_apps / "arcade.zx")
shutil.copyfile(node_apps / "arcade.zx", ROOT / "build/arcade.zx")
# The desktop host supplies its controller from beside the collection.
shutil.copyfile(args.apps_bundle, ROOT / "build/apps.zx")
receipt = dict(id=catalog["id"], version=(ROOT / "VERSION").read_text().strip(),
sha256=digest(ROOT / "build/arcade.zx"),
apps_sha256=args.apps_sha256, children=catalog["children"],
apps_sha256=args.apps_sha256, children=catalog["children"], art=art,
source_mode="project")
(output / "receipt.json").write_text(json.dumps(receipt, indent=2) + "\n")
(ROOT / "build/arcade.json").write_text(json.dumps(receipt, indent=2) + "\n")
+13 -4
View File
@@ -11,6 +11,18 @@ ROOT = Path(__file__).resolve().parents[1]
ZIRAN = str(ROOT / 'scripts/ziran.sh')
def stage_startup_art(source, output):
"""Draw small full-colour images before the collection's originals load."""
from PIL import Image
startup = output / 'startup/shovey'
startup.mkdir(parents=True, exist_ok=True)
for name, edge in [('title-portrait.png', 640), ('title-landscape.png', 640), ('logo.png', 512)]:
with Image.open(source / 'assets/shovey' / name) as original:
image = original.convert('RGBA' if 'A' in original.getbands() else 'RGB')
image.thumbnail((edge, edge), Image.Resampling.LANCZOS)
image.save(startup / name, optimize=True)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output', type=Path)
@@ -59,10 +71,7 @@ def main():
if args.standalone_shovey:
from PIL import Image
source = Path(subprocess.check_output([ZIRAN, 'pkg', 'path', 'shovey', *lock], cwd=ROOT, text=True).strip())
startup = output.parent / 'startup/shovey'
startup.mkdir(parents=True, exist_ok=True)
for name in ('title-portrait.png', 'title-landscape.png', 'logo.png'):
shutil.copyfile(source / 'assets/shovey' / name, startup / name)
stage_startup_art(source, output.parent)
Image.open(source / 'assets/branding/shovey-icon.png').resize((256, 256), Image.Resampling.LANCZOS).save(output.parent / 'shovey-icon.png')
print(('Shovey' if args.standalone_shovey else 'Arcade') + ' native build passed')
+5
View File
@@ -49,6 +49,7 @@ def build(ziran, lock_flags):
crypto = dependency("crypto", daochi_client)
entries = []
apps = dependency_order(declared_apps(ROOT, ziran, lock_flags))
by_id = {app['descriptor']['id']: app for app in apps}
for app in apps:
source, manifest, descriptor = app["source"], app["manifest"], app["descriptor"]
if descriptor["kind"] != "game" or "arcade" not in descriptor["harnesses"]:
@@ -140,6 +141,10 @@ def build(ziran, lock_flags):
"--module-path", "daochi_client=" + str(daochi_client),
"--module-path", "crypto=" + str(crypto / "src"),
*[flag for name in defines for flag in ('--define', name)],
*[flag for entry in app['library_entries'] for flag in ('--retain', entry)],
*[flag for dependency_id in app['requires'] if app['shared_code']
for flag in ('--library', str(ROOT / 'build/games' /
(by_id[dependency_id]['descriptor']['name'] + '.zx')))],
"--define", "KRYON_HOSTED_UI", "--asset-dir", "assets=" + str(staged / "assets"),
"--entry", descriptor["entry"], "-o", str(bundle),
str(source / descriptor["source"])], cwd=ROOT, check=True)
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Build Arcade's browser edition into build/web-site.
The page runs a collection, by default this checkout's build/node-apps/arcade.zx;
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.
"""
import argparse
import hashlib
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys
ROOT = Path(__file__).resolve().parents[1]
ZIRAN = str(ROOT / 'scripts/ziran.sh')
def package(name):
flags = [] if (ROOT / 'ziran.local.toml').exists() else ['--locked']
return Path(subprocess.check_output([ZIRAN, 'pkg', 'path', name, *flags], cwd=ROOT, text=True).strip())
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--bundle', type=Path, default=ROOT / 'build/node-apps/arcade.zx')
parser.add_argument('--controller-sha256', default=(ROOT / 'apps-controller.sha256').read_text().strip())
parser.add_argument('--version', default=(ROOT / 'VERSION').read_text().strip())
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')
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)
work = ROOT / 'build/web'
work.mkdir(parents=True, exist_ok=True)
env = {**os.environ, 'ZIRAN': str(package('ziran') / 'build/bin/ziran')}
subprocess.run([sys.executable, str(package('entity') / 'scripts/build-web.py'),
'--bundle', str(bundle), '--profile', str(args.profile.resolve()),
'--output', str(work / 'runtime.html'),
'--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)
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')
# 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)
else:
print('No matching Apps controller beside the collection; it must pack its own')
print(f'Arcade {args.version} for the browser in {output}')
if __name__ == '__main__':
main()
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env python3
"""Keep Arcade's Cloudflare Pages project and arcade.waozi.xyz in place.
`prepare` creates the `arcade` Pages project when it is missing, before the
first deployment. `connect` adds arcade.waozi.xyz to the project and points
its DNS at the project. Both are safe to repeat on every deployment. They read
CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID and never print the token.
"""
import json
import os
import sys
import urllib.error
import urllib.request
PROJECT = 'arcade'
DOMAIN = 'arcade.waozi.xyz'
ZONE = 'waozi.xyz'
def api(method, path, body=None):
request = urllib.request.Request('https://api.cloudflare.com/client/v4' + path, method=method,
data=None if body is None else json.dumps(body).encode(),
headers={'Authorization': 'Bearer ' + os.environ['CLOUDFLARE_API_TOKEN'], 'Content-Type': 'application/json'})
try:
with urllib.request.urlopen(request, timeout=40) as response:
return response.status, json.load(response)
except urllib.error.HTTPError as error:
return error.code, json.loads(error.read() or b'{}')
def result(method, path, body=None):
status, data = api(method, path, body)
if not data.get('success'):
raise SystemExit(f'Cloudflare {method} {path} failed ({status}): {data.get("errors")}')
return data['result']
def prepare(account):
status, data = api('GET', f'/accounts/{account}/pages/projects/{PROJECT}')
if data.get('success'):
print(f'Pages project {PROJECT} exists.')
return
if status != 404:
raise SystemExit(f'Could not read Pages project {PROJECT} ({status}): {data.get("errors")}')
result('POST', f'/accounts/{account}/pages/projects', {'name': PROJECT, 'production_branch': 'master'})
print(f'Created Pages project {PROJECT}.')
def connect(account):
project = result('GET', f'/accounts/{account}/pages/projects/{PROJECT}')
domains = result('GET', f'/accounts/{account}/pages/projects/{PROJECT}/domains')
if not any(domain['name'] == DOMAIN for domain in domains):
result('POST', f'/accounts/{account}/pages/projects/{PROJECT}/domains', {'name': DOMAIN})
print(f'Added {DOMAIN} to Pages project {PROJECT}.')
zones = result('GET', f'/zones?name={ZONE}')
if len(zones) != 1:
raise SystemExit(f'Expected one {ZONE} zone, found {len(zones)}')
zone = zones[0]['id']
records = result('GET', f'/zones/{zone}/dns_records?name={DOMAIN}')
if not records:
result('POST', f'/zones/{zone}/dns_records',
{'type': 'CNAME', 'name': DOMAIN, 'content': project['subdomain'], 'proxied': True, 'ttl': 1})
print(f'Pointed {DOMAIN} at {project["subdomain"]}.')
elif not (len(records) == 1 and records[0]['type'] == 'CNAME' and records[0]['content'] == project['subdomain']):
# Never overwrite a record someone else made.
raise SystemExit(f'{DOMAIN} already has DNS records that do not point at {project["subdomain"]}')
print(f'{DOMAIN} serves Pages project {PROJECT}.')
if __name__ == '__main__':
if len(sys.argv) != 2 or sys.argv[1] not in {'prepare', 'connect'}:
raise SystemExit('Usage: cloudflare-site.py prepare|connect')
account = os.environ['CLOUDFLARE_ACCOUNT_ID']
{'prepare': prepare, 'connect': connect}[sys.argv[1]](account)
+164
View File
@@ -0,0 +1,164 @@
#!/usr/bin/env python3
"""Follow the published releases of Arcade's game packages.
`check` records newer published game releases without changing dependencies.
`pin` selects their exact commits in ziran.toml and asks Ziran to update each
game and its transitive dependencies. New game imports must reach the lock;
unrelated packages and the compiler stay pinned. The updates are recorded in
build/game-updates.json.
`changelog` adds an Arcade release entry naming each updated game with the
notes of its newest release, for update_version.sh to synchronize.
`art` remakes the library's small copies of game art (scripts/library-art.py)
only when a game's art changed, so unchanged copies keep their bytes.
"""
import argparse
import hashlib
import importlib.util
import json
import re
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
UPDATES = ROOT / 'build/game-updates.json'
def gh(*args):
return subprocess.check_output(['gh', *args], text=True).strip()
def repository(url):
match = re.fullmatch(r'https://github\.com/([A-Za-z0-9._-]+/[A-Za-z0-9._-]+?)(\.git)?', url)
if not match:
raise SystemExit(f'Not a GitHub package: {url}')
return match[1]
def released_updates():
lock = json.loads((ROOT / 'ziran.lock').read_text())
names = json.loads((ROOT / 'games.json').read_text())['packages']
updates = []
for name in names:
old_id = lock['root']['dependencies'][name]
entry = next(item for item in lock['packages'] if item['id'] == old_id)
repo = repository(entry['url'])
tag = gh('release', 'view', '--repo', repo, '--json', 'tagName', '--jq', '.tagName')
commit = gh('api', f'repos/{repo}/commits/{tag}', '--jq', '.sha')
if not re.fullmatch(r'[0-9a-f]{40}', commit):
raise SystemExit(f'{name}: invalid release commit')
if commit == entry['commit']:
continue
# Release metadata can be recorded before the game is published.
# The pinned source must still advance to that release's commit.
# Never move back: the release must contain the pinned commit.
status = gh('api', f'repos/{repo}/compare/{entry["commit"]}...{commit}', '--jq', '.status')
if status != 'ahead':
print(f'{name}: release {tag} is {status} of the pinned {entry["commit"][:12]}; kept')
continue
updates.append({'name': name, 'repository': repo, 'tag': tag, 'commit': commit})
print(f'{name}: {repo} {tag} ({commit[:12]})')
return updates
def record_updates(updates):
UPDATES.parent.mkdir(parents=True, exist_ok=True)
UPDATES.write_text(json.dumps(updates, indent=2) + '\n')
def pin(ziran):
updates = released_updates()
manifest = ROOT / 'ziran.toml'
lock_path = ROOT / 'ziran.lock'
original_manifest = manifest.read_bytes()
original_lock = lock_path.read_bytes()
try:
for update in updates:
name, commit = update['name'], update['commit']
# Edit the declaration; only the package manager writes the graph.
section = re.compile(r'(^\[dependencies\.' + re.escape(name) +
r'\]\s*\n)([^\[]*)', re.M)
text = manifest.read_text()
match = section.search(text)
if match is None:
raise ValueError(f'{name}: missing dependency declaration')
body, count = re.subn(r'^ref[ \t]*=[ \t]*"[^"\n]*"[ \t]*$',
f'ref = "{commit}"', match[2], flags=re.M)
if count != 1:
raise ValueError(f'{name}: expected one dependency ref')
manifest.write_text(text[:match.start(2)] + body + text[match.end(2):])
subprocess.run([str(ziran), 'update', name], cwd=ROOT, check=True)
lock = json.loads(lock_path.read_text())
target = lock['root']['dependencies'][name]
entry = next(p for p in lock['packages'] if p['id'] == target)
if entry['commit'] != commit:
raise ValueError(f'{name}: Ziran did not select the released commit; remove its local override')
except BaseException:
manifest.write_bytes(original_manifest)
lock_path.write_bytes(original_lock)
raise
record_updates(updates)
def newest_notes(changelog):
"""The bullets of a changelog's newest numeric release."""
text = changelog.read_text()
heading = re.search(r'^## \[?(\d+\.\d+\.\d+)\]?.*$', text, re.M)
if heading is None:
raise SystemExit(f'{changelog} needs a numeric release entry')
following = re.search(r'^## ', text[heading.end():], re.M)
section = text[heading.end():heading.end() + following.start()] if following else text[heading.end():]
notes = [line[2:].strip() for line in section.splitlines() if line.startswith('- ')]
return heading[1], notes
def changelog(ziran):
updates = json.loads(UPDATES.read_text())
if not updates:
return
lines = []
for update in updates:
source = Path(subprocess.check_output([ziran, 'pkg', 'path', update['name']], cwd=ROOT, text=True).strip())
declaration = json.loads((source / 'apps.json').read_text())
# The package's first app is the game itself; its changelog sits beside its catalog.
manifest = source / declaration['apps'][0]['manifest']
version, notes = newest_notes(manifest.with_name('CHANGELOG.md'))
title = declaration['title']
lines += [f'- {title} {version}: {note}' for note in notes] or [f'- {title} {version}.']
path = ROOT / 'CHANGELOG.md'
text = path.read_text()
current = re.search(r'^## (\d+)\.(\d+)\.(\d+)\s*$', text, re.M)
if current is None:
raise SystemExit('CHANGELOG.md needs a numeric release entry')
version = f'{current[1]}.{current[2]}.{int(current[3]) + 1}'
entry = f'## {version}\n\n' + '\n'.join(lines) + '\n\n'
path.write_text(text[:current.start()] + entry + text[current.start():])
print(f'Arcade {version}')
def art():
sys.path.insert(0, str(ROOT / 'scripts'))
spec = importlib.util.spec_from_file_location('library_art', ROOT / 'scripts/library-art.py')
library = importlib.util.module_from_spec(spec)
spec.loader.exec_module(library)
recorded = json.loads((library.LIBRARY / 'sources.json').read_text())
current = {f'{name}-{key}': hashlib.sha256(data).hexdigest() for name, key, data in library.art()}
if {copy: item['source_sha256'] for copy, item in recorded.items()} != current:
library.main()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('command', choices=['check', 'pin', 'changelog', 'art'])
parser.add_argument('--ziran', default=str(ROOT / 'scripts/ziran.sh'))
args = parser.parse_args()
if args.command == 'check':
record_updates(released_updates())
elif args.command == 'pin':
pin(args.ziran)
elif args.command == 'changelog':
changelog(args.ziran)
else:
art()
+19 -2
View File
@@ -5,10 +5,11 @@ for an app the library opens from a full-screen cover, that cover's art,
caption and action. games.json names the game packages Arcade includes.
"""
import json
import re
from pathlib import Path
import subprocess
APP_KEYS = {'manifest', 'cover', 'enabled', 'requires'}
APP_KEYS = {'manifest', 'cover', 'enabled', 'requires', 'shared_code', 'library_entries', 'shared_records'}
COVER_KEYS = {'portrait', 'landscape', 'logo', 'caption', 'action'}
@@ -46,9 +47,25 @@ def declared_packages(root, ziran=None, lock_flags=()):
any(not isinstance(item, str) or not item for item in requires) or \
len(set(requires)) != len(requires):
raise ValueError(f'{name}: invalid app dependencies')
shared_code = app.get('shared_code', False)
if type(shared_code) is not bool or (shared_code and not requires):
raise ValueError(f'{name}: shared code needs declared dependencies')
shared_records = app.get('shared_records', [])
if not isinstance(shared_records, list) or len(shared_records) > 8 or any(
not isinstance(item, str) or not re.fullmatch(r'[A-Za-z0-9_.-]{1,63}', item) or
item in ('.', '..') for item in shared_records) or len(set(shared_records)) != len(shared_records):
raise ValueError(f'{name}: invalid shared records')
library_entries = app.get('library_entries', [])
if not isinstance(library_entries, list) or len(library_entries) > 64 or \
any(not isinstance(item, str) or len(item) > 253 or
not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_]*:[A-Za-z_][A-Za-z0-9_]*', item)
for item in library_entries) or len(set(library_entries)) != len(library_entries):
raise ValueError(f'{name}: invalid portable library entries')
apps.append(dict(package=name, source=source, manifest=manifest,
descriptor=json.loads(manifest.read_text()),
cover=app.get('cover'), requires=requires, enabled=app.get('enabled', True)))
cover=app.get('cover'), requires=requires, shared_code=shared_code,
shared_records=shared_records,
library_entries=library_entries, enabled=app.get('enabled', True)))
packages.append(dict(name=name, source=source, id=declaration['id'],
title=declaration['title'], apps=apps))
return packages
+78
View File
@@ -0,0 +1,78 @@
#!/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
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
was made from, are committed. The collection build uses them as they are,
so its bytes never depend on the local image library, and it stops when a
game's art changes until this script makes fresh copies.
"""
import hashlib
import io
import json
from pathlib import Path
from PIL import Image
from game_packages import declared_packages
ROOT = Path(__file__).resolve().parents[1]
LIBRARY = ROOT / 'assets/arcade/library'
PREVIEW_LONGEST = 480
COVER_LONGEST = 640
LOGO_LONGEST = 512
def small_copy(data, key):
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
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)))
image = image.resize(size, Image.Resampling.LANCZOS)
if key == 'preview':
if alpha:
image = image.quantize(256, method=Image.Quantize.FASTOCTREE, dither=Image.Dither.FLOYDSTEINBERG)
else:
image = image.quantize(256, dither=Image.Dither.FLOYDSTEINBERG)
output = io.BytesIO()
image.save(output, 'PNG', optimize=True)
return output.getvalue()
def art(root=ROOT):
"""(copy name, key, source bytes) for every enabled game's library art."""
for package in declared_packages(root)[1:]:
for app in package['apps']:
if not app['enabled']:
continue
name = app['descriptor']['name']
yield name, 'preview', (app['source'] / app['descriptor']['preview']).read_bytes()
for key in ('portrait', 'landscape', 'logo'):
if app['cover'] and key in app['cover']:
yield name, key, (app['source'] / app['cover'][key]).read_bytes()
def main():
LIBRARY.mkdir(parents=True, exist_ok=True)
sources = {}
for name, key, data in art():
copy = f'{name}-{key}'
(LIBRARY / f'{copy}.png').write_bytes(small_copy(data, key))
sources[copy] = {'source_sha256': hashlib.sha256(data).hexdigest()}
for stale in LIBRARY.glob('*.png'):
if stale.stem not in sources:
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)
print(f'{len(sources)} library images, {total / 1048576:.1f} MiB')
if __name__ == '__main__':
main()
+9
View File
@@ -0,0 +1,9 @@
/*
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
/*.webp
Cache-Control: public, max-age=604800
/*.png
Cache-Control: public, max-age=604800
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="8" fill="#181622"/><g transform="translate(4 4)" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M15 9v3M13.5 10.5h3M7 5c1 0 3 1 5 1s4-1 5-1c3 0 7 14 3 14-3 0-4.5-4-8-4s-5 4-8 4C0 19 4 5 7 5Zm3 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"/></g></svg>

After

Width:  |  Height:  |  Size: 394 B

+83
View File
@@ -0,0 +1,83 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Arcade</title>
<meta name="description" content="Arcade: all of Waozi's games in one place. Pick a cover, download the game and play, free in your browser.">
<meta name="theme-color" content="#111223">
<link rel="canonical" href="https://arcade.waozi.xyz/">
<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">
<meta property="og:type" content="website">
<meta property="og:url" content="https://arcade.waozi.xyz/">
<meta property="og:title" content="Arcade">
<meta property="og:description" content="All of Waozi's games in one place, free in your browser.">
<meta property="og:image" content="https://arcade.waozi.xyz/og.jpg">
<meta name="twitter:card" content="summary_large_image">
<style>
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; background: #111223; color: #f4f2ff; }
canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: #111223; font: 600 16px/1.4 system-ui, sans-serif; transition: opacity .3s ease; }
#loading.done { opacity: 0; pointer-events: none; }
#loading svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#loading .track { width: min(280px, 70vw); height: 6px; border-radius: 3px; background: #ffffff26; overflow: hidden; }
#loading .bar { width: 0; height: 100%; background: #ffd166; transition: width .2s ease; }
#loading .failed { display: none; color: #ffb4a8; text-align: center; padding: 0 24px; }
#loading.error .failed { display: block; }
#loading.error .track { display: none; }
</style>
</head>
<body>
<canvas id="canvas" tabindex="0"></canvas>
<div id="loading" role="status" aria-live="polite">
<!-- MingCute game_2 gamepad, Apache-2.0 -->
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 9v3M13.5 10.5h3M7 5c1 0 3 1 5 1s4-1 5-1c3 0 7 14 3 14-3 0-4.5-4-8-4s-5 4-8 4C0 19 4 5 7 5Zm3 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"/></svg>
<div class="track"><div class="bar"></div></div>
<p class="failed">Arcade could not start. Reload the page to try again.</p>
</div>
<script>
(function () {
var loading = document.getElementById('loading');
var bar = loading.querySelector('.bar');
function failed() { loading.classList.add('error'); }
// Arcade's Profile reports ready once the library is about to draw.
function watch() {
if (window.Module && Module.profileReady) { loading.classList.add('done'); return; }
requestAnimationFrame(watch);
}
window.Module = {
canvas: document.getElementById('canvas'),
setStatus: function (text) {
var match = /\((\d+(?:\.\d+)?)\/(\d+)\)/.exec(text || '');
if (match) bar.style.width = Math.min(100, 100 * match[1] / match[2]) + '%';
},
onAbort: failed,
onExit: function (code) { if (code !== 0) failed(); }
};
// 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) {
if (!response.ok) throw new Error(response.status);
return response.text();
}),
fetch('apps.zx').then(function (response) {
return response.ok ? response.arrayBuffer() : null;
})
]).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();
}).catch(failed);
})();
</script>
</body>
</html>
+13
View File
@@ -0,0 +1,13 @@
{
"name": "Arcade",
"short_name": "Arcade",
"description": "All my games in one place.",
"start_url": "/",
"display": "standalone",
"background_color": "#181622",
"theme_color": "#181622",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
]
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

+3
View File
@@ -19,6 +19,9 @@ ARCADE_BACK_KEY :: 4
arcade_state: s32;
ArcadeStart :: () -> bool {
// Later animation pictures load asynchronously too. Keep the last
// complete frame visible while a new sprite is being decoded.
RaylibCompletePictureFrames(true)
// Android before 10 cannot name its system font; the APK carries the
// same font as the Windows build, so text never falls back to raylib's
// bitmap font.
+4
View File
@@ -0,0 +1,4 @@
// Arcade's library art: the games' covers, logos and previews, downloaded
// beside the games. The Apps host only reads its assets; it never runs.
#program_export
Main :: () -> s32 { return 0 }
+102 -4
View File
@@ -21,6 +21,7 @@
#import "kryon/button_widget"
#import "kryon/button_props"
#import "kryon/hosted_values"
#import "kryon/hosted_app"
#import "kryon/widget_host"
#import "kryon/app_files"
#import "kryon/app_protocol"
@@ -42,7 +43,11 @@ Codec :: #import "apps/node_codec";
#import "entity/publications_read"
#import "entity/entity_records"
#import "entity/entity_dew"
#import "entity/leaderboard_native"
#import "kryon/widget_palette"
#import "kryon/image_raster"
#import "kryon/loading_indicator"
#import, file "collection_loading.zi";
#import "shovey/shovey_theme"
ProfileIcon :: #import "mingcute/mingcute_regular_user_4";
DewIcon :: #import "mingcute/mingcute_filled_drop";
@@ -78,6 +83,8 @@ collection_shared_codec: Codec.WidgetAppSharedCodec;
collection_item_codec: Codec.WidgetAppSharedItemCodec;
collection_invitation_codec: Codec.WidgetAppInvitationCodec;
collection_ready: bool;
collection_loading: CollectionLoading;
collection_pictures_missing: bool;
collection_leave_to_library: bool;
// Whether games download new levels when they come out: asked once on the
// covers and passed to the games as arcade.updates. -1 unread, 0 off, 1 on,
@@ -127,7 +134,7 @@ CollectionAllows :: (context: *void, node: *AppNode, name: string) -> bool {
name == "tile_map.sampling" || name == "arcade.controls" || name == "arcade.sound" || name == "arcade.navigation" ||
name == "arcade.updates" ||
name == PUBLICATIONS_READ_SERVICE || name == ENTITY_RECORDS_SERVICE || name == ENTITY_DEW_SERVICE ||
name == "entity.profile"
name == "entity.profile" || name == "leaderboard"
}
CollectionCall :: (context: *void, node: *AppNode, module: *u8, function: *u8,
@@ -170,6 +177,12 @@ CollectionCall :: (context: *void, node: *AppNode, module: *u8, function: *u8,
HostScalarValid(arguments[1], "string", cast(s32)HostString) {
service := AppArgumentText(arguments[0])
request := AppArgumentText(arguments[1])
if service == "leaderboard" {
saved := EntityLeaderboardReport("arcade", "Arcade", TextUntilNul(node.identity.id[:]),
TextUntilNul(node.entry.title[:]), request)
result.* = AppHostText(ifx saved then "{\"status\":\"saved\"}" else "{\"status\":\"rejected\"}")
return 1
}
// Public level collections, such as a game's live campaign.
if service == PUBLICATIONS_READ_SERVICE {
result.* = AppHostText(PublicationsReadAnswer(request))
@@ -275,14 +288,15 @@ CollectionCall :: (context: *void, node: *AppNode, module: *u8, function: *u8,
}
CollectionAssetAllowed :: (path: string) -> bool {
return path == "" || (collection_widget_node != null && AppHostAsset(collection_widget_node, path).found)
return path == "" || (collection_widget_node != null && (AppHostAsset(collection_widget_node, path).found ||
AppHostAssetPending(collection_widget_node, path)))
}
CollectionAssetPath :: (path: string) -> string {
if path == "" { return "" }
if collection_widget_node == null { return "" }
asset := AppHostAsset(collection_widget_node, path)
if !asset.found { return "" }
if !asset.found { collection_pictures_missing = true; return "" }
relative := Join(TextUntilNul(collection_widget_node.entry.sha256[:]), path)
defer { AppFileFree(relative) }
cached := collection_images
@@ -315,6 +329,27 @@ CollectionWidgets :: (context: *void, node: *AppNode, module: *u8, function: *u8
return WidgetHostCall(context, module, function, arguments, count, result)
}
// Check the same saved install state and verified download plan as Apps.
// A cached payload or an old score alone is never installed membership.
CollectionLeaderboardInstalled :: (game: string) -> bool {
if !collection_ready { return false }
for slot: cast(s64)0..collection_host.tree.nodes.count - 1 {
parent := collection_host.tree.nodes[slot].node
if parent == null || !parent.collection { continue }
index := AppCatalogFind(*parent.catalog, game)
if index < 0 { continue }
entry := AppCatalogAt(*parent.catalog, index)
identity := AppIdentity.{.authority = parent.identity.authority, .id = entry.id}
state: AppState
plan: AppInstallPlan
if CollectionState(null, "local", *identity, *state) && state.installed &&
AppHostInstallPlan(*collection_host, parent, entry, *plan) && plan.count == 0 {
return true
}
}
return false
}
CollectionSave :: (context: *void, node: *AppNode) -> bool {
saved := collection_records
while saved != null {
@@ -378,9 +413,22 @@ CollectionEffect :: (context: *void, account: string, locator: *AppLocator,
return true
}
// Arcade's own copy of the shared Apps controller. A collection that does not
// pack one uses it; the Apps host accepts it only by the trusted digest.
collection_controller: string;
CollectionController :: (context: *void) -> HostedAsset {
unused context
controller: HostedAsset
controller.data = collection_controller
controller.found = collection_controller.count > 0
return controller
}
CollectionOpen :: (bundle: string, digest: string, harness_digest: string,
data: string, locale: string) -> bool {
if collection_ready { return false }
leaderboard_installed = CollectionLeaderboardInstalled
collection_directory = data
collection_resource_root = Join(data, "resources")
opened := AppFilesOpen(*collection_resources, collection_resource_root)
@@ -390,7 +438,8 @@ CollectionOpen :: (bundle: string, digest: string, harness_digest: string,
.widgets = CollectionWidgets, .save = CollectionSave, .state = CollectionState,
.effect = CollectionEffect,
.bundle = CollectionBundle, .download = CollectionDownload, .fetch = CollectionFetch,
.presentation = AppPresentation.{.cover_grid = true}}
// Covers show only the art; the download dialog names the size.
.controller = CollectionController, .presentation = AppPresentation.{.cover_grid = true, .hide_sizes = true}}
collection_ready = AppHostStart(*collection_host, bundle, "arcade.local", "inbe.arcade",
"arcade", digest, "local", platform, harness_digest, locale)
if !collection_ready { Report("Arcade: the shared Apps host refused the collection") }
@@ -398,6 +447,11 @@ CollectionOpen :: (bundle: string, digest: string, harness_digest: string,
}
CollectionOpenFiles :: (directory: string, data: string) -> bool {
// The installed controller beside the collection; kept while Arcade runs.
controller_path := Join(directory, "apps.zx")
controller, controller_found := ReadEntireFile(controller_path)
AppFileFree(controller_path)
if controller_found { collection_controller = controller } else { AppFileFree(controller) }
bundle_path := Join(directory, "arcade.zx")
metadata_path := Join(directory, "arcade.json")
defer { AppFileFree(bundle_path); AppFileFree(metadata_path) }
@@ -441,6 +495,7 @@ CollectionOpenShovey :: (directory: string, data: string) -> bool {
CollectionOpenShoveyBytes :: (bytes: string, metadata: string, data: string) -> bool {
if collection_ready { return false }
leaderboard_installed = CollectionLeaderboardInstalled
id: [128]u8
digest: [65]u8
harness: [65]u8
@@ -482,6 +537,7 @@ CollectionClose :: () -> bool {
if !EntityClose() { return false }
if collection_ready && !AppHostStop(*collection_host) { return false }
collection_ready = false
collection_loading = .{}
CollectionDownloadsClose()
CollectionCollect()
VecFree(collection_frame_paths)
@@ -504,9 +560,19 @@ CollectionClose :: () -> bool {
AppFilesClose(*collection_resources)
AppFileFree(collection_resource_root)
collection_resource_root = ""
AppFileFree(collection_controller)
collection_controller = ""
return true
}
CollectionPending :: (request: s64) -> bool {
for index: cast(s64)0..collection_host.tree.pending.count - 1 {
pending := collection_host.tree.pending[index]
if pending.reply.request == request { return !pending.complete }
}
return false
}
CollectionOpenGame :: (id: string) -> bool {
root := AppTreeNode(*collection_host.tree, collection_host.tree.active)
if root == null || !root.collection { Report("Arcade: no collection is open to start "); Report(id); Report("\n"); return false }
@@ -526,6 +592,12 @@ CollectionOpenGame :: (id: string) -> bool {
return false
}
if !AppTreeDrain(*collection_host.tree) { Report("Arcade: the apps host stopped while starting "); Report(id); Report("\n"); return false }
// Games that share code are verified in the background; wait for it.
started := MonotonicMilliseconds()
while CollectionPending(queued.request) && MonotonicMilliseconds() - started < 60000 {
unused SleepMilliseconds(5)
if !AppTreeDrain(*collection_host.tree) { Report("Arcade: the apps host stopped while starting "); Report(id); Report("\n"); return false }
}
for index: cast(s64)0..collection_host.tree.pending.count - 1 {
reply := collection_host.tree.pending[index].reply
if reply.request == queued.request && reply.status == APPS_REJECTED {
@@ -607,6 +679,10 @@ CollectionFrame :: (session: Session, viewport: Rectangle, key: s32, modifiers:
if entity_visible { return EntityFrame(session, viewport, key, modifiers) }
runtime := AppHostActiveRuntime(*collection_host)
if runtime == null { Report("Arcade: no app is running\n"); return false }
opening := !runtime.node.collection && (!collection_loading.shown ||
collection_loading.slot != collection_host.tree.active.slot ||
collection_loading.generation != collection_host.tree.active.generation)
if opening { key = 0 }
nested := runtime.node.parent.generation != 0 && !runtime.node.collection
// An app opened from its cover fills the screen with its own navigation.
// Other apps get a bar with Back and their title; the library and that
@@ -643,6 +719,7 @@ CollectionFrame :: (session: Session, viewport: Rectangle, key: s32, modifiers:
.scale = 1.0, .font = 16, .now = now}
}
WidgetHostBegin(session, CollectionAssetAllowed, CollectionAssetPath)
collection_pictures_missing = false
drawn := AppHostRun(*collection_host, APP_FRAME)
WidgetHostEnd()
if !drawn {
@@ -654,6 +731,27 @@ CollectionFrame :: (session: Session, viewport: Rectangle, key: s32, modifiers:
unused AppHostBack(*collection_host)
return true
}
if opening {
pictures_ready := !collection_pictures_missing
// Query every path, including those first requested by this frame's
// TileMap. Android decodes them asynchronously on its render thread.
for path: collection_frame_paths {
if AssetWidth(path) < 0 { pictures_ready = false }
}
if CollectionNeedsCover(*collection_loading, collection_host.tree.active.slot,
collection_host.tree.active.generation, pictures_ready) {
collection_toolbar_visible = false
Box(session, BoxProps.{.key = cast(u64)49400, .bounds = viewport,
.fill = ColorFromPacked(ifx entity_shovey then ShoveyPalette().background else AppCoversPalette().background)})
unused Button(session, ButtonProps.{.key = cast(u64)49401, .id = 49401,
.bounds = viewport, .invisible = true})
LoadingIndicator(session, LoadingIndicatorProps.{.key = cast(u64)49402,
.bounds = viewport, .now = now, .scale = 1.5})
return true
}
} else if runtime.node.collection {
collection_loading = .{}
}
if asking {
unused WidgetPaletteUse(session, ifx entity_shovey then ShoveyPalette() else AppCoversPalette())
CollectionUpdatesQuestion(session, viewport)
+21
View File
@@ -0,0 +1,21 @@
// A newly opened game stays covered until two complete picture frames have
// composed. Images can be requested after the first apparently ready frame.
CollectionLoading :: struct {
generation: s64
slot: s64
ready_frame: bool
shown: bool
}
CollectionNeedsCover :: (state: *CollectionLoading, slot: s64, generation: s64,
pictures_ready: bool) -> bool {
if state.slot != slot || state.generation != generation {
state.* = CollectionLoading.{.slot = slot, .generation = generation}
return true
}
if state.shown { return false }
if !pictures_ready { state.ready_frame = false; return true }
if !state.ready_frame { state.ready_frame = true; return true }
state.shown = true
return false
}
+2
View File
@@ -18,6 +18,8 @@
sdl :: #system_library "SDL2";
SetTitle :: (window: *void, title: *u8) #foreign sdl "SDL_SetWindowTitle";
// First show small RGB/RGBA previews. The collection replaces them with its
// original artwork when ready, using the same layout and coloured logo.
DrawStartup :: (session: Session, directory: string, standalone: bool = true) -> bool {
if !PollDesktop() || WindowTakeCloseRequestHost() { return false }
BeginDesktopFrame()
+3
View File
@@ -43,6 +43,9 @@ EntityShoveyTokens :: () {
EntityOpen :: (bytes: string, data: string, shovey: bool = false) -> bool {
entity_shovey = shovey
#if #defined(GOOGLE_PLAY) {
EntityHostAllowFunding(false)
}
if shovey { EntityShoveyTokens() }
root := Join(data, "entity")
defer { EntityFree(root) }
+5
View File
@@ -48,6 +48,11 @@ DataDirectory :: () -> string {
BuilderPrint(*result, "%", private)
return BuilderFinish(result)
}
// The browser keeps saves and downloaded games in the page's persistent
// storage, which Kryon mounts at /kryon-apps.
#if #defined(PLATFORM_WEB) {
return Join("/kryon-apps", "arcade")
}
exact := EnvironmentText("ARCADE_DATA")
if exact != "" { return exact }
#if #defined(_WIN32) {
+2 -2
View File
@@ -10,8 +10,8 @@ SoundMuted :: () -> bool { return sound_muted }
SoundSetMuted :: (muted: bool) { sound_muted = muted }
#if #defined(ANDROID_BUILD) {
// Android has no SDL audio; games stay silent there and run on.
#if #defined(ANDROID_BUILD) || #defined(PLATFORM_WEB) {
// Android and the browser have no SDL audio; games stay silent there and run on.
SoundPlay :: (bytes: string) -> bool {
unused bytes
return false
+102
View File
@@ -0,0 +1,102 @@
// 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.
using Canvas :: #import "kryon/Canvas";
#import "kryon/bundle_storage_web"
#import "kryon/app_files"
#import "kryon/session"
#import "kryon/geometry"
#import "kryon/tree"
#import "kryon/tree_input"
#import "kryon/Frame"
#import "kryon/ScrollDevice"
#import "kryon/key_input"
#import "kryon/TestDriver"
#import "kryon/page_core"
#import "std/file"
#import "std/web"
#import "std/byte_text_linux"
#import "platform"
#import "collection_host"
#import "entity_host"
arcade_receipt: [4096]u8;
// The page passes the collection's build receipt (its digest and trusted
// Apps controller) as Module.arcadeReceipt, beside the preloaded /app.zx.
ArcadeReceipt :: () -> string {
handle := WebAsObject(WebGet(WebGetObject(WebGlobal, WebName("Module")), WebName("arcadeReceipt")))
if handle == 0 { return "" }
length := WebCopyString(handle, arcade_receipt[:])
if length <= 0 || length >= cast(s32)arcade_receipt.count { return "" }
return TextFromBytes(arcade_receipt[:length])
}
ArcadeFrame :: (session: Session) -> bool {
BeginCanvasFrame()
viewport := CanvasViewport()
modifiers := CanvasModifiers()
KeyboardModifiersSend(session, modifiers)
key := CanvasPressedKey()
if key == 256 && CollectionBack() { key = 0 }
KeyboardSend(session, key)
point := CanvasTypedCodepoint()
while point != 0 { unused TypedCodepointSend(session, point); point = CanvasTypedCodepoint() }
pointer := PollPointer()
TreePointerUpdate(session, pointer)
TreeSecondaryPointerUpdate(session, PollSecondaryPointer())
wheel := CanvasWheelMove()
PointerWheelSend(session, pointer.x, pointer.y, wheel)
BeginScrollFrame(session, Vector2.{pointer.x, pointer.y}, pointer.pressed,
pointer.down, pointer.released, wheel, PageNow() / 1000.0)
if BeginFrame(session, cast(u64)1, viewport) != FrameStatus.FrameOk { return false }
if !CollectionFrame(session, viewport, key, modifiers) {
TreeCancel(session)
return false
}
if EndFrame(session) != FrameStatus.FrameOk { return false }
TestDriverFrame(session)
CanvasCursor(session)
ok := EndCanvasFrame()
CollectionCollect()
return ok
}
#program_export
main :: () -> s32 {
if !OpenCanvas() { return 1 }
defer CloseCanvas()
if !BundleStorageOpen() { return 1 }
while !BundleStorageReady() && !BundleStorageFailed() { WebSleep(10) }
if !BundleStorageReady() { return 1 }
data := DataDirectory()
// The page preloads Arcade's published collection; the Profile is embedded.
bytes, found := ReadEntireFile("/app.zx")
profile, profile_found := ReadEntireFile("/entity.zx")
defer { AppFileFree(bytes) }
receipt := ArcadeReceipt()
// 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 }
session := SessionOpen()
if !SessionValid(session) { unused CollectionClose(); return 1 }
defer { SessionClose(session) }
WebSet(WebGetObject(WebGlobal, WebName("Module")), WebName("profileReady"), WebBool(true))
saved := PageNow()
ok := true
while ok && PollCanvas() {
scope := WebScope()
ok = ArcadeFrame(session)
// Saves reach the browser's storage about once a second.
if PageNow() - saved >= 1000.0 {
unused BundleStorageSync(false)
saved = PageNow()
}
WebEnd(scope)
}
unused CollectionClose()
unused BundleStorageSync(false)
return ifx ok then 0 else 1
}
+21
View File
@@ -0,0 +1,21 @@
#import, file "../src/collection_loading.zi";
#program_export
Check :: () -> s32 {
state: CollectionLoading
if !CollectionNeedsCover(*state, 1, 1, true) { return 1 }
if !CollectionNeedsCover(*state, 1, 1, true) { return 2 }
// A later request invalidates the apparently ready frame.
if !CollectionNeedsCover(*state, 1, 1, false) { return 3 }
if !CollectionNeedsCover(*state, 1, 1, false) { return 4 }
if !CollectionNeedsCover(*state, 1, 1, true) { return 5 }
if CollectionNeedsCover(*state, 1, 1, true) { return 6 }
// Gameplay never returns to its opening cover for an animation sprite.
if CollectionNeedsCover(*state, 1, 1, false) { return 7 }
// A new game or a reopened slot gets its own loading stage.
if !CollectionNeedsCover(*state, 2, 1, true) { return 8 }
if !CollectionNeedsCover(*state, 2, 1, true) { return 9 }
if CollectionNeedsCover(*state, 2, 1, true) { return 10 }
if !CollectionNeedsCover(*state, 2, 2, true) { return 11 }
return 42
}
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$root"
mkdir -p build/collection-loading-test
./scripts/ziran.sh bundle --project --root "$root" \
--entry collection_loading_behavior:Check \
-o build/collection-loading-test/test.zx tests/collection_loading_behavior.zi
test "$(./scripts/ziran.sh run build/collection-loading-test/test.zx)" = 42
echo 'Local collection loading test: late image requests, consecutive ready frames and navigation'
+108 -13
View File
@@ -1,6 +1,7 @@
"""Exercise packaging from the actual registered game builds, preserving bytes."""
import hashlib
import importlib.util
import io
import json
from pathlib import Path
import shlex
@@ -9,12 +10,16 @@ import tempfile
import unittest
import sys
import tarfile
from PIL import Image
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
spec = importlib.util.spec_from_file_location("build_collection", ROOT / "scripts/build-collection.py")
builder = importlib.util.module_from_spec(spec)
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)
class CollectionTests(unittest.TestCase):
@@ -38,6 +43,7 @@ class CollectionTests(unittest.TestCase):
shutil.copytree(ROOT / "build/games", self.root / "build/games")
(self.root / "assets/arcade").mkdir(parents=True)
shutil.copyfile(ROOT / "assets/arcade/sidebar.shape", self.root / "assets/arcade/sidebar.shape")
shutil.copytree(ROOT / "assets/arcade/library", self.root / "assets/arcade/library")
# Only a native VM identity gate can trust a controller. This fixture
# tests packing and its exact-content requirement, not that handshake.
self.controller = self.root / "controller.zx"
@@ -70,10 +76,46 @@ class CollectionTests(unittest.TestCase):
self.assertEqual(builder.digest(packed), child["sha256"])
self.assertEqual(child["version"], ledger[name]["version"])
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"build/games/{name}-preview.png").read_bytes())
(ROOT / f"assets/arcade/library/{name}-preview.png").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())
self.assertEqual((self.output / catalog["harness"]).read_bytes(), self.controller.read_bytes())
def test_changed_game_art_needs_fresh_library_copies(self):
sources = self.root / "assets/arcade/library/sources.json"
value = json.loads(sources.read_text())
value["wurm-portrait"]["source_sha256"] = "0" * 64
sources.write_text(json.dumps(value))
with self.assertRaisesRegex(ValueError, "wurm-portrait art changed"):
self.stage()
def test_every_library_cover_uses_a_bounded_thumbnail(self):
catalog, packages = builder.stage(self.root, self.controller, self.controller_digest, self.output)
children = {child['id']: child for child in catalog['children']}
for package in packages:
for app in package['apps']:
if not app['enabled'] or not app['cover']:
continue
child = children[app['descriptor']['id']]
for key in ('portrait', 'landscape', 'logo'):
if key not in app['cover']:
continue
original = (app['source'] / app['cover'][key]).read_bytes()
with self.subTest(app=child['id'], image=key):
with Image.open(io.BytesIO(original)) as source:
with Image.open(self.output / child['cover'][key]) as thumbnail:
limit = 512 if key == 'logo' else 640
self.assertLessEqual(max(thumbnail.size), limit)
self.assertLessEqual(thumbnail.width, source.width)
self.assertLessEqual(thumbnail.height, source.height)
self.assertAlmostEqual(thumbnail.width / thumbnail.height,
source.width / source.height, delta=0.01)
self.assertIn(thumbnail.mode, ('RGB', 'RGBA'))
def test_editor_download_reuses_verified_shovey_assets(self):
catalog = self.stage()
children = {child['id']: child for child in catalog['children']}
@@ -110,29 +152,45 @@ class CollectionTests(unittest.TestCase):
catalog = self.stage()
small = self.root / "small"
games = self.root / "arcade.games"
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
art = self.root / "art"
self.assertEqual((small / "assets/apps/catalog.json").read_bytes(),
(self.output / "assets/apps/catalog.json").read_bytes())
self.assertEqual((small / catalog["harness"]).read_bytes(), self.controller.read_bytes())
# The published launcher packs neither the host's controller nor art.
self.assertFalse((small / catalog["harness"]).exists())
self.assertTrue((self.output / catalog["harness"]).is_file(), "Standalone players keep the controller")
for child in catalog["children"]:
full = self.output / child["bundle"]
self.assertTrue(full.is_file(), "Standalone players retain the game")
self.assertFalse((small / child["bundle"]).exists())
self.assertEqual((games / (child["sha256"] + ".zx")).read_bytes(), full.read_bytes())
self.assertEqual((small / child["preview"]).read_bytes(),
(self.output / child["preview"]).read_bytes())
for key in child["cover"].keys() & {"portrait", "landscape", "logo"}:
relative = child["cover"][key]
self.assertEqual((small / relative).read_bytes(), (self.output / relative).read_bytes())
pictures = [child["preview"]] + [child["cover"][key] for key in child["cover"].keys() & {"portrait", "landscape", "logo"}]
for relative in pictures:
self.assertFalse((small / relative).exists())
self.assertEqual((art / relative).read_bytes(), (self.output / relative).read_bytes())
packed = sum(path.stat().st_size for path in small.rglob("*") if path.is_file())
self.assertLess(packed, 1024 * 1024, "Arcade itself stays under one megabyte")
def test_art_bundle_is_published_and_named_by_the_catalog(self):
catalog = self.stage()
small = self.root / "small"
games = self.root / "arcade.games"
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
art_bundle = self.root / "art.zx"
art_bundle.write_bytes(b"ZX\0\0art fixture")
art = builder.add_art(small, games, art_bundle)
self.assertEqual(art, dict(sha256=builder.digest(art_bundle), bytes=art_bundle.stat().st_size))
self.assertEqual((games / (art["sha256"] + ".zx")).read_bytes(), art_bundle.read_bytes())
self.assertEqual(json.loads((small / "assets/apps/catalog.json").read_text())["art"], art)
def test_changed_download_preserves_previous_outputs(self):
catalog = self.stage()
small = self.root / "small"
games = self.root / "arcade.games"
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
(self.output / catalog["children"][0]["bundle"]).write_bytes(b"changed game")
with self.assertRaisesRegex(ValueError, "declared digest"):
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
self.assertTrue((small / "assets/apps/catalog.json").exists())
self.assertTrue((games / (catalog["children"][0]["sha256"] + ".zx")).exists())
@@ -140,7 +198,7 @@ class CollectionTests(unittest.TestCase):
catalog = self.stage()
small = self.root / "small"
games = self.root / "arcade.games"
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
archive = self.root / "arcade.games.tar"
builder.archive_downloads(games, archive)
with tarfile.open(archive) as content:
@@ -154,12 +212,12 @@ class CollectionTests(unittest.TestCase):
catalog = self.stage()
small = self.root / "small"
games = self.root / "arcade.games"
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
catalog["children"] = []
# Build a fresh full stage as a real removed registration does.
(self.root / "games.json").write_text(json.dumps({"packages": []}))
catalog = self.stage()
builder.stage_downloads(catalog, self.output, small, games)
builder.stage_downloads(catalog, self.output, small, games, self.root / "art")
self.assertEqual(list(games.iterdir()), [])
self.assertFalse((small / "assets/arcade/games/shovey.zx").exists())
@@ -202,5 +260,42 @@ class CollectionTests(unittest.TestCase):
self.assertFalse(self.output.exists())
class LibraryThumbnailTests(unittest.TestCase):
def test_cover_keeps_full_colour_at_thumbnail_resolution(self):
source = Image.new('RGB', (900, 1200))
source.putdata([(x % 256, y % 256, (x + y) % 256)
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:
self.assertEqual(thumbnail.size, (480, 640))
self.assertEqual(thumbnail.mode, 'RGB')
self.assertIsNone(thumbnail.getcolors(256))
def test_logo_retains_transparency(self):
source = Image.new('RGBA', (1200, 400), (45, 155, 90, 0))
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:
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):
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())
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:
self.assertEqual(thumbnail.size, (512, 1))
if __name__ == "__main__":
unittest.main()
+53 -17
View File
@@ -51,12 +51,14 @@ def package_server(root):
def do_GET(self):
digest = self.path.removeprefix('/api/v2/packages/inbe.arcade/').removesuffix('.zx')
state['requests'].append(digest)
if state['offline'] or digest not in by_digest:
# Every published file: the games and the library art.
published = root / 'build/node-apps/arcade.games' / (digest + '.zx')
if state['offline'] or not published.is_file():
self.send_error(503)
return
entry = by_digest[digest]
data = (root / 'build/node-apps/arcade.games' / (digest + '.zx')).read_bytes()
if (state['corrupt_wurm'] and entry['expected_id'] == 'wurm') or (state['corrupt_shovey'] and entry['expected_id'] == 'shovey'):
entry = by_digest.get(digest, {})
data = published.read_bytes()
if (state['corrupt_wurm'] and entry.get('expected_id') == 'wurm') or (state['corrupt_shovey'] and entry.get('expected_id') == 'shovey'):
data = data[:-1] + bytes([data[-1] ^ 1])
self.send_response(200)
self.send_header('Content-Length', str(len(data)))
@@ -83,6 +85,8 @@ def main():
root = Path(__file__).resolve().parents[1]
entries = json.loads((root / 'build/arcade.json').read_text())['children']
by_name = {entry['expected_id']: entry for entry in entries}
# The library art downloads with Arcade; games only after consent.
games = {entry['sha256'] for entry in entries}
def size_text(size):
return f"{(size * 10 + 500000) // 1000000 / 10:.1f} MB"
sizes = {name: size_text(entry['bytes']) for name, entry in by_name.items()}
@@ -127,7 +131,7 @@ def main():
assert int(subprocess.check_output(["xdotool", "getwindowpid", window], text=True, timeout=10)) == child.pid
subprocess.run(["import", "-window", window, str(output / (name + ".png"))], check=True, timeout=10)
def grid(child, name):
def grid(child, name, phone=False):
driver.wait_idle(frames=20)
driver.wait(label="Arcade", role="text")
assert not driver.find(label="Chess"), "Chess is temporarily disabled"
@@ -137,14 +141,21 @@ def main():
editor_card = driver.wait(label="Shovey Editor", role="button")
assert classic_card['y'] == editor_card['y'], "Apps must share a grid row"
assert classic_card['x'] != editor_card['x']
assert classic_card['width'] >= 200 and classic_card['height'] >= 350
if phone:
# Phones show small covers, two or three a row.
wurm_card = driver.wait(label='Apfelwurm', role='button')
assert wurm_card['y'] == classic_card['y'], 'A phone row holds all three covers'
assert 100 <= classic_card['width'] < 200, 'Phone covers must be small cards'
else:
assert classic_card['width'] >= 200 and classic_card['height'] >= 350
assert not driver.find(label='Play', role='button')
assert not driver.find(label='Open', role='button')
for label in ('Shovey', 'Shovey Editor', 'Apfelwurm'):
assert not driver.find(label=label, role='text'), 'Title artwork must not repeat its name underneath'
driver.wait(label='Apfelwurm', role='button', visible=False)
smallest = (100, 140) if phone else (180, 200)
covers = [node for node in driver.find(role='image', visible=True)
if node['width'] >= 180 and node['height'] >= 200]
if node['width'] >= smallest[0] and node['height'] >= smallest[1]]
assert len(covers) >= 2, "Apps must use large title-screen artwork"
capture(child, name)
with Image.open(output / (name + ".png")) as image:
@@ -168,7 +179,7 @@ def main():
driver.wait(label='Download size: ' + total, role='text')
capture(child, 'editor-download-plan')
driver.press(label='Cancel', role='button')
assert server['requests'] == [], 'Dependency consent must precede every download'
assert not games & set(server['requests']), 'Dependency consent must precede every download'
driver.press(label='Shovey Editor', role='button')
server['corrupt_shovey'] = True
primary_download()
@@ -180,7 +191,7 @@ def main():
capture(child, 'editor-shared-assets')
assert server['requests'].count(by_name['shovey']['sha256']) == 2
assert server['requests'].count(by_name['shovey-editor']['sha256']) == 1
assert len(server['requests']) == 3, 'Retry must reuse the already downloaded editor'
assert len([digest for digest in server['requests'] if digest in games]) == 3, 'Retry must reuse the already downloaded editor'
assert by_name['shovey-editor']['bytes'] < by_name['shovey']['bytes'], 'The editor must carry only its additions'
server['requests'].clear()
# Disabling an entry must leave a person's older Chess save untouched.
@@ -204,21 +215,28 @@ def main():
answer_library_question(driver)
window = subprocess.check_output(['xdotool', 'search', '--onlyvisible', '--pid', str(child.pid)], text=True).splitlines()[0]
subprocess.run(['xdotool', 'windowsize', window, '480', '820'], check=True)
grid(child, "apps-portrait")
assert server['requests'] == [], 'Covers must not predownload games'
grid(child, "apps-portrait", phone=True)
assert not games & set(server['requests']), "Covers must not predownload games"
# Covers show only the art; the download dialog names the size.
cover_sizes = dict(sizes, **{'shovey-editor': size_text(by_name['shovey']['bytes'] + by_name['shovey-editor']['bytes'])})
for text in cover_sizes.values():
driver.wait(label=text, role='text', visible=False)
assert not driver.find(label=text, role='text'), "Covers must not show download sizes"
driver.press(label='Profile', role='button')
driver.wait(label='Account', role='text')
capture(child, 'arcade-profile')
driver.press(label='Leaderboard', role='button')
driver.wait(label='Leaderboard', role='text')
driver.wait(label='No leaderboard data yet.', role='text')
capture(child, 'leaderboard-empty')
driver.press(label='Back', role='button')
driver.wait(label='Account', role='text')
driver.press(label="Back", role="button")
driver.wait(label='Shovey', role='button')
assert not list((profile / 'resources/downloads').glob('*.zx'))
assert not [path for path in (profile / 'resources/downloads').glob('*.zx') if path.stem in games]
driver.press(label="Shovey", role="button")
driver.wait(label='Cancel', role='button')
driver.press(label='Cancel', role='button')
assert server['requests'] == [], 'Cancel must download nothing'
assert not games & set(server['requests']), 'Cancel must download nothing'
driver.press(label="Shovey", role="button")
primary_download()
driver.wait(label=f"Level 1 / {classic}")
@@ -249,6 +267,23 @@ def main():
saved = wait(lambda: record.read_bytes() if record.exists() else None, "Classic did not save")
driver.press(label="Back", role="button")
driver.wait(label="Shovey Editor", role="button")
driver.press(label='Profile', role='button')
driver.press(label='Leaderboard', role='button')
driver.wait(label='Shovey', role='button')
assert not driver.find(label='Apfelwurm', role='button'), 'An undownloaded game has a board'
assert not driver.find(label='Shovey Editor', role='button'), 'An unranked editor has a board'
capture(child, 'leaderboard-installed')
state = profile / 'resources/state/arcade.shovey.json'
state.parent.mkdir(parents=True, exist_ok=True)
state.write_text('{"v":1,"installed":0,"favorite":0}')
driver.wait(label='No leaderboard data yet.', role='text')
assert not driver.find(label='Shovey', role='button'), 'A retained score kept an uninstalled board visible'
state.write_text('{"v":1,"installed":1,"favorite":0}')
driver.wait(label='Shovey', role='button')
driver.press(label='Back', role='button')
driver.wait(label='Account', role='text')
driver.press(label='Back', role='button')
driver.wait(label='Shovey Editor', role='button')
assert not driver.find(label=sizes["shovey"], role="text"), "Installed games must omit their download size"
driver.press(label="Shovey Editor", role="button")
driver.wait(label='Download size: ' + sizes['shovey-editor'], role='text')
@@ -275,15 +310,16 @@ def main():
assert not driver.find(label='Pause', role='button'), 'Unverified bytes must never run'
server['corrupt_wurm'] = False
primary_download('Try again')
driver.wait(label='Play', role='button', timeout=60)
capture(child, 'wurm-title')
driver.press(label='Play', role='button')
# The cover is its title: Apfelwurm asks once how to move, then plays.
driver.wait(label='How do you want to move?', role='text', timeout=60)
driver.press(label='Swipe', role='button')
driver.wait(label='Pause', role='button')
capture(child, 'wurm-playing')
driver.press(label='Pause', role='button')
driver.wait(label='Resume', role='button')
driver.press(label='Back to title', role='button')
driver.wait(label='Play', role='button')
capture(child, 'wurm-title')
driver.press(label='Back', role='button')
driver.wait(label='Shovey', role='button')
for entry in json.loads((root / 'build/arcade.json').read_text())['children']:
+27
View File
@@ -8,9 +8,36 @@ import unittest
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'scripts'))
from game_resources import dependency_order, share_resources
from game_packages import declared_apps
class GameResourcesTest(unittest.TestCase):
def test_shared_code_requires_explicit_dependencies_and_valid_library_entries(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
(root / 'games.json').write_text(json.dumps({'packages': []}))
(root / 'catalog.json').write_text(json.dumps({'id': 'editor', 'name': 'editor'}))
app = {'manifest': 'catalog.json', 'requires': ['game'], 'shared_code': True,
'library_entries': ['engine:Step'], 'shared_records': ['local.campaign']}
def declare(value):
(root / 'apps.json').write_text(json.dumps(
{'id': 'fixture', 'title': 'Fixture', 'apps': [value]}))
return declared_apps(root)[0]
parsed = declare(app)
self.assertTrue(parsed['shared_code'])
self.assertEqual(parsed['library_entries'], ['engine:Step'])
self.assertEqual(parsed['shared_records'], ['local.campaign'])
for invalid in [app | {'requires': []}, app | {'shared_code': 1},
app | {'library_entries': ['engine:../Step']},
app | {'library_entries': ['engine:Step', 'engine:Step']},
app | {'shared_records': ['../campaign']},
app | {'shared_records': ['local.campaign', 'local.campaign']},
app | {'shared_records': ['..']}, app | {'shared_records': 'campaign'}]:
with self.subTest(invalid=invalid), self.assertRaises(ValueError):
declare(invalid)
def test_dependency_order_rejects_missing_disabled_and_cyclic_games(self):
base = dict(enabled=True, descriptor=dict(id='game'), requires=[])
editor = dict(enabled=True, descriptor=dict(id='editor'), requires=['game'])
+109
View File
@@ -0,0 +1,109 @@
"""Released games must bring new dependency edges without moving backwards."""
import importlib.util
import json
from pathlib import Path
import subprocess
import tempfile
import tomllib
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[1]
spec = importlib.util.spec_from_file_location('follow_game_releases', ROOT / 'scripts/follow-game-releases.py')
follower = importlib.util.module_from_spec(spec)
spec.loader.exec_module(follower)
class GameUpdates(unittest.TestCase):
def follow(self, comparison, same_commit=False, failure=False, wrong_commit=False):
with tempfile.TemporaryDirectory(prefix='arcade-release-metadata-') as temporary:
root = Path(temporary)
(root / 'apps').mkdir()
old = '1' * 40
new = old if same_commit else '2' * 40
lock = {'format': 1, 'toolchain': {'commit': 'compiler'},
'root': {'dependencies': {'wurm': 'old', 'other': 'unrelated'}},
'packages': [{'id': 'old', 'name': 'Apfelwurm',
'url': 'https://github.com/waozixyz/wurm.git',
'commit': old, 'ref': 'master', 'dependencies': {}},
{'id': 'unrelated', 'commit': 'unchanged', 'dependencies': {}}]}
original_lock = json.dumps(lock)
(root / 'ziran.lock').write_text(original_lock)
original_manifest = ('[package]\nname = "Arcade"\n\n[dependencies.wurm]\n'
'git = "https://github.com/waozixyz/wurm.git"\nref = "master"\n\n'
'[dependencies.other]\nref = "stable"\n')
(root / 'ziran.toml').write_text(original_manifest)
(root / 'games.json').write_text(json.dumps({'packages': ['wurm']}))
# Release metadata may name a release before its source is pinned.
(root / 'apps/versions.json').write_text(json.dumps({'node_apps': {'wurm': {'version': '0.2.0'}}}))
def gh(*arguments):
if arguments[0] == 'release':
return 'v0.2.0'
return comparison if '/compare/' in arguments[1] else new
def resolve(command, **kwargs):
self.assertEqual(command, ['verified-ziran', 'update', 'wurm'])
self.assertEqual(kwargs, {'cwd': root, 'check': True})
self.assertIn(f'ref = "{new}"', (root / 'ziran.toml').read_text())
declaration = tomllib.loads((root / 'ziran.toml').read_text())
self.assertEqual(declaration['dependencies']['wurm']['ref'], new)
self.assertEqual(declaration['dependencies']['other']['ref'], 'stable')
if failure:
(root / 'ziran.lock').write_text('partial resolver output')
raise subprocess.CalledProcessError(1, command)
# A package-manager result with a newly introduced Entity import.
# The follower must retain this graph verbatim, rather than
# replacing the game id while preserving its old empty edges.
lock['root']['dependencies']['wurm'] = 'released'
lock['packages'][0].update(id='released', commit=old if wrong_commit else new,
ref=new, dependencies={'entity': 'accounts'})
lock['packages'].append({'id': 'accounts', 'commit': 'new-entity', 'dependencies': {}})
(root / 'ziran.lock').write_text(json.dumps(lock))
updates = root / 'updates.json'
with patch.object(follower, 'ROOT', root), patch.object(follower, 'UPDATES', updates), \
patch.object(follower, 'gh', gh), patch.object(follower.subprocess, 'run', side_effect=resolve) as run:
# Discovery must not require a compiler or modify either input.
follower.record_updates(follower.released_updates())
self.assertEqual((root / 'ziran.lock').read_text(), original_lock)
self.assertEqual((root / 'ziran.toml').read_text(), original_manifest)
run.assert_not_called()
if failure or wrong_commit:
with self.assertRaises((subprocess.CalledProcessError, ValueError)):
follower.pin('verified-ziran')
self.assertEqual((root / 'ziran.lock').read_text(), original_lock)
self.assertEqual((root / 'ziran.toml').read_text(), original_manifest)
else:
follower.pin('verified-ziran')
calls = run.call_count
return json.loads((root / 'ziran.lock').read_text()), json.loads(updates.read_text()), old, new, calls
def test_new_release_refreshes_transitive_graph(self):
lock, updates, old, new, calls = self.follow('ahead')
self.assertEqual(lock['packages'][0]['commit'], new)
self.assertEqual(lock['root']['dependencies']['wurm'], lock['packages'][0]['id'])
self.assertEqual(lock['packages'][0]['dependencies'], {'entity': 'accounts'})
self.assertEqual(lock['packages'][1]['commit'], 'unchanged')
self.assertEqual(lock['toolchain']['commit'], 'compiler')
self.assertEqual((len(updates), calls), (1, 1))
def test_same_source_is_unchanged(self):
lock, updates, old, new, calls = self.follow('identical', same_commit=True)
self.assertEqual(lock['packages'][0]['commit'], old)
self.assertEqual((updates, calls), ([], 0))
def test_older_release_never_moves_the_pin_back(self):
lock, updates, old, new, calls = self.follow('behind')
self.assertEqual(lock['packages'][0]['commit'], old)
self.assertEqual((updates, calls), ([], 0))
def test_failed_resolution_restores_manifest_and_lock(self):
self.follow('ahead', failure=True)
def test_local_override_cannot_publish_wrong_game(self):
self.follow('ahead', wrong_commit=True)
if __name__ == '__main__':
unittest.main()
+3
View File
@@ -230,6 +230,9 @@ def main():
resize_owned_window(child, 480, 820)
driver.press(label='Swipe and tap')
driver.wait_gone(label='How do you want to move?', role='text')
driver.wait(label='Got it', role='button')
driver.press(label='Got it', role='button')
driver.wait_gone(label='Got it', role='button')
assert (profile / 'games/arcade.shovey-player/records/controls').read_text() == 'off'
assert not driver.find(label='Continue', role='button'), 'Classic must open straight on a level'
assert driver.find(label='Shovey', role='image', visible=True), 'Shovey must be drawn as a picture'
+3
View File
@@ -117,6 +117,9 @@ def main():
answer_level_updates(driver)
driver.press(label='Swipe and tap')
driver.wait_gone(label='How do you want to move?', role='text')
driver.wait(label='Got it', role='button')
driver.press(label='Got it', role='button')
driver.wait_gone(label='Got it', role='button')
# Entering play may save the untouched campaign; a fresh profile may
# have no record until the first move.
deadline = time.monotonic() + 10
+51
View File
@@ -0,0 +1,51 @@
"""Startup previews keep full colour and alpha while the originals stay intact."""
import importlib.util
from pathlib import Path
import tempfile
import unittest
from PIL import Image
ROOT = Path(__file__).resolve().parents[1]
spec = importlib.util.spec_from_file_location('build_desktop', ROOT / 'scripts/build-desktop.py')
desktop = importlib.util.module_from_spec(spec)
spec.loader.exec_module(desktop)
class StartupArtTests(unittest.TestCase):
def test_previews_keep_colour_alpha_and_aspect_ratio(self):
work = ROOT / 'build/scratch'
work.mkdir(parents=True, exist_ok=True)
with tempfile.TemporaryDirectory(prefix='startup-art-', dir=work) as temporary:
root = Path(temporary)
source = root / 'source/assets/shovey'
source.mkdir(parents=True)
# A continuous RGB gradient needs more than a 256-colour palette.
gradient = Image.new('RGB', (900, 1200))
gradient.putdata([(x % 256, y % 256, (x + y) % 256)
for y in range(1200) for x in range(900)])
gradient.save(source / 'title-portrait.png')
gradient.transpose(Image.Transpose.ROTATE_90).save(source / 'title-landscape.png')
logo = gradient.resize((1200, 400)).convert('RGBA')
alpha = Image.new('L', logo.size, 0)
alpha.paste(255, (100, 50, 1100, 350))
logo.putalpha(alpha)
logo.save(source / 'logo.png')
originals = {path.name: path.read_bytes() for path in source.iterdir()}
output = root / 'output'
desktop.stage_startup_art(root / 'source', output)
expected = {'title-portrait.png': (480, 640),
'title-landscape.png': (640, 480), 'logo.png': (512, 171)}
for name, size in expected.items():
with self.subTest(image=name), Image.open(output / 'startup/shovey' / name) as preview:
self.assertEqual(preview.size, size)
self.assertEqual(preview.mode, 'RGBA' if name == 'logo.png' else 'RGB')
self.assertIsNone(preview.getcolors(256), 'Title previews must not use a 256-colour palette')
if name == 'logo.png':
self.assertEqual(preview.getpixel((0, 0))[3], 0)
self.assertEqual(preview.getpixel((256, 85))[3], 255)
self.assertEqual((source / name).read_bytes(), originals[name])
if __name__ == '__main__':
unittest.main()
+77
View File
@@ -0,0 +1,77 @@
"""Verify coloured startup previews, original covers and title transitions privately."""
import argparse
import json
import os
from pathlib import Path
import subprocess
import sys
import tempfile
from PIL import Image
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--binary', type=Path, required=True)
parser.add_argument('--driver-source', type=Path, required=True)
args = parser.parse_args()
assert int(os.environ['DISPLAY'].split(':')[-1].split('.')[0]) >= 400
assert os.environ['YUE_DESKTOP_RECOVERY'] == '0'
sys.path.insert(0, str(args.driver_source / 'tests'))
from ui_driver import UiDriver
root = Path(__file__).resolve().parents[1]
output = root / 'build/scratch/title-progressive/ui'
output.mkdir(parents=True, exist_ok=True)
binary = args.binary.resolve()
driver = UiDriver(output / 'driver')
with tempfile.TemporaryDirectory(prefix='profile-', dir=output) as temporary:
profile = Path(temporary)
records = profile / 'games/arcade.shovey-player/records'
records.mkdir(parents=True)
(records / 'level-updates').write_text('off')
log_path = output / 'game.log'
with log_path.open('w') as log:
child = subprocess.Popen([str(binary)], cwd=binary.parent,
env=os.environ | driver.environment() |
{'ARCADE_DATA': str(profile), 'ENTITY_DATA': str(profile / 'entity'),
'LANG': 'en_US.UTF-8', 'SDL_AUDIODRIVER': 'dummy'},
stdout=log, stderr=subprocess.STDOUT)
driver.attach(child, log_path)
try:
startup = driver.tree()
assert driver.last['frame'] <= 3, 'Preview must precede collection loading'
images = [node for node in startup if node['kind'] == 'image' and node['label'] == 'Shovey']
assert len(images) == 2, 'Startup must show the artwork and coloured logo together'
for node in images:
assert 'startup/shovey/' in node['detail']
with Image.open(node['detail']) as picture:
assert picture.mode in ('RGB', 'RGBA'), 'Startup art must retain full colour'
assert max(picture.size) <= 640, 'Startup must use a small preview'
(output / 'startup-tree.json').write_text(json.dumps(driver.last, indent=2) + '\n')
driver.wait(label='Play', role='button', timeout=60)
full = [node for node in driver.tree() if node['kind'] == 'image' and
'arcade/covers/shovey-' in node.get('detail', '')]
assert len(full) >= 2
assert any(max(Image.open(node['detail']).size) >= 1200 for node in full), \
'Ready cover must replace the preview with the original artwork'
windows = subprocess.check_output(['xdotool', 'search', '--onlyvisible', '--pid', str(child.pid)], text=True).split()
assert len(windows) == 1
window = windows[0]
assert subprocess.check_output(['xdotool', 'getwindowpid', window], text=True).strip() == str(child.pid)
subprocess.run(['xdotool', 'windowmove', window, '0', '0'], check=True)
subprocess.run(['import', '-window', window, str(output / 'classic-ready.png')], check=True)
driver.key('right')
subprocess.run(['import', '-window', window, str(output / 'logo-fading.png')], check=True)
driver.wait(label='Editor', role='text')
driver.wait(label='Open', role='button')
driver.wait_idle(frames=5)
subprocess.run(['import', '-window', window, str(output / 'editor-ready.png')], check=True)
driver.key('left')
driver.wait(label='Classic', role='text')
driver.wait(label='Play', role='button')
assert child.poll() is None
finally:
if child.poll() is None:
child.terminate()
child.wait(timeout=10)
print('Local title UI test: full-colour previews precede original covers; Classic/Editor transitions work')
+85
View File
@@ -0,0 +1,85 @@
// Open Arcade's browser edition in a private headless browser and require
// its library to draw without a failed frame. Usage: node tests/web_site_test.mjs SITE_DIR
import { spawn } from 'node:child_process';
import { createServer } from 'node:http';
import { access, mkdtemp, readFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { extname, join, normalize } from 'node:path';
import { setTimeout as delay } from 'node:timers/promises';
const site = process.argv[2];
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';
try {
const body = await readFile(join(site, path));
response.writeHead(200, { 'Content-Type': types[extname(path)] || 'application/octet-stream' });
response.end(body);
} catch { response.writeHead(404); response.end(); }
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
const profile = await mkdtemp(join(process.env.TMPDIR || tmpdir(), 'arcade-web-'));
const env = { ...process.env };
for (const key of ['DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS']) delete env[key];
const browser = spawn(process.env.CHROMIUM || 'chromium', ['--headless=new', '--no-sandbox', '--use-gl=swiftshader',
'--enable-unsafe-swiftshader', '--no-first-run', '--remote-debugging-port=0', `--user-data-dir=${profile}`, 'about:blank'],
{ env, detached: true, stdio: 'ignore' });
let socket, sequence = 0;
const pending = new Map(), console_lines = [];
const command = (method, params = {}) => new Promise((resolve, reject) => {
const id = ++sequence; pending.set(id, { resolve, reject }); socket.send(JSON.stringify({ id, method, params }));
});
let failure = '';
try {
const started = Date.now();
while (true) {
try { await access(join(profile, 'DevToolsActivePort')); break; } catch {}
if (Date.now() - started > 15000) throw new Error('the browser did not start');
await delay(50);
}
const port = (await readFile(join(profile, 'DevToolsActivePort'), 'utf8')).split('\n')[0];
const targets = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json();
socket = new WebSocket(targets.find(target => target.type === 'page').webSocketDebuggerUrl);
await new Promise((resolve, reject) => { socket.onopen = resolve; socket.onerror = reject; });
socket.onmessage = event => {
const message = JSON.parse(event.data);
if (message.method === 'Runtime.consoleAPICalled')
console_lines.push(message.params.args.map(arg => arg.value ?? arg.description ?? '').join(' '));
const request = pending.get(message.id);
if (!request) return;
pending.delete(message.id);
message.error ? request.reject(new Error(JSON.stringify(message.error))) : request.resolve(message.result);
};
await command('Runtime.enable'); await command('Page.enable');
await command('Emulation.setDeviceMetricsOverride', { width: 1280, height: 800, deviceScaleFactor: 1, mobile: false });
await command('Page.navigate', { url: `http://127.0.0.1:${server.address().port}/` });
let ready = false;
const deadline = Date.now() + 60000;
while (!ready && Date.now() < deadline) {
// The page may still be loading; it answers once its status element exists.
const state = await command('Runtime.evaluate', {
expression: 'JSON.stringify({ready: !!(window.Module && Module.profileReady), error: !!document.getElementById("loading")?.classList.contains("error")})',
returnByValue: true });
if (typeof state.result?.value !== 'string') { await delay(250); continue; }
const value = JSON.parse(state.result.value);
if (value.error) { failure = 'the page reported that Arcade could not start'; break; }
ready = value.ready;
if (!ready) await delay(250);
}
if (!ready && !failure) failure = 'the library never became ready';
// 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));
if (!failure && failed) failure = failed;
} finally {
try { process.kill(-browser.pid, 'SIGTERM'); } catch {}
server.close();
await rm(profile, { recursive: true, force: true }).catch(() => {});
}
if (failure) {
console.error(console_lines.slice(-20).join('\n'));
throw new Error(failure);
}
console.log('Arcade opened its library in the browser');
+72 -71
View File
@@ -1,14 +1,6 @@
{
"format": 1,
"packages": [
{
"commit": "ce01eafebd60cf0f729154fa6c735a37cd907d2d",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p2d318e48a4d2aa44"},
"id": "p00c3077d466cc4cc",
"name": "Apps",
"ref": "master",
"url": "https://github.com/waozixyz/apps.git"
},
{
"commit": "b31299434c785d0f2bd82f36b5bfd2fd36ba1216",
"dependencies": {},
@@ -26,63 +18,55 @@
"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": "p4b0a50b49959e674", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "p9079dde0fcc11248", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "p1d80baafaa5fa18a"},
"id": "p183b01bccc6424e7",
"name": "Inbe",
"ref": "master",
"url": "https://github.com/waozixyz/inbe.git"
},
{
"commit": "1cb9df183089a77c8a16448a556186f30b261a98",
"dependencies": {"kryon": "p2d318e48a4d2aa44"},
"dependencies": {"kryon": "p3127065409ca96f6"},
"id": "p1b13dda539ed2a39",
"name": "Kss",
"ref": "master",
"url": "https://github.com/kryonlabs/kss.git"
},
{
"commit": "bad2caaa84ef3eae61e40c99bf572d2b060d0ca2",
"dependencies": {"kryon": "p2d318e48a4d2aa44"},
"id": "p20eb23d3e6db3711",
"name": "Game2D",
"ref": "master",
"url": "https://github.com/kryonlabs/game2d.git"
},
{
"commit": "1f3e5e763dbee918ae8f8c44b84bb98f8d0fa2d6",
"commit": "19b299005fbe2d895f4ad525cfdae62a2220c3ea",
"dependencies": {},
"id": "p219661bf4be659ed",
"name": "sqlite",
"ref": "master",
"source": true,
"url": "https://github.com/sqlite/sqlite.git"
},
{
"commit": "be74b13fd9b991e63a96360e8f13d781cece964e",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p2d318e48a4d2aa44", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p2b0009b9bbaa09de",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "92ca1fd68ced43969df57632720060ee9666da16",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p2d318e48a4d2aa44",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "eb2b201a2da3bfc6fefd7ff2d8e476e3cb9e5bcb",
"dependencies": {},
"id": "p2f75403ea4cb61e4",
"id": "p1ca0e8d3c19dbe4c",
"name": "curl",
"ref": "master",
"source": true,
"url": "https://github.com/curl/curl.git"
},
{
"commit": "2f6f1f57d7de742ef7ebc01159c2315acf793d5b",
"dependencies": {"apps": "p00c3077d466cc4cc", "crypto": "pc23fbf455e97614d", "curl": "p2f75403ea4cb61e4", "daochi_client": "p9972fcdd2d5ba999", "game2d": "p20eb23d3e6db3711", "kryon": "p2d318e48a4d2aa44", "kss": "p1b13dda539ed2a39", "liboqs": "p4b0a50b49959e674", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "self": "pa4da0de6c3c44e61", "sqlite": "p219661bf4be659ed"},
"id": "p48228a6b7e2920d3",
"name": "Inbe",
"commit": "5d1ee888094efc63d1fb25a58af93478b103d441",
"dependencies": {},
"id": "p1d80baafaa5fa18a",
"name": "sqlite",
"ref": "master",
"url": "https://github.com/waozixyz/inbe.git"
"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": "e1f480f382d9443c4412133b55948374c77a5c21",
@@ -93,6 +77,14 @@
"source": true,
"url": "https://github.com/open-quantum-safe/liboqs.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": {},
@@ -119,6 +111,15 @@
"source": true,
"url": "https://github.com/LoupVaillant/Monocypher.git"
},
{
"commit": "8b81994303400255ddb0ee2da49044dbaef4397f",
"dependencies": {},
"id": "p9079dde0fcc11248",
"name": "practices",
"ref": "master",
"source": true,
"url": "https://github.com/waozixyz/practices.git"
},
{
"commit": "25d9f649c43a8de44a5fea602d2835e33e6ca999",
"dependencies": {"crypto": "pc23fbf455e97614d", "oqs": "p7098ac9cd92f7e5f"},
@@ -127,29 +128,21 @@
"ref": "master",
"url": "https://github.com/ziranlang/daochi-client.git"
},
{
"commit": "357a71d1ee2c7c9526c2af18793ea8628c505034",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p2d318e48a4d2aa44", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "pa4da0de6c3c44e61",
"name": "Self",
"ref": "master",
"url": "https://github.com/waozixyz/self.git"
},
{
"commit": "3f888653b6b97010163d824c4cc72476be3214f3",
"dependencies": {"kryon": "p2d318e48a4d2aa44"},
"dependencies": {"kryon": "p3127065409ca96f6"},
"id": "pab5377a2950368a2",
"name": "plot",
"ref": "master",
"url": "https://github.com/kryonlabs/plot.git"
},
{
"commit": "a6aebdbb5af7491b9303e70aed85b32c70a127a2",
"dependencies": {"apps": "p00c3077d466cc4cc", "kryon": "p2d318e48a4d2aa44", "mingcute": "pe1027b9d16704793"},
"id": "pb047b340fde29f6b",
"name": "Apfelwurm",
"ref": "master",
"url": "https://github.com/waozixyz/wurm.git"
"commit": "b16edce6913dc708d7b56c9b1759ab17cdd1b6e3",
"dependencies": {"apps": "p15331309f570593d", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
"id": "pb7670046fce2454f",
"name": "Shovey",
"ref": "b16edce6913dc708d7b56c9b1759ab17cdd1b6e3",
"url": "https://github.com/waozixyz/shovey.git"
},
{
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
@@ -168,20 +161,28 @@
"url": "https://github.com/kryonlabs/mingcute.git"
},
{
"commit": "2c05b39693a6d8a697f5b111f9d438092b4f186a",
"dependencies": {"apps": "p00c3077d466cc4cc", "entity": "p2b0009b9bbaa09de", "kryon": "p2d318e48a4d2aa44", "mingcute": "pe1027b9d16704793"},
"id": "ped09a2b79138be62",
"name": "Shovey",
"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"},
"id": "pf2f54c7603f6e861",
"name": "Game2D",
"ref": "master",
"url": "https://github.com/waozixyz/shovey.git"
"url": "https://github.com/kryonlabs/game2d.git"
}
],
"root": {
"dependencies": {"apps": "p00c3077d466cc4cc", "entity": "p2b0009b9bbaa09de", "inbe": "p48228a6b7e2920d3", "kryon": "p2d318e48a4d2aa44", "mingcute": "pe1027b9d16704793", "shovey": "ped09a2b79138be62", "wurm": "pb047b340fde29f6b"},
"dependencies": {"apps": "p15331309f570593d", "entity": "p52862c0351d05875", "inbe": "p183b01bccc6424e7", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793", "shovey": "pb7670046fce2454f", "wurm": "peafb3c123b12e97a"},
"name": "Arcade"
},
"toolchain": {
"commit": "21c6a681c9ba684bbe069004fd971748cc5c7dc0",
"commit": "5efa24f818485cf265bdd5c066a4e2150175ac0e",
"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 = "master"
ref = "b16edce6913dc708d7b56c9b1759ab17cdd1b6e3"
# 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 = "master"
ref = "3cead1f21720258c0acffa84c8625579d68c3a9e"