feat(daily-run): 预检存档截图便于诊断坏首启画面
坏首启的画面至今只能靠体积推测;预检现在每 30 秒把采样帧存到 artifacts/preflight/(每轮运行开始时清空),坏首启次日可直接查看 游戏到底停在什么画面上,再设计针对性点按。
This commit is contained in:
@@ -35,6 +35,12 @@ ATTEMPT_MAX_SECONDS="${MAA_ONLINE_ATTEMPT_MAX_SECONDS:-3000}" # per-attempt cei
|
|||||||
# while the game does first-login resource processing; without this, MAA burns
|
# while the game does first-login resource processing; without this, MAA burns
|
||||||
# the whole attempt (and its quota) failing recognition on every task.
|
# the whole attempt (and its quota) failing recognition on every task.
|
||||||
PREFLIGHT_MAX_SECONDS="${MAA_ONLINE_PREFLIGHT_MAX_SECONDS:-780}"
|
PREFLIGHT_MAX_SECONDS="${MAA_ONLINE_PREFLIGHT_MAX_SECONDS:-780}"
|
||||||
|
# Archive pre-flight screenshots (one every 30s) so a bad first boot can be
|
||||||
|
# diagnosed visually afterwards: the bad screen is static, so a handful of
|
||||||
|
# saved frames tell us exactly what the game was showing.
|
||||||
|
PREFLIGHT_SHOT_DIR="${MAA_ONLINE_PREFLIGHT_SHOT_DIR:-$LOG_DIR/preflight}"
|
||||||
|
rm -rf "$PREFLIGHT_SHOT_DIR"
|
||||||
|
mkdir -p "$PREFLIGHT_SHOT_DIR"
|
||||||
|
|
||||||
mkdir -p "$LOG_DIR"
|
mkdir -p "$LOG_DIR"
|
||||||
|
|
||||||
@@ -107,13 +113,16 @@ fi
|
|||||||
# Screen classes by PNG size, calibrated on real captures (2026-09-23):
|
# Screen classes by PNG size, calibrated on real captures (2026-09-23):
|
||||||
# black/loading <20KB | login 200-350KB (开始唤醒) | title ~480KB |
|
# black/loading <20KB | login 200-350KB (开始唤醒) | title ~480KB |
|
||||||
# announcement/menu >=650KB (hand off to MAA)
|
# announcement/menu >=650KB (hand off to MAA)
|
||||||
preflight() { # arg1: max seconds; returns 0 once the screen looks in-game
|
preflight() { # arg1: max seconds, arg2: attempt no.; returns 0 once the screen looks in-game
|
||||||
local max="$1" elapsed=0 last_action=-20 ready_hits=0
|
local max="$1" attempt_no="${2:-x}" elapsed=0 last_action=-20 ready_hits=0
|
||||||
local png=/tmp/maa-preflight.png
|
local png=/tmp/maa-preflight.png
|
||||||
while [ "$elapsed" -lt "$max" ]; do
|
while [ "$elapsed" -lt "$max" ]; do
|
||||||
if api GET /screencap > "$png" 2>/dev/null; then
|
if api GET /screencap > "$png" 2>/dev/null; then
|
||||||
local size
|
local size
|
||||||
size=$(stat -c %s "$png" 2>/dev/null || echo 0)
|
size=$(stat -c %s "$png" 2>/dev/null || echo 0)
|
||||||
|
if [ $((elapsed % 30)) -eq 0 ]; then
|
||||||
|
cp "$png" "$PREFLIGHT_SHOT_DIR/a${attempt_no}-t$(printf '%04d' "$elapsed").png" 2>/dev/null
|
||||||
|
fi
|
||||||
if [ "$size" -ge 650000 ]; then
|
if [ "$size" -ge 650000 ]; then
|
||||||
# Require the in-game-class screen to be stable: a single large
|
# Require the in-game-class screen to be stable: a single large
|
||||||
# frame can still be a loading/transition screen (2026-09-25
|
# frame can still be a loading/transition screen (2026-09-25
|
||||||
@@ -181,7 +190,7 @@ while [ "$attempt" -lt "$MAX_ATTEMPTS" ]; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "[daily-run] attempt $attempt: preflight: waiting for a recognizable game screen (max ${PREFLIGHT_MAX_SECONDS}s) ..."
|
echo "[daily-run] attempt $attempt: preflight: waiting for a recognizable game screen (max ${PREFLIGHT_MAX_SECONDS}s) ..."
|
||||||
if ! preflight "$PREFLIGHT_MAX_SECONDS"; then
|
if ! preflight "$PREFLIGHT_MAX_SECONDS" "$attempt"; then
|
||||||
REASON="preflight timed out after ${PREFLIGHT_MAX_SECONDS}s; game screen never became ready"
|
REASON="preflight timed out after ${PREFLIGHT_MAX_SECONDS}s; game screen never became ready"
|
||||||
echo "[daily-run] attempt $attempt failed: $REASON; releasing cloud session" >&2
|
echo "[daily-run] attempt $attempt failed: $REASON; releasing cloud session" >&2
|
||||||
api POST /exit >/dev/null 2>&1 || true
|
api POST /exit >/dev/null 2>&1 || true
|
||||||
|
|||||||
Reference in New Issue
Block a user