comparison libblastem.c @ 1694:9e4dd1595f37

Fix aspect ratio for H32 games
author Michael Pavone <pavone@retrodev.com>
date Wed, 23 Jan 2019 19:25:50 -0800
parents e96d0d3bec7f
children 3c34122754ac
comparison
equal deleted inserted replaced
1693:ba3fb7a3be6b 1694:9e4dd1595f37
74 info->need_fullpath = 0; 74 info->need_fullpath = 0;
75 info->block_extract = 0; 75 info->block_extract = 0;
76 } 76 }
77 77
78 static vid_std video_standard; 78 static vid_std video_standard;
79 static uint32_t last_width;
79 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) 80 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info)
80 { 81 {
82 last_width = LINEBUF_SIZE;
81 info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE; 83 info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE;
82 info->geometry.base_height = info->geometry.max_height = video_standard == VID_NTSC ? 243 : 294; 84 info->geometry.base_height = info->geometry.max_height = video_standard == VID_NTSC ? 243 : 294;
83 info->geometry.aspect_ratio = 0; 85 info->geometry.aspect_ratio = 0;
84 info->timing.fps = video_standard == VID_NTSC ? 60 : 50; 86 info->timing.fps = video_standard == VID_NTSC ? 60 : 50;
85 info->timing.sample_rate = 53267; //approximate sample rate of YM2612 87 info->timing.sample_rate = 53267; //approximate sample rate of YM2612
240 return fb; 242 return fb;
241 } 243 }
242 244
243 void render_framebuffer_updated(uint8_t which, int width) 245 void render_framebuffer_updated(uint8_t which, int width)
244 { 246 {
245 //TODO: Deal with 256 px wide modes
246 //TODO: deal with interlace 247 //TODO: deal with interlace
247 retro_video_refresh(fb, LINEBUF_SIZE, video_standard == VID_NTSC ? 243 : 294, LINEBUF_SIZE * sizeof(uint32_t)); 248 unsigned height = video_standard == VID_NTSC ? 243 : 294;
249 if (width != last_width) {
250 struct retro_game_geometry geometry = {
251 .base_width = width,
252 .base_height = height,
253 .aspect_ratio = (float)LINEBUF_SIZE / height
254 };
255 retro_environment(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry);
256 last_width = width;
257 }
258 retro_video_refresh(fb, width, height, LINEBUF_SIZE * sizeof(uint32_t));
248 current_system->request_exit(current_system); 259 current_system->request_exit(current_system);
249 } 260 }
250 261
251 uint8_t render_get_active_framebuffer(void) 262 uint8_t render_get_active_framebuffer(void)
252 { 263 {