mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00

Some checks failed
Build macOS / build_macos (push) Has been cancelled
Build Android / build_android (apk) (push) Has been cancelled
Build Android / build_android (libretro) (push) Has been cancelled
Build Linux ARM32 / build_linux_arm32 (push) Has been cancelled
Build Linux ARM64 / build_linux_arm64 (push) Has been cancelled
Build Windows Psf / build_windows_psf (off, x86_64, Visual Studio 16 2019, installer64.nsi, x64) (push) Has been cancelled
Build Windows Psf / build_windows_psf (on, x86_64, Visual Studio 16 2019, installer64.nsi, x64) (push) Has been cancelled
Build Windows / build_windows (x86_32, Visual Studio 16 2019, installer32.nsi, win32_msvc2019, Win32) (push) Has been cancelled
Build Windows / build_windows (x86_64, Visual Studio 16 2019, installer64.nsi, win64_msvc2019_64, x64) (push) Has been cancelled
Check Format / run_clangformat (push) Has been cancelled
Build iOS / build_ios (push) Has been cancelled
Build JavaScript / build_js (push) Has been cancelled
Build Linux / build_linux (push) Has been cancelled
73 lines
1.5 KiB
Text
73 lines
1.5 KiB
Text
#import "AltServerJitService.h"
|
|
#import "AltKit-Swift.h"
|
|
#include "AppConfig.h"
|
|
#import "PreferenceDefs.h"
|
|
|
|
@implementation AltServerJitService
|
|
|
|
- (id)init
|
|
{
|
|
if(self = [super init])
|
|
{
|
|
[self registerPreferences];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
+ (AltServerJitService*)sharedAltServerJitService
|
|
{
|
|
static AltServerJitService* sharedInstance = nil;
|
|
static dispatch_once_t onceToken;
|
|
dispatch_once(&onceToken, ^{
|
|
sharedInstance = [[self alloc] init];
|
|
});
|
|
return sharedInstance;
|
|
}
|
|
|
|
- (void)registerPreferences
|
|
{
|
|
CAppConfig::GetInstance().RegisterPreferenceBoolean(PREFERENCE_ALTSTORE_JIT_ENABLED, false);
|
|
}
|
|
|
|
- (void)startProcess
|
|
{
|
|
//Don't start the process if it's not enabled
|
|
if(!CAppConfig::GetInstance().GetPreferenceBoolean(PREFERENCE_ALTSTORE_JIT_ENABLED))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//Don't start the process if we've already started it
|
|
if(self.processStarted)
|
|
{
|
|
return;
|
|
}
|
|
|
|
self.processStarted = YES;
|
|
|
|
[[ALTServerManager sharedManager] startDiscovering];
|
|
|
|
[[ALTServerManager sharedManager] autoconnectWithCompletionHandler:^(ALTServerConnection* connection, NSError* error) {
|
|
if(error)
|
|
{
|
|
return NSLog(@"Could not auto-connect to server. %@", error);
|
|
}
|
|
|
|
[connection enableUnsignedCodeExecutionWithCompletionHandler:^(BOOL success, NSError* error) {
|
|
if(success)
|
|
{
|
|
NSLog(@"Successfully enabled JIT compilation!");
|
|
[[ALTServerManager sharedManager] stopDiscovering];
|
|
self.jitEnabled = true;
|
|
}
|
|
else
|
|
{
|
|
NSLog(@"Could not enable JIT compilation. %@", error);
|
|
}
|
|
|
|
[connection disconnect];
|
|
}];
|
|
}];
|
|
}
|
|
|
|
@end
|