Check for alternate joystick handlers (GameKeyboard, etc.)
Remove unused imports from various activities Verify if gamekeyboard is being used to replace hardware Configure stock controller layout as default
This commit is contained in:
parent
437da8cd77
commit
03d4f59a02
|
@ -62,6 +62,7 @@
|
|||
<string name="joystick_layout">Use Joystick For D-Pad Input</string>
|
||||
<string name="modified_layout">Enable Custom Key Layout</string>
|
||||
<string name="controller_compat">Enable Compatibility Mode</string>
|
||||
<string name="controller_unavailable">Gamepad IME detected!\nPlease disable native interface</string>
|
||||
<string name="mic_in_port_2">Microphone plugged into port 2</string>
|
||||
|
||||
<string name="customize_physical_controls">Customize Physical Controls</string>
|
||||
|
|
|
@ -18,8 +18,6 @@ import java.util.zip.GZIPOutputStream;
|
|||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import com.reicast.emulator.MainActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaScannerConnection;
|
||||
|
@ -27,6 +25,8 @@ import android.media.MediaScannerConnection.OnScanCompletedListener;
|
|||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.reicast.emulator.MainActivity;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
public void saveArray(String filename, List<String> output_field) {
|
||||
|
|
|
@ -19,9 +19,9 @@ import android.view.InputDevice;
|
|||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.WindowManager;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
|
@ -156,9 +156,16 @@ public class GL2JNIActivity extends Activity {
|
|||
} else {
|
||||
pad.joystick[playerNum] = false;
|
||||
}
|
||||
if (!pad.compat[playerNum]) {
|
||||
if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_gamekey)) {
|
||||
if (pad.custom[playerNum]) {
|
||||
pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs);
|
||||
setCustomMapping(id, playerNum);
|
||||
} else {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
}
|
||||
} else if (!pad.compat[playerNum]) {
|
||||
if (pad.custom[playerNum]) {
|
||||
setCustomMapping(id, playerNum);
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.equals(Gamepad.controllers_sony)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
|
@ -178,13 +185,15 @@ public class GL2JNIActivity extends Activity {
|
|||
getCompatibilityMap(playerNum, id);
|
||||
}
|
||||
initJoyStickLayout(playerNum);
|
||||
} else {
|
||||
runCompatibilityMode(joy);
|
||||
}
|
||||
}
|
||||
if (joys.length == 0) {
|
||||
runCompatibilityMode();
|
||||
fullCompatibilityMode();
|
||||
}
|
||||
} else {
|
||||
runCompatibilityMode();
|
||||
fullCompatibilityMode();
|
||||
}
|
||||
|
||||
config.loadConfigurationPrefs();
|
||||
|
@ -231,6 +240,10 @@ public class GL2JNIActivity extends Activity {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setCustomMapping(String id, int playerNum) {
|
||||
pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs);
|
||||
}
|
||||
|
||||
private void initJoyStickLayout(int playerNum) {
|
||||
if (!pad.joystick[playerNum]) {
|
||||
|
@ -239,7 +252,7 @@ public class GL2JNIActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
private void runCompatibilityMode() {
|
||||
private void runCompatibilityMode(int joy) {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
if (pad.compat[n]) {
|
||||
String id = pad.portId[n];
|
||||
|
@ -249,6 +262,12 @@ public class GL2JNIActivity extends Activity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fullCompatibilityMode() {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
runCompatibilityMode(n);
|
||||
}
|
||||
}
|
||||
|
||||
private void getCompatibilityMap(int playerNum, String id) {
|
||||
pad.name[playerNum] = prefs.getInt(Gamepad.pref_pad + id, -1);
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.view.Window;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.reicast.emulator.config.Config;
|
||||
import com.reicast.emulator.emu.GL2JNIView;
|
||||
|
@ -146,7 +147,6 @@ public class GL2JNINative extends NativeActivity {
|
|||
}
|
||||
if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_play_tp)) {
|
||||
// registerXperia(joy);
|
||||
pad.keypadZeus[1] = joy;
|
||||
}
|
||||
}
|
||||
|
@ -168,8 +168,17 @@ public class GL2JNINative extends NativeActivity {
|
|||
pad.joystick[playerNum] = false;
|
||||
}
|
||||
if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_play)) {
|
||||
pad.playerNumX.put(joy, playerNum);
|
||||
.contains(Gamepad.controllers_gamekey)) {
|
||||
// if (pad.custom[playerNum]) {
|
||||
// setCustomMapping(id, playerNum);
|
||||
// } else {
|
||||
// pad.map[playerNum] = pad.getConsoleController();
|
||||
// }
|
||||
Toast.makeText(getApplicationContext(), R.string.controller_unavailable,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_play) ) {
|
||||
for (int keys : pad.keypadZeus) {
|
||||
pad.playerNumX.put(keys, playerNum);
|
||||
}
|
||||
|
@ -178,28 +187,26 @@ public class GL2JNINative extends NativeActivity {
|
|||
} else {
|
||||
pad.map[playerNum] = pad.getXPlayController();
|
||||
}
|
||||
} else {
|
||||
if (!pad.compat[playerNum]) {
|
||||
if (pad.custom[playerNum]) {
|
||||
setCustomMapping(id, playerNum);
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.equals(Gamepad.controllers_sony)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.equals(Gamepad.controllers_xbox)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_shield)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (!pad.isActiveMoga[playerNum]) { // Ouya controller
|
||||
pad.map[playerNum] = pad.getOUYAController();
|
||||
}
|
||||
} else{
|
||||
getCompatibilityMap(playerNum, id);
|
||||
} else if (!pad.compat[playerNum]) {
|
||||
if (pad.custom[playerNum]) {
|
||||
setCustomMapping(id, playerNum);
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.equals(Gamepad.controllers_sony)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.equals(Gamepad.controllers_xbox)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (InputDevice.getDevice(joy).getName()
|
||||
.contains(Gamepad.controllers_shield)) {
|
||||
pad.map[playerNum] = pad.getConsoleController();
|
||||
} else if (!pad.isActiveMoga[playerNum]) { // Ouya controller
|
||||
pad.map[playerNum] = pad.getOUYAController();
|
||||
}
|
||||
initJoyStickLayout(playerNum);
|
||||
pad.playerNumX.put(joy, playerNum);
|
||||
} else{
|
||||
getCompatibilityMap(playerNum, id);
|
||||
}
|
||||
initJoyStickLayout(playerNum);
|
||||
pad.playerNumX.put(joy, playerNum);
|
||||
} else {
|
||||
runCompatibilityMode(joy);
|
||||
}
|
||||
|
|
|
@ -4,21 +4,11 @@ import java.io.BufferedReader;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.util.DreamTime;
|
||||
import com.reicast.emulator.R;
|
||||
import com.reicast.emulator.emu.JNIdc;
|
||||
|
||||
public class Config {
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.reicast.emulator.emu;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.reicast.emulator.periph;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import tv.ouya.console.api.OuyaController;
|
||||
import tv.ouya.console.api.OuyaFacade;
|
||||
|
@ -48,6 +46,7 @@ public class Gamepad {
|
|||
public static final String controllers_play = "keypad-zeus";
|
||||
public static final String controllers_play_gp = "keypad-game-zeus";
|
||||
public static final String controllers_play_tp = "synaptics_touchpad";
|
||||
public static final String controllers_gamekey = "gamekeyboard";
|
||||
|
||||
public String[] portId = { "_A", "_B", "_C", "_D" };
|
||||
public boolean[] compat = { false, false, false, false };
|
||||
|
|
Loading…
Reference in New Issue