diff --git a/VoidLink/Input/CustomOSC/OSCProfilesManager.h b/VoidLink/Input/CustomOSC/OSCProfilesManager.h index 11f994bc..2178251b 100644 --- a/VoidLink/Input/CustomOSC/OSCProfilesManager.h +++ b/VoidLink/Input/CustomOSC/OSCProfilesManager.h @@ -45,8 +45,6 @@ NS_ASSUME_NONNULL_BEGIN * Returns the index of the 'selected' profile within the array it's in */ - (NSInteger) getIndexOfSelectedProfile; -- (void)replaceSelectedProfileWith:(OSCProfile*)newProfile overwriteDefault:(bool)overwriteDefault; - - (NSMutableArray *) getEncodedProfiles; // - (NSData* )getSelectedEncodedProfile; - (void) importEncodedProfiles:(NSMutableArray* )profilesEncoded; @@ -58,6 +56,8 @@ NS_ASSUME_NONNULL_BEGIN * Sets the profile object with the particular index as the selected profile to be displayed on screen during game streaming */ - (void) setProfileToSelected:(uint32_t)index; +- (void) replaceSelectedProfileWith:(OSCProfile*)newProfile overwriteDefault:(bool)overwriteDefault; +- (void) replaceProfile:(OSCProfile*)oldProfile withProfile:(OSCProfile*)newProfile; /** * Saves a profile object with a particular 'name' and an array of button layers (the CALayer button layers are the objects currently visible on screen) to persistent storage diff --git a/VoidLink/Input/CustomOSC/OSCProfilesManager.m b/VoidLink/Input/CustomOSC/OSCProfilesManager.m index 97e0777d..f3b77552 100644 --- a/VoidLink/Input/CustomOSC/OSCProfilesManager.m +++ b/VoidLink/Input/CustomOSC/OSCProfilesManager.m @@ -229,7 +229,8 @@ static CGRect layoutViewBounds; NSMutableArray *profiles = [self getAllProfiles]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSString* persistedKey = @"widgetProfileUpdated-20251015"; + // NSString* persistedKey = @"widgetProfileUpdated-20251015"; + NSString* persistedKey = @"widgetProfileUpdated-20251229"; BOOL needImportDefaultTemplates = [defaults objectForKey:persistedKey] == nil; if(profiles.count == 0 || needImportDefaultTemplates){ diff --git a/VoidLink/Input/OnScreenWidgetView.swift b/VoidLink/Input/OnScreenWidgetView.swift index a393b480..595bf0f0 100644 --- a/VoidLink/Input/OnScreenWidgetView.swift +++ b/VoidLink/Input/OnScreenWidgetView.swift @@ -744,7 +744,7 @@ import SVGKit attributes: [ .foregroundColor: UIColor(white:labelAlpha>0 ? 1.0 : 0, alpha: abs(labelAlpha)), // 填充色 .strokeColor: (labelAlpha>0 ? UIColor.black : UIColor.white).withAlphaComponent(abs(labelAlpha)*0.43), // 描边色 - .strokeWidth: containsNonLatin(text) ? -1 : -4 // 负值 = 同时填充 + .strokeWidth: widgetType == .touchPad ? 7 : (containsNonLatin(text) ? -1 : -4) // 负值 = 同时填充 ] ) label.attributedText = attr @@ -1078,7 +1078,7 @@ import SVGKit alpha: componentAlpha ) - let axisdiameter = self.getDiameter(lengthFactor: 0.5) + let axisdiameter = self.getDiameter(lengthFactor: UIDevice.current.userInterfaceIdiom == .phone ? 0.35 : 0.5) let axisSize = CGSize(width: axisdiameter, height: axisdiameter) self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis.svg", in: self.layer, targetSize: axisSize) self.stickWheelAxis.removeFromSuperlayer() @@ -1496,10 +1496,10 @@ import SVGKit } if !touchCenteredOffset { - let axisdiameter = self.getDiameter(lengthFactor: 0.35) + let axisdiameter = self.getDiameter(lengthFactor: UIDevice.current.userInterfaceIdiom == .phone ? 0.27 : 0.35) let axisSize = CGSize(width: axisdiameter, height: axisdiameter) self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis-0.75.svg", in: self.layer, targetSize: axisSize) - GraphicUtils.changeColor(layer: self.stickWheelAxis, color: UIColor(white: 1, alpha: 0.6)) + GraphicUtils.changeColor(layer: self.stickWheelAxis, color: UIColor(white: 1, alpha: 0.5)) self.stickWheelAxis.removeFromSuperlayer() self.layer.addSublayer(self.stickWheelAxis) self.stickWheelAxis.isHidden = false @@ -2566,7 +2566,7 @@ import SVGKit private func highlightBorder(highlighted:Bool) { if highlighted { - self.layer.borderWidth = 2 + self.layer.borderWidth = 3 self.layer.borderColor = voidlinkPurple } else { @@ -2590,7 +2590,6 @@ import SVGKit self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT) } buttonDownVisualEffectLayer.removeFromSuperlayer() - crossMarkLayer.removeFromSuperlayer() lrudIndicatorBall.removeFromSuperlayer() l3r3Indicator.removeFromSuperlayer() @@ -2599,6 +2598,9 @@ import SVGKit leftIndicator.removeFromSuperlayer() rightIndicator.removeFromSuperlayer() lrudIndicatorBall.removeFromSuperlayer() + stickWheelAxis.removeFromSuperlayer() + stickWheelLayer.removeFromSuperlayer() + stickWheelLayerSmall.removeFromSuperlayer() self.inertialScroller.timer?.clean() self.clearLeftStickTouchPadFlag() self.clearRightStickTouchPadFlag() diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 2a8ff413..0e75cb6b 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -1751,25 +1751,25 @@ } } }, - "Deceleration Rate: %.3f " : { + "DecelerationRateX: %.3f " : { "extractionState" : "manual", "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "减速率: %.3f " + "value" : "减速率X: %.3f " } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "減速率: %.3f " + "value" : "減速率X: %.3f " } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "減速率: %.3f " + "value" : "減速率X: %.3f " } } } diff --git a/VoidLink/Network/DiscoveryWorker.m b/VoidLink/Network/DiscoveryWorker.m index 86de7a6d..8e578817 100644 --- a/VoidLink/Network/DiscoveryWorker.m +++ b/VoidLink/Network/DiscoveryWorker.m @@ -71,7 +71,7 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds // to preserve insertion order of addresses. for (int i = 0; i < [array count]; i++) { NSString *addr1 = [array objectAtIndex:i]; - NSLog(@"iterates discovery addrs %@, host: %@", addr1, _host.name); + // NSLog(@"iterates discovery addrs %@, host: %@", addr1, _host.name); for (int j = 1; j < [array count]; j++) { if (i == j) { diff --git a/VoidLink/PresetConfigs/widgetTemplates.bin b/VoidLink/PresetConfigs/widgetTemplates.bin index 2f21b71f..eb6d2a4a 100644 Binary files a/VoidLink/PresetConfigs/widgetTemplates.bin and b/VoidLink/PresetConfigs/widgetTemplates.bin differ diff --git a/VoidLink/PresetConfigs/widgetTemplatesIPhone.bin b/VoidLink/PresetConfigs/widgetTemplatesIPhone.bin index dd4bb065..783b5a59 100644 Binary files a/VoidLink/PresetConfigs/widgetTemplatesIPhone.bin and b/VoidLink/PresetConfigs/widgetTemplatesIPhone.bin differ diff --git a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 5afccda9..a548a9dd 100644 --- a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -36,7 +36,7 @@ typedef NS_ENUM(NSUInteger, BorderWidthSliderMode) { }; typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) { - decelerationRate2D, + decelerationRateX, decelerationRateY, DecelerationRateSliderModeCount }; @@ -834,6 +834,15 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) { /* show pop up notification that lets users choose to save the current OSC layout configuration as a profile they can load when they want. User can also choose to cancel out of this pop up */ - (IBAction) saveTapped:(id)sender { + + /* + OSCProfile* targetProfile = [profilesManager getAllProfiles][0]; + OSCProfile* currentProfile = [profilesManager getSelectedProfile]; + // currentProfile.name = @"RPG游戏示例 / RPG example (ZZZ in Genshin style)"; + currentProfile.name = @"Default"; + [profilesManager replaceProfile:targetProfile withProfile:currentProfile]; + */ + [self clearSickInput]; [OSCProfilesManager setLayoutViewBounds:self.view.bounds]; @@ -1328,16 +1337,15 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) { } - (void)loadDecelerationRates { - self.decelerationRateSlider.value = decelerationRateSliderMode == decelerationRate2D ? selectedWidgetView.decelerationRateX : selectedWidgetView.decelerationRateY; - NSString* labelText = [LocalizationHelper localizedStringForKey:decelerationRateSliderMode == decelerationRate2D ? @"Deceleration Rate: %.3f " : @"DecelerationRateY: %.3f ", self.decelerationRateSlider.value]; + self.decelerationRateSlider.value = decelerationRateSliderMode == decelerationRateX ? selectedWidgetView.decelerationRateX : selectedWidgetView.decelerationRateY; + NSString* labelText = [LocalizationHelper localizedStringForKey:decelerationRateSliderMode == decelerationRateX ? @"DecelerationRateX: %.3f " : @"DecelerationRateY: %.3f ", self.decelerationRateSlider.value]; [self.decelerationRateLabel setText: labelText]; } - (void)decelerationRateSliderMoved:(UISlider* )sender{ if(self->selectedWidgetView != nil && self->widgetViewSelected){ - if(decelerationRateSliderMode == decelerationRate2D){ + if(decelerationRateSliderMode == decelerationRateX){ self->selectedWidgetView.decelerationRateX = sender.value; - self->selectedWidgetView.decelerationRateY = sender.value; } else{ self->selectedWidgetView.decelerationRateY = sender.value; diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index 7d1a70e7..520368a6 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -1681,6 +1681,19 @@ static NSMutableSet* hostList; GCController* controller = note.object; [self unregisterControllerCallbacks:controller]; }]; + + [self prewarmSoftKeyboard]; +} + +- (void)prewarmSoftKeyboard { + dispatch_async(dispatch_get_main_queue(), ^{ + UITextField *tf = [[UITextField alloc] initWithFrame:CGRectZero]; + tf.hidden = YES; + [[UIApplication sharedApplication].windows.firstObject addSubview:tf]; + [tf becomeFirstResponder]; + [tf resignFirstResponder]; + [tf removeFromSuperview]; + }); } -(void)viewDidLayoutSubviews{