Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/iOS/App/Common/Emulation/EmulationCoordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
@class EmulationBootParameter;
@class UIView;

NS_ASSUME_NONNULL_BEGIN

NSString* const DOLEmulationDidStartNotification = @"DOLEmulationDidStartNotification";
NSString* const DOLEmulationDidEndNotification = @"DOLEmulationDidEndNotification";

NS_ASSUME_NONNULL_BEGIN

@interface EmulationCoordinator : NSObject

+ (EmulationCoordinator*)shared;
Expand Down
40 changes: 21 additions & 19 deletions Source/iOS/App/Common/Jit/JitManager+AltServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,33 @@

@import AltKit;

@interface JitManager (AltServer)
@interface JitManager (AltServerPrivate)
@property (nonatomic) BOOL isAltServerAutoConnecting;
@end

@implementation JitManager (AltServerPrivate)

// Hack: Private property

- (BOOL)isAltServerAutoConnecting {
return [objc_getAssociatedObject(self, @selector(isAltServerAutoConnecting)) boolValue];
}

@property (nonatomic) bool isAltServerAutoConnecting;
- (void)setIsAltServerAutoConnecting:(BOOL)result {
objc_setAssociatedObject(self, @selector(isAltServerAutoConnecting), [NSNumber numberWithBool:result], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end

@implementation JitManager (AltServer)

- (bool)checkAppInstalledByAltServer {
NSString* deviceId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ALTDeviceID"];

if (!deviceId) {
return false;
}

// If ALTDeviceID isn't our dummy value, then we can use AltServer to enable JIT.
return ![deviceId isEqualToString:@"NotSet"];
}
Expand All @@ -39,35 +51,25 @@ - (void)acquireJitByAltServer {
return;
}

self.isAltServerAutoConnecting = true;
self.isAltServerAutoConnecting = YES;

// TODO: Localization
[[ALTServerManager sharedManager] autoconnectWithCompletionHandler:^(ALTServerConnection *connection, NSError *error) {
if (error != nil) {
self.acquisitionError = [NSString stringWithFormat:@"Failed to connect to AltServer: %@", [error localizedDescription]];
self.isAltServerAutoConnecting = false;
self.isAltServerAutoConnecting = NO;
} else {
[connection enableUnsignedCodeExecutionWithCompletionHandler:^(bool success, NSError* error) {
if (!success) {
self.acquisitionError = [NSString stringWithFormat:@"AltServer failed to enable JIT: %@", [error localizedDescription]];
}

[connection disconnect];
self.isAltServerAutoConnecting = false;

self.isAltServerAutoConnecting = NO;
}];
}
}];
}

// Hack: Private property

- (bool)isAltServerAutoConnecting {
return [objc_getAssociatedObject(self, @selector(isAltServerAutoConnecting)) boolValue];
}

- (void)setIsAltServerAutoConnecting:(bool)result {
objc_setAssociatedObject(self, @selector(isAltServerAutoConnecting), [NSNumber numberWithBool:result], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (GameFileCacheManager*)sharedManager;

- (void)rescan;
- (void)rescanAndFetchMetadataWithCompletionHandler:(nullable void (^)())completion_handler;
- (void)rescanAndFetchMetadataWithCompletionHandler:(nullable void (^)(void))completion_handler;

- (NSArray<GameFilePtrWrapper*>*)getGames;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ import Foundation

// UIApplicationDidChangeStatusBarOrientationNotification is deprecated...
@objc func statusBarOrientationChanged() {
self.orientation = UIApplication.shared.statusBarOrientation
self.orientation = UIApplication.shared.foregroundActiveScene?.interfaceOrientation ?? .portrait
}
}

private extension UIApplication {
var foregroundActiveScene: UIWindowScene? {
return connectedScenes.filter { $0.activationState == .foregroundActive }.compactMap { $0 as? UIWindowScene }.first
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class TCJoystick: UIView
let yDiff = point.y - joystickCenter.y

// Calculate distance
var distance = sqrt(pow(xDiff, 2) + pow(yDiff, 2))
let distance = sqrt(pow(xDiff, 2) + pow(yDiff, 2))
let maxDistance = self.frame.width / 3

if (distance > maxDistance)
Expand Down