+ return strkeys;\r
+}\r
+\r
+static void unbind_action(int action)\r
+{\r
+ int i, u;\r
+\r
+ for (i = 0; i < 32; i++)\r
+ Settings.KeyBinds[i] &= ~action;\r
+ for (u = 0; u < 4; u++)\r
+ for (i = 0; i < 32; i++)\r
+ Settings.JoyBinds[u][i] &= ~action;\r
+}\r
+\r
+static int count_bound_keys(int action, int is_joy)\r
+{\r
+ int i, u, keys = 0;\r
+\r
+ if (is_joy)\r
+ {\r
+ for (u = 0; u < 4; u++)\r
+ for (i = 0; i < 32; i++)\r
+ if (Settings.JoyBinds[u][i] & action) keys++;\r
+ }\r
+ else\r
+ {\r
+ for (i = 0; i < 32; i++)\r
+ if (Settings.KeyBinds[i] & action) keys++;\r
+ }\r
+ return keys;\r
+}\r
+\r
+typedef struct { char *name; int mask; } bind_action_t;\r
+\r
+// b_turbo,a_turbo RLDU SEBA\r
+static bind_action_t ctrl_actions[] =\r
+{\r
+ { "UP ", 0x010 },\r
+ { "DOWN ", 0x020 },\r
+ { "LEFT ", 0x040 },\r
+ { "RIGHT ", 0x080 },\r
+ { "A ", 0x001 },\r
+ { "B ", 0x002 },\r
+ { "A TURBO", 0x100 },\r
+ { "B TURBO", 0x200 },\r
+ { "START ", 0x008 },\r
+ { "SELECT ", 0x004 },\r
+};\r
+\r
+static void draw_key_config(const bind_action_t *opts, int opt_cnt, int player_idx, int sel)\r
+{\r
+ int x, y, tl_y = 40, i;\r
+\r