diff --git a/Natives/SurfaceViewController+LogView.m b/Natives/SurfaceViewController+LogView.m index 80d3ce76..0259dc8e 100644 --- a/Natives/SurfaceViewController+LogView.m +++ b/Natives/SurfaceViewController+LogView.m @@ -85,6 +85,7 @@ static int logCharPerLine; UINavigationBar* navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; navigationBar.items = @[navigationItem]; navigationBar.topItem.title = NSLocalizedString(@"game.menu.log_output", nil); + [navigationBar sizeToFit]; [self.logOutputView addSubview:navigationBar]; canAppendToLog = YES; [self actionStartStopLogOutput]; @@ -210,8 +211,7 @@ static int logCharPerLine; // Print last 100 lines from latestlog.txt for (int i = MAX(lines.count-100, 0); i < lines.count; i++) { - -[self _appendToLog:lines[i]]; + [self _appendToLog:lines[i]]; } fatalErrorOccurred = YES; diff --git a/Natives/SurfaceViewController.m b/Natives/SurfaceViewController.m index 0544f32e..be63d50b 100644 --- a/Natives/SurfaceViewController.m +++ b/Natives/SurfaceViewController.m @@ -45,7 +45,7 @@ BOOL slideableHotbar; @property(nonatomic) UIView *ctrlView; -@property(nonatomic) TrackedTextField *inputView; +@property(nonatomic) TrackedTextField *inputTextField; @property(nonatomic) NSMutableDictionary* cc_dictionary; @property(nonatomic) NSMutableArray* swipeableButtons; @property(nonatomic) ControlButton* swipingButton; @@ -163,16 +163,16 @@ BOOL slideableHotbar; self.mousePointerView.userInteractionEnabled = NO; [self.rootView addSubview:self.mousePointerView]; - self.inputView = [[TrackedTextField alloc] initWithFrame:CGRectMake(0, -32.0, self.view.frame.size.width, 30.0)]; + self.inputTextField = [[TrackedTextField alloc] initWithFrame:CGRectMake(0, -32.0, self.view.frame.size.width, 30.0)]; if (@available(iOS 13.0, *)) { - self.inputView.backgroundColor = UIColor.secondarySystemBackgroundColor; + self.inputTextField.backgroundColor = UIColor.secondarySystemBackgroundColor; } else { - self.inputView.backgroundColor = UIColor.groupTableViewBackgroundColor; + self.inputTextField.backgroundColor = UIColor.groupTableViewBackgroundColor; } - self.inputView.delegate = self; - self.inputView.font = [UIFont fontWithName:@"Menlo-Regular" size:20]; - self.inputView.clearsOnBeginEditing = YES; - self.inputView.textAlignment = NSTextAlignmentCenter; + self.inputTextField.delegate = self; + self.inputTextField.font = [UIFont fontWithName:@"Menlo-Regular" size:20]; + self.inputTextField.clearsOnBeginEditing = YES; + self.inputTextField.textAlignment = NSTextAlignmentCenter; NSString *controlFilePath = [NSString stringWithFormat:@"%s/controlmap/%@", getenv("POJAV_HOME"), (NSString *)getPreference(@"default_ctrl")]; @@ -216,7 +216,7 @@ BOOL slideableHotbar; [ControllerInput registerControllerCallbacks:GCController.controllers.firstObject]; } - [self.rootView addSubview:self.inputView]; + [self.rootView addSubview:self.inputTextField]; [self performSelector:@selector(initCategory_LogView)]; @@ -628,13 +628,13 @@ int currentVisibility = 1; switch (keycode) { case SPECIALBTN_KEYBOARD: if (held == 0) { - if (self.inputView.isFirstResponder) { - [self.inputView resignFirstResponder]; - self.inputView.alpha = 1.0f; + if (self.inputTextField.isFirstResponder) { + [self.inputTextField resignFirstResponder]; + self.inputTextField.alpha = 1.0f; } else { - [self.inputView becomeFirstResponder]; + [self.inputTextField becomeFirstResponder]; // Insert an undeletable space - self.inputView.text = @" "; + self.inputTextField.text = @" "; inputTextLength = 0; } } diff --git a/Natives/TrackedTextField.m b/Natives/TrackedTextField.m index 7fd3c14e..3290e2e2 100644 --- a/Natives/TrackedTextField.m +++ b/Natives/TrackedTextField.m @@ -118,7 +118,7 @@ extern bool isUseStackQueueCall; return range; } -- (id) replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text +- (id)replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text { int length = [super offsetFromPosition:range.start toPosition:range.end]; diff --git a/Natives/UIKit+hook.m b/Natives/UIKit+hook.m index e21845e3..ba9992b3 100644 --- a/Natives/UIKit+hook.m +++ b/Natives/UIKit+hook.m @@ -37,24 +37,6 @@ __attribute__((constructor)) void hookConstructor(void) { @end -@implementation UIResponder(hook) - -- (BOOL)hook_becomeFirstResponder { - // Workaround a weird bug: UIKit tries to present an accessibility UITextField - // for some reason, which could cause crash due to mismatched parent view controller - // UIViewControllerHierarchyInconsistency - - @try { - return [self hook_becomeFirstResponder]; - } @catch (NSException *e) { - NSLog(@"-[UITextInputUIResponderAccessibility becomeFirstResponder]: %@", e); - } - - return NO; -} - -@end - @implementation UITraitCollection(hook) - (UIUserInterfaceSizeClass)verticalSizeClass {