diff --git a/gfx/drivers/caca_gfx.c b/gfx/drivers/caca_gfx.c index 1c5a24d842..0e4885133d 100644 --- a/gfx/drivers/caca_gfx.c +++ b/gfx/drivers/caca_gfx.c @@ -261,7 +261,7 @@ static void caca_gfx_viewport_info(void *data, (void)vp; } -static bool caca_gfx_read_viewport(void *data, uint8_t *buffer) +static bool caca_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index e47f9a31cc..b83183dff2 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -1146,7 +1146,7 @@ static void ctr_get_poke_interface(void* data, *iface = &ctr_poke_interface; } -static bool ctr_read_viewport(void* data, uint8_t* buffer) +static bool ctr_read_viewport(void* data, uint8_t* buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index 3000b0d9b4..03f1af93d0 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -53,7 +53,6 @@ #include "../../performance_counters.h" #include "../../defines/d3d_defines.h" -#include "../../runloop.h" #include "../../verbosity.h" #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) @@ -1475,7 +1474,7 @@ static bool d3d_frame(void *data, const void *frame, return true; } -static bool d3d_read_viewport(void *data, uint8_t *buffer) +static bool d3d_read_viewport(void *data, uint8_t *buffer, bool is_idle) { d3d_video_t *d3d = (d3d_video_t*)data; diff --git a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp index fb6a72afff..7c25bcbf5c 100644 --- a/gfx/drivers/d3d_renderchains/render_chain_cg.cpp +++ b/gfx/drivers/d3d_renderchains/render_chain_cg.cpp @@ -38,7 +38,6 @@ #include "../../video_driver.h" #include "../../../performance_counters.h" #include "../../../configuration.h" -#include "../../../runloop.h" #include "../../../verbosity.h" #define cg_d3d9_set_param_1f(param, x) if (param) cgD3D9SetUniform(param, x) diff --git a/gfx/drivers/dispmanx_gfx.c b/gfx/drivers/dispmanx_gfx.c index 485445c2fd..9ac5001319 100644 --- a/gfx/drivers/dispmanx_gfx.c +++ b/gfx/drivers/dispmanx_gfx.c @@ -30,7 +30,6 @@ #include "../../driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../video_context_driver.h" #include "../font_driver.h" @@ -599,7 +598,7 @@ static void dispmanx_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer) +static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/drm_gfx.c b/gfx/drivers/drm_gfx.c index e92bb1a895..0b861d8cee 100644 --- a/gfx/drivers/drm_gfx.c +++ b/gfx/drivers/drm_gfx.c @@ -39,7 +39,6 @@ #include "../font_driver.h" #include "../video_context_driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "drm_pixformats.h" @@ -940,7 +939,7 @@ static void drm_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool drm_gfx_read_viewport(void *data, uint8_t *buffer) +static bool drm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 30bd481baf..7cb08690cb 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -44,7 +44,6 @@ #include "../font_driver.h" #include "../../configuration.h" #include "../../retroarch.h" -#include "../../runloop.h" /* TODO: Honor these properties: vsync, menu rotation, menu alpha, aspect ratio change */ @@ -1521,7 +1520,7 @@ static bool exynos_gfx_set_shader(void *data, return false; } -static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer) +static bool exynos_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index c02517f195..8daeff9a62 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -355,7 +355,7 @@ static void gdi_gfx_viewport_info(void *data, (void)vp; } -static bool gdi_gfx_read_viewport(void *data, uint8_t *buffer) +static bool gdi_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index dc3da7ae1a..102313b44b 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -47,7 +47,6 @@ #include "../../performance_counters.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../common/gl_common.h" @@ -2360,7 +2359,7 @@ static void gl_viewport_info(void *data, struct video_viewport *vp) vp->y = top_dist; } -static bool gl_read_viewport(void *data, uint8_t *buffer) +static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) { #ifndef NO_GL_READ_PIXELS static struct retro_perf_counter read_viewport = {0}; @@ -2443,7 +2442,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer) goto error; } - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!is_idle) video_driver_cached_frame(); video_frame_convert_rgba_to_bgr( diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index d41fc3cc8f..fc0b9f6012 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -42,7 +42,6 @@ #include "../../defines/gx_defines.h" #include "../../configuration.h" #include "../../driver.h" -#include "../../runloop.h" extern syssram* __SYS_LockSram(void); extern u32 __SYS_UnlockSram(u32 write); @@ -1180,7 +1179,7 @@ static void gx_viewport_info(void *data, struct video_viewport *vp) *vp = gx->vp; } -static bool gx_read_viewport(void *data, uint8_t *buffer) +static bool gx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/nullgfx.c b/gfx/drivers/nullgfx.c index 858bad3aea..b3d66d428b 100644 --- a/gfx/drivers/nullgfx.c +++ b/gfx/drivers/nullgfx.c @@ -105,7 +105,7 @@ static void null_gfx_viewport_info(void *data, (void)vp; } -static bool null_gfx_read_viewport(void *data, uint8_t *buffer) +static bool null_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/omap_gfx.c b/gfx/drivers/omap_gfx.c index 2f799421f7..f9b6679357 100644 --- a/gfx/drivers/omap_gfx.c +++ b/gfx/drivers/omap_gfx.c @@ -48,7 +48,6 @@ #include "../../configuration.h" #include "../../driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../video_context_driver.h" @@ -1097,7 +1096,7 @@ static void omap_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool omap_gfx_read_viewport(void *data, uint8_t *buffer) +static bool omap_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/psp1_gfx.c b/gfx/drivers/psp1_gfx.c index 958bad4003..49f28e5330 100644 --- a/gfx/drivers/psp1_gfx.c +++ b/gfx/drivers/psp1_gfx.c @@ -35,7 +35,6 @@ #include "../font_driver.h" #include "../../defines/psp_defines.h" -#include "../../runloop.h" #ifndef SCEGU_SCR_WIDTH #define SCEGU_SCR_WIDTH 480 @@ -871,7 +870,7 @@ static void psp_get_poke_interface(void *data, *iface = &psp_poke_interface; } -static bool psp_read_viewport(void *data, uint8_t *buffer) +static bool psp_read_viewport(void *data, uint8_t *buffer, bool is_idle) { void* src_buffer; int i, j, src_bufferwidth, src_pixelformat, src_x, src_y, src_x_max, src_y_max; diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 11f7354a8e..6b9cea9b80 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -40,7 +40,6 @@ #include "../../configuration.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../performance_counters.h" #include "../../verbosity.h" #include "../video_context_driver.h" @@ -627,7 +626,7 @@ static void sdl2_gfx_viewport_info(void *data, struct video_viewport *vp) *vp = vid->vp; } -static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer) +static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { SDL_Surface *surf = NULL, *bgr24 = NULL; sdl2_video_t *vid = (sdl2_video_t*)data; @@ -636,7 +635,7 @@ static bool sdl2_gfx_read_viewport(void *data, uint8_t *buffer) performance_counter_init(&sdl2_gfx_read_viewport, "sdl2_gfx_read_viewport"); performance_counter_start(&sdl2_gfx_read_viewport); - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + if (!is_idle) video_driver_cached_frame(); surf = SDL_GetWindowSurface(vid->window); diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 01eb8959f2..805c15a4e5 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -43,7 +43,6 @@ #include "../video_driver.h" #include "../../configuration.h" -#include "../../runloop.h" #include "../../performance_counters.h" #include "../video_context_driver.h" @@ -576,7 +575,7 @@ static void sdl_gfx_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer) +static bool sdl_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/sunxi_gfx.c b/gfx/drivers/sunxi_gfx.c index 2d7aeeef26..0d6e4d5a61 100644 --- a/gfx/drivers/sunxi_gfx.c +++ b/gfx/drivers/sunxi_gfx.c @@ -36,7 +36,6 @@ #include "../font_driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #define NUMPAGES 2 diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 3da5d3df9e..6608c5da88 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -40,11 +40,9 @@ #include "../video_context_driver.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../driver.h" #include "../../performance_counters.h" #include "../../content.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../../configuration.h" @@ -502,7 +500,7 @@ static void vg_viewport_info(void *data, (void)vp; } -static bool vg_read_viewport(void *data, uint8_t *buffer) +static bool vg_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c index 2cd19893bf..edcc496410 100644 --- a/gfx/drivers/vga_gfx.c +++ b/gfx/drivers/vga_gfx.c @@ -276,7 +276,7 @@ static void vga_gfx_viewport_info(void *data, (void)vp; } -static bool vga_gfx_read_viewport(void *data, uint8_t *buffer) +static bool vga_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/vita2d_gfx.c b/gfx/drivers/vita2d_gfx.c index 9caaacc6ea..07ba4550c5 100644 --- a/gfx/drivers/vita2d_gfx.c +++ b/gfx/drivers/vita2d_gfx.c @@ -32,7 +32,6 @@ #include "../common/vita2d_common.h" #include "../../driver.h" -#include "../../runloop.h" #include "../video_coord_array.h" #include "../video_context_driver.h" #include "../../verbosity.h" @@ -561,7 +560,7 @@ static void vita2d_gfx_viewport_info(void *data, *vp = vita->vp; } -static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer) +static bool vita2d_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 2385cb1046..0481a84896 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -45,7 +45,6 @@ #include "../../performance_counters.h" #include "../../retroarch.h" -#include "../../runloop.h" #include "../../verbosity.h" #include "../video_context_driver.h" @@ -2262,7 +2261,7 @@ static void vulkan_viewport_info(void *data, struct video_viewport *vp) vp->full_height = height; } -static bool vulkan_read_viewport(void *data, uint8_t *buffer) +static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle) { struct vk_texture *staging = NULL; vk_t *vk = (vk_t*)data; @@ -2305,7 +2304,8 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer) * with conversion. */ vk->readback.pending = true; - if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) + + if (!is_idle) video_driver_cached_frame(); vkQueueWaitIdle(vk->context->queue); diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 9ab075f1f8..9ee8ed829c 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -768,7 +768,7 @@ static void wiiu_gfx_viewport_info(void* data, *vp = wiiu->vp; } -static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer) +static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) { (void)data; (void)buffer; @@ -777,7 +777,7 @@ static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer) } static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data, - bool threaded, enum texture_filter_type filter_type) + bool threaded, enum texture_filter_type filter_type) { return 0; } diff --git a/gfx/drivers/xenon360_gfx.c b/gfx/drivers/xenon360_gfx.c index 59723790d5..881b8731cd 100644 --- a/gfx/drivers/xenon360_gfx.c +++ b/gfx/drivers/xenon360_gfx.c @@ -29,7 +29,6 @@ #include "../font_driver.h" #include "../../driver.h" -#include "../../runloop.h" #define XE_W 512 #define XE_H 512 @@ -299,7 +298,7 @@ static void xenon360_gfx_viewport_info(void *data, struct video_viewport *vp) (void)vp; } -static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer) +static bool xenon360_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/drivers/xshm_gfx.c b/gfx/drivers/xshm_gfx.c index 5bc22c81c3..b283121211 100644 --- a/gfx/drivers/xshm_gfx.c +++ b/gfx/drivers/xshm_gfx.c @@ -158,7 +158,7 @@ static void xshm_gfx_viewport_info(void *data, struct video_viewport *vp) } -static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer) +static bool xshm_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle) { return false; } diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index 499195e66b..772165fa01 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -892,7 +892,7 @@ static void xv_set_rotation(void *data, unsigned rotation) (void)rotation; } -static bool xv_read_viewport(void *data, uint8_t *buffer) +static bool xv_read_viewport(void *data, uint8_t *buffer, bool is_idle) { (void)data; (void)buffer; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 40f9cf8a20..e682147593 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1102,7 +1102,8 @@ static bool video_driver_frame_filter( if (video_info->post_filter_record && recording_data) recording_dump_frame(video_driver_state_buffer, - *output_width, *output_height, *output_pitch); + *output_width, *output_height, *output_pitch, + video_info->runloop_is_idle); return true; } @@ -1634,10 +1635,10 @@ void video_driver_apply_state_changes(void) video_driver_poke->apply_state_changes(video_driver_data); } -bool video_driver_read_viewport(uint8_t *buffer) +bool video_driver_read_viewport(uint8_t *buffer, bool is_idle) { if ( current_video->read_viewport - && current_video->read_viewport(video_driver_data, buffer)) + && current_video->read_viewport(video_driver_data, buffer, is_idle)) return true; return false; @@ -2169,7 +2170,7 @@ void video_driver_frame(const void *data, unsigned width, || video_driver_record_gpu_buffer ) && recording_data ) - recording_dump_frame(data, width, height, pitch); + recording_dump_frame(data, width, height, pitch, video_info.runloop_is_idle); if (data && video_driver_state_filter && video_driver_frame_filter(data, &video_info, width, height, pitch, diff --git a/gfx/video_driver.h b/gfx/video_driver.h index ec42341613..505d733ffa 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -242,7 +242,7 @@ typedef struct video_driver void (*viewport_info)(void *data, struct video_viewport *vp); /* Reads out in BGR byte order (24bpp). */ - bool (*read_viewport)(void *data, uint8_t *buffer); + bool (*read_viewport)(void *data, uint8_t *buffer, bool is_idle); /* Returns a pointer to a newly allocated buffer that can * (and must) be passed to free() by the caller, containing a @@ -305,7 +305,7 @@ void video_driver_hide_mouse(void); void video_driver_set_nonblock_state(bool toggle); bool video_driver_find_driver(void); void video_driver_apply_state_changes(void); -bool video_driver_read_viewport(uint8_t *buffer); +bool video_driver_read_viewport(uint8_t *buffer, bool is_idle); bool video_driver_cached_frame(void); uint64_t video_driver_get_frame_count(void); bool video_driver_frame_filter_alive(void); diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index d0834f12b1..ce76aa5fb5 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -187,6 +187,7 @@ struct thread_video bool suppress_screensaver; bool has_windowed; bool nonblock; + bool is_idle; retro_time_t last_time; unsigned hit_count; @@ -393,7 +394,7 @@ static bool video_thread_handle_packet( if (thr->driver->read_viewport) ret = thr->driver->read_viewport(thr->driver_data, - (uint8_t*)pkt.data.v); + (uint8_t*)pkt.data.v, thr->is_idle); pkt.data.b = ret; thr->frame.within_thread = false; @@ -916,7 +917,7 @@ static void video_thread_viewport_info(void *data, struct video_viewport *vp) slock_unlock(thr->lock); } -static bool video_thread_read_viewport(void *data, uint8_t *buffer) +static bool video_thread_read_viewport(void *data, uint8_t *buffer, bool is_idle) { thread_video_t *thr = (thread_video_t*)data; thread_packet_t pkt = { CMD_READ_VIEWPORT }; @@ -924,7 +925,8 @@ static bool video_thread_read_viewport(void *data, uint8_t *buffer) if (!thr) return false; - pkt.data.v = buffer; + pkt.data.v = buffer; + thr->is_idle = is_idle; video_thread_send_and_wait_user_to_thread(thr, &pkt); diff --git a/record/record_driver.c b/record/record_driver.c index d3d2b1769b..fc68b0cf87 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -183,7 +183,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data, } void recording_dump_frame(const void *data, unsigned width, - unsigned height, size_t pitch) + unsigned height, size_t pitch, bool is_idle) { struct ffemu_video_data ffemu_data = {0}; @@ -205,7 +205,7 @@ void recording_dump_frame(const void *data, unsigned width, msg_hash_to_str(MSG_VIEWPORT_SIZE_CALCULATION_FAILED)); command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL); - recording_dump_frame(data, width, height, pitch); + recording_dump_frame(data, width, height, pitch, is_idle); return; } @@ -229,7 +229,7 @@ void recording_dump_frame(const void *data, unsigned width, /* Big bottleneck. * Since we might need to do read-backs asynchronously, * it might take 3-4 times before this returns true. */ - if (!video_driver_read_viewport(gpu_buf)) + if (!video_driver_read_viewport(gpu_buf, is_idle)) return; ffemu_data.pitch = recording_gpu_width * 3; diff --git a/record/record_driver.h b/record/record_driver.h index d124042b94..7fefc072b9 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -145,7 +145,7 @@ bool record_driver_init_first(const record_driver_t **backend, void **data, const struct ffemu_params *params); void recording_dump_frame(const void *data, unsigned width, - unsigned height, size_t pitch); + unsigned height, size_t pitch, bool is_idle); bool recording_deinit(void); diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index c8318a4736..8687ab3b73 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -76,6 +76,7 @@ typedef struct bool bgr24; bool silence; void *userbuf; + bool is_idle; bool is_paused; bool history_list_enable; } screenshot_task_state_t; @@ -189,7 +190,9 @@ static bool screenshot_dump( const void *frame, unsigned width, unsigned height, - int pitch, bool bgr24, void *userbuf, bool savestate, + int pitch, bool bgr24, + void *userbuf, bool savestate, + bool is_idle, bool is_paused) { char screenshot_path[PATH_MAX_LENGTH]; @@ -211,6 +214,7 @@ static bool screenshot_dump( screenshot_dir = screenshot_path; } + state->is_idle = is_idle; state->is_paused = is_paused; state->bgr24 = bgr24; state->height = height; @@ -263,7 +267,7 @@ static bool screenshot_dump( #if !defined(VITA) static bool take_screenshot_viewport(const char *name_base, bool savestate, - bool is_paused) + bool is_idle, bool is_paused) { struct video_viewport vp; uint8_t *buffer = NULL; @@ -286,13 +290,13 @@ static bool take_screenshot_viewport(const char *name_base, bool savestate, if (!buffer) return false; - if (!video_driver_read_viewport(buffer)) + if (!video_driver_read_viewport(buffer, is_idle)) goto error; /* Data read from viewport is in bottom-up order, suitable for BMP. */ if (!screenshot_dump(name_base, buffer, vp.width, vp.height, - vp.width * 3, true, buffer, savestate, is_paused)) + vp.width * 3, true, buffer, savestate, is_idle, is_paused)) goto error; return true; @@ -305,7 +309,7 @@ error: #endif static bool take_screenshot_raw(const char *name_base, void *userbuf, - bool savestate, bool is_paused) + bool savestate, bool is_idle, bool is_paused) { size_t pitch; unsigned width, height; @@ -318,7 +322,7 @@ static bool take_screenshot_raw(const char *name_base, void *userbuf, */ if (!screenshot_dump(name_base, (const uint8_t*)data + (height - 1) * pitch, - width, height, -pitch, false, userbuf, savestate, is_paused)) + width, height, -pitch, false, userbuf, savestate, is_idle, is_paused)) return false; return true; @@ -347,14 +351,14 @@ static bool take_screenshot_choice(const char *name_base, bool savestate, if (!is_idle) video_driver_cached_frame(); #if defined(VITA) - return take_screenshot_raw(name_base, NULL, savestate, is_paused); + return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); #else - return take_screenshot_viewport(name_base, savestate, is_paused); + return take_screenshot_viewport(name_base, savestate, is_idle, is_paused); #endif } if (!video_driver_cached_frame_has_valid_framebuffer()) - return take_screenshot_raw(name_base, NULL, savestate, is_paused); + return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); if (!video_driver_supports_read_frame_raw()) return false; @@ -371,7 +375,7 @@ static bool take_screenshot_choice(const char *name_base, bool savestate, if (frame_data) { video_driver_set_cached_frame_ptr(frame_data); - if (take_screenshot_raw(name_base, frame_data, savestate, is_paused)) + if (take_screenshot_raw(name_base, frame_data, savestate, is_idle, is_paused)) ret = true; }