diff options
| author | 2023-03-04 21:42:26 -0600 | |
|---|---|---|
| committer | 2023-06-03 00:05:34 -0700 | |
| commit | bde568c3c5d278ef00acd88daabd44127b5ddace (patch) | |
| tree | 5b000794a0c1563bb8e018c5722bdf9bf72d5542 /src/android | |
| parent | android: Replace old buttons with vectors (diff) | |
| download | yuzu-bde568c3c5d278ef00acd88daabd44127b5ddace.tar.gz yuzu-bde568c3c5d278ef00acd88daabd44127b5ddace.tar.xz yuzu-bde568c3c5d278ef00acd88daabd44127b5ddace.zip | |
android: Use the center of the object and reduce draw calls
Diffstat (limited to 'src/android')
8 files changed, 76 insertions, 59 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java index 41103ec5b..343bc032b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.java | |||
| @@ -12,6 +12,7 @@ import android.view.KeyEvent; | |||
| 12 | import android.view.LayoutInflater; | 12 | import android.view.LayoutInflater; |
| 13 | import android.view.MotionEvent; | 13 | import android.view.MotionEvent; |
| 14 | import android.view.View; | 14 | import android.view.View; |
| 15 | import android.view.WindowManager; | ||
| 15 | import android.widget.SeekBar; | 16 | import android.widget.SeekBar; |
| 16 | import android.widget.TextView; | 17 | import android.widget.TextView; |
| 17 | 18 | ||
| @@ -164,6 +165,9 @@ public final class EmulationActivity extends AppCompatActivity { | |||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | private void enableFullscreenImmersive() { | 167 | private void enableFullscreenImmersive() { |
| 168 | getWindow().getAttributes().layoutInDisplayCutoutMode= | ||
| 169 | WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; | ||
| 170 | |||
| 167 | // It would be nice to use IMMERSIVE_STICKY, but that doesn't show the toolbar. | 171 | // It would be nice to use IMMERSIVE_STICKY, but that doesn't show the toolbar. |
| 168 | mDecorView.setSystemUiVisibility( | 172 | mDecorView.setSystemUiVisibility( |
| 169 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | | 173 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
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 76c437cb9..74119c398 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 | |||
| @@ -186,7 +186,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 186 | scale = 0.38f; | 186 | scale = 0.38f; |
| 187 | break; | 187 | break; |
| 188 | default: | 188 | default: |
| 189 | scale = 0.40f; | 189 | scale = 0.43f; |
| 190 | break; | 190 | break; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| @@ -215,10 +215,10 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 215 | 215 | ||
| 216 | // Now set the bounds for the InputOverlayDrawableButton. | 216 | // Now set the bounds for the InputOverlayDrawableButton. |
| 217 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableButton will be. | 217 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableButton will be. |
| 218 | overlayDrawable.setBounds(drawableX, drawableY, drawableX + width, drawableY + height); | 218 | overlayDrawable.setBounds(drawableX - (width / 2), drawableY - (height / 2), drawableX + (width / 2), drawableY + (height / 2)); |
| 219 | 219 | ||
| 220 | // Need to set the image's position | 220 | // Need to set the image's position |
| 221 | overlayDrawable.setPosition(drawableX, drawableY); | 221 | overlayDrawable.setPosition(drawableX - (width / 2), drawableY - (height / 2)); |
| 222 | 222 | ||
| 223 | return overlayDrawable; | 223 | return overlayDrawable; |
| 224 | } | 224 | } |
| @@ -278,10 +278,10 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 278 | 278 | ||
| 279 | // Now set the bounds for the InputOverlayDrawableDpad. | 279 | // Now set the bounds for the InputOverlayDrawableDpad. |
| 280 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableDpad will be. | 280 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableDpad will be. |
| 281 | overlayDrawable.setBounds(drawableX, drawableY, drawableX + width, drawableY + height); | 281 | overlayDrawable.setBounds(drawableX - (width / 2), drawableY - (height / 2), drawableX + (width / 2), drawableY + (height / 2)); |
| 282 | 282 | ||
| 283 | // Need to set the image's position | 283 | // Need to set the image's position |
| 284 | overlayDrawable.setPosition(drawableX, drawableY); | 284 | overlayDrawable.setPosition(drawableX - (width / 2), drawableY - (height / 2)); |
| 285 | 285 | ||
| 286 | return overlayDrawable; | 286 | return overlayDrawable; |
| 287 | } | 287 | } |
| @@ -306,7 +306,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 306 | final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context); | 306 | final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context); |
| 307 | 307 | ||
| 308 | // Decide scale based on user preference | 308 | // Decide scale based on user preference |
| 309 | float scale = 0.35f; | 309 | float scale = 0.40f; |
| 310 | scale *= (sPrefs.getInt("controlScale", 50) + 50); | 310 | scale *= (sPrefs.getInt("controlScale", 50) + 50); |
| 311 | scale /= 100; | 311 | scale /= 100; |
| 312 | 312 | ||
| @@ -320,12 +320,12 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 320 | int drawableX = (int) sPrefs.getFloat(button + orientation + "-X", 0f); | 320 | int drawableX = (int) sPrefs.getFloat(button + orientation + "-X", 0f); |
| 321 | int drawableY = (int) sPrefs.getFloat(button + orientation + "-Y", 0f); | 321 | int drawableY = (int) sPrefs.getFloat(button + orientation + "-Y", 0f); |
| 322 | 322 | ||
| 323 | float outerScale = 1.3f; | 323 | float outerScale = 1.66f; |
| 324 | 324 | ||
| 325 | // Now set the bounds for the InputOverlayDrawableJoystick. | 325 | // Now set the bounds for the InputOverlayDrawableJoystick. |
| 326 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be. | 326 | // This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be. |
| 327 | int outerSize = bitmapOuter.getWidth(); | 327 | int outerSize = bitmapOuter.getWidth(); |
| 328 | Rect outerRect = new Rect(drawableX, drawableY, drawableX + outerSize, drawableY + outerSize); | 328 | Rect outerRect = new Rect(drawableX - (outerSize / 2), drawableY - (outerSize / 2), drawableX + (outerSize / 2), drawableY + (outerSize / 2)); |
| 329 | Rect innerRect = new Rect(0, 0, (int) (outerSize / outerScale), (int) (outerSize / outerScale)); | 329 | Rect innerRect = new Rect(0, 0, (int) (outerSize / outerScale), (int) (outerSize / outerScale)); |
| 330 | 330 | ||
| 331 | // Send the drawableId to the joystick so it can be referenced when saving control position. | 331 | // Send the drawableId to the joystick so it can be referenced when saving control position. |
| @@ -362,12 +362,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 362 | if (isInEditMode()) { | 362 | if (isInEditMode()) { |
| 363 | return onTouchWhileEditing(event); | 363 | return onTouchWhileEditing(event); |
| 364 | } | 364 | } |
| 365 | 365 | boolean should_update_view = false; | |
| 366 | for (InputOverlayDrawableButton button : overlayButtons) { | 366 | for (InputOverlayDrawableButton button : overlayButtons) { |
| 367 | if (!button.updateStatus(event)) { | 367 | if (!button.updateStatus(event)) { |
| 368 | continue; | 368 | continue; |
| 369 | } | 369 | } |
| 370 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, button.getId(), button.getStatus()); | 370 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, button.getId(), button.getStatus()); |
| 371 | should_update_view = true; | ||
| 371 | } | 372 | } |
| 372 | 373 | ||
| 373 | for (InputOverlayDrawableDpad dpad : overlayDpads) { | 374 | for (InputOverlayDrawableDpad dpad : overlayDpads) { |
| @@ -378,6 +379,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 378 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getDownId(), dpad.getDownStatus()); | 379 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getDownId(), dpad.getDownStatus()); |
| 379 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getLeftId(), dpad.getLeftStatus()); | 380 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getLeftId(), dpad.getLeftStatus()); |
| 380 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getRightId(), dpad.getRightStatus()); | 381 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, dpad.getRightId(), dpad.getRightStatus()); |
| 382 | should_update_view = true; | ||
| 381 | } | 383 | } |
| 382 | 384 | ||
| 383 | for (InputOverlayDrawableJoystick joystick : overlayJoysticks) { | 385 | for (InputOverlayDrawableJoystick joystick : overlayJoysticks) { |
| @@ -387,6 +389,11 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 387 | int axisID = joystick.getJoystickId(); | 389 | int axisID = joystick.getJoystickId(); |
| 388 | NativeLibrary.onGamePadJoystickEvent(NativeLibrary.Player1Device, axisID, joystick.getXAxis(), joystick.getYAxis()); | 390 | NativeLibrary.onGamePadJoystickEvent(NativeLibrary.Player1Device, axisID, joystick.getXAxis(), joystick.getYAxis()); |
| 389 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, joystick.getButtonId(), joystick.getButtonStatus()); | 391 | NativeLibrary.onGamePadButtonEvent(NativeLibrary.Player1Device, joystick.getButtonId(), joystick.getButtonStatus()); |
| 392 | should_update_view = true; | ||
| 393 | } | ||
| 394 | |||
| 395 | if (should_update_view) { | ||
| 396 | invalidate(); | ||
| 390 | } | 397 | } |
| 391 | 398 | ||
| 392 | if (!mPreferences.getBoolean("isTouchEnabled", true)) { | 399 | if (!mPreferences.getBoolean("isTouchEnabled", true)) { |
| @@ -420,8 +427,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 420 | NativeLibrary.onTouchReleased(pointerId); | 427 | NativeLibrary.onTouchReleased(pointerId); |
| 421 | } | 428 | } |
| 422 | 429 | ||
| 423 | invalidate(); | ||
| 424 | |||
| 425 | return true; | 430 | return true; |
| 426 | } | 431 | } |
| 427 | 432 | ||
| @@ -536,11 +541,11 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 536 | overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.joystick_range, | 541 | overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.joystick_range, |
| 537 | R.drawable.joystick, R.drawable.joystick_depressed, StickType.STICK_R, ButtonType.STICK_R, orientation)); | 542 | R.drawable.joystick, R.drawable.joystick_depressed, StickType.STICK_R, ButtonType.STICK_R, orientation)); |
| 538 | } | 543 | } |
| 539 | if (mPreferences.getBoolean("buttonToggle13", true)) { | 544 | if (mPreferences.getBoolean("buttonToggle13", false)) { |
| 540 | overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.facebutton_home, | 545 | overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.facebutton_home, |
| 541 | R.drawable.facebutton_home_depressed, ButtonType.BUTTON_HOME, orientation)); | 546 | R.drawable.facebutton_home_depressed, ButtonType.BUTTON_HOME, orientation)); |
| 542 | } | 547 | } |
| 543 | if (mPreferences.getBoolean("buttonToggle14", true)) { | 548 | if (mPreferences.getBoolean("buttonToggle14", false)) { |
| 544 | overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.facebutton_screenshot, | 549 | overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.facebutton_screenshot, |
| 545 | R.drawable.facebutton_screenshot_depressed, ButtonType.BUTTON_CAPTURE, orientation)); | 550 | R.drawable.facebutton_screenshot_depressed, ButtonType.BUTTON_CAPTURE, orientation)); |
| 546 | } | 551 | } |
| @@ -580,7 +585,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 580 | if (!mPreferences.getBoolean("OverlayInit", false)) { | 585 | if (!mPreferences.getBoolean("OverlayInit", false)) { |
| 581 | defaultOverlayLandscape(); | 586 | defaultOverlayLandscape(); |
| 582 | } | 587 | } |
| 583 | 588 | resetButtonPlacement(); | |
| 584 | SharedPreferences.Editor sPrefsEditor = mPreferences.edit(); | 589 | SharedPreferences.Editor sPrefsEditor = mPreferences.edit(); |
| 585 | sPrefsEditor.putBoolean("OverlayInit", true); | 590 | sPrefsEditor.putBoolean("OverlayInit", true); |
| 586 | sPrefsEditor.apply(); | 591 | sPrefsEditor.apply(); |
| @@ -596,7 +601,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 596 | // Get screen size | 601 | // Get screen size |
| 597 | Display display = ((Activity) getContext()).getWindowManager().getDefaultDisplay(); | 602 | Display display = ((Activity) getContext()).getWindowManager().getDefaultDisplay(); |
| 598 | DisplayMetrics outMetrics = new DisplayMetrics(); | 603 | DisplayMetrics outMetrics = new DisplayMetrics(); |
| 599 | display.getMetrics(outMetrics); | 604 | display.getRealMetrics(outMetrics); |
| 600 | float maxX = outMetrics.heightPixels; | 605 | float maxX = outMetrics.heightPixels; |
| 601 | float maxY = outMetrics.widthPixels; | 606 | float maxY = outMetrics.widthPixels; |
| 602 | // Height and width changes depending on orientation. Use the larger value for height. | 607 | // Height and width changes depending on orientation. Use the larger value for height. |
| @@ -605,6 +610,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 605 | maxX = maxY; | 610 | maxX = maxY; |
| 606 | maxY = tmp; | 611 | maxY = tmp; |
| 607 | } | 612 | } |
| 613 | |||
| 608 | Resources res = getResources(); | 614 | Resources res = getResources(); |
| 609 | 615 | ||
| 610 | // Each value is a percent from max X/Y stored as an int. Have to bring that value down | 616 | // Each value is a percent from max X/Y stored as an int. Have to bring that value down |
| @@ -621,8 +627,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener, | |||
| 621 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZL + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZL_Y) / 1000) * maxY)); | 627 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZL + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZL_Y) / 1000) * maxY)); |
| 622 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_X) / 1000) * maxX)); | 628 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_X) / 1000) * maxX)); |
| 623 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_Y) / 1000) * maxY)); | 629 | sPrefsEditor.putFloat(ButtonType.TRIGGER_ZR + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_ZR_Y) / 1000) * maxY)); |
| 624 | sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_UP_X) / 1000) * maxX)); | 630 | sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-X", (((float) res.getInteger(R.integer.SWITCH_BUTTON_DPAD_X) / 1000) * maxX)); |
| 625 | sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_UP_Y) / 1000) * maxY)); | 631 | sPrefsEditor.putFloat(ButtonType.DPAD_UP + "-Y", (((float) res.getInteger(R.integer.SWITCH_BUTTON_DPAD_Y) / 1000) * maxY)); |
| 626 | sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_X) / 1000) * maxX)); | 632 | sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_X) / 1000) * maxX)); |
| 627 | sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_Y) / 1000) * maxY)); | 633 | sPrefsEditor.putFloat(ButtonType.TRIGGER_L + "-Y", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_L_Y) / 1000) * maxY)); |
| 628 | sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_R_X) / 1000) * maxX)); | 634 | sPrefsEditor.putFloat(ButtonType.TRIGGER_R + "-X", (((float) res.getInteger(R.integer.SWITCH_TRIGGER_R_X) / 1000) * maxX)); |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableButton.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableButton.java index 15da42f3d..16a4b96ad 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableButton.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableButton.java | |||
| @@ -67,6 +67,7 @@ public final class InputOverlayDrawableButton { | |||
| 67 | int motion_event = event.getAction() & MotionEvent.ACTION_MASK; | 67 | int motion_event = event.getAction() & MotionEvent.ACTION_MASK; |
| 68 | boolean isActionDown = motion_event == MotionEvent.ACTION_DOWN || motion_event == MotionEvent.ACTION_POINTER_DOWN; | 68 | boolean isActionDown = motion_event == MotionEvent.ACTION_DOWN || motion_event == MotionEvent.ACTION_POINTER_DOWN; |
| 69 | boolean isActionUp = motion_event == MotionEvent.ACTION_UP || motion_event == MotionEvent.ACTION_POINTER_UP; | 69 | boolean isActionUp = motion_event == MotionEvent.ACTION_UP || motion_event == MotionEvent.ACTION_POINTER_UP; |
| 70 | boolean current_state = mPressedState; | ||
| 70 | 71 | ||
| 71 | if (isActionDown) { | 72 | if (isActionDown) { |
| 72 | if (!getBounds().contains(xPosition, yPosition)) { | 73 | if (!getBounds().contains(xPosition, yPosition)) { |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableDpad.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableDpad.java index aa3653e09..1d10b1e65 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableDpad.java +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlayDrawableDpad.java | |||
| @@ -121,12 +121,16 @@ public final class InputOverlayDrawableDpad { | |||
| 121 | maxY -= getBounds().centerY(); | 121 | maxY -= getBounds().centerY(); |
| 122 | final float AxisX = touchX / maxX; | 122 | final float AxisX = touchX / maxX; |
| 123 | final float AxisY = touchY / maxY; | 123 | final float AxisY = touchY / maxY; |
| 124 | final boolean up_state = mUpButtonState; | ||
| 125 | final boolean down_state = mDownButtonState; | ||
| 126 | final boolean left_state = mLeftButtonState; | ||
| 127 | final boolean right_state = mRightButtonState; | ||
| 124 | 128 | ||
| 125 | mUpButtonState = AxisY < -InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; | 129 | mUpButtonState = AxisY < -InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; |
| 126 | mDownButtonState = AxisY > InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; | 130 | mDownButtonState = AxisY > InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; |
| 127 | mLeftButtonState = AxisX < -InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; | 131 | mLeftButtonState = AxisX < -InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; |
| 128 | mRightButtonState = AxisX > InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; | 132 | mRightButtonState = AxisX > InputOverlayDrawableDpad.VIRT_AXIS_DEADZONE; |
| 129 | return true; | 133 | return up_state != mUpButtonState || down_state != mDownButtonState || left_state != mLeftButtonState || right_state != mRightButtonState; |
| 130 | } | 134 | } |
| 131 | 135 | ||
| 132 | return false; | 136 | return false; |
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 4a0b9fd86..f7919e483 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 | |||
| @@ -140,6 +140,8 @@ public final class InputOverlayDrawableJoystick { | |||
| 140 | maxY -= getVirtBounds().centerY(); | 140 | maxY -= getVirtBounds().centerY(); |
| 141 | final float AxisX = touchX / maxX; | 141 | final float AxisX = touchX / maxX; |
| 142 | final float AxisY = touchY / maxY; | 142 | final float AxisY = touchY / maxY; |
| 143 | final float oldXAxis = mXAxis; | ||
| 144 | final float oldYAxis = mYAxis; | ||
| 143 | 145 | ||
| 144 | // Clamp the circle pad input to a circle | 146 | // Clamp the circle pad input to a circle |
| 145 | final float angle = (float) Math.atan2(AxisY, AxisX); | 147 | final float angle = (float) Math.atan2(AxisY, AxisX); |
| @@ -150,7 +152,7 @@ public final class InputOverlayDrawableJoystick { | |||
| 150 | mXAxis = ((float) Math.cos(angle) * radius); | 152 | mXAxis = ((float) Math.cos(angle) * radius); |
| 151 | mYAxis = ((float) Math.sin(angle) * radius); | 153 | mYAxis = ((float) Math.sin(angle) * radius); |
| 152 | SetInnerBounds(); | 154 | SetInnerBounds(); |
| 153 | return true; | 155 | return oldXAxis != mXAxis && oldYAxis != mYAxis; |
| 154 | } | 156 | } |
| 155 | 157 | ||
| 156 | return false; | 158 | return false; |
diff --git a/src/android/app/src/main/res/drawable/joystick_range.xml b/src/android/app/src/main/res/drawable/joystick_range.xml index cdd5d2e50..f6282b5c8 100644 --- a/src/android/app/src/main/res/drawable/joystick_range.xml +++ b/src/android/app/src/main/res/drawable/joystick_range.xml | |||
| @@ -20,17 +20,17 @@ | |||
| 20 | </aapt:attr> | 20 | </aapt:attr> |
| 21 | </path> | 21 | </path> |
| 22 | <path android:fillAlpha="0.6" | 22 | <path android:fillAlpha="0.6" |
| 23 | android:pathData="M18.74,64.84A132.8,132.8 0,1 0,200.8 18.74,132.8 132.8,0 0,0 18.74,64.84ZM230,190.72A113.12,113.12 0,1 1,190.72 35.64,113.12 113.12,0 0,1 230,190.72Z" android:strokeAlpha="0.6"> | 23 | android:pathData="m18.72,64.82a132.8,132.8 0,1 0,182.06 -46.1,132.8 132.8,0 0,0 -182.06,46.1zM229.98,190.7a113.12,113.12 0,1 1,-39.28 -155.08,113.12 113.12,0 0,1 39.28,155.08z" android:strokeAlpha="0.6"> |
| 24 | <aapt:attr name="android:fillColor"> | 24 | <aapt:attr name="android:fillColor"> |
| 25 | <gradient android:centerX="132.84" android:centerY="132.73" | 25 | <gradient android:centerX="132.82" android:centerY="132.7" |
| 26 | android:gradientRadius="132.8" android:type="radial"> | 26 | android:gradientRadius="141.24" android:type="radial"> |
| 27 | <item android:color="#FF969696" android:offset="0"/> | 27 | <item android:color="#FF969696" android:offset="0"/> |
| 28 | <item android:color="#FF949494" android:offset="0.45"/> | 28 | <item android:color="#FF949494" android:offset="0.8"/> |
| 29 | <item android:color="#FF8D8D8D" android:offset="0.61"/> | 29 | <item android:color="#FF8D8D8D" android:offset="0.84"/> |
| 30 | <item android:color="#FF828282" android:offset="0.72"/> | 30 | <item android:color="#FF828282" android:offset="0.87"/> |
| 31 | <item android:color="#FF717171" android:offset="0.82"/> | 31 | <item android:color="#FF717171" android:offset="0.9"/> |
| 32 | <item android:color="#FF5B5B5B" android:offset="0.9"/> | 32 | <item android:color="#FF5B5B5B" android:offset="0.94"/> |
| 33 | <item android:color="#FF404040" android:offset="0.97"/> | 33 | <item android:color="#FF404040" android:offset="0.98"/> |
| 34 | <item android:color="#FF303030" android:offset="1"/> | 34 | <item android:color="#FF303030" android:offset="1"/> |
| 35 | </gradient> | 35 | </gradient> |
| 36 | </aapt:attr> | 36 | </aapt:attr> |
diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml index 828c5efc4..729a986db 100644 --- a/src/android/app/src/main/res/layout/fragment_emulation.xml +++ b/src/android/app/src/main/res/layout/fragment_emulation.xml | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | <TextView | 24 | <TextView |
| 25 | android:id="@+id/show_fps_text" | 25 | android:id="@+id/show_fps_text" |
| 26 | android:layout_marginStart="8dp" | 26 | android:layout_marginStart="18dp" |
| 27 | android:layout_marginTop="2dp" | 27 | android:layout_marginTop="2dp" |
| 28 | android:layout_width="wrap_content" | 28 | android:layout_width="wrap_content" |
| 29 | android:layout_height="wrap_content" | 29 | android:layout_height="wrap_content" |
diff --git a/src/android/app/src/main/res/values/integers.xml b/src/android/app/src/main/res/values/integers.xml index 6e81215a5..7755be527 100644 --- a/src/android/app/src/main/res/values/integers.xml +++ b/src/android/app/src/main/res/values/integers.xml | |||
| @@ -4,35 +4,35 @@ | |||
| 4 | <integer name="game_grid_columns">1</integer> | 4 | <integer name="game_grid_columns">1</integer> |
| 5 | 5 | ||
| 6 | <!-- Default SWITCH landscape layout --> | 6 | <!-- Default SWITCH landscape layout --> |
| 7 | <integer name="SWITCH_BUTTON_A_X">930</integer> | 7 | <integer name="SWITCH_BUTTON_A_X">760</integer> |
| 8 | <integer name="SWITCH_BUTTON_A_Y">610</integer> | 8 | <integer name="SWITCH_BUTTON_A_Y">810</integer> |
| 9 | <integer name="SWITCH_BUTTON_B_X">870</integer> | 9 | <integer name="SWITCH_BUTTON_B_X">710</integer> |
| 10 | <integer name="SWITCH_BUTTON_B_Y">720</integer> | 10 | <integer name="SWITCH_BUTTON_B_Y">920</integer> |
| 11 | <integer name="SWITCH_BUTTON_X_X">870</integer> | 11 | <integer name="SWITCH_BUTTON_X_X">710</integer> |
| 12 | <integer name="SWITCH_BUTTON_X_Y">500</integer> | 12 | <integer name="SWITCH_BUTTON_X_Y">700</integer> |
| 13 | <integer name="SWITCH_BUTTON_Y_X">810</integer> | 13 | <integer name="SWITCH_BUTTON_Y_X">660</integer> |
| 14 | <integer name="SWITCH_BUTTON_Y_Y">610</integer> | 14 | <integer name="SWITCH_BUTTON_Y_Y">810</integer> |
| 15 | <integer name="SWITCH_STICK_L_X">170</integer> | 15 | <integer name="SWITCH_STICK_L_X">100</integer> |
| 16 | <integer name="SWITCH_STICK_L_Y">740</integer> | 16 | <integer name="SWITCH_STICK_L_Y">670</integer> |
| 17 | <integer name="SWITCH_STICK_R_X">715</integer> | 17 | <integer name="SWITCH_STICK_R_X">900</integer> |
| 18 | <integer name="SWITCH_STICK_R_Y">740</integer> | 18 | <integer name="SWITCH_STICK_R_Y">670</integer> |
| 19 | <integer name="SWITCH_TRIGGER_L_X">13</integer> | 19 | <integer name="SWITCH_TRIGGER_L_X">70</integer> |
| 20 | <integer name="SWITCH_TRIGGER_L_Y">125</integer> | 20 | <integer name="SWITCH_TRIGGER_L_Y">220</integer> |
| 21 | <integer name="SWITCH_TRIGGER_R_X">895</integer> | 21 | <integer name="SWITCH_TRIGGER_R_X">930</integer> |
| 22 | <integer name="SWITCH_TRIGGER_R_Y">125</integer> | 22 | <integer name="SWITCH_TRIGGER_R_Y">220</integer> |
| 23 | <integer name="SWITCH_TRIGGER_ZL_X">13</integer> | 23 | <integer name="SWITCH_TRIGGER_ZL_X">70</integer> |
| 24 | <integer name="SWITCH_TRIGGER_ZL_Y">0</integer> | 24 | <integer name="SWITCH_TRIGGER_ZL_Y">90</integer> |
| 25 | <integer name="SWITCH_TRIGGER_ZR_X">895</integer> | 25 | <integer name="SWITCH_TRIGGER_ZR_X">930</integer> |
| 26 | <integer name="SWITCH_TRIGGER_ZR_Y">0</integer> | 26 | <integer name="SWITCH_TRIGGER_ZR_Y">90</integer> |
| 27 | <integer name="SWITCH_BUTTON_MINUS_X">440</integer> | 27 | <integer name="SWITCH_BUTTON_MINUS_X">460</integer> |
| 28 | <integer name="SWITCH_BUTTON_MINUS_Y">850</integer> | 28 | <integer name="SWITCH_BUTTON_MINUS_Y">955</integer> |
| 29 | <integer name="SWITCH_BUTTON_PLUS_X">520</integer> | 29 | <integer name="SWITCH_BUTTON_PLUS_X">540</integer> |
| 30 | <integer name="SWITCH_BUTTON_PLUS_Y">850</integer> | 30 | <integer name="SWITCH_BUTTON_PLUS_Y">955</integer> |
| 31 | <integer name="SWITCH_BUTTON_HOME_X">600</integer> | 31 | <integer name="SWITCH_BUTTON_HOME_X">620</integer> |
| 32 | <integer name="SWITCH_BUTTON_HOME_Y">890</integer> | 32 | <integer name="SWITCH_BUTTON_HOME_Y">960</integer> |
| 33 | <integer name="SWITCH_BUTTON_CAPTURE_X">360</integer> | 33 | <integer name="SWITCH_BUTTON_CAPTURE_X">380</integer> |
| 34 | <integer name="SWITCH_BUTTON_CAPTURE_Y">890</integer> | 34 | <integer name="SWITCH_BUTTON_CAPTURE_Y">960</integer> |
| 35 | <integer name="SWITCH_BUTTON_UP_X">35</integer> | 35 | <integer name="SWITCH_BUTTON_DPAD_X">260</integer> |
| 36 | <integer name="SWITCH_BUTTON_UP_Y">480</integer> | 36 | <integer name="SWITCH_BUTTON_DPAD_Y">810</integer> |
| 37 | 37 | ||
| 38 | </resources> | 38 | </resources> |