static u16 __attribute__((aligned(16))) osd_buf[512*8]; // buffer for osd text
-static int h32_mode = 0;
static int out_x, out_y;
static int out_w, out_h;
+static float hscale, vscale;
static struct in_default_bind in_psp_defbinds[] =
{
int fbimg_width, fbimg_height, fbimg_xoffs, fbimg_yoffs, border_hack = 0;
g_vertices[0].z = g_vertices[1].z = 0;
- fbimg_height = (int)(out_h * currentConfig.scale + 0.5);
- if (!h32_mode)
- fbimg_width = (int)(out_w * currentConfig.scale * currentConfig.hscale40 + 0.5);
- else
- fbimg_width = (int)(out_w * currentConfig.scale * currentConfig.hscale32 + 0.5);
+ fbimg_height = (int)(out_h * vscale + 0.5);
+ fbimg_width = (int)(out_w * hscale + 0.5);
if (fbimg_width & 1) fbimg_width++; // make even
if (fbimg_height & 1) fbimg_height++;
sceGuClutMode(GU_PSM_5650,0,0xff,0);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
- if (currentConfig.scaling)
+ if (currentConfig.filter)
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
else sceGuTexFilter(GU_NEAREST, GU_NEAREST);
sceGuTexScale(1.0f,1.0f);
defaultConfig.s_PsndRate = 22050;
defaultConfig.s_PicoCDBuffers = 64;
defaultConfig.CPUclock = 333;
- defaultConfig.scaling = 1; // bilinear filtering for psp
- defaultConfig.scale = 1.20; // fullscreen
- defaultConfig.hscale40 = 1.25;
- defaultConfig.hscale32 = 1.56;
+ defaultConfig.filter = EOPT_FILTER_BILINEAR; // bilinear filtering
+ defaultConfig.scaling = EOPT_SCALE_43;
+ defaultConfig.vscaling = EOPT_VSCALE_FULL;
defaultConfig.EmuOpt |= EOPT_SHOW_RTC;
}
{
if (currentConfig.CPUclock < 33 || currentConfig.CPUclock > 333)
currentConfig.CPUclock = 333;
- if (currentConfig.scaling < 0.01)
- currentConfig.scaling = 0.01;
- if (currentConfig.hscale40 < 0.01)
- currentConfig.hscale40 = 0.01;
- if (currentConfig.hscale32 < 0.01)
- currentConfig.hscale32 = 0.01;
if (currentConfig.gamma < -4 || currentConfig.gamma > 16)
currentConfig.gamma = 0;
if (currentConfig.gamma2 < 0 || currentConfig.gamma2 > 2)
/* prepare for MD screen mode change */
void emu_video_mode_change(int start_line, int line_count, int start_col, int col_count)
{
- h32_mode = col_count < 320;
- out_y = start_line; out_x = (h32_mode ? 32 : 0);
- out_h = line_count; out_w = (h32_mode ? 256:320);
+ out_y = start_line; out_x = start_col;
+ out_h = line_count; out_w = col_count;
+
+ switch (currentConfig.vscaling) {
+ case EOPT_VSCALE_PAL:
+ vscale = (float)270/240;
+ break;
+ case EOPT_VSCALE_FULL:
+ vscale = (float)270/line_count;
+ break;
+ default:
+ vscale = 1;
+ break;
+ }
+ switch (currentConfig.scaling) {
+ case EOPT_SCALE_43:
+ hscale = (float)360/col_count;
+ break;
+ case EOPT_SCALE_WIDE:
+ hscale = (float)420/col_count;
+ break;
+ case EOPT_SCALE_FULL:
+ hscale = (float)480/col_count;
+ break;
+ default:
+ hscale = 1;
+ break;
+ }
vidResetMode();
- if (h32_mode) // clear borders from h40 remnants
+ if (col_count < 320) // clear borders from h40 remnants
clearArea(1);
}
-static const char h_scale43[] = "Scales low and high res to 4:3 screen size.\n"
- "For 240 line PAL use Scale factor 1.12";
-static const char h_scalefull[] = "Scales low and high res to full screen.\n"
- "For 240 line PAL use scaling 1.12, 1.6, 1.28";
+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_filter_opts[] = { "OFF", "bilinear" };
+
#define MENU_OPTIONS_GFX \
- mee_cust("Scale factor", MA_OPT3_SCALE, mh_scale, ms_scale), \
- mee_cust("Hor. scale (for low res. games)", MA_OPT3_HSCALE32, mh_scale, ms_scale), \
- mee_cust("Hor. scale (for hi res. games)", MA_OPT3_HSCALE40, mh_scale, ms_scale), \
- mee_onoff("Bilinear filtering", MA_OPT3_FILTERING, currentConfig.scaling, 1), \
- mee_range("Gamma adjustment", MA_OPT3_GAMMAA, currentConfig.gamma, -4, 16), \
- mee_range("Black level", MA_OPT3_BLACKLVL, currentConfig.gamma2, 0, 2), \
- mee_onoff("wait for vsync", MA_OPT3_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
- mee_cust_nosave("Set to unscaled centered", MA_OPT3_PRES_NOSCALE, mh_preset_scale, NULL), \
- mee_cust_nosave("Set to 4:3 scaled", MA_OPT3_PRES_SCALE43, mh_preset_scale, NULL), \
- mee_cust_nosave("Set to fullscreen", MA_OPT3_PRES_FULLSCR, mh_preset_scale, NULL), \
+ 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_h ("Scaler type", MA_OPT3_FILTERING, currentConfig.filter, men_filter_opts, NULL), \
+ mee_range ("Gamma adjustment", MA_OPT3_GAMMAA, currentConfig.gamma, -4, 16), \
+ mee_range ("Black level", MA_OPT3_BLACKLVL, currentConfig.gamma2, 0, 2), \
+ mee_onoff ("Wait for vsync", MA_OPT3_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
#define MENU_OPTIONS_ADV
-
-static const char *ms_scale(int id, int *offs)
-{
- float val = 0;
- switch (id) {
- case MA_OPT3_SCALE: val = currentConfig.scale; break;
- case MA_OPT3_HSCALE32: val = currentConfig.hscale32; break;
- case MA_OPT3_HSCALE40: val = currentConfig.hscale40; break;
- }
- sprintf(static_buff, "%.2f", val);
- return static_buff;
-}
-
-static int mh_scale(int id, int keys)
-{
- float *val = NULL;
- switch (id) {
- case MA_OPT3_SCALE: val = ¤tConfig.scale; break;
- case MA_OPT3_HSCALE32: val = ¤tConfig.hscale32; break;
- case MA_OPT3_HSCALE40: val = ¤tConfig.hscale40; break;
- }
- if (keys & PBTN_LEFT) *val += -0.01;
- if (keys & PBTN_RIGHT) *val += +0.01;
- if (*val < 0.01) *val = +0.01;
- return 0;
-}
-
-
-static int mh_preset_scale(int id, int keys)
-{
- switch (id) {
- case MA_OPT3_PRES_NOSCALE:
- currentConfig.scale = 1.0;
- currentConfig.hscale32 = 1.0;
- currentConfig.hscale40 = 1.0;
- break;
- case MA_OPT3_PRES_SCALE43:
- // parameters for 224 lines; for 240 lines scale = 1.125
- // moreover, H32 and H40 had the same width on a TV.
- currentConfig.scale = 1.2;
- currentConfig.hscale32 = 1.25;
- currentConfig.hscale40 = 1.0;
- break;
- case MA_OPT3_PRES_FULLSCR:
- // uses width 460 to avoid some ugly moiree effects
- currentConfig.scale = 1.2;
- currentConfig.hscale32 = 1.5;
- currentConfig.hscale40 = 1.2;
- break;
- }
- return 0;
-}
-
-static menu_entry e_menu_gfx_options[];
-
void psp_menu_init(void)
{
- int i;
- for (i = 0; e_menu_gfx_options[i].name; i++) {
- switch (e_menu_gfx_options[i].id) {
- case MA_OPT3_PRES_SCALE43: e_menu_gfx_options[i].help = h_scale43; break;
- case MA_OPT3_PRES_FULLSCR: e_menu_gfx_options[i].help = h_scalefull; break;
- }
- }
}