release r13
[pcsx_rearmed.git] / frontend / menu.c
index 5fe86ad..a8d2e48 100644 (file)
@@ -13,6 +13,9 @@
 #include <errno.h>
 #include <dlfcn.h>
 #include <zlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "main.h"
 #include "menu.h"
@@ -34,6 +37,8 @@
 #include "../plugins/dfinput/main.h"
 #include "revision.h"
 
+#define REARMED_BIRTHDAY_TIME 1293306830       /* 25 Dec 2010 */
+
 #define array_size(x) (sizeof(x) / sizeof(x[0]))
 
 typedef enum
@@ -124,10 +129,30 @@ void emu_make_path(char *buff, const char *end, int size)
                printf("Warning: path truncated: %s\n", buff);
 }
 
-static int emu_check_save_file(int slot)
+static int emu_check_save_file(int slot, int *time)
 {
-       int ret = emu_check_state(slot);
-       return ret == 0 ? 1 : 0;
+       char fname[MAXPATHLEN];
+       struct stat status;
+       int ret;
+       
+       ret = emu_check_state(slot);
+       if (ret != 0 || time == NULL)
+               return ret == 0 ? 1 : 0;
+
+       ret = get_state_filename(fname, sizeof(fname), slot);
+       if (ret != 0)
+               return 1;
+
+       ret = stat(fname, &status);
+       if (ret != 0)
+               return 1;
+
+       if (status.st_mtime < REARMED_BIRTHDAY_TIME)
+               return 1; // probably bad rtc like on some Caanoos
+
+       *time = status.st_mtime;
+
+       return 1;
 }
 
 static int emu_save_load_game(int load, int unused)
