Merge branch 'master' into skmp/r7-sprint

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2014-09-14 14:12:46 +03:00
commit aa33d230e5
6 changed files with 17 additions and 21 deletions

View File

@ -150,11 +150,7 @@ public class GL2JNIActivity extends Activity {
String id = pad.portId[playerNum]; String id = pad.portId[playerNum];
pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false); pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false);
pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false); pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false);
if (pad.custom[playerNum] || pad.compat[playerNum]) { pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_merged + id, false);
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, false);
} else {
pad.joystick[playerNum] = true;
}
if (InputDevice.getDevice(joy).getName() if (InputDevice.getDevice(joy).getName()
.contains(Gamepad.controllers_gamekey)) { .contains(Gamepad.controllers_gamekey)) {
if (pad.custom[playerNum]) { if (pad.custom[playerNum]) {

View File

@ -162,11 +162,7 @@ public class GL2JNINative extends NativeActivity {
String id = pad.portId[playerNum]; String id = pad.portId[playerNum];
pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false); pad.custom[playerNum] = prefs.getBoolean(Gamepad.pref_js_modified + id, false);
pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false); pad.compat[playerNum] = prefs.getBoolean(Gamepad.pref_js_compat + id, false);
if (pad.custom[playerNum] || pad.compat[playerNum]) { pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_merged + id, false);
pad.joystick[playerNum] = prefs.getBoolean(Gamepad.pref_js_separate + id, false);
} else {
pad.joystick[playerNum] = true;
}
if (InputDevice.getDevice(joy).getName() if (InputDevice.getDevice(joy).getName()
.contains(Gamepad.controllers_gamekey)) { .contains(Gamepad.controllers_gamekey)) {
// if (pad.custom[playerNum]) { // if (pad.custom[playerNum]) {

View File

@ -105,7 +105,7 @@ public class InputModFragment extends Fragment {
public void onCheckedChanged(CompoundButton buttonView, public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) { boolean isChecked) {
mPrefs.edit() mPrefs.edit()
.putBoolean(Gamepad.pref_js_separate + player, .putBoolean(Gamepad.pref_js_merged + player,
isChecked).commit(); isChecked).commit();
} }
}; };
@ -118,11 +118,6 @@ public class InputModFragment extends Fragment {
mPrefs.edit() mPrefs.edit()
.putBoolean(Gamepad.pref_js_modified + player, .putBoolean(Gamepad.pref_js_modified + player,
isChecked).commit(); isChecked).commit();
if (isChecked) {
switchJoystickDpadEnabled.setEnabled(true);
} else if (!switchCompatibilityEnabled.isChecked()) {
switchJoystickDpadEnabled.setEnabled(false);
}
} }
}; };
@ -576,7 +571,7 @@ public class InputModFragment extends Fragment {
private void updateController(String player) { private void updateController(String player) {
switchJoystickDpadEnabled.setChecked(mPrefs.getBoolean( switchJoystickDpadEnabled.setChecked(mPrefs.getBoolean(
Gamepad.pref_js_separate + player, false)); Gamepad.pref_js_merged + player, false));
switchModifiedLayoutEnabled.setChecked(mPrefs.getBoolean( switchModifiedLayoutEnabled.setChecked(mPrefs.getBoolean(
Gamepad.pref_js_modified + player, false)); Gamepad.pref_js_modified + player, false));
switchCompatibilityEnabled.setChecked(mPrefs.getBoolean( switchCompatibilityEnabled.setChecked(mPrefs.getBoolean(

View File

@ -122,6 +122,7 @@ public class GL2JNIView extends GLSurfaceView
SYSTEM_UI_FLAG_IMMERSIVE_STICKY SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| SYSTEM_UI_FLAG_FULLSCREEN | SYSTEM_UI_FLAG_FULLSCREEN
| SYSTEM_UI_FLAG_HIDE_NAVIGATION); | SYSTEM_UI_FLAG_HIDE_NAVIGATION);
requestLayout();
} }
} }
}); });
@ -741,7 +742,9 @@ public class GL2JNIView extends GLSurfaceView
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);} | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
requestLayout();
}
} }
private boolean takeScreenshot = false; private boolean takeScreenshot = false;

View File

@ -21,7 +21,7 @@ public class Gamepad {
public static final String pref_js_modified = "modified_key_layout"; public static final String pref_js_modified = "modified_key_layout";
public static final String pref_js_compat = "controller_compat"; public static final String pref_js_compat = "controller_compat";
public static final String pref_js_separate = "separate_joystick"; public static final String pref_js_merged = "merged_joystick";
public static final String pref_js_rbuttons = "right_buttons"; public static final String pref_js_rbuttons = "right_buttons";
public static final String pref_button_a = "a_button"; public static final String pref_button_a = "a_button";
@ -226,7 +226,7 @@ public class Gamepad {
for (int n = 0; n < 4; n++) { for (int n = 0; n < 4; n++) {
if (compat[n]) { if (compat[n]) {
String id = portId[n]; String id = portId[n];
joystick[n] = prefs.getBoolean(Gamepad.pref_js_separate + id, false); joystick[n] = prefs.getBoolean(Gamepad.pref_js_merged + id, false);
getCompatibilityMap(n, portId[n], prefs); getCompatibilityMap(n, portId[n], prefs);
initJoyStickLayout(n); initJoyStickLayout(n);
} }

View File

@ -6,15 +6,18 @@ package com.reicast.emulator.periph;
import java.util.Arrays; import java.util.Arrays;
import android.app.Activity; import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import com.bda.controller.KeyEvent;
import com.bda.controller.Controller; import com.bda.controller.Controller;
import com.bda.controller.ControllerListener; import com.bda.controller.ControllerListener;
import com.bda.controller.KeyEvent;
import com.bda.controller.MotionEvent; import com.bda.controller.MotionEvent;
import com.bda.controller.StateEvent; import com.bda.controller.StateEvent;
import com.reicast.emulator.R; import com.reicast.emulator.R;
@ -131,11 +134,14 @@ public final class MOGAInput
public void onKeyEvent(KeyEvent event) public void onKeyEvent(KeyEvent event)
{ {
// Handled by the primary controller interface // Handled by the primary controller interface
// act.dispatchKeyEvent(new android.view.KeyEvent(0, 0, event.getAction(),
// event.getKeyCode(), 0));
} }
public void onMotionEvent(MotionEvent event) public void onMotionEvent(MotionEvent event)
{ {
// Handled by the primary controller interface // Handled by the primary controller interface
} }
private void getCompatibilityMap(int playerNum, String id) { private void getCompatibilityMap(int playerNum, String id) {