From e0cc113689aae8cd8dcf659c8f271290e9acd5fc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 18 Jun 2017 18:49:49 +0200 Subject: [PATCH] Try to fix this regression https://github.com/libretro/RetroArch/issues/5060 --- configuration.c | 9 ++++----- configuration.h | 3 +++ gfx/video_driver.c | 27 +++++++++++++++------------ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/configuration.c b/configuration.c index a1c4b5eab7..a73c4e38af 100644 --- a/configuration.c +++ b/configuration.c @@ -1295,7 +1295,6 @@ static struct config_float_setting *populate_settings_float(settings_t *settings static struct config_uint_setting *populate_settings_uint(settings_t *settings, int *size) { unsigned count = 0; - struct video_viewport *custom_vp = video_viewport_get_custom(); struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false); @@ -1337,10 +1336,10 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("menu_shader_pipeline", &settings->uints.menu_xmb_shader_pipeline, true, menu_shader_pipeline, false); #endif SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, out_rate, false); - SETTING_UINT("custom_viewport_width", &custom_vp->width, false, 0 /* TODO */, false); - SETTING_UINT("custom_viewport_height", &custom_vp->height, false, 0 /* TODO */, false); - SETTING_UINT("custom_viewport_x", (unsigned*)&custom_vp->x, false, 0 /* TODO */, false); - SETTING_UINT("custom_viewport_y", (unsigned*)&custom_vp->y, false, 0 /* TODO */, false); + SETTING_UINT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false); + SETTING_UINT("custom_viewport_height", &settings->video_viewport_custom.height, false, 0 /* TODO */, false); + SETTING_UINT("custom_viewport_x", (unsigned*)&settings->video_viewport_custom.x, false, 0 /* TODO */, false); + SETTING_UINT("custom_viewport_y", (unsigned*)&settings->video_viewport_custom.y, false, 0 /* TODO */, false); SETTING_UINT("content_history_size", &settings->uints.content_history_size, true, default_content_history_size, false); SETTING_UINT("video_hard_sync_frames", &settings->uints.video_hard_sync_frames, true, hard_sync_frames, false); SETTING_UINT("video_frame_delay", &settings->uints.video_frame_delay, true, frame_delay, false); diff --git a/configuration.h b/configuration.h index 1ff0e37dc1..6105de3b0e 100644 --- a/configuration.h +++ b/configuration.h @@ -29,6 +29,7 @@ #include "config.h" #endif +#include "gfx/video_driver.h" #include "input/input_defines.h" enum override_type @@ -410,6 +411,8 @@ typedef struct settings bool modified; + video_viewport_t video_viewport_custom; + size_t rewind_buffer_size; } settings_t; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 2aa04cb16c..9e0824d12d 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -161,8 +161,6 @@ static retro_time_t video_driver_frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_C static uint64_t video_driver_frame_time_count = 0; static uint64_t video_driver_frame_count = 0; -static video_viewport_t video_viewport_custom; - static void *video_driver_data = NULL; static video_driver_t *current_video = NULL; @@ -893,11 +891,11 @@ static bool video_driver_init_internal(bool *video_is_threaded) { video_info_t video; unsigned max_dim, scale, width, height; + video_viewport_t *custom_vp = NULL; const input_driver_t *tmp = NULL; const struct retro_game_geometry *geom = NULL; rarch_system_info_t *system = NULL; static uint16_t dummy_pixels[32] = {0}; - video_viewport_t *custom_vp = &video_viewport_custom; settings_t *settings = config_get_ptr(); struct retro_system_av_info *av_info = &video_driver_av_info; @@ -937,6 +935,8 @@ static bool video_driver_init_internal(bool *video_is_threaded) video_driver_set_viewport_config(); /* Update CUSTOM viewport. */ + custom_vp = video_viewport_get_custom(); + if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM) { float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value; @@ -1686,7 +1686,7 @@ void video_driver_set_viewport_core(void) void video_driver_reset_custom_viewport(void) { - struct video_viewport *custom_vp = &video_viewport_custom; + struct video_viewport *custom_vp = video_viewport_get_custom(); custom_vp->width = 0; custom_vp->height = 0; @@ -2147,7 +2147,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp, if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM) { - struct video_viewport *custom = &video_viewport_custom; + struct video_viewport *custom = video_viewport_get_custom(); if (custom) { @@ -2212,7 +2212,8 @@ struct retro_system_av_info *video_viewport_get_system_av_info(void) struct video_viewport *video_viewport_get_custom(void) { - return &video_viewport_custom; + settings_t *settings = config_get_ptr(); + return &settings->video_viewport_custom; } unsigned video_pixel_get_alignment(unsigned pitch) @@ -2460,11 +2461,13 @@ void video_driver_build_info(video_frame_info_t *video_info) bool is_idle = false; bool is_slowmotion = false; settings_t *settings = NULL; + video_viewport_t *custom_vp = NULL; #ifdef HAVE_THREADS bool is_threaded = video_driver_is_threaded(); video_driver_threaded_lock(is_threaded); #endif settings = config_get_ptr(); + custom_vp = &settings->video_viewport_custom; video_info->refresh_rate = settings->floats.video_refresh_rate; video_info->black_frame_insertion = settings->bools.video_black_frame_insertion; @@ -2485,12 +2488,12 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->font_msg_color_r = settings->floats.video_msg_color_r; video_info->font_msg_color_g = settings->floats.video_msg_color_g; video_info->font_msg_color_b = settings->floats.video_msg_color_b; - video_info->custom_vp_x = video_viewport_custom.x; - video_info->custom_vp_y = video_viewport_custom.y; - video_info->custom_vp_width = video_viewport_custom.width; - video_info->custom_vp_height = video_viewport_custom.height; - video_info->custom_vp_full_width = video_viewport_custom.full_width; - video_info->custom_vp_full_height = video_viewport_custom.full_height; + video_info->custom_vp_x = custom_vp->x; + video_info->custom_vp_y = custom_vp->y; + video_info->custom_vp_width = custom_vp->width; + video_info->custom_vp_height = custom_vp->height; + video_info->custom_vp_full_width = custom_vp->full_width; + video_info->custom_vp_full_height = custom_vp->full_height; video_info->fps_text[0] = '\0';