partially revived platform support for PSP (unfinished) #2

scaling, release generation, fixes
still not planning to make this officially supported.
This commit is contained in:
kub 2021-01-13 22:26:41 +01:00
parent cdc6aac4c0
commit 6c5784f07f
13 changed files with 129 additions and 93 deletions

View file

@ -1,68 +1,64 @@
// TODO scaling configuration non-functional ATM
static const char *men_scaler[] = { "unscaled", "4:3", "fullscreen", NULL };
#if 0
static const char h_cscaler40[] = "Configures the custom scaler for wide resolution";
static const char h_cscaler32[] = "Configures the custom scaler for narrow resolution";
static int menu_loop_cscaler(int id, int keys)
{
unsigned int inp;
currentConfig.scaling = SCALE_CUSTOM;
pnd_setup_layer(1, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
pnd_restore_layer_data();
for (;;)
{
menu_draw_begin(0, 1);
menuscreen_memset_lines(g_menuscreen_ptr, 0, g_menuscreen_h);
text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch);
menu_draw_end();
inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT
|PBTN_R|PBTN_MOK|PBTN_MBACK, NULL, 40);
if (inp & PBTN_UP) g_layer_cy--;
if (inp & PBTN_DOWN) g_layer_cy++;
if (inp & PBTN_LEFT) g_layer_cx--;
if (inp & PBTN_RIGHT) g_layer_cx++;
if (!(inp & PBTN_R)) {
if (inp & PBTN_UP) g_layer_ch += 2;
if (inp & PBTN_DOWN) g_layer_ch -= 2;
if (inp & PBTN_LEFT) g_layer_cw += 2;
if (inp & PBTN_RIGHT) g_layer_cw -= 2;
}
if (inp & (PBTN_MOK|PBTN_MBACK))
break;
if (inp & (PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT)) {
if (g_layer_cx < 0) g_layer_cx = 0;
if (g_layer_cx > 640) g_layer_cx = 640;
if (g_layer_cy < 0) g_layer_cy = 0;
if (g_layer_cy > 420) g_layer_cy = 420;
if (g_layer_cw < 160) g_layer_cw = 160;
if (g_layer_ch < 60) g_layer_ch = 60;
if (g_layer_cx + g_layer_cw > 800)
g_layer_cw = 800 - g_layer_cx;
if (g_layer_cy + g_layer_ch > 480)
g_layer_ch = 480 - g_layer_cy;
pnd_setup_layer(1, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
}
}
pnd_setup_layer(0, g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch);
return 0;
}
#endif
#define MENU_OPTIONS_GFX \
mee_enum ("Scaler", MA_OPT_SCALING, currentConfig.scaling, \
men_scaler), \
mee_onoff ("Vsync", MA_OPT3_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
/* mee_cust_h ("Setup custom scaler", MA_NONE, menu_loop_cscaler, NULL, h_cscaler), \*/
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), \
#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 = &currentConfig.scale; break;
case MA_OPT3_HSCALE32: val = &currentConfig.hscale32; break;
case MA_OPT3_HSCALE40: val = &currentConfig.hscale40; break;
}
if (keys & PBTN_LEFT) *val += -0.01;
if (keys & PBTN_RIGHT) *val += +0.01;
if (*val <= 0) *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:
currentConfig.scale = 1.2;
currentConfig.hscale32 = 1.25;
currentConfig.hscale40 = 1.0;
break;
case MA_OPT3_PRES_FULLSCR:
currentConfig.scale = 1.2;
currentConfig.hscale32 = 1.56;
currentConfig.hscale40 = 1.25;
break;
}
return 0;
}