Merge branch 'Integration' into stylus3

This commit is contained in:
TrueZhuanjia
2025-12-29 17:26:59 +08:00
9 changed files with 43 additions and 19 deletions
@@ -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
@@ -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){
+8 -6
View File
@@ -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()
+4 -4
View File
@@ -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 "
}
}
}
+1 -1
View File
@@ -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) {
Binary file not shown.
Binary file not shown.
@@ -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;
@@ -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{