From d1ae0810df31a6707adb35510c375ffb678e4b8b Mon Sep 17 00:00:00 2001 From: kub Date: Sun, 12 Sep 2021 10:02:01 +0200 Subject: [PATCH] sms, fix drawing for new scaling code --- pico/mode4.c | 17 ++++++++++------- platform/linux/emu.c | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pico/mode4.c b/pico/mode4.c index 76cbfabc..6711febe 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -14,6 +14,7 @@ * - doubled sprites */ #include "pico_int.h" +#include static void (*FinalizeLineM4)(int line); static int skip_next_line; @@ -272,9 +273,10 @@ static void DrawDisplayM4(int scanline) } } +static void FinalizeLineRGB555M4(int line); void PicoFrameStartMode4(void) { - int lines = 192; + int lines = 192, coffs; skip_next_line = 0; screen_offset = 24; Pico.est.rendstatus = PDRAW_32_COLS; @@ -289,9 +291,13 @@ void PicoFrameStartMode4(void) lines = 224; } } + line_offset = PicoIn.opt & (POPT_DIS_32C_BORDER|POPT_EN_SOFTSCALE) ? 0 : 32; + coffs = line_offset; + if (FinalizeLineM4 == FinalizeLineRGB555M4) + line_offset = 0 /* done in FinalizeLine */; if (Pico.est.rendstatus != rendstatus_old || lines != rendlines) { - emu_video_mode_change(screen_offset, lines, line_offset, 256); + emu_video_mode_change(screen_offset, lines, coffs, 256); rendstatus_old = Pico.est.rendstatus; rendlines = lines; } @@ -352,8 +358,6 @@ void PicoDoHighPal555M4(void) Pico.est.HighPal[0xe0] = 0; } -#include - static void FinalizeLineRGB555M4(int line) { if (Pico.m.dirtyPal) @@ -379,15 +383,14 @@ static void FinalizeLine8bitM4(int line) void PicoDrawSetOutputMode4(pdso_t which) { - line_offset = PicoIn.opt & (POPT_DIS_32C_BORDER|POPT_EN_SOFTSCALE) ? 0 : 32; switch (which) { case PDF_8BIT: FinalizeLineM4 = FinalizeLine8bitM4; break; - case PDF_RGB555: FinalizeLineM4 = FinalizeLineRGB555M4; - line_offset = 0 /* done in FinalizeLine */; break; + case PDF_RGB555: FinalizeLineM4 = FinalizeLineRGB555M4; break; default: FinalizeLineM4 = NULL; PicoDrawSetInternalBuf(Pico.est.Draw2FB, 328); break; } + rendstatus_old = -1; } // vim:shiftwidth=2:ts=2:expandtab diff --git a/platform/linux/emu.c b/platform/linux/emu.c index 5cfea5d8..36898e61 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -172,6 +172,7 @@ void plat_video_set_buffer(void *buf) static void apply_renderer(void) { PicoIn.opt &= ~(POPT_ALT_RENDERER|POPT_EN_SOFTSCALE|POPT_DIS_32C_BORDER); + switch (get_renderer()) { case RT_16BIT: // 32X uses line mode for vscaling with accurate renderer, since @@ -195,7 +196,7 @@ static void apply_renderer(void) if (PicoIn.AHW & PAHW_32X) PicoDrawSetOutBuf(screen_buffer(g_screen_ptr), g_screen_ppitch * 2); - else if (is_16bit_mode()) { + if (is_16bit_mode()) { if (currentConfig.scaling == EOPT_SCALE_SW) { PicoIn.opt |= POPT_EN_SOFTSCALE; PicoIn.filter = currentConfig.filter; @@ -325,7 +326,6 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co screen_w = g_screen_width, screen_x = (screen_w - out_w)/2; screen_h = g_screen_height, screen_y = (screen_h - out_h)/2; - switch (currentConfig.scaling) { case EOPT_SCALE_HW: screen_w = out_w; -- 2.39.5