[core] WIP: frames, detect, hotkey modules with tests; caps, docs, version 0.2.0 (fmt/clippy/wasm/android not yet run)

This commit is contained in:
2026-11-25 14:32:16 +01:00
parent 871d69de1c
commit 43701bbadc
13 changed files with 1394 additions and 7 deletions
+24 -5
View File
@@ -1,9 +1,9 @@
# 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.
`libraryfolders.vdf` and `appmanifest_<id>.acf`, Epic `.item`, GOG entries), the library model, and the
overlay's pure logic (frametime statistics, game detection, the shortcut); later the replay-ring logic. No I/O:
inputs are bytes or values, outputs are data. Builds for Windows, Android and WebAssembly.
## Licence
@@ -26,7 +26,7 @@ received them; from this commit on, the code is under CPAL-1.0.
| Crate | Lib | What it holds |
| :-- | :-- | :-- |
| `crates/arena-core` | `arena_core` | launcher parsers, `WinPath`, `GameId`, `Launch`, the `Game` / `Library` model, `merge` |
| `crates/arena-core` | `arena_core` | launcher parsers, `WinPath`, `GameId`, `Launch`, the `Game` / `Library` model, `merge`; for the overlay `frames`, `detect`, `hotkey` |
## `arena-core` in one screen
@@ -73,8 +73,27 @@ match &game.launch {
| `Game` | `{ id, source, title, install_dir, launch, cover }`; serde round trip validates every field |
| `ParseError` | typed, `Display`, never carries input text |
For the overlay agent (0.2.0):
```rust
use arena_core::{frames, detect::{self, Detection, How, Marks}, hotkey::{self, Hotkey}};
// Frametimes in ms → avg FPS (frames / time), 1 % and 0.1 % lows (nearest-rank percentile, capped at the
// average), stutters (>= 2.5 x the median of the 60 frames before and >= 25 ms). None for empty or bad input.
let st: Option<frames::FrameStats> = frames::stats(&frametimes_ms);
// Launched by Arena > inside an install_dir (deepest wins) > marked by the user. Outside every install_dir and
// not marked: never a game. Whole path components, ignoring case.
let d: Option<Detection> = detect::detect(&exe, launched_by_arena, &library.games, &marks);
// "Ctrl+Shift+G" ⇄ Hotkey; refuses bare letters and Windows-reserved keys; Win32 values for RegisterHotKey.
let h: Hotkey = hotkey::parse("Ctrl+Shift+G")?;
let (fs_modifiers, vk) = (h.win32_modifiers(), h.virtual_key());
```
`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.
as the parsers, so a tampered `library.json` cannot smuggle in a bad path or launch string. The same holds for `Marks` (a JSON
array of exe paths in the agent's `overlay.json`) and `Hotkey` (its text form in `settings.json`).
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).