From 35dcd917dd3dee9e8692fd1d2ff721c13fc0eb14 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 2 Jul 2018 16:24:42 +0200 Subject: [PATCH] embed/unix: save screenshot on "P" press in emulator --- embed/extmod/modtrezorui/display-unix.h | 1 + embed/unix/touch.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/embed/extmod/modtrezorui/display-unix.h b/embed/extmod/modtrezorui/display-unix.h index 6615a1b27..8400db274 100644 --- a/embed/extmod/modtrezorui/display-unix.h +++ b/embed/extmod/modtrezorui/display-unix.h @@ -163,6 +163,7 @@ void display_save(const char *prefix) char fname[256]; snprintf(fname, sizeof(fname), "%s%08d.png", prefix, cnt); IMG_SavePNG(BUFFER, fname); + fprintf(stderr, "Saved display buffer to %s\n", fname); cnt++; #endif } diff --git a/embed/unix/touch.c b/embed/unix/touch.c index fa4383199..f01c3f1e3 100644 --- a/embed/unix/touch.c +++ b/embed/unix/touch.c @@ -28,6 +28,7 @@ extern int sdl_display_res_x, sdl_display_res_y; extern int sdl_touch_offset_x, sdl_touch_offset_y; extern void __shutdown(void); +extern void display_save(const char *prefix); uint32_t touch_read(void) { @@ -69,6 +70,9 @@ uint32_t touch_read(void) if (event.key.keysym.sym == SDLK_ESCAPE) { __shutdown(); } + if (event.key.keysym.sym == SDLK_p) { + display_save("emu"); + } break; case SDL_QUIT: __shutdown();