[libretro] fixed core resolution changes detection

This commit is contained in:
EkeEke 2014-04-05 00:46:30 +02:00
parent df6dbe855a
commit bc97224fef

View File

@ -443,8 +443,11 @@ static void extract_directory(char *buf, const char *path, size_t size)
buf[0] = '\0'; buf[0] = '\0';
} }
static void update_viewport(void) static bool update_viewport(void)
{ {
int ow = vwidth;
int oh = vheight;
vwidth = bitmap.viewport.w + (bitmap.viewport.x * 2); vwidth = bitmap.viewport.w + (bitmap.viewport.x * 2);
vheight = bitmap.viewport.h + (bitmap.viewport.y * 2); vheight = bitmap.viewport.h + (bitmap.viewport.y * 2);
@ -460,6 +463,8 @@ static void update_viewport(void)
{ {
vheight = vheight * 2; vheight = vheight * 2;
} }
return ((ow != vwidth) || (oh != vheight));
} }
static void check_variables(void) static void check_variables(void)
@ -998,12 +1003,14 @@ void retro_run(void)
if (bitmap.viewport.changed & 1) if (bitmap.viewport.changed & 1)
{ {
struct retro_system_av_info info;
bitmap.viewport.changed &= ~1; bitmap.viewport.changed &= ~1;
update_viewport(); if (update_viewport())
{
struct retro_system_av_info info;
retro_get_system_av_info(&info); retro_get_system_av_info(&info);
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &info); environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &info);
} }
}
video_cb(bitmap.data, vwidth, vheight, 720 * 2); video_cb(bitmap.data, vwidth, vheight, 720 * 2);
audio_cb(soundbuffer, audio_update(soundbuffer)); audio_cb(soundbuffer, audio_update(soundbuffer));