bugfixes, state load for new mode
[picodrive.git] / platform / psp / menu.c
index 1613cfb..4cb0b4b 100644 (file)
@@ -52,18 +52,21 @@ static unsigned int inp_prev = 0;
 static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
 {
        unsigned int ret;
-       static int repeats = 0, wait = 50;
+       static int repeats = 0, wait = 6;
        int release = 0, count, i;
 
        if (!is_key_config)
                interesting |= (interesting & 0xf0) << 24; // also use analog
 
-       if (repeats == 2 || repeats == 4) wait /= 2;
-       if (repeats == 6) wait = 15;
+       if      (repeats == 2) wait = 3;
+       else if (repeats == 4) wait = 2;
+       else if (repeats == 6) wait = 1;
 
-       for (i = 0; i < 6 && inp_prev == psp_pad_read(1); i++) {
+       for (i = 0; i < wait && inp_prev == gp2x_joystick_read(1); i++) {
+
+       for (i = 0; i < wait && inp_prev == psp_pad_read(1); i++) {
                if (i == 0) repeats++;
-               psp_msleep(wait);
+               psp_msleep(30);
        }
 
        for (count = 0; !((ret = psp_pad_read(1)) & interesting) && count < 100; count++) {
@@ -73,7 +76,7 @@ static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
 
        if (release || ret != inp_prev) {
                repeats = 0;
-               wait = 50;
+               wait = 6;
        }
        inp_prev = ret;
 
@@ -185,7 +188,7 @@ struct my_dirent
 static unsigned short file2color(const char *fname)
 {
        const char *ext = fname + strlen(fname) - 3;
-       static const char *rom_exts[]   = { "zip", "bin", "smd", "gen", "iso", "cso" };
+       static const char *rom_exts[]   = { "zip", "bin", "smd", "gen", "iso", "cso", "cue" };
        static const char *other_exts[] = { "gmv", "pat" };
        int i;
 
@@ -241,7 +244,7 @@ static int scandir_cmp(const void *p1, const void *p2)
 
 static char *filter_exts[] = {
        ".mp3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html",
-       ".jpg", ".cue", ".pbp"
+       ".jpg", ".pbp"
 };
 
 static int scandir_filter(const struct my_dirent *ent)
@@ -1810,10 +1813,11 @@ int menu_loop_tray(void)
                                case 0: // select image
                                        selfname = romsel_loop(curr_path);
                                        if (selfname) {
-                                               int ret = -1, cd_type;
+                                               int ret = -1;
+                                               cd_img_type cd_type;
                                                cd_type = emu_cdCheck(NULL);
-                                               if (cd_type > 0)
-                                                       ret = Insert_CD(romFileName, cd_type == 2);
+                                               if (cd_type != CIT_NOT_CD)
+                                                       ret = Insert_CD(romFileName, cd_type);
                                                if (ret != 0) {
                                                        sprintf(menuErrorMsg, "Load failed, invalid CD image?");
                                                        lprintf("%s\n", menuErrorMsg);