[core] Detect: Marks hold on and off sets; arena-core 0.2.0 checks pass

Marks keeps one verdict per exe: on ("This is a game") or off ("This is
not a game"). detect: Launched > marked off (None) > marked on (Marked,
with the library game if any) > InstallDir. Serde writes
{"on": [...], "off": [...]} and still reads the plain array as on;
an exe in both lists is refused, MAX_MARKS counts both.

Also: collapsible-if for clippy, rustfmt, README and FORMATS updated.
Checked: cargo test -p arena-core (183 passed), clippy -D warnings,
fmt --check, check for wasm32-unknown-unknown and aarch64-linux-android.
This commit is contained in:
2026-11-26 03:27:03 +01:00
parent 43701bbadc
commit 95d031fef9
6 changed files with 251 additions and 64 deletions
+6 -4
View File
@@ -82,8 +82,9 @@ use arena_core::{frames, detect::{self, Detection, How, Marks}, hotkey::{self, H
// 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.
// Launched by Arena > marked off ("not a game": None) > marked on > inside an install_dir (deepest wins).
// Outside every install_dir and not marked on: never a game. Whole path components, ignoring case.
marks.set(exe.clone(), true)?; // the "This is a game" toggle; false = off
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.
@@ -92,8 +93,9 @@ 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. 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`).
as the parsers, so a tampered `library.json` cannot smuggle in a bad path or launch string. The same holds for
`Marks` (`{"on": [...], "off": [...]}` 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).