Add an extra check to prevent 2.3 controller handling error
This commit is contained in:
parent
4175e3e813
commit
17f4a77e92
|
@ -437,28 +437,32 @@ public class GL2JNIActivity extends Activity {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boolean handle_key(Integer playerNum, int kc, boolean down) {
|
boolean handle_key(Integer playerNum, int kc, boolean down) {
|
||||||
if (playerNum == null)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
return false;
|
if (playerNum == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!moga.isActive[playerNum]) {
|
if (!moga.isActive[playerNum]) {
|
||||||
|
|
||||||
boolean rav = false;
|
boolean rav = false;
|
||||||
for (int i = 0; i < map[playerNum].length; i += 2) {
|
for (int i = 0; i < map[playerNum].length; i += 2) {
|
||||||
if (map[playerNum][i + 0] == kc) {
|
if (map[playerNum][i + 0] == kc) {
|
||||||
if (down)
|
if (down)
|
||||||
GL2JNIView.kcode_raw[playerNum] &= ~map[playerNum][i + 1];
|
GL2JNIView.kcode_raw[playerNum] &= ~map[playerNum][i + 1];
|
||||||
else
|
else
|
||||||
GL2JNIView.kcode_raw[playerNum] |= map[playerNum][i + 1];
|
GL2JNIView.kcode_raw[playerNum] |= map[playerNum][i + 1];
|
||||||
|
|
||||||
rav = true;
|
rav = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rav;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rav;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue