From: kub Date: Wed, 10 Nov 2021 22:08:49 +0000 (+0100) Subject: platform, fix vertical scaling, aspect ratio handling (gp2x, psp) X-Git-Tag: v2.00~423 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=495fe1fdad5d394836be44ab2c52b695e9c5d2cb;p=picodrive.git platform, fix vertical scaling, aspect ratio handling (gp2x, psp) --- diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 70c6d3dc..d01da070 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -256,8 +256,11 @@ static int ld_left, ld_lines; // numbers in Q1 format static int EmuScanBegin16_ld(unsigned int num) { - if ((signed int)(ld_counter - num) > 100) - ld_counter = 0; + if ((signed int)(ld_counter - num) > 100) { + // vsync, offset so that the upscaled image is centered + ld_counter = 120 - (120-num) * (ld_lines+2)/ld_lines; + ld_left = ld_lines; + } if (emu_scan_begin) return emu_scan_begin(ld_counter); @@ -586,6 +589,12 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co int scalex = 320, scaley = 240; int ln_offs = 0; + /* NTSC always has 224 visible lines, anything smaller has bars */ + if (line_count < 224 && line_count > 144) { + start_line -= (224-line_count) /2; + line_count = 224; + } + /* line doubling for swscaling, also needed for bg frames */ if (currentConfig.vscaling == EOPT_SCALE_SW && line_count < 240) { ld_lines = ld_left = 2*line_count / (240 - line_count); diff --git a/platform/psp/emu.c b/platform/psp/emu.c index 59ccab56..4b98db0b 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -679,6 +679,12 @@ void plat_update_volume(int has_changed, int is_up) /* prepare for MD screen mode change */ void emu_video_mode_change(int start_line, int line_count, int start_col, int col_count) { + /* NTSC always has 224 visible lines, anything smaller has bars */ + if (line_count < 224 && line_count > 144) { + start_line -= (224-line_count) /2; + line_count = 224; + } + out_y = start_line; out_x = start_col; out_h = line_count; out_w = col_count;