diff --git a/VoidLink/Database/DataManager.h b/VoidLink/Database/DataManager.h
index f5a1ee8e..5085f683 100644
--- a/VoidLink/Database/DataManager.h
+++ b/VoidLink/Database/DataManager.h
@@ -63,6 +63,7 @@ typedef NS_ENUM(NSInteger, SettingsMenuMode) {
pointerVelocityModeDivider:(CGFloat)pointerVelocityModeDivider
touchPointerVelocityFactor:(CGFloat)touchPointerVelocityFactor
mousePointerVelocityFactor:(CGFloat)mousePointerVelocityFactor
+ gyroSensitivity:(CGFloat)gyroSensitivity
touchMoveEventInterval:(NSInteger)touchMoveEventInterval
reverseMouseWheelDirection:(BOOL)reverseMouseWheelDirection
asyncNativeTouchPriority:(NSInteger)asyncNativeTouchPriority
diff --git a/VoidLink/Database/DataManager.m b/VoidLink/Database/DataManager.m
index 383a5122..99f5301e 100644
--- a/VoidLink/Database/DataManager.m
+++ b/VoidLink/Database/DataManager.m
@@ -65,10 +65,11 @@
keyboardToggleFingers:(NSInteger)keyboardToggleFingers
oscLayoutToolFingers:(NSInteger)oscLayoutToolFingers
slideToSettingsScreenEdge:(NSInteger)slideToSettingsScreenEdge
- slideToSettingsDistance:(CGFloat)slideToSettingsDistance
+ slideToSettingsDistance:(CGFloat)slideToSettingsDistance
pointerVelocityModeDivider:(CGFloat)pointerVelocityModeDivider
touchPointerVelocityFactor:(CGFloat)touchPointerVelocityFactor
mousePointerVelocityFactor:(CGFloat)mousePointerVelocityFactor
+ gyroSensitivity:(CGFloat)gyroSensitivity
touchMoveEventInterval:(NSInteger)touchMoveEventInterval
reverseMouseWheelDirection:(BOOL)reverseMouseWheelDirection
asyncNativeTouchPriority:(NSInteger)asyncNativeTouchPriority
@@ -108,6 +109,7 @@
settingsToSave.pointerVelocityModeDivider = [NSNumber numberWithFloat:pointerVelocityModeDivider];
settingsToSave.touchPointerVelocityFactor = [NSNumber numberWithFloat:touchPointerVelocityFactor];
settingsToSave.mousePointerVelocityFactor = [NSNumber numberWithFloat:mousePointerVelocityFactor];
+ settingsToSave.gyroSensitivity = [NSNumber numberWithFloat:gyroSensitivity];
settingsToSave.touchMoveEventInterval = [NSNumber numberWithInteger:touchMoveEventInterval];
settingsToSave.reverseMouseWheelDirection = reverseMouseWheelDirection;
settingsToSave.asyncNativeTouchPriority = [NSNumber numberWithInteger:asyncNativeTouchPriority];
diff --git a/VoidLink/Database/TemporarySettings.h b/VoidLink/Database/TemporarySettings.h
index c3e7a9b2..7240d6d5 100644
--- a/VoidLink/Database/TemporarySettings.h
+++ b/VoidLink/Database/TemporarySettings.h
@@ -32,6 +32,7 @@
@property (nonatomic, retain) NSNumber * slideToSettingsDistance;
@property (nonatomic, retain) NSNumber * touchMoveEventInterval;
@property (nonatomic, retain) NSNumber * touchPointerVelocityFactor;
+@property (nonatomic, retain) NSNumber * gyroSensitivity;
@property (nonatomic, retain) NSNumber * mousePointerVelocityFactor;
@property (nonatomic, retain) NSNumber * pointerVelocityModeDivider;
@property (nonatomic, retain) NSString * uniqueId;
diff --git a/VoidLink/Database/TemporarySettings.m b/VoidLink/Database/TemporarySettings.m
index cd8ac009..7e1bc8aa 100644
--- a/VoidLink/Database/TemporarySettings.m
+++ b/VoidLink/Database/TemporarySettings.m
@@ -106,6 +106,7 @@
self.touchMoveEventInterval = settings.touchMoveEventInterval;
self.touchPointerVelocityFactor = settings.touchPointerVelocityFactor;
self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor;
+ self.gyroSensitivity = settings.gyroSensitivity;
self.pointerVelocityModeDivider = settings.pointerVelocityModeDivider;
self.unlockDisplayOrientation = settings.unlockDisplayOrientation;
self.resolutionSelected = settings.resolutionSelected;
diff --git a/VoidLink/Input/ControllerSupport.m b/VoidLink/Input/ControllerSupport.m
index bb0ccebe..7351bf45 100644
--- a/VoidLink/Input/ControllerSupport.m
+++ b/VoidLink/Input/ControllerSupport.m
@@ -54,6 +54,7 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
bool _multiController;
bool _swapABXYButtons;
int _gyroMode;
+ CGFloat _gyroSensitivity;
bool _captureMouse;
}
@@ -130,9 +131,9 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
CMAcceleration lastDeviceAccelSample = controller.lastDeviceAccelSample;
CMAcceleration deviceAccelSample = controller.motionManager.deviceMotion.userAcceleration;
//userAcceleration does not contain gravity, add gravity to x, y and z values:
- deviceAccelSample.x += controller.motionManager.deviceMotion.gravity.x;
- deviceAccelSample.y += controller.motionManager.deviceMotion.gravity.y;
- deviceAccelSample.z += controller.motionManager.deviceMotion.gravity.z;
+ deviceAccelSample.x += controller.motionManager.deviceMotion.gravity.x * self->_gyroSensitivity;
+ deviceAccelSample.y += controller.motionManager.deviceMotion.gravity.y * self->_gyroSensitivity;
+ deviceAccelSample.z += controller.motionManager.deviceMotion.gravity.z * self->_gyroSensitivity;
if (memcmp(&deviceAccelSample, &lastDeviceAccelSample, sizeof(deviceAccelSample)) == 0) {
return;
@@ -143,16 +144,16 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
if(UIApplication.sharedApplication.windows.firstObject.windowScene.interfaceOrientation == 4){ //check for landscape left or landscape right
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_ACCEL,
- deviceAccelSample.y * -9.80665f,
- deviceAccelSample.z * -9.80665f,
- deviceAccelSample.x * -9.80665f);
+ deviceAccelSample.y * -9.80665f * self->_gyroSensitivity,
+ deviceAccelSample.z * -9.80665f * self->_gyroSensitivity,
+ deviceAccelSample.x * -9.80665f * self->_gyroSensitivity);
}
else{
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_ACCEL,
- deviceAccelSample.y * +9.80665f,
- deviceAccelSample.z * -9.80665f,
- deviceAccelSample.x * +9.80665f);
+ deviceAccelSample.y * +9.80665f * self->_gyroSensitivity,
+ deviceAccelSample.z * -9.80665f * self->_gyroSensitivity,
+ deviceAccelSample.x * +9.80665f * self->_gyroSensitivity);
}
}];
});}
@@ -181,18 +182,17 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
if(UIApplication.sharedApplication.windows.firstObject.windowScene.interfaceOrientation == 4){//check for landscape left or landscape right
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_GYRO,
- deviceGyroSample.y * 57.2957795f,
- deviceGyroSample.z * 57.2957795f,
- deviceGyroSample.x * 57.2957795f);
+ deviceGyroSample.y * 57.2957795f * self->_gyroSensitivity,
+ deviceGyroSample.z * 57.2957795f * self->_gyroSensitivity,
+ deviceGyroSample.x * 57.2957795f * self->_gyroSensitivity);
}
else{
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_GYRO,
- deviceGyroSample.y * -57.2957795f,
- deviceGyroSample.z * 57.2957795f,
- deviceGyroSample.x * -57.2957795f);
+ deviceGyroSample.y * -57.2957795f * self->_gyroSensitivity,
+ deviceGyroSample.z * 57.2957795f * self->_gyroSensitivity,
+ deviceGyroSample.x * -57.2957795f * self->_gyroSensitivity);
}
-
}];
break;
}
@@ -223,9 +223,9 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
// Convert g to m/s^2
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_ACCEL,
- accelSample.x * -9.80665f,
- accelSample.y * -9.80665f,
- accelSample.z * -9.80665f);
+ accelSample.x * -9.80665f * self->_gyroSensitivity,
+ accelSample.y * -9.80665f * self->_gyroSensitivity,
+ accelSample.z * -9.80665f * self->_gyroSensitivity);
}];
}
break;
@@ -251,9 +251,9 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
// Convert rad/s to deg/s
LiSendControllerMotionEvent((uint8_t)controller.controllerNumber,
LI_MOTION_TYPE_GYRO,
- gyroSample.x * 57.2957795f,
- gyroSample.z * 57.2957795f,
- gyroSample.y * -57.2957795f);
+ gyroSample.x * 57.2957795f * self->_gyroSensitivity,
+ gyroSample.z * 57.2957795f * self->_gyroSensitivity,
+ gyroSample.y * -57.2957795f * self->_gyroSensitivity);
}];
}
break;
@@ -1221,8 +1221,11 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
_oscController.playerIndex = 0;
DataManager* dataMan = [[DataManager alloc] init];
- _oscEnabled = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue] != OnScreenControlsLevelOff;
+ //_oscEnabled = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue] != OnScreenControlsLevelOff;
+ TemporarySettings* currentSettings = [dataMan getSettings];
_oscEnabled = true;
+ _gyroSensitivity = currentSettings.gyroSensitivity.floatValue;
+
Log(LOG_I, @"Number of supported controllers connected: %d", [ControllerSupport getGamepadCount]);
Log(LOG_I, @"Multi-controller: %d", _multiController);
diff --git a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents
index 14629f52..a98415fb 100644
--- a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents
+++ b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents
@@ -25,12 +25,12 @@
-
+
diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m
index cd7b6669..547d0e5e 100644
--- a/VoidLink/ViewControllers/SettingsViewController.m
+++ b/VoidLink/ViewControllers/SettingsViewController.m
@@ -511,7 +511,7 @@ BOOL isCustomResolution(CGSize res) {
[self addSetting:self.mousePointerVelocityStack ofId:@"mousePointerVelocityStack" withInfoTag:NO withDynamicLabel:YES to:touchControlSection];
[self addSetting:self.onScreenWidgetStack ofId:@"onScreenWidgetStack" withInfoTag:YES withDynamicLabel:YES to:touchControlSection];
[self addSetting:self.swapAbaxyStack ofId:@"swapAbaxyStack" withInfoTag:NO withDynamicLabel:NO to:touchControlSection];
- [self addSetting:self.gyroModeStack ofId:@"gyroModeStack" withInfoTag:YES withDynamicLabel:NO to:touchControlSection];
+ [self addSetting:self.gyroModeStack ofId:@"gyroModeStack" withInfoTag:YES withDynamicLabel:YES to:touchControlSection];
[self addSetting:self.gyroSensitivityStack ofId:@"gyroSensitivityStack" withInfoTag:NO withDynamicLabel:YES to:touchControlSection];
[touchControlSection addToParentStack:_parentStack];
@@ -1341,7 +1341,12 @@ BOOL isCustomResolution(CGSize res) {
[self.framePacingSelector setSelectedSegmentIndex:currentSettings.useFramePacing ? 1 : 0];
[self.multiControllerSwitch setOn:currentSettings.multiController];
[self.swapABXYButtonsSelector setSelectedSegmentIndex:currentSettings.swapABXYButtons ? 1 : 0];
+
[self.gyroModeSelector setSelectedSegmentIndex:currentSettings.gyroMode.intValue];
+ [self.gyroSensitivitySlider setValue: (uint16_t)(currentSettings.gyroSensitivity.floatValue * 100) animated:YES]; // Load old setting.
+ [self.gyroSensitivitySlider addTarget:self action:@selector(gyroSensitivitySliderMoved:) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
+ [self gyroSensitivitySliderMoved:self.gyroSensitivitySlider];
+
[self.audioOnPcSwitch setOn:currentSettings.playAudioOnPC];
_lastSelectedResolutionIndex = resolution;
@@ -1590,7 +1595,11 @@ BOOL isCustomResolution(CGSize res) {
}
- (void) touchPointerVelocityFactorSliderMoved:(UISlider* )sender {
- [self findDynamicLabelFromStack:self.pointerVelocityFactorStack].text = [NSString stringWithFormat:@" %d%% ", [self map_velocFactorDisplay_fromSliderValue: self.touchPointerVelocityFactorSlider.value]]; // Update label display
+ [self findDynamicLabelFromStack:self.pointerVelocityFactorStack].text = [NSString stringWithFormat:@" %d%% ", [self map_velocFactorDisplay_fromSliderValue:sender.value]]; // Update label display
+}
+
+- (void) gyroSensitivitySliderMoved:(UISlider* )sender {
+ [self findDynamicLabelFromStack:self.gyroSensitivityStack].text = [NSString stringWithFormat:@" %d%% ", (uint16_t)sender.value]; // Update label display
}
@@ -2026,6 +2035,7 @@ BOOL isCustomResolution(CGSize res) {
CGFloat pointerVelocityModeDivider = (CGFloat)(uint8_t)self.pointerVelocityModeDividerSlider.value/100;
CGFloat touchPointerVelocityFactor = (CGFloat)(uint16_t)[self map_velocFactorDisplay_fromSliderValue:self.touchPointerVelocityFactorSlider.value]/100;
CGFloat mousePointerVelocityFactor = (CGFloat)(uint16_t)[self map_velocFactorDisplay_fromSliderValue:self.mousePointerVelocityFactorSlider.value]/100;
+ CGFloat gyroSensitivity = (CGFloat)(uint16_t)self.gyroSensitivitySlider.value/100;
uint16_t touchMoveEventInterval = (uint16_t)self.touchMoveEventIntervalSlider.value;
@@ -2057,17 +2067,18 @@ BOOL isCustomResolution(CGSize res) {
width:width
audioConfig:2 // Stereo
onscreenControls:onscreenControls
- gyroMode:gyroMode
+ gyroMode:gyroMode
keyboardToggleFingers:keyboardToggleFingers
oscLayoutToolFingers:oscLayoutToolFingers
slideToSettingsScreenEdge:slideToSettingsScreenEdge
- slideToSettingsDistance:slideToSettingsDistance
+ slideToSettingsDistance:slideToSettingsDistance
pointerVelocityModeDivider:pointerVelocityModeDivider
touchPointerVelocityFactor:touchPointerVelocityFactor
mousePointerVelocityFactor:mousePointerVelocityFactor
+ gyroSensitivity:gyroSensitivity
touchMoveEventInterval:touchMoveEventInterval
reverseMouseWheelDirection:reverseMouseWheelDirection
- asyncNativeTouchPriority:asyncNativeTouchPriority
+ asyncNativeTouchPriority:asyncNativeTouchPriority
liftStreamViewForKeyboard:liftStreamViewForKeyboard
showKeyboardToolbar:showKeyboardToolbar
optimizeGames:optimizeGames
@@ -2075,14 +2086,14 @@ BOOL isCustomResolution(CGSize res) {
swapABXYButtons:swapABXYButtons
audioOnPC:audioOnPC
preferredCodec:preferredCodec
- enableYUV444:enableYUV444
+ enableYUV444:enableYUV444
useFramePacing:useFramePacing
enableHdr:enableHdr
btMouseSupport:btMouseSupport
touchMode:touchMode
statsOverlayLevel:statsOverlayLevel
- statsOverlayEnabled:statsOverlayEnabled
- unlockDisplayOrientation:unlockDisplayOrientation
+ statsOverlayEnabled:statsOverlayEnabled
+ unlockDisplayOrientation:unlockDisplayOrientation
resolutionSelected:resolutionSelected
externalDisplayMode:externalDisplayMode
localMousePointerMode:localMousePointerMode];