- unlcok motion control section

- controller gyro button stack refactored to motion control section, saved with osc (widget) profile
- feat: reverse gyro-hold button switch
- DS4 gyro activated by default if controller gyro button is disabled
-  synth physical stick input switch
This commit is contained in:
TrueZhuanjia
2025-11-27 00:26:53 +08:00
parent 1338b4fb85
commit a3d5771b14
13 changed files with 240 additions and 77 deletions
+28 -6
View File
@@ -1023,13 +1023,13 @@
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="6Lo-Vn-3fP" userLabel="mapGyroToStack">
<rect key="frame" x="24" y="2750" width="380" height="56.5"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Map Gyro to" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6gY-8I-NWq" userLabel="Show Local Keyboard Toolbar">
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Map Built-in Gyro to" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6gY-8I-NWq">
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<segmentedControl verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="gTZ-RS-VIl" userLabel="Show Local Keyboard Toolbar Selector">
<segmentedControl verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="gTZ-RS-VIl">
<rect key="frame" x="0.0" y="25.5" width="380" height="32"/>
<segments>
<segment title="Mouse"/>
@@ -1802,6 +1802,26 @@
<constraint firstAttribute="height" constant="31" id="5sn-ce-tev"/>
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="mB8-aJ-7qO">
<rect key="frame" x="25" y="2693" width="306" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reverse Hold Button" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BQH-nQ-IyM" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="156" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="00w-mO-Ehj">
<rect key="frame" x="176" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="Uiu-Nq-2tX"/>
</constraints>
</switch>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="31" id="GLe-9B-zVX"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -1919,6 +1939,8 @@
<outlet property="renderingBackendStack" destination="6hG-dw-YSr" id="qqz-lA-EOE"/>
<outlet property="resolutionSelector" destination="ckc-Dm-8ex" id="rl6-rx-wd3"/>
<outlet property="resolutionStack" destination="zpX-lo-MLA" id="9Hu-I9-hjH"/>
<outlet property="reverseHoldButtonStack" destination="mB8-aJ-7qO" id="3bo-br-Tcb"/>
<outlet property="reverseHoldButtonSwitch" destination="00w-mO-Ehj" id="Ptz-f8-nTx"/>
<outlet property="reverseMouseWheelDirectionSelector" destination="mTM-NL-CcF" id="EYZ-Qg-OLu"/>
<outlet property="reverseMouseWheelDirectionStack" destination="2P0-Tg-zWd" id="Zz1-VC-0hC"/>
<outlet property="rollSensitivitySlider" destination="P7t-Q3-rrN" id="pEv-Be-Dxe"/>
@@ -2782,7 +2804,7 @@
<image name="tray.full.fill" catalog="system" width="128" height="88"/>
<image name="video.and.waveform" catalog="system" width="128" height="94"/>
<systemColor name="linkColor">
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="secondarySystemGroupedBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -2791,13 +2813,13 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.67450980392156867" green="0.49803921568627452" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGray3Color">
<color red="0.78039215689999997" green="0.78039215689999997" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.7803921568627451" green="0.7803921568627451" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.76470588235294112" blue="0.81568627450980391" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
+24 -2
View File
@@ -2036,13 +2036,13 @@
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="NFm-mv-3qh" userLabel="mapGyroToStack">
<rect key="frame" x="15" y="2398" width="380" height="56.5"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Map Gyro to" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GX4-zV-pQ8" userLabel="Show Local Keyboard Toolbar">
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Map Built-in Gyro to" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GX4-zV-pQ8" userLabel="Show Local Keyboard Toolbar">
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<segmentedControl verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="0OC-rX-CHK" userLabel="Show Local Keyboard Toolbar Selector">
<segmentedControl verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="0OC-rX-CHK" userLabel="Show Local Keyboard Toolbar Selector">
<rect key="frame" x="0.0" y="25.5" width="380" height="32"/>
<segments>
<segment title="Mouse"/>
@@ -2635,6 +2635,26 @@
<constraint firstAttribute="height" constant="31" id="JWd-0U-BlR"/>
</constraints>
</stackView>
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="97k-tp-tqF">
<rect key="frame" x="20" y="2919" width="306" height="31"/>
<subviews>
<label verifyAmbiguity="off" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reverse Hold Button" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="m3M-yS-Wt6" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="156" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Aey-h4-DoE">
<rect key="frame" x="176" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="BuF-mu-nxn"/>
</constraints>
</switch>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="31" id="rXC-R1-f3Z"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -2751,6 +2771,8 @@
<outlet property="renderingBackendStack" destination="6hG-dw-YSr" id="qqz-lA-EO2"/>
<outlet property="resolutionSelector" destination="7Sl-WI-zyo" id="YMv-Xy-dF9"/>
<outlet property="resolutionStack" destination="sbK-BT-6rK" id="hEi-h6-te9"/>
<outlet property="reverseHoldButtonStack" destination="97k-tp-tqF" id="C7z-79-7jb"/>
<outlet property="reverseHoldButtonSwitch" destination="Aey-h4-DoE" id="rFw-PX-RCC"/>
<outlet property="reverseMouseWheelDirectionSelector" destination="Uca-fD-4AC" id="gLa-40-suX"/>
<outlet property="reverseMouseWheelDirectionStack" destination="iS2-99-oox" id="dl2-8e-idU"/>
<outlet property="rollSensitivitySlider" destination="SQ5-oO-S7X" id="UTL-nv-UwL"/>
-1
View File
@@ -197,7 +197,6 @@
settingsToSave.mapControllerToMouse = mapControllerToMouse;
settingsToSave.controllerMousePointerVelocity = [NSNumber numberWithFloat:controllerMousePointerVelocity];
settingsToSave.controllerMouseExpo = [NSNumber numberWithFloat:controllerMouseExpo];
settingsToSave.controllerGyroSwitchMode = [NSNumber numberWithInteger:controllerGyroSwitchMode];
settingsToSave.rememberFoldState = rememberFoldState;
[self saveData];
}];
-3
View File
@@ -102,9 +102,6 @@
@property (nonatomic) BOOL mapControllerToMouse;
@property (nonatomic, retain) NSNumber * controllerMousePointerVelocity;
@property (nonatomic, retain) NSNumber * controllerMouseExpo;
@property (nonatomic, retain) NSNumber * controllerGyroSwitchToggle;
@property (nonatomic, retain) NSNumber * controllerGyroSwitchHold;
@property (nonatomic, retain) NSNumber * controllerGyroSwitchMode;
- (id) initFromSettings:(Settings*)settings;
-3
View File
@@ -158,9 +158,6 @@
self.controllerMouseStick = settings.controllerMouseStick;
self.controllerMousePointerVelocity = settings.controllerMousePointerVelocity;
self.controllerMouseExpo = settings.controllerMouseExpo;
self.controllerGyroSwitchToggle = settings.controllerGyroSwitchToggle;
self.controllerGyroSwitchHold = settings.controllerGyroSwitchHold;
self.controllerGyroSwitchMode = settings.controllerGyroSwitchMode;
#endif
+28 -16
View File
@@ -86,10 +86,11 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
CGFloat _gyroSensitivity;
bool _captureMouse;
bool _startGyroByController;
bool _controllerGyroSwitchEnabled;
bool _gyroEnabledFlag;
int _controllerGyroSwitchToggle;
int _controllerGyroSwitchHold;
bool _reverseHoldButton;
bool _controllerGyroSwitchTogglePressed;
bool _controllerGyroSwitchHoldPressed;
ControllerGyroSwitchMode _gyroSwitchMode;
@@ -1047,6 +1048,15 @@ double rc_expo(double x, double expo) {
||self->tempSettings.gyroMode.intValue==GyroModeOff;
}
- (void)switchGyroOnOffByControllerButton{
self->_gyroEnabledFlag = self->_gyroEnabledFlag && self->_controllerGyroSwitchEnabled;
if([self useMotionHandler]){
if(self->_gyroEnabledFlag) [self->motionHandler startGyroByControllerButton];
else [self->motionHandler stopGyroUpdateWithInterruptNoneGyroInput:false resetLeftStick:true];
}
else self->_gyroEnabledFlag = self->_gyroEnabledFlag || !self->_controllerGyroSwitchEnabled;
}
-(void) registerControllerCallbacks:(GCController*) controller
{
if (controller != NULL) {
@@ -1157,24 +1167,22 @@ double rc_expo(double x, double expo) {
}
else self->_controllerMouseEnabledFlag = false;
if(self->_startGyroByController){
// controller switch buttons
if(true){
if(button.pressed){
if (buttonFlagId.intValue == self->_controllerGyroSwitchToggle
&& !self->_controllerGyroSwitchTogglePressed) {
self->_controllerGyroSwitchTogglePressed = true;
self->_gyroEnabledFlag = !self->_gyroEnabledFlag;
self->_gyroEnabledFlag = self->_gyroEnabledFlag && self->_gyroSwitchMode != ControllerGyroSwitchDisabled;
if([self useMotionHandler]){
if(self->_gyroEnabledFlag) [self->motionHandler startGyroByControllerButton];
else [self->motionHandler stopGyroUpdateWithInterruptNoneGyroInput:false resetLeftStick:true];
}
[self switchGyroOnOffByControllerButton];
}
if (buttonFlagId.intValue == self->_controllerGyroSwitchHold
&& !self->_controllerGyroSwitchHoldPressed) {
self->_controllerGyroSwitchHoldPressed = true;
self->_gyroEnabledFlag = true;
self->_gyroEnabledFlag = self->_gyroEnabledFlag && self->_gyroSwitchMode != ControllerGyroSwitchDisabled;
if([self useMotionHandler] && self->_gyroEnabledFlag) [self->motionHandler startGyroByControllerButton];
self->_gyroEnabledFlag = !self->_reverseHoldButton;
[self switchGyroOnOffByControllerButton];
}
}
else{
@@ -1185,8 +1193,9 @@ double rc_expo(double x, double expo) {
if (buttonFlagId.intValue == self->_controllerGyroSwitchHold
&& self->_controllerGyroSwitchHoldPressed) {
self->_controllerGyroSwitchHoldPressed = false;
self->_gyroEnabledFlag = false;
if([self useMotionHandler]) [self->motionHandler stopGyroUpdateWithInterruptNoneGyroInput:false resetLeftStick:true];
self->_gyroEnabledFlag = self->_reverseHoldButton;
[self switchGyroOnOffByControllerButton];
}
}
}
@@ -1733,13 +1742,16 @@ double rc_expo(double x, double expo) {
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}
_startGyroByController = true;
_gyroSwitchMode = tempSettings.controllerGyroSwitchMode.intValue;
_controllerGyroSwitchEnabled = oscProfile.controllerGyroSwitchMode != ControllerGyroSwitchDisabled;
_gyroSwitchMode = oscProfile.controllerGyroSwitchMode;
// _gyroSwitchMode = ControllerGyroSwitchHoldDownToActivate;
_controllerGyroSwitchToggle = tempSettings.controllerGyroSwitchToggle.intValue;
_controllerGyroSwitchHold = tempSettings.controllerGyroSwitchHold.intValue;
_controllerGyroSwitchToggle = oscProfile.controllerGyroSwitchToggle;
_controllerGyroSwitchHold = oscProfile.controllerGyroSwitchHold;
_reverseHoldButton = oscProfile.reverseGyroHoldButton;
_controllerGyroSwitchTogglePressed = false;
_controllerGyroSwitchHoldPressed = false;
if(oscProfile.controllerGyroSwitchMode == ControllerGyroSwitchDisabled && ![self useMotionHandler]) _gyroEnabledFlag = true;
if(![self useMotionHandler]) [self->motionHandler stopGyroUpdateWithInterruptNoneGyroInput:false resetLeftStick:true];
}
+4
View File
@@ -42,6 +42,10 @@ typedef NS_ENUM(NSInteger, MapGyroTo) {
@property (nonatomic, assign) CGFloat accelSensitivityY;
@property (nonatomic, assign) CGFloat accelSensitivityZ;
@property (nonatomic, assign) double gyroToStickMinOffset;
@property (nonatomic, assign) int controllerGyroSwitchMode;
@property (nonatomic, assign) bool reverseGyroHoldButton;
@property (nonatomic, assign) int controllerGyroSwitchHold;
@property (nonatomic, assign) int controllerGyroSwitchToggle;
- (id) initWithName:(NSString*)name buttonStates:(NSMutableArray*)buttonStates isSelected:(BOOL)isSelected;
+13
View File
@@ -10,6 +10,7 @@
//
#import "OSCProfile.h"
#import "VoidLink-Swift.h"
@implementation OSCProfile
@@ -43,6 +44,10 @@
[encoder encodeFloat:self.accelSensitivityY forKey:@"accelSensitivityY"];
[encoder encodeFloat:self.accelSensitivityZ forKey:@"accelSensitivityZ"];
[encoder encodeDouble:self.gyroToStickMinOffset forKey:@"gyroToStickMinOffset"];
[encoder encodeInt:self.controllerGyroSwitchMode forKey:@"controllerGyroSwitchMode"];
[encoder encodeBool:self.reverseGyroHoldButton forKey:@"reverseGyroHoldButton"];
[encoder encodeInt:self.controllerGyroSwitchHold forKey:@"controllerGyroSwitchHold"];
[encoder encodeInt:self.controllerGyroSwitchToggle forKey:@"controllerGyroSwitchToggle"];
}
- (id) initWithCoder:(NSCoder*)decoder {
@@ -61,6 +66,10 @@
self.accelSensitivityY = [decoder containsValueForKey:@"accelSensitivityY"] ? [decoder decodeFloatForKey:@"accelSensitivityY"] : 1.0;
self.accelSensitivityZ = [decoder containsValueForKey:@"accelSensitivityZ"] ? [decoder decodeFloatForKey:@"accelSensitivityZ"] : 1.0;
self.gyroToStickMinOffset = [decoder containsValueForKey:@"gyroToStickMinOffset"] ? [decoder decodeDoubleForKey:@"gyroToStickMinOffset"] : 0;
self.controllerGyroSwitchMode = [decoder containsValueForKey:@"controllerGyroSwitchMode"] ? [decoder decodeIntForKey:@"controllerGyroSwitchMode"] : ControllerGyroSwitchDisabled;
self.reverseGyroHoldButton = [decoder containsValueForKey:@"reverseGyroHoldButton"] ? [decoder decodeBoolForKey:@"reverseGyroHoldButton"] : false;
self.controllerGyroSwitchHold = [decoder containsValueForKey:@"controllerGyroSwitchHold"] ? [decoder decodeIntForKey:@"controllerGyroSwitchHold"] : ControllerButtonNull;
self.controllerGyroSwitchToggle = [decoder containsValueForKey:@"controllerGyroSwitchToggle"] ? [decoder decodeIntForKey:@"controllerGyroSwitchToggle"] : ControllerButtonNull;
}
return self;
@@ -82,6 +91,10 @@
copy.accelSensitivityY = self.accelSensitivityY;
copy.accelSensitivityZ = self.accelSensitivityZ;
copy.gyroToStickMinOffset = self.gyroToStickMinOffset;
copy.controllerGyroSwitchMode = self.controllerGyroSwitchMode;
copy.reverseGyroHoldButton = self.reverseGyroHoldButton;
copy.controllerGyroSwitchHold = self.controllerGyroSwitchHold;
copy.controllerGyroSwitchToggle = self.controllerGyroSwitchToggle;
return copy;
}
@@ -29,9 +29,6 @@
<attribute name="bitrate" attributeType="Integer 32" defaultValueString="10000" usesScalarValueType="NO" syncable="YES"/>
<attribute name="btMouseSupport" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="buttonVisualFeedback" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="controllerGyroSwitchHold" attributeType="Integer 32" defaultValueString="1024" usesScalarValueType="NO" syncable="YES"/>
<attribute name="controllerGyroSwitchMode" attributeType="Integer 16" defaultValueString="1024" usesScalarValueType="NO" syncable="YES"/>
<attribute name="controllerGyroSwitchToggle" attributeType="Integer 32" defaultValueString="1024" usesScalarValueType="NO" syncable="YES"/>
<attribute name="controllerMouseExpo" optional="YES" attributeType="Float" defaultValueString="1.6" usesScalarValueType="NO" syncable="YES"/>
<attribute name="controllerMouseLeftButton" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="controllerMousePointerVelocity" optional="YES" attributeType="Float" defaultValueString="12" usesScalarValueType="NO" syncable="YES"/>
@@ -229,6 +229,9 @@
@property (strong, nonatomic) IBOutlet UIStackView *synthPhysicalInputStack;
@property (strong, nonatomic) IBOutlet UISwitch *synthPhysicalInputSwitch;
@property (strong, nonatomic) IBOutlet UIStackView *reverseHoldButtonStack;
@property (strong, nonatomic) IBOutlet UISwitch *reverseHoldButtonSwitch;
@property (strong, nonatomic) IBOutlet UIStackView *testStack;
@property (nonatomic, strong) MicHandler *micHandler;
@@ -354,6 +354,16 @@ BOOL isCustomResolution(int resolutionSelected) {
- (void)reloadMotionControlConfigs{
oscProfile = [oscProfileMan getSelectedProfile];
self.controllerGyroSwitchButtonSetter.selectedSegmentIndex = oscProfile.controllerGyroSwitchMode;
if(self.controllerGyroSwitchButtonSetter.selectedSegmentIndex != ControllerGyroSwitchDisabled){
bool bothButtonsSet = oscProfile.controllerGyroSwitchHold != ControllerButtonNull && oscProfile.controllerGyroSwitchToggle != ControllerButtonNull;
[self findDynamicLabelFromStack:self.controllerGyroSwitchButtonStack].text = bothButtonsSet ? [LocalizationHelper localizedStringForKey:@" both set "] : @"";
}
[self setHidden:oscProfile.controllerGyroSwitchMode==ControllerGyroSwitchDisabled forStack:self.reverseHoldButtonStack];
[self.reverseHoldButtonSwitch setOn:oscProfile.reverseGyroHoldButton];
[self.mapGyroToSelector setSelectedSegmentIndex:oscProfile.mapGyroTo];
[self mapGyroToChanged:self.mapGyroToSelector];
@@ -391,6 +401,8 @@ BOOL isCustomResolution(int resolutionSelected) {
&& (int16_t)(oscProfile.gyroSensitivityRoll*100) == (int16_t)rollSensitivityPercent
&& (int16_t)(oscProfile.gyroToStickMinOffset) == (int16_t)self.gyroToStickMinOffsetSlider.value
&& oscProfile.synthesizePhysicalStick == self.synthPhysicalInputSwitch.isOn
&& oscProfile.controllerGyroSwitchMode == self.controllerGyroSwitchButtonSetter.selectedSegmentIndex
&& oscProfile.reverseGyroHoldButton == self.reverseHoldButtonSwitch.isOn
);
if(!configNotChanged){
@@ -402,6 +414,8 @@ BOOL isCustomResolution(int resolutionSelected) {
oscProfile.gyroSensitivityRoll = rollSensitivityPercent/100;
oscProfile.gyroToStickMinOffset = (int16_t)self.gyroToStickMinOffsetSlider.value;
oscProfile.synthesizePhysicalStick = self.synthPhysicalInputSwitch.isOn;
oscProfile.controllerGyroSwitchMode = (int)self.controllerGyroSwitchButtonSetter.selectedSegmentIndex;
oscProfile.reverseGyroHoldButton = self.reverseHoldButtonSwitch.isOn;
[oscProfileMan replaceSelectedProfileWith:oscProfile overwriteDefault:YES];
}
}
@@ -453,8 +467,10 @@ BOOL isCustomResolution(int resolutionSelected) {
if(![self manuallyChangedFPS]) [self framerateChanged];
self->motionControlSection.expandable = [self isCustomOswEnabled];
[self->motionControlSection setExpanded:self->motionControlSection.expandable];
/*
// self->motionControlSection.expandable = [self isCustomOswEnabled];
self->motionControlSection.expandable = true;
// [self->motionControlSection setExpanded:self->motionControlSection.expandable];
__weak typeof(self) weakSelf = self;
self->motionControlSection.lockedSectionHandler = ^{
[AlertControllerUtil showAlertIn:weakSelf
@@ -478,6 +494,7 @@ BOOL isCustomResolution(int resolutionSelected) {
}
}];
};
*/
[self reloadMotionControlConfigs];
@@ -761,7 +778,7 @@ BOOL isCustomResolution(int resolutionSelected) {
controllerSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Controller"];
controllerSection.identifier = @"SettingsSectionController";
if (@available(iOS 13.0, *)) {
[controllerSection setSectionWithIcon:[UIImage systemImageNamed:@"gamecontroller"] andSize:26];
[controllerSection setSectionWithIcon:[UIImage systemImageNamed:@"gamecontroller"] andSize:30];
}
[self addSetting:self.swapAbxyStack ofId:@"swapAbaxyStack" withInfoTag:NO withDynamicLabel:NO to:controllerSection];
[self addSetting:self.hapticEngineStack ofId:@"hapticEngineStack" withInfoTag:NO withDynamicLabel:NO to:controllerSection];
@@ -771,7 +788,6 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.controllerToMouseStack ofId:@"controllerToMouseStack" withInfoTag:YES withDynamicLabel:YES to:controllerSection];
[self addSetting:self.controllerMouseVelocityStack ofId:@"controllerMouseVelocityStack" withInfoTag:NO withDynamicLabel:YES to:controllerSection];
[self addSetting:self.controllerMouseExpoStack ofId:@"controllerMouseExpoStack" withInfoTag:YES withDynamicLabel:YES to:controllerSection];
[self addSetting:self.controllerGyroSwitchButtonStack ofId:@"controllerGyroSwitchButtonStack" withInfoTag:YES withDynamicLabel:YES to:controllerSection];
[controllerSection addToParentStack:_parentStack];
motionControlSection = [[MenuSectionView alloc] init];
@@ -782,6 +798,8 @@ BOOL isCustomResolution(int resolutionSelected) {
// [motionControlSection setSectionWithIcon:[UIImage imageNamed:@"gyroscope"] andSize:23];
[motionControlSection setSectionWithIcon:[UIImage imageNamed:@"gyroscope"] andSize:23];
}
[self addSetting:self.controllerGyroSwitchButtonStack ofId:@"controllerGyroSwitchButtonStack" withInfoTag:YES withDynamicLabel:YES to:motionControlSection];
[self addSetting:self.reverseHoldButtonStack ofId:@"reverseHoldButtonStack" withInfoTag:YES withDynamicLabel:YES to:motionControlSection];
[self addSetting:self.mapGyroToStack ofId:@"mapGyroToStack" withInfoTag:NO withDynamicLabel:NO to:motionControlSection];
[self addSetting:self.gyroToStickSwitchStack ofId:@"gyroToStickStack" withInfoTag:NO withDynamicLabel:NO to:motionControlSection];
[self addSetting:self.yawPitchSensitivityStack ofId:@"yawPitchSensitivityStack" withInfoTag:NO withDynamicLabel:NO to:motionControlSection];
@@ -1357,13 +1375,13 @@ BOOL isCustomResolution(int resolutionSelected) {
showOnlineDocAction = false;
}
if([sender.superview.accessibilityIdentifier isEqualToString: @"controllerGyroSwitchButtonStack"]){
tempSettings = [dataMan getSettings];
tipText = [LocalizationHelper localizedStringForKey:@"controllerGyroSwitchButtonStackTip", [ControllerUtil stringFor:tempSettings.controllerGyroSwitchToggle.intValue], [ControllerUtil stringFor:tempSettings.controllerGyroSwitchHold.intValue]];
oscProfile = [oscProfileMan getSelectedProfile];
tipText = [LocalizationHelper localizedStringForKey:@"controllerGyroSwitchButtonStackTip", [ControllerUtil stringFor:oscProfile.controllerGyroSwitchToggle], [ControllerUtil stringFor:oscProfile.controllerGyroSwitchHold]];
showOnlineDocAction = false;
}
if([sender.superview.accessibilityIdentifier isEqualToString: @"controllerToMouseStack"]){
tempSettings = [dataMan getSettings];
tipText = [LocalizationHelper localizedStringForKey:@"controllerToMouseStackTip", [ControllerUtil stringFor:tempSettings.controllerMouseSwitch.intValue], [LocalizationHelper localizedStringForKey:tempSettings.controllerGyroSwitchHold.intValue == LeftStickToMouse ? @"Left stick" : @"Right stick"], [ControllerUtil stringFor:tempSettings.controllerMouseLeftButton.intValue], [ControllerUtil stringFor:tempSettings.controllerMouseRightButton.intValue]];
tipText = [LocalizationHelper localizedStringForKey:@"controllerToMouseStackTip", [ControllerUtil stringFor:tempSettings.controllerMouseSwitch.intValue], [LocalizationHelper localizedStringForKey:tempSettings.controllerMouseStick.intValue == LeftStickToMouse ? @"Left stick" : @"Right stick"], [ControllerUtil stringFor:tempSettings.controllerMouseLeftButton.intValue], [ControllerUtil stringFor:tempSettings.controllerMouseRightButton.intValue]];
showOnlineDocAction = false;
}
@@ -1995,12 +2013,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.controllerToMouseSwitch addTarget:self action:@selector(controllerToMouseSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
[self controllerToMouseSwitchFlipped:self.controllerToMouseSwitch];
self.controllerGyroSwitchButtonSetter.selectedSegmentIndex = self->tempSettings.controllerGyroSwitchMode.intValue;
[self.controllerGyroSwitchButtonSetter addTarget:self action:@selector(controllerGyroSwitchModeChanged:) forControlEvents:UIControlEventValueChanged];
if(self.controllerGyroSwitchButtonSetter.selectedSegmentIndex != ControllerGyroSwitchDisabled){
bool bothButtonsSet = self->tempSettings.controllerGyroSwitchHold.intValue != ControllerButtonNull && self->tempSettings.controllerGyroSwitchToggle.intValue != ControllerButtonNull;
[self findDynamicLabelFromStack:self.controllerGyroSwitchButtonStack].text = bothButtonsSet ? [LocalizationHelper localizedStringForKey:@" both set "] : @"";
}
[self.controllerMouseVelocitySlider setValue:self->tempSettings.controllerMousePointerVelocity.floatValue];
[self.controllerMouseVelocitySlider addTarget:self action:@selector(controllerMouseVelocitySliderMoved:) forControlEvents:UIControlEventValueChanged];
@@ -2079,8 +2092,8 @@ BOOL isCustomResolution(int resolutionSelected) {
- (bool)isCustomOswEnabled{
bool customOswEnabled = [self isOswEnabled] && self.onScreenWidgetSelector.selectedSegmentIndex == OnScreenControlsLevelCustom;
motionControlSection.expandable = customOswEnabled;
if(!(settingsViewJustExpanded || settingsViewJustLoaded)) [motionControlSection setExpanded:customOswEnabled];
// motionControlSection.expandable = customOswEnabled;
// if(!(settingsViewJustExpanded || settingsViewJustLoaded)) [motionControlSection setExpanded:customOswEnabled];
return customOswEnabled;
}
@@ -2271,13 +2284,15 @@ BOOL isCustomResolution(int resolutionSelected) {
}
- (void)controllerGyroSwitchModeChanged:(UISegmentedControl* )sender{
[self setHidden:sender.selectedSegmentIndex==ControllerGyroSwitchDisabled forStack:self.reverseHoldButtonStack];
UILabel* tipLabel = [self findDynamicLabelFromStack:self.controllerGyroSwitchButtonStack];
if(sender.selectedSegmentIndex == ControllerGyroSwitchDisabled){
tipLabel.text = @"";
}
else{
__block bool switchButtonCaptured = false;
Settings* currentSettings = [dataMan retrieveSettings];
oscProfile = [oscProfileMan getSelectedProfile];
[AlertControllerUtil showAlertIn:self
title:[LocalizationHelper localizedStringForKey:@"Gyro button on controller"]
@@ -2299,14 +2314,14 @@ BOOL isCustomResolution(int resolutionSelected) {
for(NSNumber* buttonFlagId in buttonDict){
GCControllerButtonInput * button = (GCControllerButtonInput *)buttonDict[buttonFlagId];
if(button.isPressed){
if(sender.selectedSegmentIndex == ControllerGyroSwitchPressToToggle) currentSettings.controllerGyroSwitchToggle = buttonFlagId;
if(sender.selectedSegmentIndex == ControllerGyroSwitchHoldDown) currentSettings.controllerGyroSwitchHold = buttonFlagId;
if(sender.selectedSegmentIndex == ControllerGyroSwitchPressToToggle) self->oscProfile.controllerGyroSwitchToggle = buttonFlagId.intValue;
if(sender.selectedSegmentIndex == ControllerGyroSwitchHoldDown) self->oscProfile.controllerGyroSwitchHold = buttonFlagId.intValue;
switchButtonCaptured = true;
AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"Finished"];
gamepad.valueChangedHandler = nil;
if(confirmAction) [confirmAction setValue:[LocalizationHelper localizedStringForKey:@"OK"] forKey:@"title"];
[self->dataMan saveData];
[self->oscProfileMan replaceSelectedProfileWith:self->oscProfile overwriteDefault:true];
}
}
}];
@@ -2322,7 +2337,8 @@ BOOL isCustomResolution(int resolutionSelected) {
action:^{}
completion:^{
if(AlertControllerUtil.actionCancelled){
self.controllerGyroSwitchButtonSetter.selectedSegmentIndex = ControllerGyroSwitchDisabled;
self.controllerGyroSwitchButtonSetter.selectedSegmentIndex = self->oscProfile.controllerGyroSwitchMode;
[self setHidden:self.controllerGyroSwitchButtonSetter.selectedSegmentIndex==ControllerGyroSwitchDisabled forStack:self.reverseHoldButtonStack];
return;
}
[AlertControllerUtil.alertController dismissViewControllerAnimated:NO completion:^{}];
@@ -2333,25 +2349,28 @@ BOOL isCustomResolution(int resolutionSelected) {
}
completion:^{
if(!switchButtonCaptured){
if(sender.selectedSegmentIndex == ControllerGyroSwitchPressToToggle) currentSettings.controllerGyroSwitchToggle = @(ControllerButtonNull);
if(sender.selectedSegmentIndex == ControllerGyroSwitchHoldDown) currentSettings.controllerGyroSwitchHold = @(ControllerButtonNull);
if(sender.selectedSegmentIndex == ControllerGyroSwitchPressToToggle) self->oscProfile.controllerGyroSwitchToggle = ControllerButtonNull;
if(sender.selectedSegmentIndex == ControllerGyroSwitchHoldDown) self->oscProfile.controllerGyroSwitchHold = ControllerButtonNull;
[self->oscProfileMan replaceSelectedProfileWith:self->oscProfile overwriteDefault:true];
}
bool noSwitchButtonSet = currentSettings.controllerGyroSwitchHold.intValue == ControllerButtonNull && currentSettings.controllerGyroSwitchToggle.intValue == ControllerButtonNull;
bool duplicatedButtons = currentSettings.controllerGyroSwitchHold.intValue == currentSettings.controllerGyroSwitchToggle.intValue && currentSettings.controllerGyroSwitchToggle.intValue != ControllerButtonNull;
bool bothButtonsSet = currentSettings.controllerGyroSwitchHold.intValue != ControllerButtonNull && currentSettings.controllerGyroSwitchToggle.intValue != ControllerButtonNull;
bool noSwitchButtonSet = self->oscProfile.controllerGyroSwitchHold == ControllerButtonNull && self->oscProfile.controllerGyroSwitchToggle == ControllerButtonNull;
bool duplicatedButtons = self->oscProfile.controllerGyroSwitchHold == self->oscProfile.controllerGyroSwitchToggle && self->oscProfile.controllerGyroSwitchToggle != ControllerButtonNull;
bool bothButtonsSet = self->oscProfile.controllerGyroSwitchHold != ControllerButtonNull && self->oscProfile.controllerGyroSwitchToggle != ControllerButtonNull && !duplicatedButtons;
tipLabel.text = @"";
if(bothButtonsSet) tipLabel.text = [LocalizationHelper localizedStringForKey:@" both set "];
if(duplicatedButtons){
sender.selectedSegmentIndex = ControllerGyroSwitchDisabled;
tipLabel.text = [LocalizationHelper localizedStringForKey:@" duplicated ! "];
[self->oscProfileMan replaceSelectedProfileWith:self->oscProfile overwriteDefault:true];
}
if(noSwitchButtonSet) sender.selectedSegmentIndex = ControllerGyroSwitchDisabled;
if(!noSwitchButtonSet && !bothButtonsSet){
sender.selectedSegmentIndex = currentSettings.controllerGyroSwitchToggle.intValue != ControllerButtonNull ? ControllerGyroSwitchPressToToggle : ControllerGyroSwitchHoldDown;
if(!noSwitchButtonSet && !bothButtonsSet && !duplicatedButtons){
sender.selectedSegmentIndex = self->oscProfile.controllerGyroSwitchToggle != ControllerButtonNull ? ControllerGyroSwitchPressToToggle : ControllerGyroSwitchHoldDown;
}
[self->dataMan saveData];
[self setHidden:sender.selectedSegmentIndex==ControllerGyroSwitchDisabled forStack:self.reverseHoldButtonStack];
if(self->capturedController && self->capturedController.extendedGamepad) self->capturedController.extendedGamepad.valueChangedHandler = nil;
}];
}
+38 -8
View File
@@ -374,31 +374,31 @@
}
},
"6gY-8I-NWq.text" : {
"comment" : "Class = \"UILabel\"; text = \"Map Gyro to\"; ObjectID = \"6gY-8I-NWq\";",
"comment" : "Class = \"UILabel\"; text = \"Map Built-in Gyro to\"; ObjectID = \"6gY-8I-NWq\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Map Gyro to"
"value" : "Map Built-in Gyro to"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺仪映射为"
"state" : "needs_review",
"value" : "内置陀螺仪映射为"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺儀映射為"
"state" : "needs_review",
"value" : "内建陀螺儀映射為"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺儀映射為"
"state" : "needs_review",
"value" : "内建陀螺儀映射為"
}
}
}
@@ -1537,6 +1537,36 @@
}
}
},
"BQH-nQ-IyM.text" : {
"comment" : "Class = \"UILabel\"; text = \"Reverse Hold Button\"; ObjectID = \"BQH-nQ-IyM\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Reverse Hold Button"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "反转保持按键"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "反轉保持按鍵"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "反轉保持按鍵"
}
}
}
},
"BsJ-eo-2Ac.text" : {
"comment" : "Class = \"UILabel\"; text = \"Ctrl Down for Pinch\"; ObjectID = \"BsJ-eo-2Ac\";",
"extractionState" : "extracted_with_value",
+56 -8
View File
@@ -1318,6 +1318,24 @@
"state" : "new",
"value" : "Switch Gyro by Controller"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "手柄开关陀螺仪"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "手把開關陀螺儀"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "手把開關陀螺儀"
}
}
}
},
@@ -2270,31 +2288,31 @@
}
},
"GX4-zV-pQ8.text" : {
"comment" : "Class = \"UILabel\"; text = \"Map Gyro to\"; ObjectID = \"GX4-zV-pQ8\";",
"comment" : "Class = \"UILabel\"; text = \"Map Built-in Gyro to\"; ObjectID = \"GX4-zV-pQ8\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Map Gyro to"
"value" : "Map Built-in Gyro to"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺仪映射为"
"state" : "needs_review",
"value" : "内置陀螺仪映射为"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺儀映射為"
"state" : "needs_review",
"value" : "内建陀螺儀映射為"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "陀螺儀映射為"
"state" : "needs_review",
"value" : "内建陀螺儀映射為"
}
}
}
@@ -2839,6 +2857,36 @@
}
}
},
"m3M-yS-Wt6.text" : {
"comment" : "Class = \"UILabel\"; text = \"Reverse Hold Button\"; ObjectID = \"m3M-yS-Wt6\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Reverse Hold Button"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "反转保持按键"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "反轉保持按鍵"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "反轉保持按鍵"
}
}
}
},
"mdA-jF-9Mf.text" : {
"comment" : "Class = \"UILabel\"; text = \"Local Mouse Pointer\"; ObjectID = \"mdA-jF-9Mf\";",
"extractionState" : "extracted_with_value",