Skip to content

Commit

Permalink
psp, revisit scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Nov 30, 2023
1 parent 4b24b6b commit fc07fe2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
10 changes: 5 additions & 5 deletions platform/common/emu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ enum {
EOPT_SCALE_SW = 1,
EOPT_SCALE_HW,
// PSP horiz:
EOPT_SCALE_43 = 1, // DAR 4:3 (12:9)
EOPT_SCALE_WIDE, // DAR 14:9
EOPT_SCALE_FULL, // DAR 16:9
EOPT_SCALE_43 = 1, // 4:3 screen
EOPT_SCALE_STRETCH, // stretched to between _43 and _WIDE
EOPT_SCALE_WIDE, // stretched to match display width
// PSP vert:
EOPT_VSCALE_43 = 1, // DAR 4:3
EOPT_VSCALE_FULL, // zoomed to full height
EOPT_VSCALE_FULL = 1, // TV height scaled to screen height
EOPT_VSCALE_NOBORDER, // VDP area scaled to screen height
};

enum {
Expand Down
24 changes: 13 additions & 11 deletions platform/psp/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ void pemu_prep_defconfig(void)
defaultConfig.CPUclock = 333;
defaultConfig.filter = EOPT_FILTER_BILINEAR; // bilinear filtering
defaultConfig.scaling = EOPT_SCALE_43;
defaultConfig.vscaling = EOPT_VSCALE_43;
defaultConfig.vscaling = EOPT_VSCALE_FULL;
defaultConfig.renderer = RT_8BIT_ACC;
defaultConfig.renderer32x = RT_8BIT_ACC;
defaultConfig.EmuOpt |= EOPT_SHOW_RTC;
Expand Down Expand Up @@ -696,38 +696,40 @@ 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)
{
int h43 = (col_count >= 192 ? 320 : col_count); // ugh, mind GG...
int v43 = (line_count >= 192 ? Pico.m.pal ? 240 : 224 : line_count);

out_y = start_line; out_x = start_col;
out_h = line_count; out_w = col_count;

if (col_count == 248) // mind aspect ratio when blanking 1st column
col_count = 256;

switch (currentConfig.vscaling) {
case EOPT_VSCALE_43:
// ugh, mind GG...
if (line_count >= 160)
line_count = (Pico.m.pal ? 240 : 224);
case EOPT_VSCALE_FULL:
line_count = v43;
vscale = (float)270/line_count;
break;
case EOPT_VSCALE_FULL:
case EOPT_VSCALE_NOBORDER:
vscale = (float)270/line_count;
break;
default:
vscale = 1;
break;
}

switch (currentConfig.scaling) {
case EOPT_SCALE_43:
hscale = (float)360/col_count;
hscale = (vscale*h43)/col_count;
break;
case EOPT_SCALE_WIDE:
hscale = (float)420/col_count;
case EOPT_SCALE_STRETCH:
hscale = (vscale*h43/2 + 480/2)/col_count;
break;
case EOPT_SCALE_FULL:
case EOPT_SCALE_WIDE:
hscale = (float)480/col_count;
break;
default:
hscale = 1;
hscale = vscale;
break;
}

Expand Down
6 changes: 3 additions & 3 deletions platform/psp/menu.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

static const char *men_hscaling_opts[] = { "OFF", "4:3", "wide", "fullscreen", NULL };
static const char *men_vscaling_opts[] = { "OFF", "4:3", "fullscreen", NULL };
static const char *men_vscaling_opts[] = { "OFF", "fullscreen", "borderless", NULL };
static const char *men_hscaling_opts[] = { "1:1", "4:3", "extended", "fullwidth", NULL };
static const char *men_filter_opts[] = { "nearest", "bilinear", NULL };

#define MENU_OPTIONS_GFX \
mee_enum ("Horizontal scaling", MA_OPT_SCALING, currentConfig.scaling, men_hscaling_opts), \
mee_enum ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_vscaling_opts), \
mee_enum ("Aspect ratio", MA_OPT_SCALING, currentConfig.scaling, men_hscaling_opts), \
mee_enum ("Scaler type", MA_OPT3_FILTERING, currentConfig.filter, men_filter_opts), \
mee_range ("Gamma adjustment", MA_OPT3_GAMMAA, currentConfig.gamma, -4, 16), \
mee_range ("Black level", MA_OPT3_BLACKLVL, currentConfig.gamma2, 0, 2), \
Expand Down

0 comments on commit fc07fe2

Please sign in to comment.