}\r
}\r
\r
+ // limit..\r
+ strkeys[20] = 0;\r
+\r
return strkeys;\r
}\r
\r
-static void unbind_action(int action, int pl_idx)\r
+static void unbind_action(int action, int pl_idx, int joy)\r
{\r
int i, u;\r
\r
- for (i = 0; i < 32; i++) {\r
- if (pl_idx >= 0 && (currentConfig.KeyBinds[i]&0x30000) != (pl_idx<<16)) continue;\r
- currentConfig.KeyBinds[i] &= ~action;\r
+ if (joy <= 0)\r
+ {\r
+ for (i = 0; i < 32; i++) {\r
+ if (pl_idx >= 0 && (currentConfig.KeyBinds[i]&0x30000) != (pl_idx<<16)) continue;\r
+ currentConfig.KeyBinds[i] &= ~action;\r
+ }\r
}\r
- for (u = 0; u < 4; u++)\r
+ if (joy < 0)\r
+ {\r
+ for (u = 0; u < 4; u++)\r
+ for (i = 0; i < 32; i++) {\r
+ if (pl_idx >= 0 && (currentConfig.JoyBinds[u][i]&0x30000) != (pl_idx<<16)) continue;\r
+ currentConfig.JoyBinds[u][i] &= ~action;\r
+ }\r
+ }\r
+ else if (joy > 0)\r
+ {\r
for (i = 0; i < 32; i++) {\r
- if (pl_idx >= 0 && (currentConfig.JoyBinds[u][i]&0x30000) != (pl_idx<<16)) continue;\r
- currentConfig.JoyBinds[u][i] &= ~action;\r
+ if (pl_idx >= 0 && (currentConfig.JoyBinds[joy-1][i]&0x30000) != (pl_idx<<16)) continue;\r
+ currentConfig.JoyBinds[joy-1][i] &= ~action;\r
}\r
+ }\r
}\r
\r
static int count_bound_keys(int action, int pl_idx, int joy)\r
}\r
// if we are here, we want to bind/unbind something\r
if ((inp & GP2X_SELECT) && !prev_select)\r
- unbind_action(opts[sel].mask, player_idx);\r
+ unbind_action(opts[sel].mask, player_idx, -1);\r
prev_select = inp & GP2X_SELECT;\r
inp &= CONFIGURABLE_KEYS;\r
inp &= ~GP2X_SELECT;\r
{\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
- if (count_bound_keys(opts[sel].mask, player_idx, joy) >= 1) // disallow combos for usbjoy\r
- currentConfig.JoyBinds[joy-1][i] &= ~opts[sel].mask;\r
- else currentConfig.JoyBinds[joy-1][i] ^= opts[sel].mask;\r
- if (player_idx >= 0 && currentConfig.JoyBinds[joy-1][i] & opts[sel].mask) {\r
- currentConfig.JoyBinds[joy-1][i] &= ~(3 << 16);\r
- currentConfig.JoyBinds[joy-1][i] |= player_idx << 16;\r
+ int *bind = ¤tConfig.JoyBinds[joy-1][i];\r
+ if ((*bind & opts[sel].mask) && (player_idx < 0 || player_idx == ((*bind>>16)&3)))\r
+ currentConfig.JoyBinds[joy-1][i] &= ~opts[sel].mask;\r
+ else {\r
+ // override\r
+ unbind_action(opts[sel].mask, player_idx, joy);\r
+ *bind = opts[sel].mask;\r
+ if (player_idx >= 0) *bind |= player_idx << 16;\r
}\r
}\r
}\r
PicoRegionOverride = currentConfig.PicoRegion;\r
if (!(PicoOpt & 0x20)) {\r
// unbind XYZ MODE, just in case\r
- unbind_action(0xf00, -1);\r
+ unbind_action(0xf00, -1, -1);\r
}\r
scaling_update();\r
}\r