diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index 01cc03c8..ce88d87c 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -1782,6 +1782,26 @@ + + + + + + + + + + + + + + + @@ -1927,6 +1947,8 @@ + + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index 35d030b2..52dcad90 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -2615,6 +2615,26 @@ + + + + + + + + + + + + + + + @@ -2759,6 +2779,8 @@ + + diff --git a/VoidLink/Input/CustomOSC/OSCProfile.h b/VoidLink/Input/CustomOSC/OSCProfile.h index 21036ba1..1bfb780c 100644 --- a/VoidLink/Input/CustomOSC/OSCProfile.h +++ b/VoidLink/Input/CustomOSC/OSCProfile.h @@ -34,6 +34,7 @@ typedef NS_ENUM(NSInteger, MapGyroTo) { @property (nonatomic, assign) MapGyroTo mapGyroTo; @property (nonatomic, assign) bool yawPitchToRightStick; @property (nonatomic, assign) bool rollToLeftStick; +@property (nonatomic, assign) bool synthesizePhysicalStick; @property (nonatomic, assign) CGFloat gyroSensitivityYaw; @property (nonatomic, assign) CGFloat gyroSensitivityPitch; @property (nonatomic, assign) CGFloat gyroSensitivityRoll; diff --git a/VoidLink/Input/CustomOSC/OSCProfile.m b/VoidLink/Input/CustomOSC/OSCProfile.m index 249859bd..8fb8ee31 100644 --- a/VoidLink/Input/CustomOSC/OSCProfile.m +++ b/VoidLink/Input/CustomOSC/OSCProfile.m @@ -34,6 +34,7 @@ [encoder encodeInt64:self.mapGyroTo forKey:@"mapGyroTo"]; [encoder encodeBool:self.yawPitchToRightStick forKey:@"yawPitchToRightStick"]; [encoder encodeBool:self.rollToLeftStick forKey:@"rollToLeftStick"]; + [encoder encodeBool:self.synthesizePhysicalStick forKey:@"synthesizePhysicalStick"]; [encoder encodeInt64:self.mapGyroTo forKey:@"mapGyroTo"]; [encoder encodeFloat:self.gyroSensitivityYaw forKey:@"gyroSensitivityYaw"]; [encoder encodeFloat:self.gyroSensitivityPitch forKey:@"gyroSensitivityPitch"]; @@ -52,6 +53,7 @@ self.mapGyroTo = [decoder containsValueForKey:@"mapGyroTo"] ? [decoder decodeInt64ForKey:@"mapGyroTo"] : mapGyroToMouse; self.yawPitchToRightStick = [decoder containsValueForKey:@"yawPitchToRightStick"] ? [decoder decodeBoolForKey:@"yawPitchToRightStick"] : true; self.rollToLeftStick = [decoder containsValueForKey:@"rollToLeftStick"] ? [decoder decodeBoolForKey:@"rollToLeftStick"] : false; + self.synthesizePhysicalStick = [decoder containsValueForKey:@"synthesizePhysicalStick"] ? [decoder decodeBoolForKey:@"synthesizePhysicalStick"] : true; self.gyroSensitivityYaw = [decoder containsValueForKey:@"gyroSensitivityYaw"] ? [decoder decodeFloatForKey:@"gyroSensitivityYaw"] : 1.0; self.gyroSensitivityPitch = [decoder containsValueForKey:@"gyroSensitivityPitch"] ? [decoder decodeFloatForKey:@"gyroSensitivityPitch"] : 1.0; self.gyroSensitivityRoll = [decoder containsValueForKey:@"gyroSensitivityRoll"] ? [decoder decodeFloatForKey:@"gyroSensitivityRoll"] : 1.0; @@ -72,6 +74,7 @@ copy.mapGyroTo = self.mapGyroTo; copy.yawPitchToRightStick = self.yawPitchToRightStick; copy.rollToLeftStick = self.rollToLeftStick; + copy.synthesizePhysicalStick = self.synthesizePhysicalStick; copy.gyroSensitivityYaw = self.gyroSensitivityYaw; copy.gyroSensitivityPitch = self.gyroSensitivityPitch; copy.gyroSensitivityRoll = self.gyroSensitivityRoll; diff --git a/VoidLink/Input/MotionHandler.swift b/VoidLink/Input/MotionHandler.swift index 19f93ea6..abdee09a 100644 --- a/VoidLink/Input/MotionHandler.swift +++ b/VoidLink/Input/MotionHandler.swift @@ -28,14 +28,14 @@ import CoreMotion } @objc public func mixPhysicalRightStickAndGyroInput(x: CGFloat, y: CGFloat) { - rightStickPhysicalInputX = x - rightStickPhysicalInputY = y + rightStickPhysicalInputX = oscProfile.synthesizePhysicalStick ? x : 0 + rightStickPhysicalInputY = oscProfile.synthesizePhysicalStick ? y : 0 } @objc public func mixPhysicalLeftStickAndGyroInput(x: CGFloat, y: CGFloat) { // rollIntegral = 0 - leftStickPhysicalInputX = x - leftStickPhysicalInputY = y + leftStickPhysicalInputX = oscProfile.synthesizePhysicalStick ? x : 0 + leftStickPhysicalInputY = oscProfile.synthesizePhysicalStick ? y : 0 } public func gyroMixInputStarted() -> Bool { diff --git a/VoidLink/ViewControllers/SettingsViewController.h b/VoidLink/ViewControllers/SettingsViewController.h index f8ac045f..e4fcb616 100644 --- a/VoidLink/ViewControllers/SettingsViewController.h +++ b/VoidLink/ViewControllers/SettingsViewController.h @@ -226,6 +226,8 @@ @property (strong, nonatomic) IBOutlet UIStackView *controllerGyroSwitchButtonStack; @property (strong, nonatomic) IBOutlet UISegmentedControl *controllerGyroSwitchButtonSetter; +@property (strong, nonatomic) IBOutlet UIStackView *synthPhysicalInputStack; +@property (strong, nonatomic) IBOutlet UISwitch *synthPhysicalInputSwitch; @property (strong, nonatomic) IBOutlet UIStackView *testStack; diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index c96e5cda..6cf22609 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -373,6 +373,8 @@ BOOL isCustomResolution(int resolutionSelected) { [self rollSensitivitySliderMoved:self.rollSensitivitySlider]; [self.gyroToStickMinOffsetSlider setValue:(uint16_t)oscProfile.gyroToStickMinOffset]; [self gyroMinStickOffsetSliderMoved:self.gyroToStickMinOffsetSlider]; + + [self.synthPhysicalInputSwitch setOn:oscProfile.synthesizePhysicalStick]; } - (void)saveMotionControlConfigs{ @@ -387,7 +389,9 @@ BOOL isCustomResolution(int resolutionSelected) { && (int16_t)(oscProfile.gyroSensitivityYaw*100) == (int16_t)yawSensitivityPercent && (int16_t)(oscProfile.gyroSensitivityPitch*100) == (int16_t)pitchSensitivityPercent && (int16_t)(oscProfile.gyroSensitivityRoll*100) == (int16_t)rollSensitivityPercent - && (int16_t)(oscProfile.gyroToStickMinOffset) == (int16_t)self.gyroToStickMinOffsetSlider.value); + && (int16_t)(oscProfile.gyroToStickMinOffset) == (int16_t)self.gyroToStickMinOffsetSlider.value + && oscProfile.synthesizePhysicalStick == self.synthPhysicalInputSwitch.isOn + ); if(!configNotChanged){ oscProfile.mapGyroTo = self.mapGyroToSelector.selectedSegmentIndex; @@ -397,6 +401,7 @@ BOOL isCustomResolution(int resolutionSelected) { oscProfile.gyroSensitivityPitch = pitchSensitivityPercent/100; oscProfile.gyroSensitivityRoll = rollSensitivityPercent/100; oscProfile.gyroToStickMinOffset = (int16_t)self.gyroToStickMinOffsetSlider.value; + oscProfile.synthesizePhysicalStick = self.synthPhysicalInputSwitch.isOn; [oscProfileMan replaceSelectedProfileWith:oscProfile overwriteDefault:YES]; } } @@ -784,6 +789,7 @@ BOOL isCustomResolution(int resolutionSelected) { [self addDynamicLabelForStack:self.pitchSensitivityStack]; [self addSetting:self.rollSensitivityStack ofId:@"rollSensitivityStack" withInfoTag:NO withDynamicLabel:YES to:motionControlSection]; [self addSetting:self.gyroToStickMinOffsetStack ofId:@"gyroToStickMinOffsetStack" withInfoTag:NO withDynamicLabel:YES to:motionControlSection]; + [self addSetting:self.synthPhysicalInputStack ofId:@"synthPhysicalInputStack" withInfoTag:NO withDynamicLabel:NO to:motionControlSection]; [motionControlSection addToParentStack:_parentStack]; MenuSectionView *gesturesSection = [[MenuSectionView alloc] init]; @@ -2209,15 +2215,17 @@ BOOL isCustomResolution(int resolutionSelected) { } - (void)mapGyroToChanged:(UISegmentedControl* )sender{ - [self setHidden:sender.selectedSegmentIndex != mapGyroToControllerStick forStack:_gyroToStickSwitchStack]; + // [self setHidden:sender.selectedSegmentIndex != mapGyroToControllerStick forStack:_gyroToStickSwitchStack]; bool mapGyroToMouseEnabled = sender.selectedSegmentIndex == mapGyroToMouse; bool mapGyroToControllerStickEnabled = sender.selectedSegmentIndex == mapGyroToControllerStick; if(mapGyroToMouseEnabled){ [self setHidden:false forStack:_yawPitchSensitivityStack]; [self setHidden:true forStack:_rollSensitivityStack]; } - + [self setHidden:!mapGyroToControllerStickEnabled forStack:_gyroToStickSwitchStack]; [self setHidden:!mapGyroToControllerStickEnabled forStack:self.gyroToStickMinOffsetStack]; + [self setHidden:!mapGyroToControllerStickEnabled forStack:self.synthPhysicalInputStack]; + if(mapGyroToControllerStickEnabled){ [self yawPitchToRightStickSwitchFlipped:self.yawPitchToRightStickSwitch]; [self rollToLeftStickSwitchFlipped:self.rollToLeftStickSwitch]; diff --git a/VoidLink/mul.lproj/iPad.xcstrings b/VoidLink/mul.lproj/iPad.xcstrings index 83a50ca6..3d8bb151 100644 --- a/VoidLink/mul.lproj/iPad.xcstrings +++ b/VoidLink/mul.lproj/iPad.xcstrings @@ -4873,6 +4873,36 @@ } } }, + "uFg-dv-6nT.text" : { + "comment" : "Class = \"UILabel\"; text = \"Synth Physical Stick Input\"; ObjectID = \"uFg-dv-6nT\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Synth Physical Stick Input" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成实体摇杆输入" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成實體搖桿輸入" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成實體搖桿輸入" + } + } + } + }, "v8l-hf-kiR.text" : { "comment" : "Class = \"UILabel\"; text = \"Rendering Mode (Experimental)\"; ObjectID = \"v8l-hf-kiR\";", "extractionState" : "extracted_with_value", diff --git a/VoidLink/mul.lproj/iPhone.xcstrings b/VoidLink/mul.lproj/iPhone.xcstrings index 57b08b4f..ad0752c6 100644 --- a/VoidLink/mul.lproj/iPhone.xcstrings +++ b/VoidLink/mul.lproj/iPhone.xcstrings @@ -1513,6 +1513,36 @@ } } }, + "Bx3-CM-wet.text" : { + "comment" : "Class = \"UILabel\"; text = \"Synth Physical Stick Input\"; ObjectID = \"Bx3-CM-wet\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Synth Physical Stick Input" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成实体摇杆输入" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成實體搖桿輸入" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "合成實體搖桿輸入" + } + } + } + }, "C9B-Rx-YCP.text" : { "comment" : "Class = \"UILabel\"; text = \"Physical Mouse Wheel Scroll\"; ObjectID = \"C9B-Rx-YCP\";", "extractionState" : "extracted_with_value",