aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authornotaz2012-02-27 00:23:10 +0200
committernotaz2012-02-28 01:48:59 +0200
commita72ac8031937bb80f36e9392d07724a954995029 (patch)
treed55a307bbdfca908a6f012f4169c84b7900ff1f0 /frontend
parent0b1dbe6bc25227c910a4dea2fadcdda540add969 (diff)
downloadpcsx_rearmed-a72ac8031937bb80f36e9392d07724a954995029.tar.gz
pcsx_rearmed-a72ac8031937bb80f36e9392d07724a954995029.tar.bz2
pcsx_rearmed-a72ac8031937bb80f36e9392d07724a954995029.zip
frontend: add an option to disable scaling (Caanoo)
some minor menu tuning too
Diffstat (limited to 'frontend')
-rw-r--r--frontend/menu.c40
-rw-r--r--frontend/menu.h2
-rw-r--r--frontend/plat_pollux.c37
3 files changed, 46 insertions, 33 deletions
diff --git a/frontend/menu.c b/frontend/menu.c
index 51476f5..2cfcc6e 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -69,8 +69,11 @@ typedef enum
MA_OPT_SAVECFG,
MA_OPT_SAVECFG_GAME,
MA_OPT_CPU_CLOCKS,
- MA_OPT_FILTERING,
MA_OPT_DISP_OPTS,
+ MA_OPT_SCALER,
+ MA_OPT_SCALER2,
+ MA_OPT_FILTERING,
+ MA_OPT_SCALER_C,
} menu_id;
enum {
@@ -89,7 +92,7 @@ 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 analog_deadzone; // for Caanoo
+int soft_scaling, analog_deadzone; // for Caanoo
#ifdef __ARM_ARCH_7A__
#define DEFAULT_PSX_CLOCK 57
@@ -216,6 +219,7 @@ static void menu_set_defconfig(void)
volume_boost = 0;
frameskip = 0;
analog_deadzone = 50;
+ soft_scaling = 1;
psx_clock = DEFAULT_PSX_CLOCK;
region = 0;
@@ -1179,10 +1183,11 @@ static int menu_loop_cscaler(int id, int keys)
static menu_entry e_menu_gfx_options[] =
{
- mee_enum ("Scaler", 0, scaling, men_scaler),
+ mee_enum ("Scaler", MA_OPT_SCALER, scaling, 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),
- mee_cust_h ("Setup custom scaler", 0, menu_loop_cscaler, NULL, h_cscaler),
+ mee_cust_h ("Setup custom scaler", MA_OPT_SCALER_C, menu_loop_cscaler, NULL, h_cscaler),
mee_end,
};
@@ -1380,7 +1385,8 @@ static int menu_loop_plugin_options(int id, int keys)
// ------------ adv options menu ------------
-static const char h_cfg_psxclk[] = "Over/under-clock the PSX, default is " DEFAULT_PSX_CLOCK_S "\n";
+static const char h_cfg_psxclk[] = "Over/under-clock the PSX, default is " DEFAULT_PSX_CLOCK_S "\n"
+ "(lower value - less work for the emu, may be faster)";
static const char h_cfg_nosmc[] = "Will cause crashes when loading, break memcards";
static const char h_cfg_gteunn[] = "May cause graphical glitches";
static const char h_cfg_gteflgs[] = "Will cause graphical glitches";
@@ -1488,7 +1494,7 @@ static int menu_loop_options(int id, int keys)
int i;
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
- e_menu_options[i].enabled = cpu_clock != 0 ? 1 : 0;
+ e_menu_options[i].enabled = cpu_clock_st != 0 ? 1 : 0;
me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, ready_to_go && CdromId[0]);
me_loop(e_menu_options, &sel);
@@ -1498,12 +1504,12 @@ static int menu_loop_options(int id, int keys)
// ------------ debug menu ------------
-static void draw_frame_debug(GPUFreeze_t *gpuf)
+static void draw_frame_debug(GPUFreeze_t *gpuf, int x, int y)
{
int w = min(g_menuscreen_w, 1024);
int h = min(g_menuscreen_h, 512);
u16 *d = g_menuscreen_ptr;
- u16 *s = (u16 *)gpuf->psxVRam;
+ u16 *s = (u16 *)gpuf->psxVRam + y * 1024 + x;
char buff[64];
int ty = 1;
@@ -1523,8 +1529,8 @@ static void draw_frame_debug(GPUFreeze_t *gpuf)
static void debug_menu_loop(void)
{
+ int inp, df_x = 0, df_y = 0;
GPUFreeze_t *gpuf;
- int inp;
gpuf = malloc(sizeof(*gpuf));
if (gpuf == NULL)
@@ -1533,13 +1539,16 @@ static void debug_menu_loop(void)
while (1)
{
menu_draw_begin(0);
- draw_frame_debug(gpuf);
+ draw_frame_debug(gpuf, df_x, df_y);
menu_draw_end();
inp = in_menu_wait(PBTN_MOK|PBTN_MBACK|PBTN_MA2|PBTN_MA3|PBTN_L|PBTN_R |
- PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 70);
- if (inp & PBTN_MBACK)
- break;
+ PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT, 10);
+ if (inp & PBTN_MBACK) break;
+ else if (inp & PBTN_UP) { if (df_y > 0) df_y--; }
+ else if (inp & PBTN_DOWN) { if (df_y < 512 - g_menuscreen_h) df_y++; }
+ else if (inp & PBTN_LEFT) { if (df_x > 0) df_x--; }
+ else if (inp & PBTN_RIGHT) { if (df_x < 1024 - g_menuscreen_w) df_x++; }
}
free(gpuf);
@@ -2228,9 +2237,12 @@ void menu_init(void)
readpng(g_menubg_src_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h);
#ifndef __ARM_ARCH_7A__ /* XXX */
- me_enable(e_menu_options, MA_OPT_DISP_OPTS, 0);
+ me_enable(e_menu_gfx_options, MA_OPT_SCALER, 0);
+ me_enable(e_menu_gfx_options, MA_OPT_FILTERING, 0);
+ me_enable(e_menu_gfx_options, MA_OPT_SCALER_C, 0);
me_enable(e_menu_keyconfig, MA_CTRL_NUBS_BTNS, 0);
#else
+ me_enable(e_menu_gfx_options, MA_OPT_SCALER2, 0);
me_enable(e_menu_keyconfig, MA_CTRL_VIBRATION, 0);
me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0);
#endif
diff --git a/frontend/menu.h b/frontend/menu.h
index 16f85a9..7f366df 100644
--- a/frontend/menu.h
+++ b/frontend/menu.h
@@ -14,4 +14,4 @@ enum opts {
};
extern int g_opts;
-extern int analog_deadzone;
+extern int soft_scaling, analog_deadzone;
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index af12f1e..d402e84 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -46,7 +46,7 @@ static unsigned int saved_video_regs[2][6];
static unsigned short *psx_vram;
static unsigned int psx_vram_padds[512];
static int psx_step, psx_width, psx_height, psx_bpp;
-static int psx_offset_x, psx_offset_y;
+static int psx_offset_x, psx_offset_y, psx_src_width, psx_src_height;
static int fb_offset_x, fb_offset_y;
// TODO: get rid of this
@@ -60,6 +60,7 @@ int omap_enable_layer(int enabled)
}
static void caanoo_init(void);
+static void *pl_vout_set_mode(int w, int h, int bpp);
static void *fb_flip(void)
@@ -248,9 +249,7 @@ void plat_video_menu_leave(void)
memset(g_menuscreen_ptr, 0, 320*240 * psx_bpp/8);
g_menuscreen_ptr = fb_flip();
- memset(g_menuscreen_ptr, 0, 320*240 * psx_bpp/8);
-
- pollux_changemode(psx_bpp, 1);
+ pl_vout_set_mode(psx_width, psx_height, psx_bpp);
}
void *plat_prepare_screenshot(int *w, int *h, int *bpp)
@@ -304,7 +303,7 @@ static void raw_flip_dma(int x, int y)
int spsx_line = y + psx_offset_y;
int spsx_offset = (x + psx_offset_x) & 0x3f8;
int dst_stride = 320 * psx_bpp / 8;
- int len = psx_width * psx_bpp / 8;
+ int len = psx_src_width * psx_bpp / 8;
int i;
warm_cache_op_all(WOP_D_CLEAN);
@@ -322,7 +321,7 @@ static void raw_flip_dma(int x, int y)
DMA_REG(0x24) = 1;
}
- for (i = psx_height; i > 0; i--, spsx_line += psx_step, dst += dst_stride) {
+ for (i = psx_src_height; i > 0; i--, spsx_line += psx_step, dst += dst_stride) {
while ((DMA_REG(0x2c) & 0x0f) < 4)
spend_cycles(10);
@@ -336,7 +335,7 @@ static void raw_flip_dma(int x, int y)
if (psx_bpp == 16) {
pl_vout_buf = g_menuscreen_ptr;
- pl_print_hud(320, fb_offset_y + psx_height, fb_offset_x);
+ pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x);
}
g_menuscreen_ptr = fb_flip();
@@ -353,19 +352,19 @@ static void name(int x, int y)
(fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8; \
unsigned int src = (y + psx_offset_y) * 1024 + x + psx_offset_x; \
int dst_stride = 320 * psx_bpp / 8; \
- int len = psx_width * psx_bpp / 8; \
+ int len = psx_src_width * psx_bpp / 8; \
int i; \
\
pcnt_start(PCNT_BLIT); \
\
- for (i = psx_height; i > 0; i--, src += psx_step * 1024, dst += dst_stride) { \
+ for (i = psx_src_height; i > 0; i--, src += psx_step * 1024, dst += dst_stride) { \
src &= 1024*512-1; \
blitfunc(dst, vram + src, len); \
} \
\
if (psx_bpp == 16) { \
pl_vout_buf = g_menuscreen_ptr; \
- pl_print_hud(320, fb_offset_y + psx_height, fb_offset_x); \
+ pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x); \
} \
\
g_menuscreen_ptr = fb_flip(); \
@@ -381,15 +380,17 @@ make_flip_func(raw_flip_soft_640, blit320_640)
static void *pl_vout_set_mode(int w, int h, int bpp)
{
- static int old_w, old_h, old_bpp;
int poff_w, poff_h, w_max;
- if (!w || !h || !bpp || (w == old_w && h == old_h && bpp == old_bpp))
+ if (!w || !h || !bpp)
return NULL;
printf("psx mode: %dx%d@%d\n", w, h, bpp);
+ psx_width = w;
+ psx_height = h;
+ psx_bpp = bpp;
- switch (w + (bpp != 16)) {
+ switch (w + (bpp != 16) + !soft_scaling) {
case 640:
pl_rearmed_cbs.pl_vout_raw_flip = raw_flip_soft_640;
w_max = 640;
@@ -431,9 +432,8 @@ static void *pl_vout_set_mode(int w, int h, int bpp)
psx_offset_x = poff_w;
psx_offset_y = poff_h;
- psx_width = w;
- psx_height = h;
- psx_bpp = bpp;
+ psx_src_width = w;
+ psx_src_height = h;
if (fb_offset_x || fb_offset_y) {
// not fullscreen, must clear borders
@@ -521,6 +521,7 @@ void plat_init(void)
}
fb_vaddrs[1] = (char *)fb_vaddrs[0] + 320*240*4;
+ memset(fb_vaddrs[0], 0, FB_VRAM_SIZE);
pollux_changemode(16, 0);
g_menuscreen_w = 320;
g_menuscreen_h = 240;
@@ -607,8 +608,8 @@ void plat_init(void)
pl_rearmed_cbs.pl_vout_set_mode = pl_vout_set_mode;
pl_rearmed_cbs.pl_vout_set_raw_vram = pl_vout_set_raw_vram;
- psx_width = 320;
- psx_height = 240;
+ psx_src_width = 320;
+ psx_src_height = 240;
psx_bpp = 16;
pl_rearmed_cbs.screen_w = 320;