platform sdl, preliminary window resizing fixes

picodrive doesn't handle resize events, so it's not really working :-/
it however uncovered some bugs and strange behaviour, though
This commit is contained in:
kub 2022-03-06 18:39:46 +00:00
parent e48f3f2795
commit f8aaa200cf
5 changed files with 95 additions and 35 deletions

View file

@ -297,7 +297,6 @@ void pemu_forced_frame(int no_scale, int do_emu)
Pico.m.dirtyPal = 1;
if (currentConfig.scaling) currentConfig.scaling = EOPT_SCALE_SW;
if (currentConfig.vscaling) currentConfig.vscaling = EOPT_SCALE_SW;
plat_video_set_size(g_menuscreen_w, g_menuscreen_h);
// render a frame in 16 bit mode
render_bg = 1;
@ -402,10 +401,18 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co
break;
}
if (screen_w != g_screen_width || screen_h != g_screen_height)
plat_video_set_size(screen_w, screen_h);
plat_video_set_size(screen_w, screen_h);
plat_video_set_buffer(g_screen_ptr);
if (screen_w < g_screen_width)
screen_x = (g_screen_width - screen_w)/2;
if (screen_h < g_screen_height) {
screen_y = (g_screen_height - screen_h)/2;
// NTSC always has 224 visible lines, anything smaller has bars
if (out_h < 224 && out_h > 144)
screen_y += (224 - out_h)/2;
}
// create a backing buffer for emulating the bad GG lcd display
if (currentConfig.ghosting && out_h == 144) {
int h = currentConfig.vscaling == EOPT_SCALE_SW ? 240:out_h;
@ -429,7 +436,11 @@ void pemu_loop_prep(void)
void pemu_loop_end(void)
{
/* do one more frame for menu bg */
plat_video_set_size(320, 240);
pemu_forced_frame(0, 1);
g_menubg_src_w = g_screen_width;
g_menubg_src_h = g_screen_height;
g_menubg_src_pp = g_screen_ppitch;
if (ghost_buf) {
free(ghost_buf);
ghost_buf = NULL;