Reset geometry once we know video size

Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
Mahyar Koshkouei 2018-01-15 19:03:43 +00:00
parent 5ac3dca1b7
commit 262eaf1882
1 changed files with 9 additions and 1 deletions

View File

@ -128,6 +128,9 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
.sample_rate = sampling_rate, .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) { info->geometry = (struct retro_game_geometry) {
.base_width = 256, .base_width = 256,
.base_height = 144, .base_height = 144,
@ -418,6 +421,11 @@ void retro_run(void)
mpv_get_property(mpv, "dwidth", MPV_FORMAT_INT64, &width); mpv_get_property(mpv, "dwidth", MPV_FORMAT_INT64, &width);
mpv_get_property(mpv, "dheight", MPV_FORMAT_INT64, &height); 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 = { struct retro_game_geometry geometry = {
.base_width = width, .base_width = width,
.base_height = height, .base_height = height,
@ -428,7 +436,7 @@ void retro_run(void)
.aspect_ratio = -1, .aspect_ratio = -1,
}; };
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry); environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &geometry);
updated_video_dimensions = true; updated_video_dimensions = true;
} }