Add AltJit support (#422)
* Integrate AltKit for JIT * Bump min iOS to 12.2, delete AltKit-Swift.h * Add title messages + prefer JitStreamer * Tweaks to UI and order of operations Co-authored-by: Duy Tran Khanh <[email protected]>
This commit is contained in:
1 parent
973568eaea
commit
c80f2022e4
11 files changed
+67
-7
No files matched your search
@@ -18,6 +18,7 @@ include_directories(
|
||||
"external/TOInsetGroupedTableView/TOInsetGroupedTableView"
|
||||
"external/fishhook"
|
||||
"external/mesa"
|
||||
"external/AltKit"
|
||||
"external/Apple"
|
||||
)
|
||||
|
||||
@@ -146,7 +147,9 @@ endif()
|
||||
target_link_libraries(PojavLauncher
|
||||
"-F'${CMAKE_CURRENT_LIST_DIR}/build'"
|
||||
"-F'${CMAKE_CURRENT_LIST_DIR}/resources/Frameworks'"
|
||||
"-framework AltKit"
|
||||
"-framework AuthenticationServices"
|
||||
"-framework CAltKit"
|
||||
"-framework CoreGraphics"
|
||||
"-framework CoreServices"
|
||||
"-framework GameController"
|
||||
|
||||
+9
-1
@@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ALTDeviceID</key>
|
||||
<string></string>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
@@ -80,7 +82,13 @@
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<string>12.2</string>
|
||||
<key>NSBonjourServices</key>
|
||||
<array>
|
||||
<string>_altserver._tcp</string>
|
||||
</array>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>PojavLauncher uses the local network to find and communicate with AltServer.</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#import "AFNetworking.h"
|
||||
#import <AuthenticationServices/AuthenticationServices.h>
|
||||
#import "authenticator/BaseAuthenticator.h"
|
||||
#import "ALTServerConnection.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "AccountListViewController.h"
|
||||
@@ -353,6 +354,33 @@ extern NSMutableDictionary *prefDict;
|
||||
[self presentViewController:vc animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)enableJITWithAltJIT
|
||||
{
|
||||
self.title = NSLocalizedString(@"login.jit.start.AltKit", nil);
|
||||
[ALTServerManager.sharedManager startDiscovering];
|
||||
[ALTServerManager.sharedManager autoconnectWithCompletionHandler:^(ALTServerConnection *connection, NSError *error) {
|
||||
if (error) {
|
||||
NSLog(@"[AltKit] Could not auto-connect to server. %@", error);
|
||||
self.title = NSLocalizedString(@"login.jit.fail.AltKit", nil);
|
||||
return;
|
||||
}
|
||||
[connection enableUnsignedCodeExecutionWithCompletionHandler:^(BOOL success, NSError *error) {
|
||||
if (success) {
|
||||
NSLog(@"[AltKit] Successfully enabled JIT compilation!");
|
||||
[ALTServerManager.sharedManager stopDiscovering];
|
||||
self.title = NSLocalizedString(@"login.jit.enabled", nil);
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
} else {
|
||||
NSLog(@"[AltKit] Could not enable JIT compilation. %@", error);
|
||||
self.title = NSLocalizedString(@"login.jit.fail.AltKit", nil);
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
showDialog(self, NSLocalizedString(@"Error", nil), error.description);
|
||||
}
|
||||
[connection disconnect];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)enableJITWithJitStreamer
|
||||
{
|
||||
[self displayProgress:NSLocalizedString(@"login.jit.checking", nil)];
|
||||
@@ -384,18 +412,17 @@ extern NSMutableDictionary *prefDict;
|
||||
}
|
||||
if ([responseDict[@"success"] boolValue]) {
|
||||
self.title = NSLocalizedString(@"login.jit.enabled", nil);
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
} else {
|
||||
self.title = [NSString stringWithFormat:NSLocalizedString(@"login.jit.fail.JitStreamer", nil), responseDict[@"message"]];
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
showDialog(self, NSLocalizedString(@"Error", nil), responseDict[@"message"]);
|
||||
// TODO: [self enableJITWithAltJIT];
|
||||
[self enableJITWithAltJIT];
|
||||
}
|
||||
};
|
||||
[manager POST:[NSString stringWithFormat:@"http://%@/attach/%d/", address, getpid()] parameters:nil headers:nil progress:nil success:handleResponse failure:handleResponse];
|
||||
} failure:^(NSURLSessionDataTask *task, NSError *error) {
|
||||
self.title = @"";
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
//showDialog(self, @"Error", [NSString stringWithFormat:@"%@", error]);
|
||||
// TODO: [self enableJITWithAltJIT];
|
||||
[self enableJITWithAltJIT];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
"login.jit.enabled" = "JIT has been enabled";
|
||||
"login.jit.fail.JitStreamer" = "JitStreamer error: %@";
|
||||
"login.jit.found.JitStreamer" = "Found JitStreamer, enabling JIT";
|
||||
"login.jit.start.AltKit" = "Attempting to use AltJIT";
|
||||
"login.jit.fail.AltKit" = "AltKit error: %@";
|
||||
|
||||
// Login buttons
|
||||
"Sign in" = "Sign in";
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface ALTServerConnection
|
||||
|
||||
- (void)disconnect;
|
||||
- (void)enableUnsignedCodeExecutionWithCompletionHandler:(void(^)(BOOL success, NSError *error))handler;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface ALTServerManager
|
||||
|
||||
+ (ALTServerManager *)sharedManager;
|
||||
|
||||
- (void)autoconnectWithCompletionHandler:(void(^)(ALTServerConnection *connection, NSError *error))handler;
|
||||
- (void)startDiscovering;
|
||||
- (void)stopDiscovering;
|
||||
|
||||
@end
|
||||
+1
-1
@@ -20,6 +20,6 @@ void debugLog(const char *message,...)
|
||||
static BOOL debugLog_warned = NO;
|
||||
if (debugLog_warned) return;
|
||||
debugLog_warned = YES;
|
||||
NSLog(@"WARNING!!! DEBUG LOG DISABLED");
|
||||
NSLog(@"Debug log not enabled.");
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -77,6 +77,7 @@ PojavLauncher is amazing, and surprisingly stable, and it wouldn't be this way w
|
||||
- [Java Native Access](https://github.com/java-native-access/jna): [Apache 2.0 License](https://github.com/java-native-access/jna/blob/master/LICENSE).
|
||||
- [shaderc](https://github.com/google/shaderc) (used by mods that uses Vulkan for rendering): [Apache 2.0 License](https://github.com/google/shaderc/blob/main/LICENSE).
|
||||
- [TOInsetGroupedTableView](https://github.com/TimOliver/TOInsetGroupedTableView): [MIT License](https://github.com/TimOliver/TOInsetGroupedTableView/blob/master/LICENSE).
|
||||
- [AltKit](https://github.com/rileytestut/AltKit)
|
||||
- Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars.
|
||||
|
||||
## Special thanks to MacStadium!
|
||||
|
||||
Reference in new issue
Block a user