mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
Remove macOS port
We now have a proper native PC port (Moonlight Qt) and if we wanted to bring the full iOS app over we can now use Catalyst.
This commit is contained in:
@@ -6,19 +6,11 @@
|
||||
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
@property (readonly, strong) NSPersistentContainer *persistentContainer;
|
||||
@property (strong, nonatomic) NSWindow *window;
|
||||
#endif
|
||||
|
||||
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
||||
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
||||
|
||||
+1
-15
@@ -18,13 +18,10 @@ static NSOperationQueue* mainQueue;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
static NSString* DB_NAME = @"Moonlight_tvOS.bin";
|
||||
#elif TARGET_OS_IPHONE
|
||||
static NSString* DB_NAME = @"Limelight_iOS.sqlite";
|
||||
#else
|
||||
static NSString* DB_NAME = @"moonlight_mac.sqlite";
|
||||
static NSString* DB_NAME = @"Limelight_iOS.sqlite";
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
|
||||
@@ -58,17 +55,6 @@ static NSString* DB_NAME = @"moonlight_mac.sqlite";
|
||||
// Saves changes in the application's managed object context before the application terminates.
|
||||
[self saveContext];
|
||||
}
|
||||
#else
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
// Insert code here to initialize your application
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Insert code here to tear down your application
|
||||
[self saveContext];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)saveContext
|
||||
{
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
// Swift
|
||||
#if !TARGET_OS_IPHONE
|
||||
#import "Gamepad.h"
|
||||
#endif
|
||||
#import "StreamConfiguration.h"
|
||||
#import "Controller.h"
|
||||
|
||||
@@ -19,15 +15,9 @@
|
||||
|
||||
-(id) initWithConfig:(StreamConfiguration*)streamConfig;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
-(void) initAutoOnScreenControlMode:(OnScreenControls*)osc;
|
||||
-(void) cleanup;
|
||||
-(Controller*) getOscController;
|
||||
#else
|
||||
-(void) assignGamepad:(struct Gamepad_device *)gamepad;
|
||||
-(void) removeGamepad:(struct Gamepad_device *)gamepad;
|
||||
-(NSMutableDictionary*) getControllers;
|
||||
#endif
|
||||
|
||||
-(void) updateLeftStick:(Controller*)controller x:(short)x y:(short)y;
|
||||
-(void) updateRightStick:(Controller*)controller x:(short)x y:(short)y;
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
#import "Controller.h"
|
||||
|
||||
#import "OnScreenControls.h"
|
||||
#if !TARGET_OS_IPHONE
|
||||
#import "Gamepad.h"
|
||||
#import "Control.h"
|
||||
#endif
|
||||
|
||||
#import "DataManager.h"
|
||||
#include "Limelight.h"
|
||||
@@ -364,9 +360,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[_osc setLevel:level];
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void) initAutoOnScreenControlMode:(OnScreenControls*)osc
|
||||
@@ -402,40 +396,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
-(Controller*) getOscController {
|
||||
return _player0osc;
|
||||
}
|
||||
#else
|
||||
-(NSMutableDictionary*) getControllers {
|
||||
return _controllers;
|
||||
}
|
||||
|
||||
-(void) assignGamepad:(struct Gamepad_device *)gamepad {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!(_controllerNumbers & (1 << i))) {
|
||||
_controllerNumbers |= (1 << i);
|
||||
gamepad->deviceID = i;
|
||||
NSLog(@"Gamepad device id: %u assigned", gamepad->deviceID);
|
||||
Controller* limeController;
|
||||
limeController = [[Controller alloc] init];
|
||||
limeController.playerIndex = i;
|
||||
|
||||
[_controllers setObject:limeController forKey:[NSNumber numberWithInteger:i]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void) removeGamepad:(struct Gamepad_device *)gamepad {
|
||||
_controllerNumbers &= ~(1 << gamepad->deviceID);
|
||||
Log(LOG_I, @"Unassigning controller index: %ld", (long)gamepad->deviceID);
|
||||
|
||||
// Inform the server of the updated active gamepads before removing this controller
|
||||
[self updateFinished:[_controllers objectForKey:[NSNumber numberWithInteger:gamepad->deviceID]]];
|
||||
[_controllers removeObjectForKey:[NSNumber numberWithInteger:gamepad->deviceID]];
|
||||
}
|
||||
#endif
|
||||
|
||||
+(bool) isSupportedGamepad:(GCController*) controller {
|
||||
return controller.extendedGamepad != nil || controller.gamepad != nil;
|
||||
@@ -472,7 +435,6 @@
|
||||
mask = 0x1;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
OnScreenControlsLevel level = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue];
|
||||
|
||||
@@ -481,7 +443,6 @@
|
||||
if (level != OnScreenControlsLevelOff) {
|
||||
mask |= 0x1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mask;
|
||||
}
|
||||
@@ -515,14 +476,8 @@
|
||||
_player0osc = [[Controller alloc] init];
|
||||
_player0osc.playerIndex = 0;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
_oscEnabled = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue] != OnScreenControlsLevelOff;
|
||||
#else
|
||||
_oscEnabled = false;
|
||||
initGamepad(self);
|
||||
Gamepad_detectDevices();
|
||||
#endif
|
||||
|
||||
_rumbleTimer = [NSTimer scheduledTimerWithTimeInterval:0.20
|
||||
target:self
|
||||
|
||||
@@ -25,12 +25,10 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
OnScreenControlsLevelAutoGCExtendedGamepadWithStickButtons
|
||||
};
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport swipeDelegate:(id<EdgeDetectionDelegate>)edgeDelegate;
|
||||
- (BOOL) handleTouchDownEvent:(NSSet*)touches;
|
||||
- (BOOL) handleTouchUpEvent:(NSSet*)touches;
|
||||
- (BOOL) handleTouchMovedEvent:(NSSet*)touches;
|
||||
- (void) setLevel:(OnScreenControlsLevel)level;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
self.statusCode = -1;
|
||||
}
|
||||
- (OSImage*) getImage {
|
||||
#if TARGET_OS_IPHONE
|
||||
OSImage* appImage = [[OSImage alloc] initWithData:self.data];
|
||||
#else
|
||||
OSImage* appImage = nil;
|
||||
#endif
|
||||
return appImage;
|
||||
return [[OSImage alloc] initWithData:self.data];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,16 +24,12 @@ static const int MAX_ATTEMPTS = 5;
|
||||
AppAssetResponse* appAssetResp = [[AppAssetResponse alloc] init];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:appAssetResp withUrlRequest:[hMan newAppAssetRequestWithAppId:self.app.id]]];
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (appAssetResp.data != nil) {
|
||||
NSString* boxArtPath = [AppAssetManager boxArtPathForApp:self.app];
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:[boxArtPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
[appAssetResp.data writeToFile:boxArtPath atomically:NO];
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
if (![self isCancelled]) {
|
||||
[NSThread sleepForTimeInterval:RETRY_DELAY];
|
||||
|
||||
@@ -110,7 +110,6 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
|
||||
opusConfig->mapping,
|
||||
&err);
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// Configure the audio session for our app
|
||||
NSError *audioSessionError = nil;
|
||||
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
|
||||
@@ -122,7 +121,6 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
|
||||
|
||||
// FIXME: Calling this breaks surround audio for some reason
|
||||
//[audioSession setPreferredOutputNumberOfChannels:opusConfig->channelCount error:&audioSessionError];
|
||||
#endif
|
||||
|
||||
OSStatus status;
|
||||
|
||||
@@ -203,10 +201,8 @@ void ArCleanup(void)
|
||||
audioCircularBuffer = NULL;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// Audio session is now inactive
|
||||
[[AVAudioSession sharedInstance] setActive: NO error: nil];
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArDecodeAndPlaySample(char* sampleData, int sampleLength)
|
||||
@@ -358,7 +354,6 @@ void ClConnectionStatusUpdate(int status)
|
||||
config.allowHevc = YES;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// On iOS 11, we can use HEVC if the server supports encoding it
|
||||
// and this device has hardware decode for it (A9 and later).
|
||||
// Additionally, iPhone X had a bug which would cause video
|
||||
@@ -367,13 +362,6 @@ void ClConnectionStatusUpdate(int status)
|
||||
if (@available(iOS 11.3, tvOS 11.3, *)) {
|
||||
_streamConfig.supportsHevc = config.allowHevc && VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC);
|
||||
}
|
||||
#else
|
||||
if (@available(macOS 10.13, *)) {
|
||||
// Streaming with limited bandwidth will result in better quality with HEVC
|
||||
if (VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC) || _streamConfig.streamingRemotely != 0)
|
||||
_streamConfig.supportsHevc = config.allowHevc;
|
||||
}
|
||||
#endif
|
||||
|
||||
// HEVC must be supported when HDR is enabled
|
||||
assert(!_streamConfig.enableHdr || _streamConfig.supportsHevc);
|
||||
|
||||
@@ -78,14 +78,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// Set mouse delta factors from the screen resolution and stream size
|
||||
CGFloat screenScale = [[UIScreen mainScreen] scale];
|
||||
CGRect screenBounds = [[UIScreen mainScreen] bounds];
|
||||
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);
|
||||
[((StreamView*)_renderView) setMouseDeltaFactors:_config.width / screenSize.width
|
||||
y:_config.height / screenSize.height];
|
||||
#endif
|
||||
|
||||
// Populate the config's version fields from serverinfo
|
||||
_config.appVersion = appversion;
|
||||
|
||||
@@ -75,9 +75,6 @@
|
||||
- (void)setupWithVideoFormat:(int)videoFormat refreshRate:(int)refreshRate
|
||||
{
|
||||
self->videoFormat = videoFormat;
|
||||
#if !TARGET_OS_IPHONE
|
||||
_view.codec = videoFormat;
|
||||
#endif
|
||||
|
||||
if (refreshRate > 60) {
|
||||
// HACK: We seem to just get 60 Hz screen updates even with a 120 FPS stream if
|
||||
@@ -255,11 +252,7 @@
|
||||
|
||||
Log(LOG_I, @"Constructing new HEVC format description");
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (@available(iOS 11.0, *)) {
|
||||
#else
|
||||
if (@available(macOS 10.13, *)) {
|
||||
#endif
|
||||
status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault,
|
||||
3, /* count of parameter sets */
|
||||
parameterSetPointers,
|
||||
@@ -370,10 +363,6 @@
|
||||
CFDictionarySetValue(dict, kCMSampleAttachmentKey_DependsOnOthers, kCFBooleanFalse);
|
||||
}
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
_view.frameCount++;
|
||||
#endif
|
||||
|
||||
// Enqueue video samples on the main thread
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Enqueue the next frame
|
||||
|
||||
Reference in New Issue
Block a user