diff --git a/Android/app/build.gradle b/Android/app/build.gradle index ccb3673..0844016 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.example.androidsteering" minSdkVersion 19 targetSdkVersion 33 - versionCode 6 - versionName "2.2.0" + versionCode 7 + versionName "2.3.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/Android/app/src/main/java/com/example/androidsteering/MainActivity.java b/Android/app/src/main/java/com/example/androidsteering/MainActivity.java index cd809dc..63f3825 100644 --- a/Android/app/src/main/java/com/example/androidsteering/MainActivity.java +++ b/Android/app/src/main/java/com/example/androidsteering/MainActivity.java @@ -75,17 +75,28 @@ public void run() { vHorizontal.setProgress((int) progressHorizontal); vVertical.setProgress((int) progressVertical); } - if (controllerMode == ControllerMode.Alter || controllerMode == ControllerMode.GamePad) { - if (!LTPressed && !RTPressed) + if (controllerMode == ControllerMode.Alter) { + if (!LTPressed && !RTPressed) { globalBuffer.addData(MotionStatus.ResetAccAngle, 0.0f); - if (LTPressed) { + } else if (LTPressed) { ProgressBar bar = findViewById(R.id.progressBarLT); globalBuffer.addData(MotionStatus.SetAccRatio, -bar.getProgress() / (float) bar.getMax()); - } - if (RTPressed && (!LTPressed || controllerMode == ControllerMode.GamePad)) { + } else if (RTPressed) { ProgressBar bar = findViewById(R.id.progressBarRT); globalBuffer.addData(MotionStatus.SetAccRatio, bar.getProgress() / (float) bar.getMax()); } + } else if (controllerMode == ControllerMode.GamePad) { + if (!LTPressed && !RTPressed) { + globalBuffer.addData(MotionStatus.ResetAccAngle, 0.0f); + } + if (LTPressed) { + ProgressBar bar = findViewById(R.id.progressBarLT); + globalBuffer.addData(MotionStatus.SetLTValue, bar.getProgress() / (float) bar.getMax()); + } + if (RTPressed) { + ProgressBar bar = findViewById(R.id.progressBarRT); + globalBuffer.addData(MotionStatus.SetRTValue, bar.getProgress() / (float) bar.getMax()); + } } } catch (Exception e) { Log.d(getString(R.string.logTagMain), Objects.requireNonNull(e.getMessage())); @@ -458,8 +469,8 @@ private Pair computeJoyStickXY(int angle, int strength) { double r = Math.toRadians(angle); double s = strength / 100.0; - float x = (float)(Math.cos(r) * s); - float y = (float)(Math.sin(r) * s); + float x = (float) (Math.cos(r) * s); + float y = (float) (Math.sin(r) * s); return new Pair<>(x, y); } diff --git a/Android/app/src/main/java/com/example/androidsteering/Motion.java b/Android/app/src/main/java/com/example/androidsteering/Motion.java index b812987..e2c76f5 100644 --- a/Android/app/src/main/java/com/example/androidsteering/Motion.java +++ b/Android/app/src/main/java/com/example/androidsteering/Motion.java @@ -21,7 +21,9 @@ enum MotionStatus { SetLeftStickX(5), SetLeftStickY(6), SetRightStickX(7), - SetRightStickY(8); + SetRightStickY(8), + SetLTValue(9), + SetRTValue(10); private final int val; diff --git a/Assets/phone1.jpg b/Assets/phone1.jpg deleted file mode 100644 index f8e8cbb..0000000 Binary files a/Assets/phone1.jpg and /dev/null differ diff --git a/Assets/phone1.png b/Assets/phone1.png new file mode 100644 index 0000000..48d2735 Binary files /dev/null and b/Assets/phone1.png differ diff --git a/Assets/phone2.jpg b/Assets/phone2.jpg deleted file mode 100644 index e7121d6..0000000 Binary files a/Assets/phone2.jpg and /dev/null differ diff --git a/Assets/phone2.png b/Assets/phone2.png new file mode 100644 index 0000000..f2216af Binary files /dev/null and b/Assets/phone2.png differ diff --git a/Assets/phone3.jpg b/Assets/phone3.jpg deleted file mode 100644 index 9ade483..0000000 Binary files a/Assets/phone3.jpg and /dev/null differ diff --git a/Assets/phone3.png b/Assets/phone3.png new file mode 100644 index 0000000..27d75a1 Binary files /dev/null and b/Assets/phone3.png differ diff --git a/Assets/phone4.jpg b/Assets/phone4.jpg deleted file mode 100644 index 0acaf1f..0000000 Binary files a/Assets/phone4.jpg and /dev/null differ diff --git a/Assets/phone4.png b/Assets/phone4.png new file mode 100644 index 0000000..6cdc68b Binary files /dev/null and b/Assets/phone4.png differ diff --git a/Assets/phone5.jpg b/Assets/phone5.jpg deleted file mode 100644 index 2037ae2..0000000 Binary files a/Assets/phone5.jpg and /dev/null differ diff --git a/Assets/phone5.png b/Assets/phone5.png new file mode 100644 index 0000000..42fda59 Binary files /dev/null and b/Assets/phone5.png differ diff --git a/README.md b/README.md index 4e6db25..be9171a 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ See [Game Steering Wheel Settings](SETTINGS.md) for more details. - [x] Slider bar on phone for LT/RT controls - [x] Memorized user settings - [x] Connection under same network (does not have to be Wifi hotspot) +- [x] Fully implemented Xbox controller emulator ------ @@ -115,15 +116,15 @@ Pre-built installers can be found [here](https://github.com/teamclouday/AndroidS __Android Side__ -phone1 +phone1 -phone2 +phone2 -phone3 +phone3 -phone4 +phone4 -phone6 +phone6 __Windows Side__ diff --git a/Windows/SteeringWheel/Controller.cs b/Windows/SteeringWheel/Controller.cs index 67ac501..282ebcc 100644 --- a/Windows/SteeringWheel/Controller.cs +++ b/Windows/SteeringWheel/Controller.cs @@ -31,6 +31,8 @@ public enum MotionStatus SetLeftStickY = 6, SetRightStickX = 7, SetRightStickY = 8, + SetLTValue = 9, + SetRTValue = 10, } /// @@ -308,6 +310,22 @@ private void SetupProcess() } break; } + case MotionStatus.SetLTValue: + { + lock (joyReportLock) + { + joyReport.AxisZ = (int)(data.Value * axisMax); + } + break; + } + case MotionStatus.SetRTValue: + { + lock (joyReportLock) + { + joyReport.AxisZRot = (int)(data.Value * axisMax); + } + break; + } } } } diff --git a/Windows/SteeringWheel/SteeringWheel.csproj b/Windows/SteeringWheel/SteeringWheel.csproj index 4ac69a2..92d914b 100644 --- a/Windows/SteeringWheel/SteeringWheel.csproj +++ b/Windows/SteeringWheel/SteeringWheel.csproj @@ -30,7 +30,7 @@ Teamclouday false 0 - 2.2.0.0 + 2.3.0.0 false true true