aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2011-09-25 15:40:31 +0300
committernotaz2011-09-27 02:09:30 +0300
commit41f55c9fb3e682e2c424e98ec70ab6aad226f85d (patch)
treea79e30ddf95aad52a8cd0ef75dfe13624bd09c87
parent2924e5711a8279228df4c03bc0a970c349e55938 (diff)
downloadpcsx_rearmed-41f55c9fb3e682e2c424e98ec70ab6aad226f85d.tar.gz
pcsx_rearmed-41f55c9fb3e682e2c424e98ec70ab6aad226f85d.tar.bz2
pcsx_rearmed-41f55c9fb3e682e2c424e98ec70ab6aad226f85d.zip
frontend: few more pollux/caanoo tweaks
-rw-r--r--frontend/menu.c2
-rw-r--r--frontend/plat_pollux.c38
-rw-r--r--frontend/plugin_lib.c22
-rw-r--r--frontend/plugin_lib.h2
4 files changed, 41 insertions, 23 deletions
diff --git a/frontend/menu.c b/frontend/menu.c
index a063fa1..ce65ccf 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -172,7 +172,7 @@ static void menu_set_defconfig(void)
scaling = SCALE_4_3;
volume_boost = 0;
frameskip = 0;
- analog_deadzone = 50;
+ analog_deadzone = 70;
region = 0;
in_type_sel1 = in_type_sel2 = 0;
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index d710e8f..d214b63 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -36,7 +36,7 @@ static int cpu_clock_allowed;
static unsigned short *psx_vram;
static unsigned int psx_vram_padds[512];
static int psx_offset, psx_step, psx_width, psx_height, psx_bpp;
-static int fb_offset;
+static int fb_offset_x, fb_offset_y;
// TODO: get rid of this
struct vout_fbdev;
@@ -217,7 +217,6 @@ void plat_video_menu_end(void)
void plat_video_menu_leave(void)
{
- pollux_changemode(psx_bpp, 1);
if (psx_vram == NULL) {
fprintf(stderr, "GPU plugin did not provide vram\n");
exit(1);
@@ -225,6 +224,12 @@ void plat_video_menu_leave(void)
in_set_config_int(in_name_to_id("evdev:pollux-analog"),
IN_CFG_ABS_DEAD_ZONE, analog_deadzone);
+
+ 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);
}
static void pl_vout_set_raw_vram(void *vram)
@@ -248,7 +253,6 @@ static void pl_vout_set_raw_vram(void *vram)
static void *pl_vout_set_mode(int w, int h, int bpp)
{
static int old_w, old_h, old_bpp;
- int fboff_w, fboff_h;
int poff_w, poff_h;
if (!w || !h || !bpp || (w == old_w && h == old_h && bpp == old_bpp))
@@ -271,14 +275,20 @@ static void *pl_vout_set_mode(int w, int h, int bpp)
poff_h = h / 2 - 240/2;
h = 240;
}
- fboff_w = 320/2 - w / 2;
- fboff_h = 240/2 - h / 2;
+ fb_offset_x = 320/2 - w / 2;
+ fb_offset_y = 240/2 - h / 2;
psx_offset = poff_h * 1024 + poff_w;
psx_width = w;
psx_height = h;
psx_bpp = bpp;
- fb_offset = fboff_h * 320 + fboff_w;
+
+ if (fb_offset_x || fb_offset_y) {
+ // not fullscreen, must clear borders
+ 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(bpp, 1);
@@ -300,7 +310,8 @@ static void spend_cycles(int loops)
/* this takes ~1.5ms, while ldm/stm ~1.95ms */
static void raw_flip_dma(int x, int y)
{
- unsigned int dst = fb_paddrs[fb_work_buf] + fb_offset * psx_bpp / 8;
+ unsigned int dst = fb_paddrs[fb_work_buf] +
+ (fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8;
int spsx_line = y + (psx_offset >> 10);
int spsx_offset = (x + psx_offset) & 0x3f8;
int dst_stride = 320 * psx_bpp / 8;
@@ -338,7 +349,7 @@ static void raw_flip_dma(int x, int y)
if (psx_bpp == 16) {
pl_vout_buf = g_menuscreen_ptr;
- pl_print_hud(psx_width, psx_height);
+ pl_print_hud(320, fb_offset_y + psx_height, fb_offset_x);
}
g_menuscreen_ptr = fb_flip();
@@ -348,7 +359,8 @@ static void raw_flip_dma(int x, int y)
static void raw_flip_soft(int x, int y)
{
unsigned short *src = psx_vram + y * 1024 + x + psx_offset;
- unsigned char *dst = (unsigned char *)g_menuscreen_ptr + fb_offset * psx_bpp / 8;
+ unsigned char *dst = (unsigned char *)g_menuscreen_ptr +
+ (fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8;
int dst_stride = 320 * psx_bpp / 8;
int len = psx_width * psx_bpp / 8;
//unsigned int st = timer_get();
@@ -361,13 +373,18 @@ static void raw_flip_soft(int x, int y)
if (psx_bpp == 16) {
pl_vout_buf = g_menuscreen_ptr;
- pl_print_hud(psx_width, psx_height);
+ pl_print_hud(320, fb_offset_y + psx_height, fb_offset_x);
}
g_menuscreen_ptr = fb_flip();
pl_flip_cnt++;
}
+static void *pl_vout_flip(void)
+{
+ return NULL;
+}
+
void plat_init(void)
{
const char *main_fb_name = "/dev/fb0";
@@ -474,6 +491,7 @@ void plat_init(void)
// hmh
plat_rescan_inputs();
+ pl_rearmed_cbs.pl_vout_flip = pl_vout_flip;
pl_rearmed_cbs.pl_vout_raw_flip = warm_ret == 0 ? raw_flip_dma : raw_flip_soft;
pl_rearmed_cbs.pl_vout_set_mode = pl_vout_set_mode;
pl_rearmed_cbs.pl_vout_set_raw_vram = pl_vout_set_raw_vram;
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index c931518..239e852 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -61,22 +61,22 @@ static __attribute__((noinline)) int get_cpu_ticks(void)
return ret;
}
-static void print_msg(int h)
+static void print_msg(int h, int border)
{
if (pl_vout_bpp == 16)
- pl_text_out16(2, h - 10, "%s", hud_msg);
+ pl_text_out16(border + 2, h - 10, "%s", hud_msg);
}
-static void print_fps(int h)
+static void print_fps(int h, int border)
{
if (pl_vout_bpp == 16)
- pl_text_out16(2, h - 10, "%2d %4.1f", flips_per_sec, vsps_cur);
+ pl_text_out16(border + 2, h - 10, "%2d %4.1f", flips_per_sec, vsps_cur);
}
-static void print_cpu_usage(int w, int h)
+static void print_cpu_usage(int w, int h, int border)
{
if (pl_vout_bpp == 16)
- pl_text_out16(w - 28, h - 10, "%3d", tick_per_sec);
+ pl_text_out16(w - border - 28, h - 10, "%3d", tick_per_sec);
}
// draw 192x8 status of 24 sound channels
@@ -109,7 +109,7 @@ static __attribute__((noinline)) void draw_active_chans(int vout_w, int vout_h)
}
}
-void pl_print_hud(int w, int h)
+void pl_print_hud(int w, int h, int xborder)
{
pl_vout_w = w; // used by pollux
pl_vout_h = h;
@@ -118,12 +118,12 @@ void pl_print_hud(int w, int h)
draw_active_chans(w, h);
if (hud_msg[0] != 0)
- print_msg(h);
+ print_msg(h, xborder);
else if (g_opts & OPT_SHOWFPS)
- print_fps(h);
+ print_fps(h, xborder);
if (g_opts & OPT_SHOWCPU)
- print_cpu_usage(w, h);
+ print_cpu_usage(w, h, xborder);
}
static void *pl_vout_set_mode(int w, int h, int bpp)
@@ -164,7 +164,7 @@ static void *pl_vout_flip(void)
pl_flip_cnt++;
if (pl_vout_buf != NULL)
- pl_print_hud(pl_vout_w, pl_vout_h);
+ pl_print_hud(pl_vout_w, pl_vout_h, 0);
// let's flip now
#if defined(VOUT_FBDEV)
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index c327348..43c1a5f 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -28,7 +28,7 @@ void pl_text_out16(int x, int y, const char *texto, ...);
void pl_start_watchdog(void);
void *pl_prepare_screenshot(int *w, int *h, int *bpp);
void pl_init(void);
-void pl_print_hud(int w, int h);
+void pl_print_hud(int w, int h, int xborder);
void pl_timing_prepare(int is_pal);
void pl_frame_limit(void);