From: kub Date: Wed, 28 Sep 2022 18:43:33 +0000 (+0000) Subject: psp, more fps, improve sms/gg scaling X-Git-Tag: v2.00~295 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6370b1d401e9edf32eb96ecc3022bfbd660d433c;p=picodrive.git psp, more fps, improve sms/gg scaling --- diff --git a/platform/common/emu.h b/platform/common/emu.h index 0be17f97..fc36f0fb 100644 --- a/platform/common/emu.h +++ b/platform/common/emu.h @@ -45,7 +45,7 @@ enum { EOPT_SCALE_WIDE, // DAR 14:9 EOPT_SCALE_FULL, // DAR 16:9 // PSP vert: - EOPT_VSCALE_PAL = 1, // always 240 lines + EOPT_VSCALE_43 = 1, // DAR 4:3 EOPT_VSCALE_FULL, // zoomed to full height }; diff --git a/platform/psp/emu.c b/platform/psp/emu.c index a76d5839..7868bf79 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -189,8 +189,7 @@ static void set_scaling_params(void) g_vertices[1].y = fbimg_yoffs + fbimg_height; if (!is_16bit_mode()) { // 8-bit modes have an 8 px overlap area on the left - int offs = out_w == 248 ? 16 : 8; - g_vertices[0].u += offs; g_vertices[1].u += offs; + g_vertices[0].u += 8; g_vertices[1].u += 8; } if (border_hack) { g_vertices[0].u++; g_vertices[1].u--; @@ -594,7 +593,9 @@ void pemu_prep_defconfig(void) defaultConfig.CPUclock = 333; defaultConfig.filter = EOPT_FILTER_BILINEAR; // bilinear filtering defaultConfig.scaling = EOPT_SCALE_43; - defaultConfig.vscaling = EOPT_VSCALE_FULL; + defaultConfig.vscaling = EOPT_VSCALE_43; + defaultConfig.renderer = RT_8BIT_ACC; + defaultConfig.renderer32x = RT_8BIT_ACC; defaultConfig.EmuOpt |= EOPT_SHOW_RTC; } @@ -686,18 +687,18 @@ 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; + if (col_count == 248) // mind aspect ration when blanking 1st column + col_count = 256; + switch (currentConfig.vscaling) { - case EOPT_VSCALE_PAL: - vscale = (float)270/240; + case EOPT_VSCALE_43: + // ugh, mind GG... + if (line_count >= 160) + line_count = (Pico.m.pal ? 240 : 224); + vscale = (float)270/line_count; break; case EOPT_VSCALE_FULL: vscale = (float)270/line_count; diff --git a/platform/psp/in_psp.c b/platform/psp/in_psp.c index 94e2d396..c56173d2 100644 --- a/platform/psp/in_psp.c +++ b/platform/psp/in_psp.c @@ -52,7 +52,12 @@ static int lg2(unsigned v) static unsigned in_psp_get_bits(void) { - return psp_pad_read(0) & 0xf000ffff; + unsigned mask = PSP_NUB_UP|PSP_NUB_DOWN|PSP_NUB_LEFT|PSP_NUB_RIGHT | + PSP_CTRL_UP|PSP_CTRL_DOWN|PSP_CTRL_LEFT|PSP_CTRL_RIGHT | + PSP_CTRL_CIRCLE|PSP_CTRL_CROSS|PSP_CTRL_TRIANGLE|PSP_CTRL_SQUARE | + PSP_CTRL_LTRIGGER|PSP_CTRL_RTRIGGER|PSP_CTRL_SELECT|PSP_CTRL_START; + + return psp_pad_read(0) & mask; } static void in_psp_probe(const in_drv_t *drv) diff --git a/platform/psp/menu.c b/platform/psp/menu.c index 81356b29..d1710a1b 100644 --- a/platform/psp/menu.c +++ b/platform/psp/menu.c @@ -1,6 +1,6 @@ static const char *men_hscaling_opts[] = { "OFF", "4:3", "wide", "fullscreen", NULL }; -static const char *men_vscaling_opts[] = { "OFF", "PAL", "fullscreen", NULL }; +static const char *men_vscaling_opts[] = { "OFF", "4:3", "fullscreen", NULL }; static const char *men_filter_opts[] = { "nearest", "bilinear" }; #define MENU_OPTIONS_GFX \ diff --git a/platform/psp/plat.c b/platform/psp/plat.c index fb7e310c..287759b9 100644 --- a/platform/psp/plat.c +++ b/platform/psp/plat.c @@ -68,7 +68,7 @@ void plat_target_finish(void) void plat_video_flip(void) { g_menubg_src_ptr = psp_screen; - psp_video_flip(currentConfig.EmuOpt & EOPT_VSYNC); + psp_video_flip(currentConfig.EmuOpt & EOPT_VSYNC, 1); g_screen_ptr = VRAM_CACHED_STUFF + (psp_screen - VRAM_FB0); plat_video_set_buffer(g_screen_ptr); } @@ -94,7 +94,7 @@ void plat_video_menu_begin(void) void plat_video_menu_end(void) { plat_video_wait_vsync(); - plat_video_flip(); + psp_video_flip(0, 0); } /* terminate menu display */ diff --git a/platform/psp/psp.c b/platform/psp/psp.c index f78de70a..cf69ffa5 100644 --- a/platform/psp/psp.c +++ b/platform/psp/psp.c @@ -192,12 +192,12 @@ void psp_finish(void) sceKernelExitGame(); } -void psp_video_flip(int wait_vsync) +void psp_video_flip(int wait_vsync, int other) { - void *fb = (void *)((unsigned long)psp_screen & ~0x40000000); - sceGuSync(0, 0); + unsigned long fb = (unsigned long)psp_screen & ~0x40000000; + if (other) fb ^= 0x44000; if (wait_vsync) sceDisplayWaitVblankStart(); - sceDisplaySetFrameBuf(fb, 512, PSP_DISPLAY_PIXEL_FORMAT_565, + sceDisplaySetFrameBuf((void *)fb, 512, PSP_DISPLAY_PIXEL_FORMAT_565, wait_vsync ? PSP_DISPLAY_SETBUF_IMMEDIATE : PSP_DISPLAY_SETBUF_NEXTFRAME); current_screen ^= 1; psp_screen = current_screen ? VRAM_FB0 : VRAM_FB1; diff --git a/platform/psp/psp.h b/platform/psp/psp.h index c46fdcaa..c8d4de82 100644 --- a/platform/psp/psp.h +++ b/platform/psp/psp.h @@ -38,7 +38,7 @@ extern int psp_unhandled_suspend; void *psp_video_get_active_fb(void); void psp_video_switch_to_single(void); -void psp_video_flip(int wait_vsync); +void psp_video_flip(int wait_vsync, int other); extern void *psp_screen; unsigned int psp_pad_read(int blocking); @@ -52,10 +52,10 @@ void psp_wait_suspend(void); void psp_resume_suspend(void); /* fake 'nub' btns, mapped to the 4 unused upper bits of ctrl buttons */ -#define PSP_NUB_UP (1 << 28) -#define PSP_NUB_RIGHT (1 << 29) -#define PSP_NUB_DOWN (1 << 30) -#define PSP_NUB_LEFT (1 << 31) +#define PSP_NUB_UP (1 << 26) +#define PSP_NUB_RIGHT (1 << 27) +#define PSP_NUB_DOWN (1 << 28) +#define PSP_NUB_LEFT (1 << 29) /* from menu.c */ void psp_menu_init(void);