# HG changeset patch # User Michael Pavone # Date 1548300350 28800 # Node ID 9e4dd1595f374210c7bd99b0de28df2065fb21db # Parent ba3fb7a3be6b778b3fdecd5b18006f92d6c8b026 Fix aspect ratio for H32 games diff -r ba3fb7a3be6b -r 9e4dd1595f37 libblastem.c --- a/libblastem.c Tue Jan 22 21:15:38 2019 -0800 +++ b/libblastem.c Wed Jan 23 19:25:50 2019 -0800 @@ -76,8 +76,10 @@ } static vid_std video_standard; +static uint32_t last_width; RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) { + last_width = LINEBUF_SIZE; info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE; info->geometry.base_height = info->geometry.max_height = video_standard == VID_NTSC ? 243 : 294; info->geometry.aspect_ratio = 0; @@ -242,9 +244,18 @@ void render_framebuffer_updated(uint8_t which, int width) { - //TODO: Deal with 256 px wide modes //TODO: deal with interlace - retro_video_refresh(fb, LINEBUF_SIZE, video_standard == VID_NTSC ? 243 : 294, LINEBUF_SIZE * sizeof(uint32_t)); + unsigned height = video_standard == VID_NTSC ? 243 : 294; + if (width != last_width) { + struct retro_game_geometry geometry = { + .base_width = width, + .base_height = height, + .aspect_ratio = (float)LINEBUF_SIZE / height + }; + retro_environment(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry); + last_width = width; + } + retro_video_refresh(fb, width, height, LINEBUF_SIZE * sizeof(uint32_t)); current_system->request_exit(current_system); }