From 262eaf188206e0a83f029088495a678ee3920bf5 Mon Sep 17 00:00:00 2001 From: Mahyar Koshkouei Date: Mon, 15 Jan 2018 19:03:43 +0000 Subject: [PATCH] Reset geometry once we know video size Signed-off-by: Mahyar Koshkouei --- mpv-libretro.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mpv-libretro.c b/mpv-libretro.c index 4835488..58aaf8d 100644 --- a/mpv-libretro.c +++ b/mpv-libretro.c @@ -128,6 +128,9 @@ void retro_get_system_av_info(struct retro_system_av_info *info) .sample_rate = sampling_rate, }; + /* We don't know the dimensions of the video yet, so we set some good + * defaults in the meantime. + */ info->geometry = (struct retro_game_geometry) { .base_width = 256, .base_height = 144, @@ -418,6 +421,11 @@ void retro_run(void) mpv_get_property(mpv, "dwidth", MPV_FORMAT_INT64, &width); mpv_get_property(mpv, "dheight", MPV_FORMAT_INT64, &height); + /* We don't know the dimensions of the video when + * retro_get_system_av_info is called, so we have to set it here for + * the correct aspect ratio. + * This is not a temporary change + */ struct retro_game_geometry geometry = { .base_width = width, .base_height = height, @@ -428,7 +436,7 @@ void retro_run(void) .aspect_ratio = -1, }; - environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry); + environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &geometry); updated_video_dimensions = true; }