From 41b2d6fc04b6c21418eb5165faf4fd4947330cab Mon Sep 17 00:00:00 2001 From: Shokunin <30949000+tetrisgm@users.noreply.github.com> Date: Tue, 6 Oct 2026 05:03:23 -0700 Subject: [PATCH] Frame generation: PSX_PRESENT_SHOT_GENERATED captures a generated frame Diagnostic: a staged present_shot waits for the next generated frame, so the in-between images can be inspected in game. Co-Authored-By: Claude Opus 5.5 --- runtime/src/gpu_gl_renderer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/src/gpu_gl_renderer.c b/runtime/src/gpu_gl_renderer.c index 264f4765..3e5cfb22 100644 --- a/runtime/src/gpu_gl_renderer.c +++ b/runtime/src/gpu_gl_renderer.c @@ -8494,7 +8494,15 @@ static void gl_swap_with_osd(void) { extern int present_shot_take(char *out, int n); extern void present_shot_done(int ok); char shot_path[512]; - if (present_shot_take(shot_path, (int)sizeof(shot_path))) { + /* PSX_PRESENT_SHOT_GENERATED=1 (diagnostic): a staged present_shot + * waits for the next generated frame (frame generation). */ + static int gen_only = -1; + if (gen_only < 0) { + const char *e = getenv("PSX_PRESENT_SHOT_GENERATED"); + gen_only = (e && *e && *e != '0') ? 1 : 0; + } + if ((!gen_only || s_fg_presenting) && + present_shot_take(shot_path, (int)sizeof(shot_path))) { int ww = 0, wh = 0; int wrote = 0; SDL_GL_GetDrawableSize(s_win, &ww, &wh);