enricobuehler 176fa8f143
CI / build (push) Successful in 1m16s
CI / publish (push) Successful in 24s
chore: 1.2.0 — seats keep their own saves
A game on another seat now syncs that person's saves under their own RomM account; the plugin moves to plugin-kit 0.13.1 on effect 4.0.1. Host 0.44 or newer still runs it; the seat half needs the host release that relays a seat's holds.
2026-10-30 14:38:32 +00:00
2026-08-09 17:41:53 +02:00

@punktfunk/plugin-rom-manager

A Punktfunk plugin that lists your ROM folders and RomM servers, launches each game in the host's emulators, and reconciles everything into the host game library — so your retro games appear automatically in the Punktfunk web console, native clients, and Moonlight /applist, each launchable. Covers and details come from the host's Art & Metadata sources (below). It ships a web UI that lives inside the Punktfunk console (no second password, no second port).

Think of it as Steam ROM Manager for Punktfunk.


Requirements

  • A Punktfunk host 0.44 or newer (Linux or Windows) with the scripting runner (punktfunk-scripting) enabled: it serves the emulator registry and the emulator launch kind. An older host keeps 0.13.
  • Bun (the runner is Bun).
  • @punktfunk/host ≥ 0.4.1 and @punktfunk/plugin-kit ≥ 0.13.1, shared with the runner.

Install

The plugin is scoped under @punktfunk, so one bunfig line points that scope at the Punktfunk registry while everything else (like effect) resolves from npm — no bundling, and @punktfunk/host + effect are shared across all your plugins:

mkdir -p "$(punktfunk config-dir)/plugins" && cd "$(punktfunk config-dir)/plugins"
cat > bunfig.toml <<'EOF'
[install.scopes]
"@punktfunk" = "https://git.unom.io/api/packages/unom/npm/"
EOF
bun add @punktfunk/plugin-rom-manager

# then enable the runner (opt-in):
systemctl --user enable --now punktfunk-scripting          # Linux
Enable-ScheduledTask PunktfunkScripting                    # Windows

Open the Punktfunk console — a ROM Manager entry appears in the nav. That's it.

Headless / host-only boxes without the console can just drop a config.json (below) and use the CLI — the sync engine is fully functional from the file alone.

Quick start (config file)

The plugin owns <config_dir>/plugin-state/rom-manager/config.json. A minimal example:

{
  "roots": [
    { "dir": "/mnt/roms" },
    { "dir": "/mnt/more/ps1-games", "platform": "psx", "excludes": ["*.sav"] }
  ]
}

A folder of system folders (snes, psx, ps2, …) needs nothing else: each subfolder is read by any name the host's registry knows for a system. A folder holding one system's games names it. bios/<system>/ beside the system folders is where firmware lives. Then, from the plugin dir:

bunx punktfunk-plugin-rom-manager scan       # what the scanner finds
bunx punktfunk-plugin-rom-manager detect     # the emulators the host has
bunx punktfunk-plugin-rom-manager preview    # the desired library (no host write)
bunx punktfunk-plugin-rom-manager sync       # reconcile into the live library

RomM servers

A RomM library is a source beside the local folders: every game on the server whose system an emulator plays is listed, with RomM's name, details and cover, and marked "Not installed" with its size until its files are in the source's download folder. Start it from a client and its cover shows the download, with speed and time left, until the game starts; or install, pause, cancel and remove it from the game's page in the console. A download that stops resumes where it left off, and a complete game plays without the server.

Connect a server under Sources: its address, then a code you approve in RomM. No token to copy; a pasted client API token still works for a server without device sign-in. Then pick the download folder and allow ROM Manager to write to it when the host asks.

When the host can reach the server's library itself, on a local drive or a mounted share, name that folder (the one holding RomM's platform folders, …/roms) as the server's files on this host. Every game RomM lists there then plays in place. A game this host already has under one of its own folders is listed once and plays from there.

"sources": [
  { "kind": "romm", "url": "https://romm.example.lan", "token": "…",
    "libraryFolder": "/mnt/games/roms", "downloadFolder": "/mnt/games/romm" }
]

Updates and DLC download with their game and go into the emulator the way it takes them: Ryujinx registers them, Cemu takes the title folder, RPCS3 installs the package. An emulator that can't take them says so on the game's page; the files are still there.

Firmware comes from the server (RomM → platform → Firmware) or a library folder's bios/<system>/. Before every launch the host answers the emulator's first-run questions and places the firmware; Systems shows a file that isn't a known good dump.

Saves follow the game ("saves": true per server, the default) for every emulator whose saves the host knows. ROM Manager asks the operator once to move emulator saves. Before a launch the newer copy on the server comes down; when the game exits, what changed goes up, paired with RomM's own sync by slot. A save changed here and elsewhere waits on the game's page for you to pick one; the other copy is kept. Shared memory cards sync through RomM's memory card store, save states go up and come down only where there are none. Play time and "last played" go to RomM.

Saves are per person. A game played on a seat of its own syncs that seat's saves, never the owner's, as that person's own RomM account. Each person signs in under Sources → Accounts with a code, like the server; they appear there after their first game on their seat. Until they sign in, their saves stay on their seat. The owner's account is the server's own sign-in.

Titles are keyed romm/<server>/<id>, so a per-game choice applies to them like to any other.

Box art and details

Covers and details come from the host's Art & Metadata sources, not from this plugin. Install them from the console's plugin store:

Source Key? What it adds
Libretro no Box art from libretro-thumbnails; developer, publisher, genres, year and players from libretro-database
SteamGridDB yes Covers, heroes and logos, for ROMs and every other game in the library

