diff options
author | Michael Pavone <pavone@retrodev.com> | 2019-01-23 19:25:50 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2019-01-23 19:25:50 -0800 |
commit | 6e4b7bff1e51a0f1128a49bc060e3532eab61e8d (patch) | |
tree | 60b0f6b2cc55ac32200c25bf79ffb648c1c9e1e3 /libblastem.c | |
parent | f69db0983a2f435e7a0147bf8ad82b16196d4397 (diff) |
Fix aspect ratio for H32 games
Diffstat (limited to 'libblastem.c')
-rw-r--r-- | libblastem.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libblastem.c b/libblastem.c index b6c5cf4..8b13ceb 100644 --- a/libblastem.c +++ b/libblastem.c @@ -76,8 +76,10 @@ RETRO_API void retro_get_system_info(struct retro_system_info *info) } 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 @@ uint32_t *render_get_framebuffer(uint8_t which, int *pitch) 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); } |