From 43e43021a328bf93585f2140703d3e15cc37bdeb Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Mon, 13 Feb 2023 12:56:16 -0600 Subject: [PATCH] android: Add all buttons to screen controller --- .../java/org/yuzu/yuzu_emu/NativeLibrary.java | 40 ++-- .../yuzu/yuzu_emu/overlay/InputOverlay.java | 174 ++++++------------ .../overlay/InputOverlayDrawableJoystick.java | 9 - .../app/src/main/res/values/integers.xml | 90 ++++----- 4 files changed, 104 insertions(+), 209 deletions(-) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java index e4619d2536..dbbc339ec3 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.java @@ -619,30 +619,22 @@ public final class NativeLibrary { public static final int BUTTON_B = 1; public static final int BUTTON_X = 2; public static final int BUTTON_Y = 3; - public static final int BUTTON_START = 11; - public static final int BUTTON_SELECT = 12; - public static final int BUTTON_HOME = 19; - public static final int BUTTON_ZL = 9; - public static final int BUTTON_ZR = 10; - public static final int DPAD_UP = 14; - public static final int DPAD_DOWN = 16; - public static final int DPAD_LEFT = 13; - public static final int DPAD_RIGHT = 15; - public static final int STICK_LEFT = 5; - public static final int STICK_LEFT_UP = 714; - public static final int STICK_LEFT_DOWN = 715; - public static final int STICK_LEFT_LEFT = 716; - public static final int STICK_LEFT_RIGHT = 717; - public static final int STICK_C = 6; - public static final int STICK_C_UP = 719; - public static final int STICK_C_DOWN = 720; - public static final int STICK_C_LEFT = 771; - public static final int STICK_C_RIGHT = 772; - public static final int TRIGGER_L = 7; - public static final int TRIGGER_R = 8; - public static final int DPAD = 780; - public static final int BUTTON_DEBUG = 781; - public static final int BUTTON_GPIO14 = 782; + public static final int STICK_L = 4; + public static final int STICK_R = 5; + public static final int TRIGGER_L = 6; + public static final int TRIGGER_R = 7; + public static final int TRIGGER_ZL = 8; + public static final int TRIGGER_ZR = 9; + public static final int BUTTON_PLUS = 10; + public static final int BUTTON_MINUS = 11; + public static final int DPAD_LEFT = 12; + public static final int DPAD_UP = 13; + public static final int DPAD_RIGHT = 14; + public static final int DPAD_DOWN = 15; + public static final int BUTTON_SL = 16; + public static final int BUTTON_SR = 17; + public static final int BUTTON_HOME = 18; + public static final int BUTTON_CAPTURE = 19; } /** diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java index 043a164ce3..686c656a89 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.java @@ -146,14 +146,15 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { switch (buttonId) { case ButtonType.BUTTON_HOME: - case ButtonType.BUTTON_START: - case ButtonType.BUTTON_SELECT: + case ButtonType.BUTTON_CAPTURE: + case ButtonType.BUTTON_PLUS: + case ButtonType.BUTTON_MINUS: scale = 0.08f; break; case ButtonType.TRIGGER_L: case ButtonType.TRIGGER_R: - case ButtonType.BUTTON_ZL: - case ButtonType.BUTTON_ZR: + case ButtonType.TRIGGER_ZL: + case ButtonType.TRIGGER_ZR: scale = 0.18f; break; default: @@ -225,7 +226,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context); // Decide scale based on button ID and user preference - float scale = 0.22f; + float scale = 0.23f; scale *= (sPrefs.getInt("controlScale", 50) + 50); scale /= 100; @@ -296,11 +297,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { int drawableX = (int) sPrefs.getFloat(joystick + orientation + "-X", 0f); int drawableY = (int) sPrefs.getFloat(joystick + orientation + "-Y", 0f); - // Decide inner scale based on joystick ID - float outerScale = 1.f; - if (joystick == ButtonType.STICK_C) { - outerScale = 2.f; - } + float outerScale = 1.3f; // Now set the bounds for the InputOverlayDrawableJoystick. // This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be. @@ -675,21 +672,21 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_r, R.drawable.button_r_pressed, ButtonType.TRIGGER_R, orientation)); } - if (mPreferences.getBoolean("buttonToggle6", false)) { + if (mPreferences.getBoolean("buttonToggle6", true)) { overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_zl, - R.drawable.button_zl_pressed, ButtonType.BUTTON_ZL, orientation)); + R.drawable.button_zl_pressed, ButtonType.TRIGGER_ZL, orientation)); } - if (mPreferences.getBoolean("buttonToggle7", false)) { + if (mPreferences.getBoolean("buttonToggle7", true)) { overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_zr, - R.drawable.button_zr_pressed, ButtonType.BUTTON_ZR, orientation)); + R.drawable.button_zr_pressed, ButtonType.TRIGGER_ZR, orientation)); } if (mPreferences.getBoolean("buttonToggle8", true)) { overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_start, - R.drawable.button_start_pressed, ButtonType.BUTTON_START, orientation)); + R.drawable.button_start_pressed, ButtonType.BUTTON_PLUS, orientation)); } if (mPreferences.getBoolean("buttonToggle9", true)) { overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_select, - R.drawable.button_select_pressed, ButtonType.BUTTON_SELECT, orientation)); + R.drawable.button_select_pressed, ButtonType.BUTTON_MINUS, orientation)); } if (mPreferences.getBoolean("buttonToggle10", true)) { overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.dpad, @@ -701,11 +698,19 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { if (mPreferences.getBoolean("buttonToggle11", true)) { overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.stick_main_range, R.drawable.stick_main, R.drawable.stick_main_pressed, - ButtonType.STICK_LEFT, orientation)); + ButtonType.STICK_L, orientation)); } - if (mPreferences.getBoolean("buttonToggle12", false)) { - overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.stick_c_range, - R.drawable.stick_c, R.drawable.stick_c_pressed, ButtonType.STICK_C, orientation)); + if (mPreferences.getBoolean("buttonToggle12", true)) { + overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.stick_main_range, + R.drawable.stick_main, R.drawable.stick_main_pressed, ButtonType.STICK_R, orientation)); + } + if (mPreferences.getBoolean("buttonToggle13", true)) { + overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_a, + R.drawable.button_a, ButtonType.BUTTON_HOME, orientation)); + } + if (mPreferences.getBoolean("buttonToggle14", true)) { + overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.button_a, + R.drawable.button_a, ButtonType.BUTTON_CAPTURE, orientation)); } } @@ -741,14 +746,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { private void defaultOverlay() { if (!mPreferences.getBoolean("OverlayInit", false)) { - // It's possible that a user has created their overlay before this was added - // Only change the overlay if the 'A' button is not in the upper corner. - if (mPreferences.getFloat(ButtonType.BUTTON_A + "-X", 0f) == 0f) { - defaultOverlayLandscape(); - } - if (mPreferences.getFloat(ButtonType.BUTTON_A + "-Portrait" + "-X", 0f) == 0f) { - defaultOverlayPortrait(); - } + defaultOverlayLandscape(); } SharedPreferences.Editor sPrefsEditor = mPreferences.edit(); @@ -757,15 +755,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { } public void resetButtonPlacement() { - boolean isLandscape = - getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; - - if (isLandscape) { - defaultOverlayLandscape(); - } else { - defaultOverlayPortrait(); - } - + defaultOverlayLandscape(); refreshControls(); } @@ -787,86 +777,36 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener { // Each value is a percent from max X/Y stored as an int. Have to bring that value down // to a decimal before multiplying by MAX X/Y. - sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_A_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_A_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_B_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_B_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_X_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_X_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_Y_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_Y_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZL + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZL_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZL + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZL_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZR + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZR_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZR + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZR_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_UP_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_UP_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X", (((float) res.getInteger(R.integer.N3DS_TRIGGER_L_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y", (((float) res.getInteger(R.integer.N3DS_TRIGGER_L_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X", (((float) res.getInteger(R.integer.N3DS_TRIGGER_R_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-Y", (((float) res.getInteger(R.integer.N3DS_TRIGGER_R_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_START_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_START + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_START_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_SELECT + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_SELECT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_SELECT + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_SELECT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_HOME_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_HOME_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.STICK_C + "-X", (((float) res.getInteger(R.integer.N3DS_STICK_C_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.STICK_C + "-Y", (((float) res.getInteger(R.integer.N3DS_STICK_C_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.STICK_LEFT + "-X", (((float) res.getInteger(R.integer.N3DS_STICK_MAIN_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.STICK_LEFT + "-Y", (((float) res.getInteger(R.integer.N3DS_STICK_MAIN_Y) / 1000) * maxY)); - - // We want to commit right away, otherwise the overlay could load before this is saved. - sPrefsEditor.commit(); - } - - private void defaultOverlayPortrait() { - SharedPreferences.Editor sPrefsEditor = mPreferences.edit(); - // Get screen size - Display display = ((Activity) getContext()).getWindowManager().getDefaultDisplay(); - DisplayMetrics outMetrics = new DisplayMetrics(); - display.getMetrics(outMetrics); - float maxX = outMetrics.heightPixels; - float maxY = outMetrics.widthPixels; - // Height and width changes depending on orientation. Use the larger value for height. - if (maxY < maxX) { - float tmp = maxX; - maxX = maxY; - maxY = tmp; - } - Resources res = getResources(); - String portrait = "-Portrait"; - - // Each value is a percent from max X/Y stored as an int. Have to bring that value down - // to a decimal before multiplying by MAX X/Y. - sPrefsEditor.putFloat(ButtonType.BUTTON_A + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_A_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_A + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_A_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_B + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_B_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_B + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_B_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_X + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_X_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_X + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_X_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_Y + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_Y_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_Y + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_Y_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZL + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZL_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZL + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZL_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZR + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZR_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_ZR + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_ZR_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.DPAD_UP + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_UP_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.DPAD_UP + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_UP_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_L + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_TRIGGER_L_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_L + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_TRIGGER_L_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_R + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_TRIGGER_R_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.TRIGGER_R + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_TRIGGER_R_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_START + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_START_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_START + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_START_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_SELECT + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_SELECT_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_SELECT + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_SELECT_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_BUTTON_HOME_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_BUTTON_HOME_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.STICK_C + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_STICK_C_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.STICK_C + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_STICK_C_PORTRAIT_Y) / 1000) * maxY)); - sPrefsEditor.putFloat(ButtonType.STICK_LEFT + portrait + "-X", (((float) res.getInteger(R.integer.N3DS_STICK_MAIN_PORTRAIT_X) / 1000) * maxX)); - sPrefsEditor.putFloat(ButtonType.STICK_LEFT + portrait + "-Y", (((float) res.getInteger(R.integer.N3DS_STICK_MAIN_PORTRAIT_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_A_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_A + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_A_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_B_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_B + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_B_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_X_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_X + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_X_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_Y_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_Y + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_Y_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_ZL + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZL_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_ZL + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZL_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_UP_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_UP_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_R_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_R_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_PLUS + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_PLUS_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_PLUS + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_PLUS_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_MINUS + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_MINUS_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_MINUS + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_MINUS_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_HOME_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_HOME + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_HOME_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.BUTTON_CAPTURE + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.BUTTON_CAPTURE + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.STICK_R + "-X", (((float) res.getInteger(R.integer.SWITCH_STICK_R_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.STICK_R + "-Y", (((float) res.getInteger(R.integer.SWITCH_STICK_R_Y) / 1000) * maxY)); + sPrefsEditor.putFloat(ButtonType.STICK_L + "-X", (((float) res.getInteger(R.integer.SWITCH_STICK_L_X) / 1000) * maxX)); + sPrefsEditor.putFloat(ButtonType.STICK_L + "-Y", (((float) res.getInteger(R.integer.SWITCH_STICK_L_Y) / 1000) * maxY)); // We want to commit right away, otherwise the overlay could load before this is saved. sPrefsEditor.commit(); diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableJoystick.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableJoystick.java index 6919562f34..03d38862ba 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableJoystick.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableJoystick.java @@ -159,10 +159,6 @@ public final class InputOverlayDrawableJoystick { int fingerPositionY = (int) event.getY(pointerIndex); int scale = 1; - if (mJoystickType == ButtonType.STICK_C) { - // C-stick is scaled down to be half the size of the circle pad - scale = 2; - } switch (event.getAction()) { case MotionEvent.ACTION_DOWN: @@ -204,11 +200,6 @@ public final class InputOverlayDrawableJoystick { int X = getVirtBounds().centerX() + (int) ((axises[0]) * (getVirtBounds().width() / 2)); int Y = getVirtBounds().centerY() + (int) ((axises[1]) * (getVirtBounds().height() / 2)); - if (mJoystickType == ButtonType.STICK_LEFT) { - X += 1; - Y += 1; - } - if (X > getVirtBounds().centerX() + (getVirtBounds().width() / 2)) X = getVirtBounds().centerX() + (getVirtBounds().width() / 2); if (X < getVirtBounds().centerX() - (getVirtBounds().width() / 2)) diff --git a/src/android/app/src/main/res/values/integers.xml b/src/android/app/src/main/res/values/integers.xml index 5cb9e4d145..2d750d89a1 100644 --- a/src/android/app/src/main/res/values/integers.xml +++ b/src/android/app/src/main/res/values/integers.xml @@ -3,64 +3,36 @@ 2 1 - - 930 - 620 - 870 - 720 - 870 - 520 - 810 - 620 - 15 - 470 - 13 - 0 - 13 - 110 - 895 - 0 - 895 - 110 - 740 - 770 - 100 - 670 - 470 - 850 - 550 - 850 - 450 - 850 - - - 810 - 870 - 710 - 925 - 710 - 815 - 610 - 870 - 10 - 680 - 10 - 0 - 10 - 70 - 810 - 0 - 810 - 70 - 800 - 710 - 80 - 840 - 360 - 794 - 400 - 794 - 520 - 794 + + 930 + 610 + 870 + 720 + 870 + 500 + 810 + 610 + 170 + 740 + 715 + 740 + 13 + 0 + 895 + 0 + 13 + 115 + 895 + 115 + 440 + 850 + 520 + 850 + 600 + 890 + 360 + 890 + 35 + 480