anti-prestige-tool/README.md

153 lines
3.9 KiB
Markdown

# Anti Prestige Tool
Queue-position reader for Arma Reforger on Linux.
The tool captures the Reforger queue screen, crops the queue-number region, and reads the orange UI digits with a small built-in matcher. It does not use Tesseract, OpenCV, or Pillow.
## Install
Install system dependencies:
```bash
# Arch example
sudo pacman -S --needed base-devel uv qt6-base gstreamer gst-plugins-base gst-plugin-pipewire imagemagick xdg-desktop-portal
```
You also need a portal backend for your desktop:
```text
KDE: xdg-desktop-portal-kde
GNOME: xdg-desktop-portal-gnome
wlr: xdg-desktop-portal-wlr
```
Build the local helpers:
```bash
make
```
No sudo install is required for the default Portal/PipeWire capture path.
The digit matcher uses ImageMagick to render reference digits. By default it auto-selects an installed font, preferring Roboto Condensed when present and falling back to common system fonts such as DejaVu Sans.
## Use
Preferred command:
```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug
```
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:
```text
~/.local/state/anti-prestige-tool/portal-window-restore-token
```
Later runs reuse that token:
```bash
uv run reforger_queue_read.py --portal-window --show-crop --debug
```
If the saved window selection is wrong or stale:
```bash
uv run reforger_queue_read.py --portal-window --portal-reselect --show-crop --debug
```
Save the captured input image while debugging:
```bash
uv run reforger_queue_read.py --portal-window --save-input /tmp/apt-portal-window.png --show-crop --debug
```
If font matching is weird on a specific machine, pass an installed ImageMagick font explicitly:
```bash
uv run reforger_queue_read.py --portal-window --font DejaVu-Sans-Condensed --show-crop --debug
```
## Optional KDE/KWin Mode
KWin mode can automatically find the Arma window by KWin metadata and can rebind after the game restarts. It is KDE-specific and requires installing an authorized helper.
Install the helper:
```bash
sudo make install-kwin-auth
kbuildsycoca6
```
Run:
```bash
uv run reforger_queue_read.py --kwin-window auto --show-crop --debug
```
If auto matching is ambiguous, list windows and pass the PID or internal id:
```bash
uv run reforger_queue_read.py --list-kwin-windows
uv run reforger_queue_read.py --kwin-window 53561 --show-crop --debug
uv run reforger_queue_read.py --kwin-window-id '{77a38955-a827-479c-971b-af8de226ac7b}' --show-crop --debug
```
The auth install places:
```text
/usr/local/bin/reforger-kwin-capture
/usr/local/share/applications/org.codex.reforger-kwin-capture.desktop
```
The desktop file must be in a root-owned application directory because KWin does not trust user-writable desktop entries for restricted screenshot interfaces.
## Other Inputs
Read an existing screenshot:
```bash
uv run reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug
```
Use Spectacle/KDE screen capture:
```bash
uv run reforger_queue_read.py --capture --screen DP-3 --show-crop --debug
```
Use an OBS scene screenshot:
```bash
uv run reforger_queue_read.py --obs-scene APT --show-crop --debug
```
Validate the included dataset:
```bash
uv run reforger_queue_read.py --dataset datasets/scootz-dataset --show-crop
```
Expected current output:
```text
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
```
## Notes
Default crop reference:
```text
reference-size: 2560x1440
reference-crop: 1050,620,100,60
scale-mode: width
```
Portal/PipeWire is easiest to install, but restore behavior depends on the desktop portal. If the selected window disappears after an Arma restart, the portal may show the picker again.
KWin mode is the best KDE automation path, but it has the extra authorization install step.