summaryrefslogtreecommitdiff
path: root/libblastem.c
diff options
context:
space:
mode:
Diffstat (limited to 'libblastem.c')
-rw-r--r--libblastem.c15
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);
}