#!/usr/bin/env python3 """Is this frame the interactive title screen? Exit 0 if yes. Counts the pixels of the **green (A) glyph** in "PRESS (A) BUTTON" anywhere in the frame. That is the one thing only the interactive title has, and counting is geometry-independent — unlike the single absolute pixel this replaced, which was a 1280x720 coordinate being sampled against the 1279x675 game surface and always read the copyright line. `screen_id.py` is too loose for this job on its own: it called the SQUARE ENIX publisher logo "title" 151 s into a boot, and skip_intro spent its one press there. Measured on a real title frame: 1442 glyph pixels, centred near (622,572). is_title.py FRAME.png [min_pixels] """ import sys import numpy as np from PIL import Image a = np.asarray(Image.open(sys.argv[1]).convert("RGB"), dtype=int) r, g, b = a[:, :, 0], a[:, :, 1], a[:, :, 2] n = int(((g > 130) & (g - r > 45) & (g - b > 45)).sum()) need = int(sys.argv[2]) if len(sys.argv) > 2 else 400 print(f"green-glyph px {n} (need {need})") sys.exit(0 if n >= need else 1)