anti-prestige-tool/README.md

140 lines
3.6 KiB
Markdown
Raw Normal View History

2026-05-01 14:45:16 +01:00
# Anti Prestige Tool v0.7.6
2026-05-01 10:26:41 +01:00
2026-05-01 14:18:16 +01:00
Queue-position reader for Arma Reforger on Linux Wayland.
2026-05-01 10:26:41 +01:00
2026-05-01 14:18:16 +01:00
The tool captures a user-selected Reforger window through xdg-desktop-portal/PipeWire, crops the queue-number region, and reads the orange UI digits with bundled real-game digit templates. Normal use does not require external OCR libraries, desktop-specific screenshot hooks, or a specific installed font.
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
## Install
Install system dependencies:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 13:05:49 +01:00
# Arch example
sudo pacman -S --needed base-devel uv qt6-base gstreamer gst-plugins-base gst-plugin-pipewire imagemagick xdg-desktop-portal
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Install the portal backend for your desktop:
2026-05-01 10:26:41 +01:00
```text
2026-05-01 13:05:49 +01:00
KDE: xdg-desktop-portal-kde
GNOME: xdg-desktop-portal-gnome
wlr: xdg-desktop-portal-wlr
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Set up the Python environment and build the portal helper:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 14:18:16 +01:00
uv sync
2026-05-01 13:05:49 +01:00
make
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
No sudo install step is required.
2026-05-01 13:25:01 +01:00
2026-05-01 13:05:49 +01:00
## Use
2026-05-01 10:26:41 +01:00
2026-05-01 14:18:16 +01:00
Run:
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 13:05:49 +01:00
On first run, your desktop should show a window-sharing picker. Select the Arma Reforger window. If the portal grants persistence, the tool stores a restore token here:
2026-05-01 10:26:41 +01:00
```text
2026-05-01 13:05:49 +01:00
~/.local/state/anti-prestige-tool/portal-window-restore-token
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Later runs try to reuse that token:
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Force a fresh picker if the saved selection is wrong or stale:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 13:05:49 +01:00
uv run reforger_queue_read.py --portal-window --portal-reselect --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 13:05:49 +01:00
Save the captured input image while debugging:
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
```bash
uv run reforger_queue_read.py --portal-window --save-input /tmp/apt-portal-window.png --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:45:16 +01:00
Watch the selected window and send a desktop notification once for each newly detected queue position under 5:
```bash
uv run reforger_queue_read.py --watch --portal-window
```
Watch mode polls every 15 seconds by default. It prints each poll result with a timestamp, the detected number, and whether an alert fired. Queue position `1` is sent as a critical notification; positions `2`, `3`, and `4` use normal urgency.
Useful watcher overrides:
```bash
uv run reforger_queue_read.py --watch --portal-window --watch-interval 5
uv run reforger_queue_read.py --watch --portal-window --alert-threshold 10
uv run reforger_queue_read.py --watch --image datasets/regression-test-set/3.png --watch-interval 1 --notify-command true
```
2026-05-01 14:18:16 +01:00
## Validation
2026-05-01 10:26:41 +01:00
2026-05-01 14:18:16 +01:00
Run the regression set:
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
```bash
2026-05-01 14:18:16 +01:00
uv run reforger_queue_read.py --dataset datasets/regression-test-set --expect-filenames
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Expected result:
2026-05-01 10:26:41 +01:00
2026-05-01 14:18:16 +01:00
```text
summary: 21 passed, 0 failed
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Run the smaller smoke dataset:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 14:18:16 +01:00
uv run reforger_queue_read.py --dataset datasets/scootz-dataset --show-crop
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Expected output:
2026-05-01 10:26:41 +01:00
```text
2026-05-01 14:18:16 +01:00
datasets/scootz-dataset/1920x1080.png crop=788,465,75,45
datasets/scootz-dataset/1920x1080.png 22
datasets/scootz-dataset/2160x1440.png crop=1050,620,100,60
datasets/scootz-dataset/2160x1440.png 24
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
## Debug Options
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
Read an existing screenshot:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 13:05:49 +01:00
uv run reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
The default matcher uses bundled templates from:
2026-05-01 13:51:43 +01:00
```text
2026-05-01 14:18:16 +01:00
templates/reforger_digits.json
2026-05-01 13:51:43 +01:00
```
2026-05-01 14:18:16 +01:00
Font mode is only for debugging. Known-good overrides:
2026-05-01 10:26:41 +01:00
```bash
2026-05-01 14:18:16 +01:00
uv run reforger_queue_read.py --portal-window --font Roboto-Condensed --show-crop --debug
uv run reforger_queue_read.py --portal-window --font Adwaita-Sans --show-crop --debug
2026-05-01 10:26:41 +01:00
```
2026-05-01 13:05:49 +01:00
Default crop reference:
2026-05-01 10:26:41 +01:00
2026-05-01 13:05:49 +01:00
```text
reference-size: 2560x1440
reference-crop: 1050,620,100,60
scale-mode: width
2026-05-01 10:26:41 +01:00
```
2026-05-01 14:18:16 +01:00
Portal restore behavior depends on the desktop portal. If the selected window disappears after an Arma restart, the portal may show the picker again.