WP-145: Beta games appear in the TV library: Get and Update tiles
Status: ✅ Done (2026-12-05), every exit criterion met. Fork PR barefootbetters/scummvm#80 merged (1dfbfb7375), private PR barefootbetters/scooby-engine-private#109 merged (67c256a), docs #391. Drafted as WP-143 (#376); renumbered because #375 claimed WP-143 first.
Phase: 5 (polish & distribution).
Depends on:
- WP-085 ✅ and WP-096 ✅: the package store, its resume and the manifest, in test builds.
- WP-137 ✅: the play band.
- WP-138 ✅: series, publisher and year grouping.
- WP-139 ✅: the per-tester Worker and the beta manifest.
Unblocks: outside testers. Today a game reaches a tester only if they know the hidden key gesture and press LOAD MANIFEST.
Companion: Publish-BetaGame.ps1, the publishing half, merged in the private repo (barefootbetters/scooby-engine-private#102).
Placement: WP-144 (drafted the same day) puts TV-app work on a fork classics branch and in a private Classics repo. If its split lands before this WP starts, the fork work below targets classics instead of scooby-engine, and this WP moves to the Classics repo.
Companion EC: none (inline checklist under Exit criteria).
Pre-flight: required. The change touches shared gui/ code and backends/platform/android/.
Targets generation(s): any format-1 package; proven with the Gen 1 packages and BASS.
Estimated effort: two to three days.
Goal
Make publishing a game enough for it to reach the testers. When the test build starts, it reads the tester’s beta manifest in the background. Each game the manifest lists that isn’t installed shows in the library as a tile with its cover and a Get band. Choosing it installs the game, and the tile becomes a normal playable one. An installed game whose package has a newer version in the manifest shows Update.
Background
The fork map (2026-12-03) was taken at origin/scooby-engine b59ea35fd8. Since
WP-137’s merge c1f2825762, only engines/terraglyph/** has changed. That
matches the TV’s build 26041074 by file hash.
- The library is ScummVM’s C++ launcher grid.
LauncherGrid::updateListing(gui/launcher.cpp:1787-1842) makes oneGridItemInfoper ConfMan game domain. Every launcher action indexes_domains[item].GridItemWidget::drawWidget(gui/widgets/grid.cpp:72-235) draws the WP-137 band with a hard-coded_("Play")(:197-210).GridItemInfo(grid.h:51-78) has no notion of a tile kind. - The package store is Java, in debug builds only. It lives in
backends/platform/android/advanced/:PackageManifest,PackageStore,PackagesActivityand others.dists/android/build.gradle:162-176addsadvanced/todebug.releasegets the all-no-opadvanced-stub/.../TestFeatures.java, and the release checkstrings | grep -c TVPKG_MANIFEST_URLmust stay 0. - The manifest is fetched only from the hidden screen.
PackagesActivity.loadManifest()(:234-267) callsPackageStore.fetchManifest(:225-239). The URL, which carries the tester’s key, is theTVPKG_MANIFEST_URLpref intv_packages. - An install finishes through a restart.
PackageStore.fetchdownloads, resumes, verifies and extracts. The caller then writespending.json.applyPending(:838-913) runs before the ScummVM thread starts, and turns anaddinto--add --path=<dir> --recursive --no-exit. Progress is text only:Progress.onProgress(String)(:70-72), roughly every MB. - Java and C++ already call each other through JNI.
- C++ → Java: abstract methods in
ScummVM.java:97-151, implemented inScummVMActivity.MyScummVM, wrapped byJNI::(for exampleJNI::setCurrentGame,jni-android.cpp:568-580). - Java → C++: natives in
ScummVM.java:66-93. - The package code uses neither yet. It talks to C++ by editing
scummvm.iniwhile the thread is stopped and by restart arguments.
- C++ → Java: abstract methods in
- The manifest can’t place a missing game in the library yet. Format 1 has
no
engineidorgameid. Those are what a tile needs for its cover (icons/<engineid>-<gameid>.png) and for WP-138’s grouping. A package id (showdown-en-aug2001) also isn’t its ConfMan target (showdown-win); the only link is the target’s path underpackages/<id>/. Format 1 ignores unknown fields, so new optional ones are allowed (tv-package-manifest.md, “Unknown fields are ignored”).
Scope
In scope
- Two new optional manifest fields:
engineidandgameid.- Documented in
tv-package-manifest.md. - Carried by the runtime file lists (
tools/packages/*.json), soNew-GamePackage.ps1andPublish-BetaGame.ps1write them. - Added to BASS’s live entry by hand (
sky/sky).
- Documented in
- A launch-time fetch (Java,
advanced/only).- A new
TestFeatureshook, called fromScummVMActivity.onCreatenext tobeforeScummVMStart(:1242), starts a background fetch of the stored manifest URL. It never blocks the start. - On success it writes
packages/available.jsonatomically, with the existingwriteJson. That file is the manifest entries withengineid/gameid, each markedgetorupdateagainstinstalled.jsonusingcompareVersions, without URLs. - On a 404 (key revoked or expired) it deletes the file. On a network failure it keeps the last good copy.
- The release stub does nothing.
- A new
- Get tiles in the grid (C++).
GridItemInfogains a kind: installed, get or update.LauncherGrid::updateListingreadsavailable.jsonif it exists and appends agettile per entry, with_domainskept index-aligned. It also marks installed tilesupdateby matching each target’s path topackages/<id>/.- Without the file, nothing changes: every non-Android build, and release.
drawWidgetdraws the band as Get or Update instead of Play.- Get tiles group with WP-138’s metadata through their
engineid/gameid.
- Choosing a Get tile installs (C++ → Java).
- A new JNI call,
installPackage(id), follows thesetCurrentGamerecipe and opens the package store on a one-package install screen. That screen shows the title, a progress bar (“MB of MB”, then “Extracting”) and Cancel. - It reuses
fetch→pending add→ restart, which brings the library back with the game playable. Progressgains numeric progress (bytes done and total) for the bar; the text form stays.- Selecting the tile or pressing OK on it goes straight to install. A get tile has no Saves or Edit, so it gets no tray.
- A new JNI call,
- Update on installed tiles. The tray of an installed game whose
package has an update gets an Update button, which calls the same JNI
with the package id and keeps the saves (the existing
updatesemantics). - The library notices a fetch that finishes after it’s shown. The
launcher dialog checks
available.json’s modified time on its tickle and re-lists when the file changes. That’s one stat a second, and it needs no JNI. - Tiles only for playable entries. An entry without
engineid/gameidgets no tile. That keeps theneg-*test entries and anything malformed in the hidden screen only.
Out of scope
- Phase 2 of the hosting plan: device activation codes, device tokens and per-tester entitlements. The key stays in the stored URL.
- Getting the manifest URL onto a device. Testers still enter it once in advanced mode, or it’s written over adb. Activation is Phase 2.
- Deltas, background or scheduled updates, notifications.
- Release builds. All of this stays in the debug source set, behind the stub.
- New covers: Get tiles use the existing icon pack.
Decisions
- A new tile kind, not fake ConfMan domains. A fake domain would
persist in
scummvm.ini, collide with--add’s target naming, and let Edit, Saves or Start act on a game that isn’t there. - The install runs on a focused Java screen, not on the tile. The store, its resume and its restart are Java. Drawing progress inside the C++ grid would mean pushing download state across JNI for little gain on a TV. Jeff’s “tile progress” becomes a full-screen install view opened from the tile. Open for Jeff: keep this, or ask for in-tile progress.
- Java hands off to C++ through a file plus a tickle check, not a new
Java → C++ call. This follows the package store’s existing pattern (files
and restart arguments). It adds one C++ → Java call (
installPackage) because a tile choice has to reach the store. engineidandgameidcome from the file lists. The publisher knows the game when it builds the package, and one list per edition already exists. BASS, not built from a disc, gets them by hand.- A revoked key hides the Get tiles. It never removes installed games.
Execution
- Pre-flight. Write
pre-flight-WP-145-<date>.md: a fork worktree fromorigin/scooby-engineviatools/New-ForkWorktree.ps1(not the staleC:\dev\scummvmcheckout), the sharedgui/files touched, and the release-check baseline. - Manifest fields. Update
tv-package-manifest.md, the two Gen 1 lists,New-GamePackage.ps1, thenPublish-BetaGame.ps1(private), and BASS’s live entry. TodayPublish-BetaGame.ps1compares only the zip’s SHA-256, so on Phantom it would report “already published” and leave the new fields out. Give it a metadata-only path that updates the entry, same version and same zip, and republishes the manifest. Re-running it on Showdown and Phantom then adds their fields. - Java: the fetch hook,
available.json, theinstallPackagescreen, numeric progress, and the stub counterparts. - C++: the tile kind,
updateListing, the band text, the tray’s Update, and the tickle check. - JNI:
installPackageacrossScummVM.java,MyScummVM,_MID_andFIND_METHOD, theJNI::wrapper andjni-android.h. - Build the debug APK in WSL, then run the exit criteria on the TCL.
Exit criteria
On the TCL 65Q77K, test build with the beta manifest URL stored:
- Release build:
strings | grep -c TVPKG_MANIFEST_URLis 0, no fetch happens, and the library is unchanged. - A Get tile appears. With Phantom removed (keep saves), starting the app shows a Phantom tile with its cover, its series group and a Get band, without opening advanced mode. It appears within a few seconds, even if the fetch finishes after the library is drawn.
- The tile installs. Choosing it opens the install screen with a moving progress bar. When it finishes, the library returns with Phantom playable, and its Guest Book save is still there.
- Cancel and resume. Cancelling mid-download returns to the library with
the Get tile. Choosing it again resumes from the kept part (store log:
Resuming). - Update. A newer BASS version in the manifest (published for the test) shows Update on BASS’s tile. The tray’s Update installs it, the saves are kept, and the band goes back to Play. The installed 1.2.1 against the manifest’s older 1.2 shows no Update today.
- Revoked key. Revoking the tester and restarting removes the Get tiles. Installed games still play.
- Offline. With the network off, the library starts normally with the last known Get tiles, and choosing one fails with a plain message.
- No key anywhere. Logcat, the shared diagnostic log and
available.jsonhold no key (WP-139 criterion 7). - Other builds unchanged: the Windows build and a desktop run without
available.json. - The
neg-wrong-hashentry gets no tile.
Deliverables
- Fork PR on
scooby-engine: Java (advanced/plus the stub), JNI, andgui/widgets/grid.{h,cpp}andgui/launcher.cpp. - Engine repo:
tv-package-manifest.md(the new fields), the Gen 1 file lists,New-GamePackage.ps1, this WP’s §Result, andWORK_INDEX.md. - Private:
Publish-BetaGame.ps1writesengineidandgameid; BASS’s manifest entry. - Pre-flight doc.
Result
Pre-flighted on 2026-12-04 and run on the TCL on 2026-12-04 and 2026-12-05
(pre-flight-WP-145-2026-12-04).
D2 kept: Jeff’s answer, “Keep D2 (Recommended)”; the install runs on a
full-screen Java view, with no progress inside the tile. WP-144’s split
hadn’t landed, so the fork work targets scooby-engine (Jeff, 2026-12-05:
“Finish before split”).
- Fork: barefootbetters/scummvm#80
on
scooby-engine, three commits, one per layer: the Java store side (AvailableList,InstallActivity, the store’s cancellable progress), the JNIinstallPackage(id), and the grid and launcher. Merged on 2026-12-05 as1dfbfb7375. - Private: barefootbetters/scooby-engine-private#109:
engineidandgameidinbeta-data/manifest/beta.json, byte-identical to the live copy. Merged on 2026-12-05 as67c256a. - This repo: the two fields in
tv-package-manifest.md, the Gen 1 file lists andNew-GamePackage.ps1, and this §Result. - The TV runs versionCode 26041078 (
2026.4.1-wp145.8, debug), built in WSL from the fork PR’s head and installed withadb install -rover 26041074 (WP-138). All three games are installed, BASS at the test 1.2.2; every save hashes as before. - The live host: the beta manifest was republished with the two fields. A test BASS 1.2.2 was published for criterion 5, then the manifest went back to 1.2 (the same bytes as before); the 1.2.2 zip stays in R2. The tester was revoked for criterion 6 and restored to active in the same step, checked through the Worker afterwards.
Engineering calls
The ten calls are in the pre-flight’s §Engineering calls. Two more came out of the TV run:
- A band over tall covers. WP-137 draws the play band only when the cover leaves room under it, and the TerraGlyph covers fill their slot, so a Get tile looked installed. A Get or Update tile now draws its band over the cover’s foot; installed tiles are as before.
- Back on Android 14. The app opts in to predictive back, so Back never
reaches
onKeyDownand the system closed the install screen while the download ran on. The screen registers anOnBackInvokedCallbackthat acts as Cancel, and leaving it any other way before the download is verified cancels too. - The install screen’s title comes from
available.jsonbefore its own manifest load, so offline it shows the game’s name, not its package id.
Checked
Evidence: capture is a TV or window screenshot, log is logcat, the store’s diagnostic log or a command’s output. The raw files stay outside the repo.
- Release build (log).
strings | grep -c TVPKG_MANIFEST_URLis 0 in the release.soandclasses.dex, before the change and after; the release dex is byte-identical across every build of the run. - A Get tile appears (capture + log). With Phantom removed (saves kept), the library shows its cover under Scooby-Doo with a Get band, without advanced mode. Written under a library already drawn, the tile appears within 2 s. Menu on a Get tile does nothing; a long press opens the install screen.
- The tile installs (capture + log). The install screen shows a moving
bar in MB; the library returns with Phantom playable;
phantomknight-win.001hashes as before. Run again on the final build. - Cancel and resume (capture + log). Back mid-download returns to the
library with the Get tile (
CANCELLED, 116,920,549 bytes kept); choosing it again logsResumingand appends with HTTP 206. - Update (capture + log). The test 1.2.2 shows Update on BASS;
the tray’s Update installs it, the
SKY-VM.*saves hash as before, and the band goes back to Play. Before the test, 1.2.1 against the manifest’s 1.2 showed no Update. - Revoked key (capture + log). Revoked, then restarted: the 404
deletes
available.json, the Get tile goes, and Showdown starts. - Offline (capture + log). With the TV’s DNS pointed at a name that doesn’t resolve, the library keeps the last Get tile; choosing it says “Can’t reach the game server…” with a button back to the library. DNS restored.
- No key anywhere (log). 0 matches for the key, its prefix (with and
without its dash),
key=,/m/and/p/in logcat, the store log andavailable.json; the same grep finds the key in a positive control. - Other builds unchanged (capture + log). The Windows UCRT64 build
(
--disable-all-engines --enable-engine=terraglyph) has no warnings ingui/; its grid looks as before and its log never mentions packages. neg-wrong-hash(log). No tile; each fetch logs “1 other entry (no engineid/gameid) left out”.
Not checked: Phantom wasn’t launched after the reinstall (Showdown
was, in criterion 6); the logcat for 06:26–06:29 was cleared before it was
saved, and the store log covers that fetch. Removing Phantom cleared its
title_movies_seen, so its intro movies play again once; that is the
store’s existing remove, not this WP.
Notes
- Leak check: the manifest URL holds the tester key.
available.jsoncarries no URLs, and the fetch logs only the host, asPackageStore.fetchManifestdoes today. - Metered networks:
JNI::isConnectionLimitedexists. Skipping the launch fetch on a limited connection is a cheap option to weigh in pre-flight.