fix sdl overlay not locked for clearing
[libpicofe.git] / menu.c
diff --git a/menu.c b/menu.c
index 3cd69d2..da9ddf2 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -981,7 +981,6 @@ static int dirent_seek_char(struct dirent **namelist, int len, int sel, char c)
 {\r
        int i;\r
 \r
-       sel++;\r
        for (i = sel + 1; ; i++) {\r
                if (i >= len)\r
                        i = 1;\r
@@ -992,7 +991,7 @@ static int dirent_seek_char(struct dirent **namelist, int len, int sel, char c)
                        break;\r
        }\r
 \r
-       return i - 1;\r
+       return i;\r
 }\r
 \r
 static const char *menu_loop_romsel(char *curr_path, int len,\r
@@ -1320,9 +1319,9 @@ static char *action_binds(int player_idx, int action_mask, int dev_id)
        if (player_idx >= 0) {\r
                can_combo = 0;\r
                type = IN_BINDTYPE_PLAYER12 + (player_idx >> 1);\r
+               if (player_idx & 1)\r
+                       action_mask <<= 16;\r
        }\r
-       if (player_idx & 1)\r
-               action_mask <<= 16;\r
 \r
        if (dev_id >= 0)\r
                dev = dev_last = dev_id;\r
@@ -1459,11 +1458,12 @@ static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_
 \r
        dev_id = -1; // show all\r
        mask_shift = 0;\r
-       if (player_idx & 1)\r
-               mask_shift = 16;\r
-       bindtype = IN_BINDTYPE_EMU;\r
-       if (player_idx >= 0)\r
-              bindtype = IN_BINDTYPE_PLAYER12 + (player_idx >> 1);\r
+       if (player_idx >= 0) {\r
+               if (player_idx & 1)\r
+                       mask_shift = 16;\r
+               bindtype = IN_BINDTYPE_PLAYER12 + (player_idx >> 1);\r
+       } else\r
+               bindtype = IN_BINDTYPE_EMU;\r
 \r
        for (;;)\r
        {\r