diff --git a/gfx/video_driver.c b/gfx/video_driver.c index be83442d41..7d61856453 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -753,3 +753,18 @@ bool video_driver_viewport_info(struct video_viewport *vp) return true; } + +bool video_driver_read_viewport(uint8_t *buffer) +{ + driver_t *driver = driver_get_ptr(); + + if (!driver) + return false; + if (!driver->video) + return false; + if (!driver->video->read_viewport) + return false; + + return driver->video->read_viewport(driver->video_data, + buffer); +} diff --git a/gfx/video_driver.h b/gfx/video_driver.h index ee6f9e88a4..f73f512772 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -298,6 +298,8 @@ void video_driver_set_texture_frame(const void *frame, bool rgb32, bool video_driver_viewport_info(struct video_viewport *vp); +bool video_driver_read_viewport(uint8_t *buffer); + #ifdef __cplusplus } #endif diff --git a/record/record_driver.c b/record/record_driver.c index 0387f0e02c..601539306f 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -23,6 +23,7 @@ #include "../retroarch.h" #include "../runloop.h" #include "../intl/intl.h" +#include "../gfx/video_driver.h" #include "../gfx/video_viewport.h" #ifdef HAVE_CONFIG_H @@ -133,9 +134,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 (driver->video && driver->video->read_viewport) - if (!driver->video->read_viewport(driver->video_data, - global->record.gpu_buffer)) + if (!video_driver_read_viewport(global->record.gpu_buffer)) return; ffemu_data.pitch = global->record.gpu_width * 3; diff --git a/screenshot.c b/screenshot.c index f713e39e40..e170788d11 100644 --- a/screenshot.c +++ b/screenshot.c @@ -29,6 +29,7 @@ #include "runloop.h" #include "retroarch_logger.h" #include "screenshot.h" +#include "gfx/video_driver.h" #include "gfx/video_viewport.h" #ifdef HAVE_CONFIG_H @@ -179,7 +180,6 @@ static bool take_screenshot_viewport(void) uint8_t *buffer = NULL; bool retval = false; struct video_viewport vp = {0}; - driver_t *driver = driver_get_ptr(); settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); @@ -191,9 +191,8 @@ static bool take_screenshot_viewport(void) if (!(buffer = (uint8_t*)malloc(vp.width * vp.height * 3))) return false; - if (driver->video && driver->video->read_viewport) - if (!driver->video->read_viewport(driver->video_data, buffer)) - goto done; + if (!video_driver_read_viewport(buffer)) + goto done; screenshot_dir = settings->screenshot_directory; diff --git a/tools/retroarch-joyconfig.c b/tools/retroarch-joyconfig.c index d2f64b79ca..0660a4761d 100644 --- a/tools/retroarch-joyconfig.c +++ b/tools/retroarch-joyconfig.c @@ -516,3 +516,8 @@ bool video_driver_viewport_info(struct video_viewport *vp) { return false; } + +bool video_driver_read_viewport(uint8_t *buffer) +{ + return false; +}