diff --git a/android/app/src/main/cpp/audio-output.cpp b/android/app/src/main/cpp/audio-output.cpp index 32495f5..83c4963 100644 --- a/android/app/src/main/cpp/audio-output.cpp +++ b/android/app/src/main/cpp/audio-output.cpp @@ -25,7 +25,7 @@ #include #define BUFFER_CHUNK_SIZE 512 -#define BUFFER_CHUNKS_COUNT 128 +#define BUFFER_CHUNKS_COUNT 32 using AudioBuffer = CircularBuffer; diff --git a/android/app/src/main/java/com/metallic/chiaki/touchcontrols/TouchControlsFragment.kt b/android/app/src/main/java/com/metallic/chiaki/touchcontrols/TouchControlsFragment.kt index 6d311f9..5704658 100644 --- a/android/app/src/main/java/com/metallic/chiaki/touchcontrols/TouchControlsFragment.kt +++ b/android/app/src/main/java/com/metallic/chiaki/touchcontrols/TouchControlsFragment.kt @@ -51,7 +51,41 @@ class TouchControlsFragment : Fragment() moonButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_MOON) pyramidButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_PYRAMID) boxButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_BOX) + l1ButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_L1) + r1ButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_R1) + optionsButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_OPTIONS) + shareButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_SHARE) psButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_PS) + touchpadButtonView.buttonPressedCallback = buttonStateChanged(ControllerState.BUTTON_TOUCHPAD) + + l2ButtonView.buttonPressedCallback = { controllerState = controllerState.copy().apply { l2State = if(it) 255U else 0U } } + r2ButtonView.buttonPressedCallback = { controllerState = controllerState.copy().apply { r2State = if(it) 255U else 0U } } + + leftDpadView.stateChangeCallback = { controllerState = controllerState.copy().apply { + val pos: Pair = when(it) + { + DPadView.Direction.UP -> Pair(0, Short.MIN_VALUE) + DPadView.Direction.DOWN -> Pair(0, Short.MAX_VALUE) + DPadView.Direction.LEFT -> Pair(Short.MIN_VALUE, 0) + DPadView.Direction.RIGHT -> Pair(Short.MAX_VALUE, 0) + null -> Pair(0, 0) + } + leftX = pos.first + leftY = pos.second + }} + + rightDpadView.stateChangeCallback = { controllerState = controllerState.copy().apply { + val pos: Pair = when(it) + { + DPadView.Direction.UP -> Pair(0, Short.MIN_VALUE) + DPadView.Direction.DOWN -> Pair(0, Short.MAX_VALUE) + DPadView.Direction.LEFT -> Pair(Short.MIN_VALUE, 0) + DPadView.Direction.RIGHT -> Pair(Short.MAX_VALUE, 0) + null -> Pair(0, 0) + } + rightX = pos.first + rightY = pos.second + }} } private fun dpadStateChanged(direction: DPadView.Direction?) diff --git a/android/app/src/main/res/layout/fragment_controls.xml b/android/app/src/main/res/layout/fragment_controls.xml index 35317db..ff89894 100644 --- a/android/app/src/main/res/layout/fragment_controls.xml +++ b/android/app/src/main/res/layout/fragment_controls.xml @@ -13,6 +13,7 @@ android:layout_width="128dp" android:layout_height="128dp" android:layout_marginLeft="32dp" + android:layout_marginBottom="32dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> @@ -22,7 +23,8 @@ android:layout_height="144dp" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"> + app:layout_constraintBottom_toBottomOf="parent" + android:layout_marginBottom="32dp"> + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml index 470f28e..1ef71a1 100644 --- a/android/app/src/main/res/values/colors.xml +++ b/android/app/src/main/res/values/colors.xml @@ -7,6 +7,6 @@ @android:color/white @android:color/black - #44ffffff + #22ffffff #88ffffff