\r
static char *action_binds(int player_idx, int action_mask, int dev_id)\r
{\r
- int k, count = 0, can_combo = 0, type;\r
- const int *binds;\r
+ int dev = 0, dev_last = IN_MAX_DEVS - 1;\r
+ int can_combo = 1, type;\r
\r
static_buff[0] = 0;\r
\r
- binds = in_get_dev_binds(dev_id);\r
- if (binds == NULL)\r
- return static_buff;\r
-\r
- in_get_config(dev_id, IN_CFG_BIND_COUNT, &count);\r
- in_get_config(dev_id, IN_CFG_DOES_COMBOS, &can_combo);\r
-\r
type = IN_BINDTYPE_EMU;\r
if (player_idx >= 0) {\r
can_combo = 0;\r
if (player_idx == 1)\r
action_mask <<= 16;\r
\r
- for (k = 0; k < count; k++)\r
- {\r
- const char *xname;\r
- int len;\r
+ if (dev_id >= 0)\r
+ dev = dev_last = dev_id;\r
+\r
+ for (; dev <= dev_last; dev++) {\r
+ int k, count = 0, combo = 0;\r
+ const int *binds;\r
\r
- if (!(binds[IN_BIND_OFFS(k, type)] & action_mask))\r
+ binds = in_get_dev_binds(dev);\r
+ if (binds == NULL)\r
continue;\r
\r
- xname = in_get_key_name(dev_id, k);\r
- len = strlen(static_buff);\r
- if (len) {\r
- strncat(static_buff, can_combo ? " + " : ", ",\r
- sizeof(static_buff) - len - 1);\r
- len += can_combo ? 3 : 2;\r
+ in_get_config(dev, IN_CFG_BIND_COUNT, &count);\r
+ in_get_config(dev, IN_CFG_DOES_COMBOS, &combo);\r
+ combo = combo && can_combo;\r
+\r
+ for (k = 0; k < count; k++) {\r
+ const char *xname;\r
+ int len;\r
+\r
+ if (!(binds[IN_BIND_OFFS(k, type)] & action_mask))\r
+ continue;\r
+\r
+ xname = in_get_key_name(dev, k);\r
+ len = strlen(static_buff);\r
+ if (len) {\r
+ strncat(static_buff, combo ? " + " : ", ",\r
+ sizeof(static_buff) - len - 1);\r
+ len += combo ? 3 : 2;\r
+ }\r
+ strncat(static_buff, xname, sizeof(static_buff) - len - 1);\r
}\r
- strncat(static_buff, xname, sizeof(static_buff) - len - 1);\r
}\r
\r
return static_buff;\r
text_out16(x, y, "%s : %s", opts[i].name,\r
action_binds(player_idx, opts[i].mask, dev_id));\r
\r
- dev_name = in_get_dev_name(dev_id, 1, 1);\r
+ if (dev_id < 0)\r
+ dev_name = "(all devices)";\r
+ else\r
+ dev_name = in_get_dev_name(dev_id, 1, 1);\r
w = strlen(dev_name) * me_mfont_w;\r
if (w < 30 * me_mfont_w)\r
w = 30 * me_mfont_w;\r
static void key_config_loop(const me_bind_action *opts, int opt_cnt, int player_idx)\r
{\r
int i, sel = 0, menu_sel_max = opt_cnt - 1, does_combos = 0;\r
- int dev_id, dev_count, kc, is_down, mkey;\r
+ int dev_id, bind_dev_id, dev_count, kc, is_down, mkey;\r
int unbind, bindtype, mask_shift;\r
\r
for (i = 0, dev_id = -1, dev_count = 0; i < IN_MAX_DEVS; i++) {\r
return;\r
}\r
\r
+ dev_id = -1; // show all\r
mask_shift = 0;\r
if (player_idx == 1)\r
mask_shift = 16;\r
case PBTN_UP: sel--; if (sel < 0) sel = menu_sel_max; continue;\r
case PBTN_DOWN: sel++; if (sel > menu_sel_max) sel = 0; continue;\r
case PBTN_LEFT:\r
- for (i = 0, dev_id--; i < IN_MAX_DEVS; i++, dev_id--) {\r
- if (dev_id < 0)\r
+ for (i = 0, dev_id--; i < IN_MAX_DEVS + 1; i++, dev_id--) {\r
+ if (dev_id < -1)\r
dev_id = IN_MAX_DEVS - 1;\r
- if (in_get_dev_name(dev_id, 1, 0) != NULL)\r
+ if (dev_id == -1 || in_get_dev_name(dev_id, 1, 0) != NULL)\r
break;\r
}\r
continue;\r
case PBTN_RIGHT:\r
for (i = 0, dev_id++; i < IN_MAX_DEVS; i++, dev_id++) {\r
if (dev_id >= IN_MAX_DEVS)\r
- dev_id = 0;\r
- if (in_get_dev_name(dev_id, 1, 0) != NULL)\r
+ dev_id = -1;\r
+ if (dev_id == -1 || in_get_dev_name(dev_id, 1, 0) != NULL)\r
break;\r
}\r
continue;\r
\r
/* wait for some up event */\r
for (is_down = 1; is_down; )\r
- kc = in_update_keycode(&dev_id, &is_down, -1);\r
+ kc = in_update_keycode(&bind_dev_id, &is_down, -1);\r
\r
- i = count_bound_keys(dev_id, opts[sel].mask << mask_shift, bindtype);\r
+ i = count_bound_keys(bind_dev_id, opts[sel].mask << mask_shift, bindtype);\r
unbind = (i > 0);\r
\r
/* allow combos if device supports them */\r
- in_get_config(dev_id, IN_CFG_DOES_COMBOS, &does_combos);\r
+ in_get_config(bind_dev_id, IN_CFG_DOES_COMBOS, &does_combos);\r
if (i == 1 && bindtype == IN_BINDTYPE_EMU && does_combos)\r
unbind = 0;\r
\r
if (unbind)\r
- in_unbind_all(dev_id, opts[sel].mask << mask_shift, bindtype);\r
+ in_unbind_all(bind_dev_id, opts[sel].mask << mask_shift, bindtype);\r
\r
- in_bind_key(dev_id, kc, opts[sel].mask << mask_shift, bindtype, 0);\r
+ in_bind_key(bind_dev_id, kc, opts[sel].mask << mask_shift, bindtype, 0);\r
}\r
}\r
\r