@@ -216,6 +241,9 @@ static void menu_set_defconfig(void)
        { #val, sizeof(pl_rearmed_cbs.val), &pl_rearmed_cbs.val }
 
 // 'versioned' var, used when defaults change
+#define CE_CONFIG_STR_V(val, ver) \
+       { #val #ver, 0, Config.val }
+
 #define CE_INTVAL_V(val, ver) \
        { #val #ver, sizeof(val), &val }
 
@@ -228,7 +256,7 @@ static const struct {
        void *val;
 } config_data[] = {
        CE_CONFIG_STR(Bios),
-       CE_CONFIG_STR(Gpu),
+       CE_CONFIG_STR_V(Gpu, 2),
        CE_CONFIG_STR(Spu),
 //     CE_CONFIG_STR(Cdr),
        CE_CONFIG_VAL(Xa),
@@ -258,9 +286,11 @@ static const struct {
        CE_INTVAL_V(frameskip, 3),
        CE_INTVAL_P(gpu_peops.iUseDither),
        CE_INTVAL_P(gpu_peops.dwActFixes),
+       CE_INTVAL_P(gpu_unai.lineskip),
        CE_INTVAL_P(gpu_unai.abe_hack),
        CE_INTVAL_P(gpu_unai.no_light),
        CE_INTVAL_P(gpu_unai.no_blend),
+       CE_INTVAL_P(gpu_neon.allow_interlace),
        CE_INTVAL_V(iUseReverb, 3),
        CE_INTVAL_V(iXAPitch, 3),
        CE_INTVAL_V(iUseInterpolation, 3),
@@ -726,6 +756,9 @@ me_bind_action emuctrl_actions[] =
        { "Toggle Frameskip ", 1 << SACTION_TOGGLE_FSKIP },
        { "Take Screenshot  ", 1 << SACTION_SCREENSHOT },
        { "Enter Menu       ", 1 << SACTION_ENTER_MENU },
+#ifdef __ARM_ARCH_7A__ /* XXX */
+       { "Minimize         ", 1 << SACTION_MINIMIZE },
+#endif
        { "Gun Trigger      ", 1 << SACTION_GUN_TRIGGER },
        { "Gun A button     ", 1 << SACTION_GUN_A },
        { "Gun B button     ", 1 << SACTION_GUN_B },
@@ -1164,8 +1197,29 @@ static int menu_loop_gfx_options(int id, int keys)
 
 // ------------ bios/plugins ------------
 
+#ifdef __ARM_NEON__
+
+static const char h_gpu_neon[] = "Configure built-in NEON GPU plugin";
+static const char *men_gpu_interlace[] = { "Off", "On", "Auto", NULL };
+
+static menu_entry e_menu_plugin_gpu_neon[] =
+{
+       mee_enum      ("Enable interlace mode",      0, pl_rearmed_cbs.gpu_neon.allow_interlace, men_gpu_interlace),
+       mee_end,
+};
+
+static int menu_loop_plugin_gpu_neon(int id, int keys)
+{
+       int sel = 0;
+       me_loop(e_menu_plugin_gpu_neon, &sel);
+       return 0;
+}
+
+#endif
+
 static menu_entry e_menu_plugin_gpu_unai[] =
 {
+       mee_onoff     ("Skip every 2nd line",        0, pl_rearmed_cbs.gpu_unai.lineskip, 1),
        mee_onoff     ("Abe's Odyssey hack",         0, pl_rearmed_cbs.gpu_unai.abe_hack, 1),
        mee_onoff     ("Disable lighting",           0, pl_rearmed_cbs.gpu_unai.no_light, 1),
        mee_onoff     ("Disable blending",           0, pl_rearmed_cbs.gpu_unai.no_blend, 1),
@@ -1180,12 +1234,12 @@ static int menu_loop_plugin_gpu_unai(int id, int keys)
 }
 
 static const char *men_gpu_dithering[] = { "None", "Game dependant", "Always", NULL };
-static const char h_gpu_0[]            = "Needed for Chrono Cross";
+//static const char h_gpu_0[]            = "Needed for Chrono Cross";
 static const char h_gpu_1[]            = "Capcom fighting games";
 static const char h_gpu_2[]            = "Black screens in Lunar";
 static const char h_gpu_3[]            = "Compatibility mode";
 static const char h_gpu_6[]            = "Pandemonium 2";
-static const char h_gpu_7[]            = "Skip every second frame";
+//static const char h_gpu_7[]            = "Skip every second frame";
 static const char h_gpu_8[]            = "Needed by Dark Forces";
 static const char h_gpu_9[]            = "better g-colors, worse textures";
 static const char h_gpu_10[]           = "Toggle busy flags after drawing";
@@ -1193,12 +1247,12 @@ static const char h_gpu_10[]           = "Toggle busy flags after drawing";
 static menu_entry e_menu_plugin_gpu_peops[] =
 {
        mee_enum      ("Dithering",                  0, pl_rearmed_cbs.gpu_peops.iUseDither, men_gpu_dithering),
-       mee_onoff_h   ("Odd/even bit hack",          0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<0, h_gpu_0),
+//     mee_onoff_h   ("Odd/even bit hack",          0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<0, h_gpu_0),
        mee_onoff_h   ("Expand screen width",        0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<1, h_gpu_1),
        mee_onoff_h   ("Ignore brightness color",    0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<2, h_gpu_2),
        mee_onoff_h   ("Disable coordinate check",   0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<3, h_gpu_3),
        mee_onoff_h   ("Lazy screen update",         0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<6, h_gpu_6),
-       mee_onoff_h   ("Old frame skipping",         0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<7, h_gpu_7),
+//     mee_onoff_h   ("Old frame skipping",         0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<7, h_gpu_7),
        mee_onoff_h   ("Repeated flat tex triangles ",0,pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<8, h_gpu_8),
        mee_onoff_h   ("Draw quads with triangles",  0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<9, h_gpu_9),
        mee_onoff_h   ("Fake 'gpu busy' states",     0, pl_rearmed_cbs.gpu_peops.dwActFixes, 1<<10, h_gpu_10),
@@ -1249,6 +1303,9 @@ static menu_entry e_menu_plugin_options[] =
        mee_enum_h    ("BIOS",                          0, bios_sel, bioses, h_bios),
        mee_enum_h    ("GPU plugin",                    0, gpu_plugsel, gpu_plugins, h_plugin_xpu),
        mee_enum_h    ("SPU plugin",                    0, spu_plugsel, spu_plugins, h_plugin_xpu),
+#ifdef __ARM_NEON__
+       mee_handler_h ("Configure built-in GPU plugin", menu_loop_plugin_gpu_neon, h_gpu_neon),
+#endif
        mee_handler_h ("Configure gpu_peops plugin",    menu_loop_plugin_gpu_peops, h_gpu_peops),
        mee_handler_h ("Configure PCSX4ALL GPU plugin", menu_loop_plugin_gpu_unai, h_gpu_unai),
        mee_handler_h ("Configure built-in SPU plugin", menu_loop_plugin_spu, h_spu),
@@ -1609,7 +1666,7 @@ static void draw_frame_main(void)
 
 static void draw_frame_credits(void)
 {
-       smalltext_out16(4, 1, "build: "__DATE__ " " __TIME__ " " REV, 0xe7fc);
+       smalltext_out16(4, 1, "build: " __DATE__ " " __TIME__ " " REV, 0xe7fc);
 }
 
 static const char credits_text[] = 
@@ -1617,13 +1674,16 @@ static const char credits_text[] =
        "(C) 1999-2003 PCSX Team\n"
        "(C) 2005-2009 PCSX-df Team\n"
        "(C) 2009-2011 PCSX-Reloaded Team\n\n"
-       "GPU and SPU code by Pete Bernert\n"
-       "  and the P.E.Op.S. team\n"
        "ARM recompiler (C) 2009-2011 Ari64\n"
-       "PCSX4ALL plugins by PCSX4ALL team\n"
+#ifdef __ARM_NEON__
+       "ARM NEON GPU (c) 2011-2012 Exophase\n"
+#endif
+       "PEOpS GPU and SPU by Pete Bernert\n"
+       "  and the P.E.Op.S. team\n"
+       "PCSX4ALL plugin by PCSX4ALL team\n"
        "  Chui, Franxis, Unai\n\n"
        "integration, optimization and\n"
-       "  frontend (C) 2010-2011 notaz\n";
+       "  frontend (C) 2010-2012 notaz\n";
 
 static int reset_game(void)
 {