Merge pull request #1316 from reicast/lk/semen

Android: Configure peripherals independently
This commit is contained in:
Abandoned Cart 2018-08-22 18:02:55 -04:00 committed by GitHub
commit fda672d66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 31 deletions

View File

@ -92,9 +92,18 @@ public class GL2JNIActivity extends Activity {
boolean player2connected = false;
boolean player3connected = false;
boolean player4connected = false;
int p2periphs[] = {0, 0};
int p3periphs[] = {0, 0};
int p4periphs[] = {0, 0};
int p2periphs[] = {
prefs.getInt(Gamepad.p2_peripheral + 1, 0),
prefs.getInt(Gamepad.p2_peripheral + 2, 0)
};
int p3periphs[] = {
prefs.getInt(Gamepad.p3_peripheral + 1, 0),
prefs.getInt(Gamepad.p3_peripheral + 2, 0)
};
int p4periphs[] = {
prefs.getInt(Gamepad.p4_peripheral + 1, 0),
prefs.getInt(Gamepad.p4_peripheral + 2, 0)
};
for (HashMap.Entry<String, Integer> e : pad.deviceDescriptor_PlayerNum.entrySet()) {
String descriptor = e.getKey();
@ -102,25 +111,16 @@ public class GL2JNIActivity extends Activity {
switch (playerNum) {
case 1:
if (descriptor != null) {
if (descriptor != null)
player2connected = true;
p2periphs[0] = prefs.getInt(Gamepad.p2_peripheral + 1, 0);
p2periphs[1] = prefs.getInt(Gamepad.p2_peripheral + 2, 0);
}
break;
case 2:
if (descriptor != null) {
if (descriptor != null)
player3connected = true;
p3periphs[0] = prefs.getInt(Gamepad.p3_peripheral + 1, 0);
p3periphs[1] = prefs.getInt(Gamepad.p3_peripheral + 2, 0);
}
break;
case 3:
if (descriptor != null) {
if (descriptor != null)
player4connected = true;
p4periphs[0] = prefs.getInt(Gamepad.p4_peripheral + 1, 0);
p4periphs[1] = prefs.getInt(Gamepad.p4_peripheral + 2, 0);
}
break;
}
}

View File

@ -93,9 +93,18 @@ public class GL2JNINative extends NativeActivity {
boolean player2connected = false;
boolean player3connected = false;
boolean player4connected = false;
int p2periphs[] = {0, 0};
int p3periphs[] = {0, 0};
int p4periphs[] = {0, 0};
int p2periphs[] = {
prefs.getInt(Gamepad.p2_peripheral + 1, 0),
prefs.getInt(Gamepad.p2_peripheral + 2, 0)
};
int p3periphs[] = {
prefs.getInt(Gamepad.p3_peripheral + 1, 0),
prefs.getInt(Gamepad.p3_peripheral + 2, 0)
};
int p4periphs[] = {
prefs.getInt(Gamepad.p4_peripheral + 1, 0),
prefs.getInt(Gamepad.p4_peripheral + 2, 0)
};
for (HashMap.Entry<String, Integer> e : pad.deviceDescriptor_PlayerNum
.entrySet()) {
@ -104,25 +113,16 @@ public class GL2JNINative extends NativeActivity {
switch (playerNum) {
case 1:
if (descriptor != null) {
if (descriptor != null)
player2connected = true;
p2periphs[0] = prefs.getInt(Gamepad.p2_peripheral + 1, 0);
p2periphs[1] = prefs.getInt(Gamepad.p2_peripheral + 2, 0);
}
break;
case 2:
if (descriptor != null) {
if (descriptor != null)
player3connected = true;
p3periphs[0] = prefs.getInt(Gamepad.p3_peripheral + 1, 0);
p3periphs[1] = prefs.getInt(Gamepad.p3_peripheral + 2, 0);
}
break;
case 3:
if (descriptor != null) {
if (descriptor != null)
player4connected = true;
p4periphs[0] = prefs.getInt(Gamepad.p4_peripheral + 1, 0);
p4periphs[1] = prefs.getInt(Gamepad.p4_peripheral + 2, 0);
}
break;
}
}

View File

@ -402,6 +402,12 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupMic(JNIEnv *env,
{
sipemu = env->NewGlobalRef(sip);
getmicdata = env->GetMethodID(env->GetObjectClass(sipemu),"getData","()[B");
// Obligatory microphone for controller A-2
delete MapleDevices[0][1];
mcfg_Create(MDT_Microphone, 0, 1);
// Allow additional microphones, if desired
for (int i = 0; i < 3; i++)
{
if (controller_periphs[i + 1][0] == MDT_Microphone) {

View File

@ -95,7 +95,7 @@
<string name="controller_compat">Enable Compatibility Mode</string>
<string name="controller_unavailable">Gamepad IME detected!\nPlease disable native interface</string>
<string name="enable_microphone">Enable Microphone(s)</string>
<string name="controller_1_vmu">Includes 2 VMUs (Cannot be modified)</string>
<string name="controller_1_vmu">Includes 2 VMUs (or 1 VMU / 1 Mic)</string>
<string name="customize_physical_controls">Customize Physical Controls</string>
<string name="map_keycode_title">Modify Controller</string>