platforms, display pad overlay and storyware pages for Pico

This commit is contained in:
kub 2024-03-20 23:43:10 +01:00
parent da4148881e
commit 15cc45c0da
14 changed files with 260 additions and 109 deletions

View file

@ -196,9 +196,12 @@ static void draw_pico_ptr(void)
{
int up = (PicoPicohw.pen_pos[0]|PicoPicohw.pen_pos[1]) & 0x8000;
int x, y, pitch = 320, offs;
// storyware pages are actually squished, 2:1
int h = (pico_inp_mode == 1 ? 160 : linecount);
if (h < 224) y++;
x = ((pico_pen_x * colcount * ((1ULL<<32)/320 + 1)) >> 32) + firstcol;
y = ((pico_pen_y * linecount * ((1ULL<<32)/224 + 1)) >> 32) + firstline;
y = ((pico_pen_y * h * ((1ULL<<32)/224 + 1)) >> 32) + firstline;
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
pitch = 240;
@ -210,16 +213,18 @@ static void draw_pico_ptr(void)
unsigned short *p = (unsigned short *)g_screen_ptr + offs;
int o = (up ? 0x0000 : 0xffff), _ = (up ? 0xffff : 0x0000);
p[-pitch-1] ^= _; p[-pitch] ^= o; p[-pitch+1] ^= _;
p[1] ^= o; p[0] ^= o; p[1] ^= o;
p[pitch-1] ^= _; p[pitch] ^= o; p[pitch+1] ^= _;
p[-pitch-1] ^= o; p[-pitch] ^= _; p[-pitch+1] ^= _; p[-pitch+2] ^= o;
p[-1] ^= _; p[0] ^= o; p[1] ^= o; p[2] ^= _;
p[pitch-1] ^= _; p[pitch] ^= o; p[pitch+1] ^= o; p[pitch+2] ^= _;
p[2*pitch-1]^= o; p[2*pitch]^= _; p[2*pitch+1]^= _; p[2*pitch+2]^= o;
} else {
unsigned char *p = (unsigned char *)g_screen_ptr + offs;
int o = (up ? 0xe0 : 0xf0), _ = (up ? 0xf0 : 0xe0);
p[-pitch-1] = _; p[-pitch] = o; p[-pitch+1] = _;
p[-1] = o; p[0] = o; p[1] = o;
p[pitch-1] = _; p[pitch] = o; p[pitch+1] = _;
p[-pitch-1] = o; p[-pitch] = _; p[-pitch+1] = _; p[-pitch+2] = o;
p[-1] = _; p[0] = o; p[1] = o; p[2] = _;
p[pitch-1] = _; p[pitch] = o; p[pitch+1] = o; p[pitch+2] = _;
p[2*pitch-1]= o; p[2*pitch]= _; p[2*pitch+1]= _; p[2*pitch+2]= o;
}
}
@ -434,8 +439,15 @@ void pemu_finalize_frame(const char *fps, const char *notice)
osd_text(osd_fps_x, osd_y, fps);
if ((PicoIn.AHW & PAHW_MCD) && (emu_opt & EOPT_EN_CD_LEDS))
draw_cd_leds();
if ((PicoIn.AHW & PAHW_PICO) && (currentConfig.EmuOpt & EOPT_PICO_PEN))
if (pico_inp_mode) draw_pico_ptr();
if (PicoIn.AHW & PAHW_PICO) {
int h = linecount, w = colcount;
u16 *pd = g_screen_ptr + firstline*g_screen_ppitch + firstcol;
if (pico_inp_mode && is_16bit_mode())
emu_pico_overlay(pd, w, h, g_screen_ppitch);
if (pico_inp_mode /*== 2 || overlay*/)
draw_pico_ptr();
}
}
void plat_video_flip(void)