Files
ArenaPublic/README.md
T

89 lines
4.3 KiB
Markdown

# ArenaPublic
The open core of Arena Domi, the Domi game library: pure Rust parsers for game launcher files (Steam
`libraryfolders.vdf` and `appmanifest_<id>.acf`, Epic `.item`, GOG entries), the library model, and later the
frametime statistics and replay-ring logic. No I/O: inputs are bytes or values, outputs are data. Builds for
Windows, Android and WebAssembly.
## Licence
ArenaPublic is licensed under the **Common Public Attribution License 1.0** (SPDX `CPAL-1.0`); see `LICENSE`.
Anyone who redistributes ArenaPublic, or a Larger Work built on it, must show the Exhibit B credit wherever
CPAL §14 asks for it (display in Larger Works is required):
| Field | Value |
| :-- | :-- |
| Attribution Copyright Notice | Copyright (c) 2026 Marek Novák |
| Attribution Phrase | Built on Domi |
| Attribution URL | https://aula.marek-novak.cz |
| Graphic Image | none |
Versions before this change (up to and including tag `core-v0.1.0`) stay available under MPL-2.0 to those who
received them; from this commit on, the code is under CPAL-1.0.
## Crates
| Crate | Lib | What it holds |
| :-- | :-- | :-- |
| `crates/arena-core` | `arena_core` | launcher parsers, `WinPath`, `GameId`, `Launch`, the `Game` / `Library` model, `merge` |
## `arena-core` in one screen
Pure: no `std::fs`, `std::process`, network, environment, registry or clock. The window app reads the files and
registry values (capped) and hands the bytes or values in. Every parser treats its input as hostile: caps on size,
depth, lengths and counts, typed errors, no panics, `#![forbid(unsafe_code)]`.
```rust
use arena_core::{merge, steam, epic, gog, manual, domi, DomiLaunch, WinPath, Launch};
// Steam: the library folders, then one manifest per installed app.
let libraries: Vec<WinPath> = steam::library_folders(&vdf_bytes)?;
let game = steam::app_manifest(&acf_bytes, &libraries[0])?; // Err(NotAGame) for redistributables
let id = steam::app_id_from_manifest_name("appmanifest_10.acf"); // Some(10): filter a folder listing
// Epic: one `.item` JSON manifest per app.
let game = epic::item(&item_bytes)?; // Err(NotAGame) for add-ons
// GOG: registry values the app read.
let game = gog::game(&gog::GogEntry { game_id, name, path, exe, working_dir, launch_params })?;
// A game the user picked, and a Domi game from the Atrium registry.
let game = manual::game(r"D:\Games\Old\old.exe", None)?;
let game = domi::game("lapilli", "Lapilli", DomiLaunch::Link { app: "lapilli" })?;
let game = domi::game("rosea", "Rosea", DomiLaunch::Web { url, allowed_hosts: &["rosea.example.org"] })?;
// One library: the same id once, the same install folder kept for the best source
// (Steam > Epic > GOG > Domi > Manual), ordered by title.
let library = merge(vec![steam_games, epic_games, gog_games, domi_games, manual_games]);
// Launching: a URI for the protocol variants, built only from validated fields.
match &game.launch {
Launch::Exe { exe, working_dir, args } => { /* Command::new(exe).current_dir(working_dir).args(args) */ }
Launch::Url(_) => { let uri = game.launch.uri_checked(&allowed_hosts); }
other => { let uri = other.uri(); } // steam://, com.epicgames.launcher://, domi-<app>://
}
```
| Type | Rule |
| :-- | :-- |
| `GameId` | `<source>:<native>`, `[a-z0-9:._-]`, at most 96 bytes, checked per source; `Display` + strict `FromStr` |
| `WinPath` | absolute with a drive letter; no UNC, `\\?\`, `..`, NUL, device names; at most 260 UTF-16 units |
| `Launch` | `SteamRunGameId(u32)`, `Epic { app_name }`, `Exe { exe, working_dir, args }`, `DomiLink { app }`, `Url` |
| `Game` | `{ id, source, title, install_dir, launch, cover }`; serde round trip validates every field |
| `ParseError` | typed, `Display`, never carries input text |
`Game`, `Library`, `GameId`, `WinPath` and `Launch` serialise with serde, and deserialising runs the same checks
as the parsers, so a tampered `library.json` cannot smuggle in a bad path or launch string.
Docs: [`docs/FORMATS.md`](docs/FORMATS.md) (what each parser accepts and refuses, every cap) and
[`docs/PORTABILITY.md`](docs/PORTABILITY.md) (the target checks).
## Commands
```
cargo test # unit, hostile, property, launch and dedupe tests
cargo clippy --all-targets -- -D warnings
cargo fmt --check
```