return strkeys;\r
}\r
\r
-static void unbind_action(int action)\r
+static void unbind_action(int action, int pl_idx)\r
{\r
int i, u;\r
\r
- for (i = 0; i < 32; i++)\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
for (u = 0; u < 4; u++)\r
- for (i = 0; i < 32; i++)\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
\r
-static int count_bound_keys(int action, int joy)\r
+static int count_bound_keys(int action, int pl_idx, int joy)\r
{\r
int i, keys = 0;\r
\r
if (joy)\r
{\r
- for (i = 0; i < 32; i++)\r
+ for (i = 0; i < 32; i++) {\r
+ if (pl_idx >= 0 && (currentConfig.JoyBinds[joy-1][i]&0x30000) != (pl_idx<<16)) continue;\r
if (currentConfig.JoyBinds[joy-1][i] & action) keys++;\r
+ }\r
}\r
else\r
{\r
- for (i = 0; i < 32; i++)\r
+ for (i = 0; i < 32; i++) {\r
+ if (pl_idx >= 0 && (currentConfig.KeyBinds[i]&0x30000) != (pl_idx<<16)) continue;\r
if (currentConfig.KeyBinds[i] & action) keys++;\r
+ }\r
}\r
return keys;\r
}\r
gp2x_pd_clone_buffer2();\r
if (player_idx >= 0) {\r
text_out16(80, 20, "Player %i controls", player_idx + 1);\r
- x = 100;\r
+ x = 80;\r
} else {\r
text_out16(80, 20, "Emulator controls");\r
x = 40;\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);\r
+ unbind_action(opts[sel].mask, player_idx);\r
prev_select = inp & GP2X_SELECT;\r
inp &= CONFIGURABLE_KEYS;\r
inp &= ~GP2X_SELECT;\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
- if (count_bound_keys(opts[sel].mask, 0) >= 2)\r
+ if (count_bound_keys(opts[sel].mask, player_idx, 0) >= 2)\r
currentConfig.KeyBinds[i] &= ~opts[sel].mask; // allow to unbind only\r
else currentConfig.KeyBinds[i] ^= opts[sel].mask;\r
- if (player_idx >= 0) {\r
+ if (player_idx >= 0 && currentConfig.KeyBinds[i] & opts[sel].mask) {\r
currentConfig.KeyBinds[i] &= ~(3 << 16);\r
currentConfig.KeyBinds[i] |= player_idx << 16;\r
}\r
{\r
for (i = 0; i < 32; i++)\r
if (inp & (1 << i)) {\r
- if (count_bound_keys(opts[sel].mask, joy) >= 1) // disallow combos for usbjoy\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) {\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
}\r
PicoRegionOverride = currentConfig.PicoRegion;\r
if (!(PicoOpt & 0x20)) {\r
// unbind XYZ MODE, just in case\r
- unbind_action(0xf00);\r
+ unbind_action(0xf00, -1);\r
}\r
scaling_update();\r
}\r