aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/cspace.h3
-rw-r--r--frontend/cspace_neon.S127
m---------frontend/libpicofe0
-rw-r--r--frontend/libretro.c7
-rw-r--r--frontend/menu.c82
-rw-r--r--frontend/menu.h2
-rw-r--r--frontend/plat_omap.c19
-rw-r--r--frontend/plugin_lib.c21
8 files changed, 222 insertions, 39 deletions
diff --git a/frontend/cspace.h b/frontend/cspace.h
index 1a9e339..8c92d2d 100644
--- a/frontend/cspace.h
+++ b/frontend/cspace.h
@@ -8,6 +8,9 @@ void bgr888_to_rgb888(void *dst, const void *src, int bytes);
void bgr888_to_rgb565(void *dst, const void *src, int bytes);
void rgb888_to_rgb565(void *dst, const void *src, int bytes);
+void bgr555_to_rgb565_b(void *dst, const void *src, int bytes,
+ int brightness2k); // 0-0x0800
+
void bgr_to_uyvy_init(void);
void rgb565_to_uyvy(void *d, const void *s, int pixels);
void bgr555_to_uyvy(void *d, const void *s, int pixels);
diff --git a/frontend/cspace_neon.S b/frontend/cspace_neon.S
index 7420585..8b201db 100644
--- a/frontend/cspace_neon.S
+++ b/frontend/cspace_neon.S
@@ -19,7 +19,7 @@
.text
.align 2
-FUNCTION(bgr555_to_rgb565):
+FUNCTION(bgr555_to_rgb565): @ dst, src, bytes
pld [r1]
mov r3, #0x07c0
vdup.16 q15, r3
@@ -28,23 +28,23 @@ FUNCTION(bgr555_to_rgb565):
0:
pld [r1, #64*2]
vldmia r1!, {q0-q3}
- vshl.u16 q4, q0, #11
- vshl.u16 q5, q1, #11
- vshl.u16 q6, q2, #11
- vshl.u16 q7, q3, #11
- vsri.u16 q4, q0, #10
- vsri.u16 q5, q1, #10
- vsri.u16 q6, q2, #10
- vsri.u16 q7, q3, #10
- vshl.u16 q0, q0, #1
- vshl.u16 q1, q1, #1
- vshl.u16 q2, q2, #1
- vshl.u16 q3, q3, #1
- vbit q4, q0, q15
- vbit q5, q1, q15
- vbit q6, q2, q15
- vbit q7, q3, q15
- vstmia r0!, {q4-q7}
+ vshl.u16 q8, q0, #11
+ vshl.u16 q9, q1, #11
+ vshl.u16 q10, q2, #11
+ vshl.u16 q11, q3, #11
+ vsri.u16 q8, q0, #10
+ vsri.u16 q9, q1, #10
+ vsri.u16 q10, q2, #10
+ vsri.u16 q11, q3, #10
+ vshl.u16 q0, q0, #1
+ vshl.u16 q1, q1, #1
+ vshl.u16 q2, q2, #1
+ vshl.u16 q3, q3, #1
+ vbit q8, q0, q15
+ vbit q9, q1, q15
+ vbit q10, q2, q15
+ vbit q11, q3, q15
+ vstmia r0!, {q8-q11}
subs r2, r2, #64
bge 0b
@@ -72,16 +72,97 @@ btr16_end16:
bxlt lr
@ very rare
- vld1.16 d0, [r1]!
+ vld1.16 {d0}, [r1]!
vshl.u16 d1, d0, #11
vshl.u16 d2, d0, #1
vsri.u16 d1, d0, #10
vbit d1, d2, d30
- vst1.16 d1, [r0]!
+ vst1.16 {d1}, [r0]!
+ bx lr
+
+
+@ note: may overflow source
+FUNCTION(bgr555_to_rgb565_b): @ dst, src, bytes, int brightness2k // 0-0x0800
+ pld [r1]
+ vdup.16 q15, r3
+ vpush {q4-q7}
+ mov r3, #0x1f
+ vdup.16 q14, r3
+0:
+ pld [r1, #64*2]
+ vldmia r1!, {q0-q3}
+ vand.u16 q8, q0, q14
+ vand.u16 q9, q1, q14
+ vand.u16 q10, q2, q14
+ vand.u16 q11, q3, q14
+ vmul.u16 q4, q8, q15
+ vmul.u16 q5, q9, q15
+ vmul.u16 q6, q10, q15
+ vmul.u16 q7, q11, q15
+
+ vshr.u16 q8, q0, #5
+ vshr.u16 q9, q1, #5
+ vshr.u16 q10, q2, #5
+ vshr.u16 q11, q3, #5
+ vand.u16 q8, q14
+ vand.u16 q9, q14
+ vand.u16 q10, q14
+ vand.u16 q11, q14
+ vmul.u16 q8, q15
+ vmul.u16 q9, q15
+ vmul.u16 q10, q15
+ vmul.u16 q11, q15
+ vsri.u16 q4, q8, #5
+ vsri.u16 q5, q9, #5
+ vsri.u16 q6, q10, #5
+ vsri.u16 q7, q11, #5
+
+ vshr.u16 q8, q0, #10
+ vshr.u16 q9, q1, #10
+ vshr.u16 q10, q2, #10
+ vshr.u16 q11, q3, #10
+ vand.u16 q8, q14
+ vand.u16 q9, q14
+ vand.u16 q10, q14
+ vand.u16 q11, q14
+ vmul.u16 q8, q15
+ vmul.u16 q9, q15
+ vmul.u16 q10, q15
+ vmul.u16 q11, q15
+ vsri.u16 q4, q8, #11
+ vsri.u16 q5, q9, #11
+ vsri.u16 q6, q10, #11
+ vsri.u16 q7, q11, #11
+
+ subs r2, r2, #64
+ ble 1f
+ vstmia r0!, {q4-q7}
+ b 0b
+
+1:
+ blt 0f
+ vstmia r0!, {q4-q7}
+ b btr16b_end
+0:
+ subs r2, r2, #8
+ blt btr16b_end
+ vst1.16 {q4}, [r0]!
+ subs r2, r2, #8
+ blt btr16b_end
+ vst1.16 {q5}, [r0]!
+ subs r2, r2, #8
+ blt btr16b_end
+ vst1.16 {q6}, [r0]!
+ subs r2, r2, #8
+ blt btr16b_end
+ vst1.16 {q7}, [r0]!
+
+btr16b_end:
+ vpop {q4-q7}
bx lr
-FUNCTION(bgr888_to_rgb888):
+FUNCTION(bgr888_to_rgb888): @ dst, src, bytes
pld [r1]
@ r2 /= 48
mov r2, r2, lsr #4
@@ -102,7 +183,7 @@ FUNCTION(bgr888_to_rgb888):
bx lr
-FUNCTION(bgr888_to_rgb565):
+FUNCTION(bgr888_to_rgb565): @ dst, src, bytes
pld [r1]
@ r2 /= 48
mov r2, r2, lsr #4
@@ -134,7 +215,7 @@ FUNCTION(bgr888_to_rgb565):
bx lr
-FUNCTION(rgb888_to_rgb565):
+FUNCTION(rgb888_to_rgb565): @ dst, src, bytes
pld [r1]
@ r2 /= 48
mov r2, r2, lsr #4
diff --git a/frontend/libpicofe b/frontend/libpicofe
-Subproject d1453cf7e6d5d6758cc5d72c6d3af7d37156bf7
+Subproject 515ac0b9d2c4d45a465335d54b8c49830914fce
diff --git a/frontend/libretro.c b/frontend/libretro.c
index fa544fd..b636f49 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -283,7 +283,7 @@ void retro_get_system_info(struct retro_system_info *info)
{
memset(info, 0, sizeof(*info));
info->library_name = "PCSX-ReARMed";
- info->library_version = "r19";
+ info->library_version = "r20";
info->valid_extensions = "bin|cue|img|mdf|pbp|toc|cbn|m3u";
info->need_fullpath = true;
}
@@ -303,8 +303,9 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
/* savestates */
size_t retro_serialize_size(void)
{
- // it's currently 4380651 bytes, but have some reserved for future
- return 0x430000;
+ // it's currently 4380651-4397047 bytes,
+ // but have some reserved for future
+ return 0x440000;
}
struct save_fp {
diff --git a/frontend/menu.c b/frontend/menu.c
index 1562735..a7012e6 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -1,5 +1,5 @@
/*
- * (C) Gražvydas "notaz" Ignotas, 2010-2013
+ * (C) Gražvydas "notaz" Ignotas, 2010-2014
*
* This work is licensed under the terms of any of these licenses
* (at your option):
@@ -83,6 +83,8 @@ typedef enum
MA_OPT_SWFILTER,
MA_OPT_GAMMA,
MA_OPT_VOUT_MODE,
+ MA_OPT_SCANLINES,
+ MA_OPT_SCANLINE_LEVEL,
} menu_id;
static int last_vout_w, last_vout_h, last_vout_bpp;
@@ -90,8 +92,10 @@ static int cpu_clock, cpu_clock_st, volume_boost, frameskip;
static char last_selected_fname[MAXPATHLEN];
static int config_save_counter, region, in_type_sel1, in_type_sel2;
static int psx_clock;
-static int memcard1_sel, memcard2_sel;
+static int memcard1_sel = -1, memcard2_sel = -1;
+extern int g_autostateld_opt;
int g_opts, g_scaler, g_gamma = 100;
+int scanlines, scanline_level = 20;
int soft_scaling, analog_deadzone; // for Caanoo
int soft_filter;
@@ -209,6 +213,9 @@ static int optional_cdimg_filter(struct dirent **namelist, int count,
struct stat64 statf;
FILE *f;
+ if (count <= 1)
+ return count;
+
for (i = 1; i < count; i++) {
if (namelist[i] == NULL || namelist[i]->d_type == DT_DIR)
continue;
@@ -330,6 +337,8 @@ static void menu_set_defconfig(void)
analog_deadzone = 50;
soft_scaling = 1;
soft_filter = 0;
+ scanlines = 0;
+ scanline_level = 20;
plat_target.vout_fullscreen = 0;
psx_clock = DEFAULT_PSX_CLOCK;
@@ -388,13 +397,15 @@ static const struct {
CE_CONFIG_VAL(VSyncWA),
CE_CONFIG_VAL(Cpu),
CE_INTVAL(region),
- CE_INTVAL_V(g_scaler, 2),
+ CE_INTVAL_V(g_scaler, 3),
CE_INTVAL(g_gamma),
CE_INTVAL(g_layer_x),
CE_INTVAL(g_layer_y),
CE_INTVAL(g_layer_w),
CE_INTVAL(g_layer_h),
CE_INTVAL(soft_filter),
+ CE_INTVAL(scanlines),
+ CE_INTVAL(scanline_level),
CE_INTVAL(plat_target.vout_method),
CE_INTVAL(plat_target.hwfilter),
CE_INTVAL(plat_target.vout_fullscreen),
@@ -404,6 +415,9 @@ static const struct {
CE_INTVAL(in_type_sel1),
CE_INTVAL(in_type_sel2),
CE_INTVAL(analog_deadzone),
+ CE_INTVAL(memcard1_sel),
+ CE_INTVAL(memcard2_sel),
+ CE_INTVAL(g_autostateld_opt),
CE_INTVAL_N("adev0_is_nublike", in_adev_is_nublike[0]),
CE_INTVAL_N("adev1_is_nublike", in_adev_is_nublike[1]),
CE_INTVAL_V(frameskip, 3),
@@ -661,6 +675,29 @@ fail:
if (strcmp(Config.Spu, spu_plugins[i]) == 0)
{ spu_plugsel = i; break; }
+ // memcard selections
+ char mcd1_old[sizeof(Config.Mcd1)];
+ char mcd2_old[sizeof(Config.Mcd2)];
+ strcpy(mcd1_old, Config.Mcd1);
+ strcpy(mcd2_old, Config.Mcd2);
+
+ if ((unsigned int)memcard1_sel < ARRAY_SIZE(memcards)) {
+ if (memcard1_sel == 0)
+ strcpy(Config.Mcd1, "none");
+ else if (memcards[memcard1_sel] != NULL)
+ snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s",
+ MEMCARD_DIR, memcards[memcard1_sel]);
+ }
+ if ((unsigned int)memcard2_sel < ARRAY_SIZE(memcards)) {
+ if (memcard2_sel == 0)
+ strcpy(Config.Mcd2, "none");
+ else if (memcards[memcard2_sel] != NULL)
+ snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s",
+ MEMCARD_DIR, memcards[memcard2_sel]);
+ }
+ if (strcmp(mcd1_old, Config.Mcd1) || strcmp(mcd2_old, Config.Mcd2))
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+
return ret;
}
@@ -1191,17 +1228,22 @@ static int menu_loop_keyconfig(int id, int keys)
// ------------ gfx options menu ------------
-static const char *men_scaler[] = { "1x1", "scaled 4:3", "integer scaled 4:3", "fullscreen", "custom", NULL };
+static const char *men_scaler[] = {
+ "1x1", "integer scaled 2x", "scaled 4:3", "integer scaled 4:3", "fullscreen", "custom", NULL
+};
static const char *men_soft_filter[] = { "None",
#ifdef __ARM_NEON__
"scale2x", "eagle2x",
#endif
NULL };
static const char *men_dummy[] = { NULL };
+static const char h_scaler[] = "int. 2x - scales w. or h. 2x if it fits on screen\n"
+ "int. 4:3 - uses integer if possible, else fractional";
static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n"
"using d-pad or move it using R+d-pad";
static const char h_overlay[] = "Overlay provides hardware accelerated scaling";
static const char h_soft_filter[] = "Works only if game uses low resolution modes";
+static const char h_scanline_l[] = "Scanline brightness, 0-100%";
static const char h_gamma[] = "Gamma/brightness adjustment (default 100)";
static int menu_loop_cscaler(int id, int keys)
@@ -1258,11 +1300,15 @@ static int menu_loop_cscaler(int id, int keys)
static menu_entry e_menu_gfx_options[] =
{
- mee_enum ("Scaler", MA_OPT_VARSCALER, g_scaler, men_scaler),
+ mee_enum_h ("Scaler", MA_OPT_VARSCALER, g_scaler, men_scaler, h_scaler),
mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
mee_onoff ("Software Scaling", MA_OPT_SCALER2, soft_scaling, 1),
mee_enum ("Hardware Filter", MA_OPT_HWFILTER, plat_target.hwfilter, men_dummy),
mee_enum_h ("Software Filter", MA_OPT_SWFILTER, soft_filter, men_soft_filter, h_soft_filter),
+#ifdef __ARM_NEON__
+ mee_onoff ("Scanlines", MA_OPT_SCANLINES, scanlines, 1),
+ mee_range_h ("Scanline brightness", MA_OPT_SCANLINE_LEVEL, scanline_level, 0, 100, h_scanline_l),
+#endif
mee_range_h ("Gamma adjustment", MA_OPT_GAMMA, g_gamma, 1, 200, h_gamma),
// mee_onoff ("Vsync", 0, vsync, 1),
mee_cust_h ("Setup custom scaler", MA_OPT_VARSCALER_C, menu_loop_cscaler, NULL, h_cscaler),
@@ -1882,7 +1928,7 @@ static const char credits_text[] =
"PCSX4ALL plugin by PCSX4ALL team\n"
" Chui, Franxis, Unai\n\n"
"integration, optimization and\n"
- " frontend (C) 2010-2012 notaz\n";
+ " frontend (C) 2010-2014 notaz\n";
static int reset_game(void)
{
@@ -1963,6 +2009,8 @@ static int run_exe(void)
static int run_cd_image(const char *fname)
{
+ int autoload_state = g_autostateld_opt;
+
ready_to_go = 0;
reload_plugins(fname);
@@ -1988,6 +2036,28 @@ static int run_cd_image(const char *fname)
emu_on_new_cd(1);
ready_to_go = 1;
+ if (autoload_state) {
+ unsigned int newest = 0;
+ int time, slot, newest_slot = -1;
+
+ for (slot = 0; slot < 10; slot++) {
+ if (emu_check_save_file(slot, &time)) {
+ if ((unsigned int)time > newest) {
+ newest = time;
+ newest_slot = slot;
+ }
+ }
+ }
+
+ if (newest_slot >= 0) {
+ lprintf("autoload slot %d\n", newest_slot);
+ emu_load_state(newest_slot);
+ }
+ else {
+ lprintf("no save to autoload.\n");
+ }
+ }
+
return 0;
}
diff --git a/frontend/menu.h b/frontend/menu.h
index 0d68469..81cd1ba 100644
--- a/frontend/menu.h
+++ b/frontend/menu.h
@@ -15,6 +15,7 @@ enum g_opts_opts {
enum g_scaler_opts {
SCALE_1_1,
+ SCALE_2_2,
SCALE_4_3,
SCALE_4_3v2,
SCALE_FULLSCREEN,
@@ -28,6 +29,7 @@ enum g_soft_filter_opts {
};
extern int g_opts, g_scaler, g_gamma;
+extern int scanlines, scanline_level;
extern int soft_scaling, analog_deadzone;
extern int soft_filter;
diff --git a/frontend/plat_omap.c b/frontend/plat_omap.c
index 6126140..4e3ea79 100644
--- a/frontend/plat_omap.c
+++ b/frontend/plat_omap.c
@@ -94,20 +94,25 @@ void plat_omap_gvideo_open(void)
vout_fbdev_wait_vsync(layer_fb);
}
-void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
+void *plat_gvideo_set_mode(int *w_in, int *h_in, int *bpp)
{
int l = 0, r = 0, t = 0, b = 0;
+ int w = *w_in, h = *h_in;
void *buf;
- if (g_scaler == SCALE_1_1) {
- if (*w > g_menuscreen_w)
- l = r = (*w - g_menuscreen_w) / 2;
- if (*h > g_menuscreen_h)
- t = b = (*h - g_menuscreen_h) / 2;
+ if (g_scaler == SCALE_1_1 || g_scaler == SCALE_2_2) {
+ if (w > g_menuscreen_w) {
+ l = r = (w - g_menuscreen_w) / 2;
+ w -= l + r;
+ }
+ if (h > g_menuscreen_h) {
+ t = b = (h - g_menuscreen_h) / 2;
+ h -= t + b;
+ }
}
vout_fbdev_clear(layer_fb);
- buf = vout_fbdev_resize(layer_fb, *w, *h, *bpp,
+ buf = vout_fbdev_resize(layer_fb, w, h, *bpp,
l, r, t, b, 3);
omap_enable_layer(1);
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index 72b3395..163d4f1 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -180,6 +180,14 @@ static void update_layer_size(int w, int h)
g_layer_w = w; g_layer_h = h;
break;
+ case SCALE_2_2:
+ g_layer_w = w; g_layer_h = h;
+ if (w * 2 <= g_menuscreen_w)
+ g_layer_w = w * 2;
+ if (h * 2 <= g_menuscreen_h)
+ g_layer_h = h * 2;
+ break;
+
case SCALE_4_3v2:
if (h > g_menuscreen_h || (240 < h && h <= 360))
goto fractional_4_3;
@@ -363,6 +371,19 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h)
neon_eagle2x_16_16(src, (void *)dest, w,
stride * 2, dstride * 2, h);
}
+ else if (scanlines != 0 && scanline_level != 100)
+ {
+ int l = scanline_level * 2048 / 100;
+
+ for (; h1 >= 2; h1 -= 2)
+ {
+ bgr555_to_rgb565(dest, src, w * 2);
+ dest += dstride * 2, src += stride;
+
+ bgr555_to_rgb565_b(dest, src, w * 2, l);
+ dest += dstride * 2, src += stride;
+ }
+ }
#endif
else
{