Each entry carries the ids they match on: ids.libretro (<libretro system>/<No-Intro name>) for every platform libretro knows, and ids.sgdb for a SteamGridDB game you picked here before 0.7.0. Pick a game's cover on its page in the console: Media → Choose….

Systems & emulators

What a system is called, which files are its games and which emulators play it come from the host's registry (hermir's catalog), not from this plugin. A system's emulator is the best copy the host has, in hermir's order, unless you pick another under Systems or for one game. A system whose emulator isn't here shows Ask to install; you allow it in the console under Library → Sources. A portable copy no rule finds is added on the console's Emulators card.

An emulator the registry doesn't know runs from Settings → Your own emulators: the program and {rom}.

Disc games are folded so a set is one entry: .m3u playlists absorb their discs, .cue/.gdi sheets hide their tracks, .chd stands alone.

The UI

servePluginUi serves the SPA on a loopback ephemeral port behind a per-boot secret and registers it with the host; the console reverse-proxies it and gates it with your existing console sign-in.

Page Shows
Home What needs you, one sentence and one action each; a card per source; what happened
Games Every title, searchable; a game that can't play yet with its reason. A game's sheet holds its files, saves and emulator
Systems Each system with games: its emulator and what makes it ready
Sources Folders and RomM servers, one change at a time
Settings Folder watching, your own emulators

Security

  • The plugin names no program. A game launches as { kind: "emulator", value: <emulator id> } with its file; the host checks the file is under a folder ROM Manager may reach and builds the command through hermir. Only your own emulators use the manifest's custom template.
  • Saves are the operator's to release. The host moves them only after one access request is allowed.
  • The RomM token stays in the plugin's state folder and never reaches the page.
  • Seats. Each person's token stays there too, under the server's accounts by profile id, and never reaches the page. A seat's save files cross in their own subfolder of saves/out and saves/in.
  • config.json lives in the hardened <config_dir>; the plugin refuses a group/world-writable one.
  • No outbound requests but to your RomM servers. No telemetry.

Development — this repo is the plugin blueprint

rom-manager is the reference consumer of @punktfunk/plugin-kit — copy this repo's structure to start a new plugin. Three bun workspaces:

Workspace What it is
contract/ The single source of truth: Effect Schemas for the config (raw↔resolved in one schema), domain DTOs, the HttpApi contract, API errors. Never published — bundled into the plugin, imported source-level by the UI. No hand-mirrored types anywhere.
plugin/ The published package. src/domain is the pure, injectable, unit-tested core; src/services wires them into the kit (ConfigService, CacheStore, SyncEngine, ProviderClient, HttpApi handlers + SSE); src/index.ts is the definePluginKit entry (async at the runner boundary, Effect inside).
ui/ The SPA: React 19 + @unom/ui + @unom/app-ui + the kit's /react helpers + /theme.css, with an Effect-native data layer (AtomHttpApi atoms derived from the contract). Builds into plugin/dist/ui.
bun install                   # one workspace install (Gitea registry for @punktfunk/@unom scopes)
bun test                      # domain + service tests (plugin/)
bun run typecheck             # contract → plugin → ui
bun run build                 # backend bundle + SPA → plugin/dist

cd ui && bun run dev          # UI with ZERO host running (in-browser mock layer + scenarios)
bun run storybook             # the UI workbench on the same fixtures (port 6013)
bun run screenshots           # build Storybook, then shoot every story in both themes
cd plugin && bun run dev      # auth-free dev API on :5885 …
cd ui && bun run dev:live     # … and the UI proxied against it

The UI workbench

bun run storybook is where the UI is designed and reviewed. Every story renders the real component or page against the same in-browser mock transport the dev loop uses — no host, no network, no fixtures duplicated per story.

Foundations/ Tokens and primitives on one page, read live off the DOM. The palette is the console's (@punktfunk/plugin-kit/theme.css), not @unom/ui's own — check a colour here before using it.
Components/ Gate, the one loading and error convention.
Pages/ Home, Games, a game's sheet, Systems, Sources and Settings, one story per fixture scenario.
Shell/App The whole plugin inside PluginShell, as the console embeds it.

Two toolbar controls change what every story shows without editing it: Theme (dark/light — the console pins dark, but the light half of the palette is real and nothing else exercises it) and Scenario (healthy / firstRun / serverAway / conflict / firmware / downloading, overriding the story's own default). The Viewport control carries the widths that actually exist in the field — the plugin is an iframe inside the console, so its viewport is the console's content column, never the window.

bun run screenshots writes ui/screenshots/<theme>/<story-id>.png for every story. Shoot it before a UI change and after: the diff is the review. Both the stories and the shots are fully offline — fixture cover art is inline SVG precisely so a missing network cannot masquerade as a visual regression. CI builds Storybook on every push, so a story that stops rendering fails there.

Requires @punktfunk/host ≥ 0.4.1 and @punktfunk/plugin-kit ≥ 0.13.1 at runtime (shared with the runner, not bundled). @unom/* + @effect/atom-react are build-time only — the SPA ships as static assets, so the published plugin carries no UI runtime dependencies.

Use of AI

This project uses AI for writing code.

License

MIT OR Apache-2.0.

S
Description
A Punktfunk plugin for managing ROMs & Emulators
Readme
1.1 MiB
0 Stars 18 Watchers 0 Forks
Languages
TypeScript 98.5%
JavaScript 1.2%
CSS 0.2%