MA_OPT_SCALER_C,
} menu_id;
-enum {
- SCALE_1_1,
- SCALE_4_3,
- SCALE_4_3v2,
- SCALE_FULLSCREEN,
- SCALE_CUSTOM,
-};
-
static int last_vout_w, last_vout_h, last_vout_bpp;
-static int scaling, cpu_clock, cpu_clock_st, volume_boost, frameskip;
+static int cpu_clock, cpu_clock_st, volume_boost, frameskip;
static char rom_fname_reload[MAXPATHLEN];
static char last_selected_fname[MAXPATHLEN];
static int warned_about_bios, region, in_type_sel1, in_type_sel2;
static int psx_clock;
static int memcard1_sel, memcard2_sel;
-int g_opts;
+int g_opts, g_scaler;
int soft_scaling, analog_deadzone; // for Caanoo
int filter;
emu_set_default_config();
g_opts = 0;
- scaling = SCALE_4_3;
+ g_scaler = SCALE_4_3;
volume_boost = 0;
frameskip = 0;
analog_deadzone = 50;
CE_CONFIG_VAL(Cpu),
CE_CONFIG_VAL(CdrReschedule),
CE_INTVAL(region),
- CE_INTVAL_V(scaling, 2),
+ CE_INTVAL_V(g_scaler, 2),
CE_INTVAL(g_layer_x),
CE_INTVAL(g_layer_y),
CE_INTVAL(g_layer_w),
{
unsigned int inp;
- scaling = SCALE_CUSTOM;
+ g_scaler = SCALE_CUSTOM;
plat_gvideo_open(Config.PsxType);
static menu_entry e_menu_gfx_options[] =
{
- mee_enum ("Scaler", MA_OPT_SCALER, scaling, men_scaler),
+ mee_enum ("Scaler", MA_OPT_SCALER, g_scaler, men_scaler),
mee_onoff ("Software Scaling", MA_OPT_SCALER2, soft_scaling, 1),
mee_enum ("Filter", MA_OPT_FILTERING, filter, men_dummy),
// mee_onoff ("Vsync", 0, vsync, 1),
void menu_notify_mode_change(int w, int h, int bpp)
{
- float mult;
- int imult;
-
last_vout_w = w;
last_vout_h = h;
last_vout_bpp = bpp;
-
- // XXX: should really menu code cotrol the layer size?
- switch (scaling) {
- case SCALE_1_1:
- g_layer_w = w; g_layer_h = h;
- break;
-
- case SCALE_4_3v2:
- if (h > g_menuscreen_h || (240 < h && h <= 360))
- goto fractional_4_3;
-
- // 4:3 that prefers integer scaling
- imult = g_menuscreen_h / h;
- g_layer_w = w * imult;
- g_layer_h = h * imult;
- mult = (float)g_layer_w / (float)g_layer_h;
- if (mult < 1.25f || mult > 1.666f)
- g_layer_w = 4.0f/3.0f * (float)g_layer_h;
- printf(" -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
- break;
-
- fractional_4_3:
- case SCALE_4_3:
- mult = 240.0f / (float)h * 4.0f / 3.0f;
- if (h > 256)
- mult *= 2.0f;
- g_layer_w = mult * (float)g_menuscreen_h;
- g_layer_h = g_menuscreen_h;
- printf(" -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
- break;
-
- case SCALE_FULLSCREEN:
- g_layer_w = g_menuscreen_w;
- g_layer_h = g_menuscreen_h;
- break;
-
- default:
- break;
- }
-
- g_layer_x = g_menuscreen_w / 2 - g_layer_w / 2;
- g_layer_y = g_menuscreen_h / 2 - g_layer_h / 2;
- if (g_layer_x < 0) g_layer_x = 0;
- if (g_layer_y < 0) g_layer_y = 0;
- if (g_layer_w > g_menuscreen_w) g_layer_w = g_menuscreen_w;
- if (g_layer_h > g_menuscreen_h) g_layer_w = g_menuscreen_h;
}
static void menu_leave_emu(void)
plat_video_menu_leave();
- menu_notify_mode_change(last_vout_w, last_vout_h, last_vout_bpp);
-
psxCpu = (Config.Cpu == CPU_INTERPRETER) ? &psxInt : &psxRec;
if (psxCpu != prev_cpu)
// note that this does not really reset, just clears drc caches
print_cpu_usage(w, h, xborder);
}
+/* update scaler target size according to user settings */
+static void update_layer_size(int w, int h)
+{
+ float mult;
+ int imult;
+
+ switch (g_scaler) {
+ case SCALE_1_1:
+ g_layer_w = w; g_layer_h = h;
+ break;
+
+ case SCALE_4_3v2:
+ if (h > g_menuscreen_h || (240 < h && h <= 360))
+ goto fractional_4_3;
+
+ // 4:3 that prefers integer scaling
+ imult = g_menuscreen_h / h;
+ g_layer_w = w * imult;
+ g_layer_h = h * imult;
+ mult = (float)g_layer_w / (float)g_layer_h;
+ if (mult < 1.25f || mult > 1.666f)
+ g_layer_w = 4.0f/3.0f * (float)g_layer_h;
+ printf(" -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
+ break;
+
+ fractional_4_3:
+ case SCALE_4_3:
+ mult = 240.0f / (float)h * 4.0f / 3.0f;
+ if (h > 256)
+ mult *= 2.0f;
+ g_layer_w = mult * (float)g_menuscreen_h;
+ g_layer_h = g_menuscreen_h;
+ printf(" -> %dx%d %.1f\n", g_layer_w, g_layer_h, mult);
+ break;
+
+ case SCALE_FULLSCREEN:
+ g_layer_w = g_menuscreen_w;
+ g_layer_h = g_menuscreen_h;
+ break;
+
+ default:
+ break;
+ }
+
+ g_layer_x = g_menuscreen_w / 2 - g_layer_w / 2;
+ g_layer_y = g_menuscreen_h / 2 - g_layer_h / 2;
+ if (g_layer_x < 0) g_layer_x = 0;
+ if (g_layer_y < 0) g_layer_y = 0;
+ if (g_layer_w > g_menuscreen_w) g_layer_w = g_menuscreen_w;
+ if (g_layer_h > g_menuscreen_h) g_layer_h = g_menuscreen_h;
+}
+
static void *pl_vout_set_mode(int w, int h, int bpp)
{
// special h handling, Wipeout likes to change it by 1-6
pl_vout_h = psx_h = h;
pl_vout_bpp = psx_bpp = bpp;
+ update_layer_size(pl_vout_w, pl_vout_h);
+
pl_vout_buf = plat_gvideo_set_mode(&pl_vout_w, &pl_vout_h, &pl_vout_bpp);
if (pl_vout_buf == NULL && pl_rearmed_cbs.pl_vout_raw_flip == NULL)
fprintf(stderr, "failed to set mode %dx%d@%d\n",