Merge branch 'Integration' into stylus3
This commit is contained in:
commit
f89372e265
9 files changed
+43
-19
No files matched your search
@@ -45,8 +45,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
* Returns the index of the 'selected' profile within the array it's in
|
* Returns the index of the 'selected' profile within the array it's in
|
||||||
*/
|
*/
|
||||||
- (NSInteger) getIndexOfSelectedProfile;
|
- (NSInteger) getIndexOfSelectedProfile;
|
||||||
- (void)replaceSelectedProfileWith:(OSCProfile*)newProfile overwriteDefault:(bool)overwriteDefault;
|
|
||||||
|
|
||||||
- (NSMutableArray *) getEncodedProfiles;
|
- (NSMutableArray *) getEncodedProfiles;
|
||||||
// - (NSData* )getSelectedEncodedProfile;
|
// - (NSData* )getSelectedEncodedProfile;
|
||||||
- (void) importEncodedProfiles:(NSMutableArray* )profilesEncoded;
|
- (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
|
* 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) 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
|
* 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];
|
NSMutableArray *profiles = [self getAllProfiles];
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
NSString* persistedKey = @"widgetProfileUpdated-20251015";
|
// NSString* persistedKey = @"widgetProfileUpdated-20251015";
|
||||||
|
NSString* persistedKey = @"widgetProfileUpdated-20251229";
|
||||||
BOOL needImportDefaultTemplates = [defaults objectForKey:persistedKey] == nil;
|
BOOL needImportDefaultTemplates = [defaults objectForKey:persistedKey] == nil;
|
||||||
|
|
||||||
if(profiles.count == 0 || needImportDefaultTemplates){
|
if(profiles.count == 0 || needImportDefaultTemplates){
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ import SVGKit
|
|||||||
attributes: [
|
attributes: [
|
||||||
.foregroundColor: UIColor(white:labelAlpha>0 ? 1.0 : 0, alpha: abs(labelAlpha)), // 填充色
|
.foregroundColor: UIColor(white:labelAlpha>0 ? 1.0 : 0, alpha: abs(labelAlpha)), // 填充色
|
||||||
.strokeColor: (labelAlpha>0 ? UIColor.black : UIColor.white).withAlphaComponent(abs(labelAlpha)*0.43), // 描边色
|
.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
|
label.attributedText = attr
|
||||||
@@ -1078,7 +1078,7 @@ import SVGKit
|
|||||||
alpha: componentAlpha
|
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)
|
let axisSize = CGSize(width: axisdiameter, height: axisdiameter)
|
||||||
self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis.svg", in: self.layer, targetSize: axisSize)
|
self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis.svg", in: self.layer, targetSize: axisSize)
|
||||||
self.stickWheelAxis.removeFromSuperlayer()
|
self.stickWheelAxis.removeFromSuperlayer()
|
||||||
@@ -1496,10 +1496,10 @@ import SVGKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !touchCenteredOffset {
|
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)
|
let axisSize = CGSize(width: axisdiameter, height: axisdiameter)
|
||||||
self.stickWheelAxis = GraphicUtils.makeCenteredSVGLayer(from: "StickWheelAxis-0.75.svg", in: self.layer, targetSize: axisSize)
|
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.stickWheelAxis.removeFromSuperlayer()
|
||||||
self.layer.addSublayer(self.stickWheelAxis)
|
self.layer.addSublayer(self.stickWheelAxis)
|
||||||
self.stickWheelAxis.isHidden = false
|
self.stickWheelAxis.isHidden = false
|
||||||
@@ -2566,7 +2566,7 @@ import SVGKit
|
|||||||
|
|
||||||
private func highlightBorder(highlighted:Bool) {
|
private func highlightBorder(highlighted:Bool) {
|
||||||
if highlighted {
|
if highlighted {
|
||||||
self.layer.borderWidth = 2
|
self.layer.borderWidth = 3
|
||||||
self.layer.borderColor = voidlinkPurple
|
self.layer.borderColor = voidlinkPurple
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2590,7 +2590,6 @@ import SVGKit
|
|||||||
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
||||||
}
|
}
|
||||||
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
||||||
|
|
||||||
crossMarkLayer.removeFromSuperlayer()
|
crossMarkLayer.removeFromSuperlayer()
|
||||||
lrudIndicatorBall.removeFromSuperlayer()
|
lrudIndicatorBall.removeFromSuperlayer()
|
||||||
l3r3Indicator.removeFromSuperlayer()
|
l3r3Indicator.removeFromSuperlayer()
|
||||||
@@ -2599,6 +2598,9 @@ import SVGKit
|
|||||||
leftIndicator.removeFromSuperlayer()
|
leftIndicator.removeFromSuperlayer()
|
||||||
rightIndicator.removeFromSuperlayer()
|
rightIndicator.removeFromSuperlayer()
|
||||||
lrudIndicatorBall.removeFromSuperlayer()
|
lrudIndicatorBall.removeFromSuperlayer()
|
||||||
|
stickWheelAxis.removeFromSuperlayer()
|
||||||
|
stickWheelLayer.removeFromSuperlayer()
|
||||||
|
stickWheelLayerSmall.removeFromSuperlayer()
|
||||||
self.inertialScroller.timer?.clean()
|
self.inertialScroller.timer?.clean()
|
||||||
self.clearLeftStickTouchPadFlag()
|
self.clearLeftStickTouchPadFlag()
|
||||||
self.clearRightStickTouchPadFlag()
|
self.clearRightStickTouchPadFlag()
|
||||||
|
|||||||
@@ -1751,25 +1751,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Deceleration Rate: %.3f " : {
|
"DecelerationRateX: %.3f " : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "减速率: %.3f "
|
"value" : "减速率X: %.3f "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "減速率: %.3f "
|
"value" : "減速率X: %.3f "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-HK" : {
|
"zh-HK" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "減速率: %.3f "
|
"value" : "減速率X: %.3f "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds
|
|||||||
// to preserve insertion order of addresses.
|
// to preserve insertion order of addresses.
|
||||||
for (int i = 0; i < [array count]; i++) {
|
for (int i = 0; i < [array count]; i++) {
|
||||||
NSString *addr1 = [array objectAtIndex: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++) {
|
for (int j = 1; j < [array count]; j++) {
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+13
-5
@@ -36,7 +36,7 @@ typedef NS_ENUM(NSUInteger, BorderWidthSliderMode) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
||||||
decelerationRate2D,
|
decelerationRateX,
|
||||||
decelerationRateY,
|
decelerationRateY,
|
||||||
DecelerationRateSliderModeCount
|
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 */
|
/* 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 {
|
- (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];
|
[self clearSickInput];
|
||||||
[OSCProfilesManager setLayoutViewBounds:self.view.bounds];
|
[OSCProfilesManager setLayoutViewBounds:self.view.bounds];
|
||||||
|
|
||||||
@@ -1328,16 +1337,15 @@ typedef NS_ENUM(NSUInteger, DecelerationRateSliderMode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadDecelerationRates {
|
- (void)loadDecelerationRates {
|
||||||
self.decelerationRateSlider.value = decelerationRateSliderMode == decelerationRate2D ? selectedWidgetView.decelerationRateX : selectedWidgetView.decelerationRateY;
|
self.decelerationRateSlider.value = decelerationRateSliderMode == decelerationRateX ? selectedWidgetView.decelerationRateX : selectedWidgetView.decelerationRateY;
|
||||||
NSString* labelText = [LocalizationHelper localizedStringForKey:decelerationRateSliderMode == decelerationRate2D ? @"Deceleration Rate: %.3f " : @"DecelerationRateY: %.3f ", self.decelerationRateSlider.value];
|
NSString* labelText = [LocalizationHelper localizedStringForKey:decelerationRateSliderMode == decelerationRateX ? @"DecelerationRateX: %.3f " : @"DecelerationRateY: %.3f ", self.decelerationRateSlider.value];
|
||||||
[self.decelerationRateLabel setText: labelText];
|
[self.decelerationRateLabel setText: labelText];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)decelerationRateSliderMoved:(UISlider* )sender{
|
- (void)decelerationRateSliderMoved:(UISlider* )sender{
|
||||||
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
if(self->selectedWidgetView != nil && self->widgetViewSelected){
|
||||||
if(decelerationRateSliderMode == decelerationRate2D){
|
if(decelerationRateSliderMode == decelerationRateX){
|
||||||
self->selectedWidgetView.decelerationRateX = sender.value;
|
self->selectedWidgetView.decelerationRateX = sender.value;
|
||||||
self->selectedWidgetView.decelerationRateY = sender.value;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
self->selectedWidgetView.decelerationRateY = sender.value;
|
self->selectedWidgetView.decelerationRateY = sender.value;
|
||||||
|
|||||||
@@ -1681,6 +1681,19 @@ static NSMutableSet* hostList;
|
|||||||
GCController* controller = note.object;
|
GCController* controller = note.object;
|
||||||
[self unregisterControllerCallbacks:controller];
|
[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{
|
-(void)viewDidLayoutSubviews{
|
||||||
|
|||||||
Reference in new issue
Block a user