commit 5cac4e361792ffffbbfa7436b551e2a065a9bb46 Author: Zsolt Tasnadi Date: Sat Aug 15 21:26:42 2026 +0200 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..f25ed4e --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# ttg-batocera-store — the Teletype Games store for Batocera + +Puts the catalog into a Batocera box's ROM folders, +with EmulationStation metadata and box art. Triggered from the **Ports** menu on +the device, or from the CLI over SSH. + +This repository is only the store definition — `config.json` plus a wrapper +installer. All the logic lives in the shared engine, +[`warp-engine-batocera-store`](https://git.teletypegames.org/tools/warp-engine-batocera-store), +which works with any WarpEngine-based site; this is just the Teletype Games +configuration of it. + +## Install + +Straight onto the device: + +```sh +curl -fsSL https://git.teletypegames.org/tools/ttg-batocera-store/raw/branch/master/install.sh | bash +``` + +Or from a checkout of this repo: + +```sh +scp -r ttg-batocera-store root@batocera:/tmp/ +ssh root@batocera /tmp/ttg-batocera-store/install.sh +``` + +The installer fetches the engine, drops it and this config in +`/userdata/system/batocera-store/ttg/`, writes the `ttg-store` launcher and the +*Teletype Games Store* Ports entry, and runs the first sync. Restart +EmulationStation (`batocera-es-swissknife --restart`) to see the games. + +## Use + +**On the device.** *Ports ▸ Teletype Games Store*. It downloads anything new, +then restarts EmulationStation. Ports scripts get no console in Batocera, so the +output goes to `/userdata/system/batocera-store/ttg/store.log`. + +**Over SSH.** + +```sh +S=/userdata/system/batocera-store/ttg-store + +$S list # compatible catalog entries; * installed, ^ update available +$S sync # download everything new, refresh gamelists +$S sync blessingofra # just one title (never prunes) +$S -n sync # dry run +$S remove c64demo # uninstall +$S config # effective configuration +``` + +Global flags go before the subcommand: `$S --roms-root /tmp/roms sync`. + +## What this store installs + +| Catalog platform | Asset kind | Batocera system | Extension | +| --- | --- | --- | --- | +| `c64` | `cartridge` | `c64` (VICE) | `.prg` | +| `tic80` | `cartridge` | `tic80` | `.tic` | + +Statuses `released` and `archived`, whole catalog, no owner filter. Everything +lands under the `teletypegames/` subfolder of each system, so a prune can never +reach ROMs you put there yourself. To change any of it, edit +`/userdata/system/batocera-store/ttg/config.json` on the box — the full key +reference is in the engine's README. + +## Where things land + +``` +/userdata/system/batocera-store/ +├── ttg-store launcher +└── ttg/ + ├── store.py, config.json + └── state.json, catalog.json, store.log + +/userdata/roms/c64/teletypegames/ blessingofra-2.0.0.prg, rabbit-1.0.0.prg, … +/userdata/roms/c64/teletypegames/images/ blessingofra.png, … +/userdata/roms/c64/gamelist.xml our entries merged in +/userdata/roms/ports/Teletype Games Store.sh +``` + +## Upgrading from the pre-split `batocera-store` + +The old repo installed everything into `/userdata/system/ttg-store`. Re-running +the install command above migrates it: `state.json` is carried over, the old +directory is renamed to `ttg-store.pre-split`, and the Ports entry is replaced +in place. The ROMs themselves never move, so nothing is re-downloaded. Delete +`/userdata/system/ttg-store.pre-split` once the new install looks right. diff --git a/config.json b/config.json new file mode 100644 index 0000000..12001fa --- /dev/null +++ b/config.json @@ -0,0 +1,39 @@ +{ + "store": { + "id": "ttg", + "name": "Teletype Games", + "base_url": "https://teletypegames.org", + "api": { + "catalog": "/api/software", + "download": "/api/download" + } + }, + + "paths": { + "roms_root": "/userdata/roms", + "subfolder": "teletypegames" + }, + + "emulationstation": { + "folder_name": "Teletype Games", + "restart": true + }, + + "catalog": { + "statuses": ["released", "archived"], + "owner_id": null, + "only": [], + "exclude": [] + }, + + "platforms": { + "c64": { "system": "c64", "kind": "cartridge", "ext": ".prg", "enabled": true }, + "tic80": { "system": "tic80", "kind": "cartridge", "ext": ".tic", "enabled": true } + }, + + "behavior": { + "prune": true, + "timeout": 30, + "insecure": false + } +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..834eb5e --- /dev/null +++ b/install.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Install the Teletype Games store on a Batocera box. +# +# curl -fsSL https://git.teletypegames.org/tools/ttg-batocera-store/raw/branch/master/install.sh | bash +# +# All the work is done by the shared engine; this script only says which store +# to install. See https://git.teletypegames.org/tools/warp-engine-batocera-store +# +set -euo pipefail + +FORGE="${FORGE:-https://git.teletypegames.org}" +ENGINE_RAW_BASE="${ENGINE_RAW_BASE:-$FORGE/tools/warp-engine-batocera-store/raw/branch/master}" +# Only set when run as a file; piped from curl "$0" is `bash` and everything +# has to come from the forge — never from whatever the cwd happens to hold. +SRC_DIR="" +if [ -f "$0" ]; then + SRC_DIR="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)" +fi + +# Prefer the config next to this script when run from a checkout. +if [ -z "${STORE_CONFIG:-}" ] && [ -n "$SRC_DIR" ] && [ -f "$SRC_DIR/config.json" ]; then + STORE_CONFIG="$SRC_DIR/config.json" +else + STORE_CONFIG="${STORE_CONFIG:-$FORGE/tools/ttg-batocera-store/raw/branch/master/config.json}" +fi +export STORE_CONFIG ENGINE_RAW_BASE + +# Keep the Ports entry the box already has, so an upgrade replaces it in place. +export BATOCERA_PORT_NAME="${BATOCERA_PORT_NAME:-Teletype Games Store}" + +# --- migrate the pre-split ttg-store layout ------------------------------- +# Up to engine 1.x everything lived in /userdata/system/ttg-store. The ROMs +# themselves do not move (the subfolder is still `teletypegames`), so carrying +# state.json across is enough to avoid a full re-download. +LEGACY_HOME="${LEGACY_STORE_HOME:-/userdata/system/ttg-store}" +NEW_HOME="${BATOCERA_STORE_ROOT:-/userdata/system/batocera-store}/ttg" + +if [ -d "$LEGACY_HOME" ] && [ ! -f "$NEW_HOME/state.json" ]; then + echo "[install] migrating $LEGACY_HOME -> $NEW_HOME" + mkdir -p "$NEW_HOME" + if [ -f "$LEGACY_HOME/state.json" ]; then + cp "$LEGACY_HOME/state.json" "$NEW_HOME/state.json" + fi + if [ -f "$LEGACY_HOME/ttg-store.log" ]; then + cp "$LEGACY_HOME/ttg-store.log" "$NEW_HOME/store.log" + fi + rm -rf "$LEGACY_HOME.pre-split" + mv "$LEGACY_HOME" "$LEGACY_HOME.pre-split" + echo "[install] old install kept at $LEGACY_HOME.pre-split — delete it once things look right" +fi + +curl -fsSL "$ENGINE_RAW_BASE/install.sh" | bash