SurfaceViewController is now always the root vc

Before launching game, SurfaceViewController is set to UIWindow.rootViewController, making it similar to "Restart before launching" in order to *attempt* to find out why touchscreen input does not work on certain devices. The restart option is still kept for debugging purpose.

Some other tiny code tweaks
This commit is contained in:
khanhduytran0 committed 2022-07-16 13:27:25 +07:00
1 parent 0622423df4
commit 5d8a136470
3 files changed
+19 -16

No files matched your search

+4 -7
View File
@@ -39,14 +39,11 @@ static AFURLSessionManager* manager;
// Check if the account has permission to download
+ (BOOL)checkAccessWithDialog:(BOOL)show {
// for now
if ([BaseAuthenticator.current.authData[@"username"] hasPrefix:@"Demo."] || BaseAuthenticator.current.authData[@"xboxGamertag"] != nil) {
return YES;
} else {
if (show) {
showDialog(viewController, @"Error", @"Minecraft can't be legally installed when logged in with a local account. Please switch to an online account to continue.");
}
return NO;
BOOL accessible = [BaseAuthenticator.current.authData[@"username"] hasPrefix:@"Demo."] || BaseAuthenticator.current.authData[@"xboxGamertag"] != nil;
if (!accessible && show) {
showDialog(viewController, @"Error", @"Minecraft can't be legally installed when logged in with a local account. Please switch to an online account to continue.");
}
return accessible;
}
// Check SHA of the file
+3 -6
View File
@@ -113,8 +113,6 @@ BOOL slideableHotbar;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGFloat screenScale = [[UIScreen mainScreen] scale];
UIEdgeInsets insets = UIApplication.sharedApplication.windows.firstObject.safeAreaInsets;
resolutionScale = ((NSNumber *)getPreference(@"resolution")).floatValue / 100.0;
slideableHotbar = [getPreference(@"slideable_hotbar") boolValue];
@@ -630,10 +628,8 @@ CGPoint lastCenterPoint;
- (void)surfaceOnHover:(UIHoverGestureRecognizer *)sender API_AVAILABLE(ios(13.0)) {
if (@available(iOS 13.0, *)) {
if (@available(iOS 14.0, *)) {
if(isGrabbing) { // Can't put into above if statement
return;
}
if (@available(iOS 14.0, *) && isGrabbing) {
return;
}
CGPoint point = [sender locationInView:self.rootView];
// NSLog(@"Mouse move!!");
@@ -864,6 +860,7 @@ int currentVisibility = 1;
if (!held) {
CallbackBridge_nativeSendScroll(0.0, -1.0);
}
break;
case SPECIALBTN_VIRTUALMOUSE:
if (!isGrabbing && !held) {
+12 -3
View File
@@ -121,9 +121,18 @@ void UIKit_launchMinecraftSurfaceVC() {
usleep(1000);
exit(0);
} else {
SurfaceViewController *vc = [[SurfaceViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[viewController.navigationController pushViewController:vc animated:YES];
id delegate = UIApplication.sharedApplication.delegate;
if (@available(iOS 13.0, *)) {
delegate = UIApplication.sharedApplication.connectedScenes.anyObject.delegate;
}
UIWindow *window = [delegate window];
[UIView animateWithDuration:0.2 animations:^{
window.rootViewController.view.alpha = 0;
} completion:^(BOOL b){
[window resignKeyWindow];
window.rootViewController = [[SurfaceViewController alloc] init];
[window makeKeyAndVisible];
}];
}
});
}