From 23a289019c61bb64b2dcc6653f16ee8699308ae6 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 27 Nov 2021 04:00:01 +0100 Subject: [PATCH] 32x, fix poll detection regression (mars check) core, improve pad compatibility (6btn, mcd32x) linux+psp, improve sw upscaling --- pico/32x/memory.c | 4 ++-- pico/memory.c | 6 +++--- platform/linux/emu.c | 18 +++++++++++------- platform/psp/emu.c | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pico/32x/memory.c b/pico/32x/memory.c index 9ce7eefd..d2d2a5b3 100644 --- a/pico/32x/memory.c +++ b/pico/32x/memory.c @@ -1461,7 +1461,7 @@ static u32 REGPARM(2) sh2_read8_cs0(u32 a, SH2 *sh2) if ((a & 0x3fff0) == 0x4100) { d = p32x_vdp_read16(a); - p32x_sh2_poll_detect(a, sh2, SH2_STATE_VPOLL, 7); + p32x_sh2_poll_detect(a, sh2, SH2_STATE_VPOLL, 9); goto out_16to8; } @@ -1524,7 +1524,7 @@ static u32 REGPARM(2) sh2_read16_cs0(u32 a, SH2 *sh2) if ((a & 0x3fff0) == 0x4100) { d = p32x_vdp_read16(a); - p32x_sh2_poll_detect(a, sh2, SH2_STATE_VPOLL, 7); + p32x_sh2_poll_detect(a, sh2, SH2_STATE_VPOLL, 9); goto out; } diff --git a/pico/memory.c b/pico/memory.c index 6bdbec39..85e2e377 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -240,9 +240,9 @@ static u32 read_pad_6btn(int i, u32 out_bits) } else if(phase == 3) { if (out_bits & 0x40) - return (pad & 0x30) | ((pad >> 8) & 0xf); // ?1CB MXYZ + value = (pad & 0x30) | ((pad >> 8) & 0xf); // ?1CB MXYZ else - return ((pad & 0xc0) >> 2) | 0x0f; // ?0SA 1111 + value = ((pad & 0xc0) >> 2) | 0x0f; // ?0SA 1111 goto out; } @@ -281,7 +281,7 @@ static NOINLINE u32 port_read(int i) // disables output before doing TH-low read, so don't emulate it for TH. // Decap Attack reportedly doesn't work on Nomad but works on must // other MD revisions (different pull-up strength?). - if (PicoIn.AHW & PAHW_32X) // don't do it on 32X, it breaks WWF Raw + if (PicoIn.AHW & (PAHW_32X|PAHW_MCD)) // don't do it on 32X, it breaks WWF Raw out |= 0x7f & ~ctrl_reg; else out |= 0x3f & ~ctrl_reg; diff --git a/platform/linux/emu.c b/platform/linux/emu.c index c7565aaa..aad7ad7e 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -175,14 +175,18 @@ void pemu_finalize_frame(const char *fps, const char *notice) u16 *ps = ghost_buf; int y, h = currentConfig.vscaling == EOPT_SCALE_SW ? 240:out_h; int w = currentConfig.scaling == EOPT_SCALE_SW ? 320:out_w; - for (y = 0; y < h; y++) { - if (currentConfig.ghosting == 1) + if (currentConfig.ghosting == 1) + for (y = 0; y < h; y++) { v_blend((u32 *)pd, (u32 *)ps, w/2, p_075_round); - else + pd += g_screen_ppitch; + ps += w; + } + else + for (y = 0; y < h; y++) { v_blend((u32 *)pd, (u32 *)ps, w/2, p_05_round); - pd += g_screen_ppitch; - ps += w; - } + pd += g_screen_ppitch; + ps += w; + } } //#define FUNKEY_AUTHORIZE_TEXT_OVERLAY @@ -394,7 +398,7 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co PicoDrawSetCallbacks(cb_vscaling_begin,cb_vscaling_nop); break; case EOPT_SCALE_SW: - screen_y = (screen_h - 240)/2 + (out_h > 144); + screen_y = (screen_h - 240)/2 + (out_h < 240 && out_h > 144); // NTSC always has 224 visible lines, anything smaller has bars if (out_h < 224 && out_h > 144) screen_y += (224 - out_h)/2; diff --git a/platform/psp/emu.c b/platform/psp/emu.c index 4b98db0b..b6d1a346 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -104,7 +104,7 @@ static void change_renderer(int diff) static void apply_renderer(void) { - PicoIn.opt &= ~POPT_ALT_RENDERER; + PicoIn.opt &= ~(POPT_ALT_RENDERER|POPT_EN_SOFTSCALE); switch (get_renderer()) { case RT_16BIT: