diff --git a/tools/re-capture/bin/screenshot b/tools/re-capture/bin/screenshot index abccb1dc..593df3b6 100755 --- a/tools/re-capture/bin/screenshot +++ b/tools/re-capture/bin/screenshot @@ -42,8 +42,17 @@ geo=$(xwininfo -root -tree 2>/dev/null \ | grep '"xenia_canary"' \ | grep -oE '[0-9]+x[0-9]+\+-?[0-9]+\+-?[0-9]+[[:space:]]+\+-?[0-9]+\+-?[0-9]+' \ | awk '{ split($1, g, /[x+]/); a = g[1] * g[2]; - if (a > best) { best = a; split($2, p, /\+/); - out = g[1] "x" g[2] "+" p[2] "+" p[3] } } + # MIN_W: largest-by-area is not enough on its own. When the game + # window is momentarily absent from the tree (during a load or a + # mode switch) the only xenia_canary window left is the narrow + # helper, it wins by default, and the crop below produces a + # SLIVER. Measured 2026-08-26: a 10x710 grab that screen_id then + # classified as `menu`, so a nav guard passed on garbage and the + # run loaded the wrong stage. Ignore anything too narrow to be a + # game frame and fall through to the raw root grab instead. + if (g[1] >= 640 && a > best) { + best = a; split($2, p, /\+/); + out = g[1] "x" g[2] "+" p[2] "+" p[3] } } END { if (best) print out }') if [ -z "$geo" ]; then # no window found — hand back the raw grab cp "$RAW" "$OUT"; echo "$OUT"; exit 0