Support per-player moga config, Disable pro config for now

This commit is contained in:
TwistedUmbrella 2014-01-24 01:23:37 -05:00
parent ba973c5b18
commit 46155b0a62
3 changed files with 22 additions and 6 deletions

View File

@ -48,6 +48,9 @@
<string name="map_keycode_title">Modify Controller</string> <string name="map_keycode_title">Modify Controller</string>
<string name="map_keycode_message">Press the new controller button for %1$s</string> <string name="map_keycode_message">Press the new controller button for %1$s</string>
<string name="moga_pro_connect">MOGA Pro Connected!</string>
<string name="moga_connect">MOGA Connected!</string>
<string name="about_title">About reicast</string> <string name="about_title">About reicast</string>
<string name="about_text">reicast is a dreamcast emulator\n\nVersion: %1$s\n\n</string> <string name="about_text">reicast is a dreamcast emulator\n\nVersion: %1$s\n\n</string>

View File

@ -277,7 +277,7 @@ public class GL2JNIActivity extends Activity {
globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f; globalLS_X[playerNum] = previousLS_X[playerNum] = 0.0f;
globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f; globalLS_Y[playerNum] = previousLS_Y[playerNum] = 0.0f;
} else if (!moga.isActive) { // Ouya controller } else if (!moga.isActive[playerNum] && !moga.isMogaPro[playerNum]) { // Ouya controller
map[playerNum] = new int[] { map[playerNum] = new int[] {
OuyaController.BUTTON_O, key_CONT_A, OuyaController.BUTTON_O, key_CONT_A,
OuyaController.BUTTON_A, key_CONT_B, OuyaController.BUTTON_A, key_CONT_B,
@ -340,7 +340,7 @@ public class GL2JNIActivity extends Activity {
if (playerNum == null) if (playerNum == null)
return false; return false;
if (!moga.isActive) { if (!moga.isActive[playerNum] && !moga.isMogaPro[playerNum]) {
// Joystick // Joystick
if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
@ -432,7 +432,7 @@ public class GL2JNIActivity extends Activity {
if (playerNum == null) if (playerNum == null)
return false; return false;
if (!moga.isActive) { if (!moga.isActive[playerNum] && !moga.isMogaPro[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) {

View File

@ -33,7 +33,8 @@ public class MOGAInput
Controller mController = null; Controller mController = null;
public boolean isActive = false; public boolean isActive[] = { false, false, false, false };
public boolean isMogaPro[] = { false, false, false, false };
private static final int key_CONT_B = 0x0002; private static final int key_CONT_B = 0x0002;
private static final int key_CONT_A = 0x0004; private static final int key_CONT_A = 0x0004;
@ -227,8 +228,20 @@ public class MOGAInput
JNIdc.hide_osd(); JNIdc.hide_osd();
if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) { if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) {
Toast.makeText(act.getApplicationContext(), "MOGA Connected!", Toast.LENGTH_SHORT).show(); int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
isActive = true; String notify = null;
if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
isActive[playerNum] = true;
isMogaPro[playerNum] = true;
notify = act.getApplicationContext().getString(R.string.moga_pro_connect);
} else if (mControllerVersion == Controller.ACTION_VERSION_MOGA) {
isActive[playerNum] = true;
isMogaPro[playerNum] = false;
notify = act.getApplicationContext().getString(R.string.moga_connect);
}
if (notify != null && !notify.equals(null)) {
Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show();
}
} }
} }
} }