Refactor new macOS code to reduce #ifs, increase shared code, and fix warnings

This commit is contained in:
Cameron Gutman
2018-03-27 00:34:38 -07:00
parent 6cc165b589
commit e8832ed746
22 changed files with 73 additions and 293 deletions

View File

@@ -22,20 +22,12 @@
// HACK: Avoid calling [UIApplication delegate] off the UI thread to keep // HACK: Avoid calling [UIApplication delegate] off the UI thread to keep
// Main Thread Checker happy. // Main Thread Checker happy.
if ([NSThread isMainThread]) { if ([NSThread isMainThread]) {
#if TARGET_OS_IPHONE _appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
#else
_appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
#endif
} }
else { else {
dispatch_sync(dispatch_get_main_queue(), ^{ dispatch_sync(dispatch_get_main_queue(), ^{
#if TARGET_OS_IPHONE _appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
_appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
#else
_appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
#endif
}); });
} }

View File

@@ -10,8 +10,7 @@
// Swift // Swift
#import "Moonlight-Swift.h" #import "Moonlight-Swift.h"
#if TARGET_OS_IPHONE #if !TARGET_OS_IPHONE
#else
#import "Gamepad.h" #import "Gamepad.h"
#endif #endif
@class Controller; @class Controller;

View File

@@ -8,9 +8,8 @@
#import "ControllerSupport.h" #import "ControllerSupport.h"
#if TARGET_OS_IPHONE
#import "OnScreenControls.h" #import "OnScreenControls.h"
#else #if !TARGET_OS_IPHONE
#import "Gamepad.h" #import "Gamepad.h"
#import "Control.h" #import "Control.h"
#endif #endif
@@ -28,7 +27,6 @@
NSLock *_controllerStreamLock; NSLock *_controllerStreamLock;
NSMutableDictionary *_controllers; NSMutableDictionary *_controllers;
#if TARGET_OS_IPHONE
OnScreenControls *_osc; OnScreenControls *_osc;
// This controller object is shared between on-screen controls // This controller object is shared between on-screen controls
@@ -37,7 +35,6 @@
#define EMULATING_SELECT 0x1 #define EMULATING_SELECT 0x1
#define EMULATING_SPECIAL 0x2 #define EMULATING_SPECIAL 0x2
#endif
bool _oscEnabled; bool _oscEnabled;
char _controllerNumbers; char _controllerNumbers;
@@ -85,7 +82,6 @@
} }
} }
#if TARGET_OS_IPHONE
-(void) handleSpecialCombosReleased:(Controller*)controller releasedButtons:(int)releasedButtons -(void) handleSpecialCombosReleased:(Controller*)controller releasedButtons:(int)releasedButtons
{ {
if ((controller.emulatingButtonFlags & EMULATING_SELECT) && if ((controller.emulatingButtonFlags & EMULATING_SELECT) &&
@@ -120,7 +116,6 @@
} }
} }
#endif
-(void) updateButtonFlags:(Controller*)controller flags:(int)flags -(void) updateButtonFlags:(Controller*)controller flags:(int)flags
{ {
@@ -129,14 +124,12 @@
// This must be called before handleSpecialCombosPressed // This must be called before handleSpecialCombosPressed
// because we clear the original button flags there // because we clear the original button flags there
#if TARGET_OS_IPHONE
int releasedButtons = (controller.lastButtonFlags ^ flags) & ~flags; int releasedButtons = (controller.lastButtonFlags ^ flags) & ~flags;
int pressedButtons = (controller.lastButtonFlags ^ flags) & flags; int pressedButtons = (controller.lastButtonFlags ^ flags) & flags;
[self handleSpecialCombosReleased:controller releasedButtons:releasedButtons]; [self handleSpecialCombosReleased:controller releasedButtons:releasedButtons];
[self handleSpecialCombosPressed:controller pressedButtons:pressedButtons]; [self handleSpecialCombosPressed:controller pressedButtons:pressedButtons];
#endif
} }
} }
@@ -144,9 +137,7 @@
{ {
@synchronized(controller) { @synchronized(controller) {
controller.lastButtonFlags |= flags; controller.lastButtonFlags |= flags;
#if TARGET_OS_IPHONE
[self handleSpecialCombosPressed:controller pressedButtons:flags]; [self handleSpecialCombosPressed:controller pressedButtons:flags];
#endif
} }
} }
@@ -154,9 +145,7 @@
{ {
@synchronized(controller) { @synchronized(controller) {
controller.lastButtonFlags &= ~flags; controller.lastButtonFlags &= ~flags;
#if TARGET_OS_IPHONE
[self handleSpecialCombosReleased:controller releasedButtons:flags]; [self handleSpecialCombosReleased:controller releasedButtons:flags];
#endif
} }
} }
@@ -258,7 +247,6 @@
} }
} }
#if TARGET_OS_IPHONE
-(void) updateAutoOnScreenControlMode -(void) updateAutoOnScreenControlMode
{ {
// Auto on-screen control support may not be enabled // Auto on-screen control support may not be enabled
@@ -285,7 +273,9 @@
} }
} }
#if TARGET_OS_IPHONE
[_osc setLevel:level]; [_osc setLevel:level];
#endif
} }
-(void) initAutoOnScreenControlMode:(OnScreenControls*)osc -(void) initAutoOnScreenControlMode:(OnScreenControls*)osc
@@ -294,7 +284,6 @@
[self updateAutoOnScreenControlMode]; [self updateAutoOnScreenControlMode];
} }
#endif
-(void) assignController:(GCController*)controller { -(void) assignController:(GCController*)controller {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -303,7 +292,7 @@
controller.playerIndex = i; controller.playerIndex = i;
Controller* limeController; Controller* limeController;
#if TARGET_OS_IPHONE
if (i == 0) { if (i == 0) {
// Player 0 shares a controller object with the on-screen controls // Player 0 shares a controller object with the on-screen controls
limeController = _player0osc; limeController = _player0osc;
@@ -311,10 +300,6 @@
limeController = [[Controller alloc] init]; limeController = [[Controller alloc] init];
limeController.playerIndex = i; limeController.playerIndex = i;
} }
#else
limeController = [[Controller alloc] init];
limeController.playerIndex = i;
#endif
[_controllers setObject:limeController forKey:[NSNumber numberWithInteger:controller.playerIndex]]; [_controllers setObject:limeController forKey:[NSNumber numberWithInteger:controller.playerIndex]];
@@ -387,10 +372,10 @@
_controllers = [[NSMutableDictionary alloc] init]; _controllers = [[NSMutableDictionary alloc] init];
_controllerNumbers = 0; _controllerNumbers = 0;
#if TARGET_OS_IPHONE
_player0osc = [[Controller alloc] init]; _player0osc = [[Controller alloc] init];
_player0osc.playerIndex = 0; _player0osc.playerIndex = 0;
#if TARGET_OS_IPHONE
DataManager* dataMan = [[DataManager alloc] init]; DataManager* dataMan = [[DataManager alloc] init];
_oscEnabled = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue] != OnScreenControlsLevelOff; _oscEnabled = (OnScreenControlsLevel)[[dataMan getSettings].onscreenControls integerValue] != OnScreenControlsLevelOff;
#else #else
@@ -403,10 +388,7 @@
for (GCController* controller in [GCController controllers]) { for (GCController* controller in [GCController controllers]) {
[self assignController:controller]; [self assignController:controller];
[self registerControllerCallbacks:controller]; [self registerControllerCallbacks:controller];
#if TARGET_OS_IPHONE
[self updateAutoOnScreenControlMode]; [self updateAutoOnScreenControlMode];
#endif
} }
self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
@@ -418,10 +400,8 @@
// Register callbacks on the new controller // Register callbacks on the new controller
[self registerControllerCallbacks:controller]; [self registerControllerCallbacks:controller];
#if TARGET_OS_IPHONE
// Re-evaluate the on-screen control mode // Re-evaluate the on-screen control mode
[self updateAutoOnScreenControlMode]; [self updateAutoOnScreenControlMode];
#endif
}]; }];
self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
Log(LOG_I, @"Controller disconnected!"); Log(LOG_I, @"Controller disconnected!");
@@ -435,10 +415,8 @@
[self updateFinished:[_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]]]; [self updateFinished:[_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]]];
[_controllers removeObjectForKey:[NSNumber numberWithInteger:controller.playerIndex]]; [_controllers removeObjectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
#if TARGET_OS_IPHONE
// Re-evaluate the on-screen control mode // Re-evaluate the on-screen control mode
[self updateAutoOnScreenControlMode]; [self updateAutoOnScreenControlMode];
#endif
}]; }];
return self; return self;
} }

View File

@@ -24,10 +24,12 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
OnScreenControlsLevelAutoGCExtendedGamepad, OnScreenControlsLevelAutoGCExtendedGamepad,
}; };
#if TARGET_OS_IPHONE
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport swipeDelegate:(id<EdgeDetectionDelegate>)edgeDelegate; - (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport swipeDelegate:(id<EdgeDetectionDelegate>)edgeDelegate;
- (BOOL) handleTouchDownEvent:(NSSet*)touches; - (BOOL) handleTouchDownEvent:(NSSet*)touches;
- (BOOL) handleTouchUpEvent:(NSSet*)touches; - (BOOL) handleTouchUpEvent:(NSSet*)touches;
- (BOOL) handleTouchMovedEvent:(NSSet*)touches; - (BOOL) handleTouchMovedEvent:(NSSet*)touches;
- (void) setLevel:(OnScreenControlsLevel)level; - (void) setLevel:(OnScreenControlsLevel)level;
#endif
@end @end

View File

@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved. // Copyright (c) 2014 Moonlight Stream. All rights reserved.
// //
// This is redundant, as it is part of the prefix header
//#import <UIKit/UIKit.h>
#import "ControllerSupport.h" #import "ControllerSupport.h"
@protocol EdgeDetectionDelegate <NSObject> @protocol EdgeDetectionDelegate <NSObject>
@@ -16,7 +14,7 @@
@end @end
@interface StreamView : UIView @interface StreamView : OSView
- (void) setupOnScreenControls:(ControllerSupport*)controllerSupport swipeDelegate:(id<EdgeDetectionDelegate>)swipeDelegate; - (void) setupOnScreenControls:(ControllerSupport*)controllerSupport swipeDelegate:(id<EdgeDetectionDelegate>)swipeDelegate;
- (void) setMouseDeltaFactors:(float)x y:(float)y; - (void) setMouseDeltaFactors:(float)x y:(float)y;

View File

@@ -21,4 +21,5 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <CoreData/CoreData.h> #import <CoreData/CoreData.h>
#import "Logger.h" #import "Logger.h"
#include "OSPortabilityDefs.h"
#endif #endif

View File

@@ -16,16 +16,13 @@
self.statusMessage = @"App asset has no status message"; self.statusMessage = @"App asset has no status message";
self.statusCode = -1; self.statusCode = -1;
} }
- (OSImage*) getImage {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
- (UIImage*) getImage { OSImage* appImage = [[OSImage alloc] initWithData:self.data];
UIImage* appImage = [[UIImage alloc] initWithData:self.data]; #else
OSImage* appImage = nil;
#endif
return appImage; return appImage;
} }
#else
- (NSImage*) getImage {
return nil;
}
#endif
@end @end

View File

@@ -19,11 +19,7 @@ static const int MAX_ATTEMPTS = 5;
- (void) main { - (void) main {
#if TARGET_OS_IPHONE OSImage* appImage = nil;
UIImage* appImage = nil;
#else
NSImage* appImage = nil;
#endif
int attempts = 0; int attempts = 0;
while (![self isCancelled] && appImage == nil && attempts++ < MAX_ATTEMPTS) { while (![self isCancelled] && appImage == nil && attempts++ < MAX_ATTEMPTS) {

View File

@@ -0,0 +1,24 @@
//
// OSPortabilityDefs.h
// Moonlight
//
// Created by Cameron Gutman on 3/26/18.
// Copyright © 2018 Moonlight Stream. All rights reserved.
//
#ifndef OSPortabilityDefs_h
#define OSPortabilityDefs_h
#if TARGET_OS_IPHONE
#define OSImage UIImage
#define OSColor UIColor
#define OSView UIView
#define OSApplication UIApplication
#else
#define OSImage NSImage
#define OSColor NSColor
#define OSView NSView
#define OSApplication NSApplication
#endif
#endif /* OSPortabilityDefs_h */

View File

@@ -98,7 +98,6 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
audioLock = [[NSLock alloc] init]; audioLock = [[NSLock alloc] init];
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
// Configure the audio session for our app // Configure the audio session for our app
NSError *audioSessionError = nil; NSError *audioSessionError = nil;
AVAudioSession* audioSession = [AVAudioSession sharedInstance]; AVAudioSession* audioSession = [AVAudioSession sharedInstance];
@@ -108,8 +107,8 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
[audioSession setPreferredOutputNumberOfChannels:opusConfig->channelCount error:&audioSessionError]; [audioSession setPreferredOutputNumberOfChannels:opusConfig->channelCount error:&audioSessionError];
[audioSession setPreferredIOBufferDuration:0.005 error:&audioSessionError]; [audioSession setPreferredIOBufferDuration:0.005 error:&audioSessionError];
[audioSession setActive: YES error: &audioSessionError]; [audioSession setActive: YES error: &audioSessionError];
#endif #endif
OSStatus status; OSStatus status;
AudioComponentDescription audioDesc; AudioComponentDescription audioDesc;

View File

@@ -12,11 +12,7 @@
@interface StreamManager : NSOperation @interface StreamManager : NSOperation
#if TARGET_OS_IPHONE - (id) initWithConfig:(StreamConfiguration*)config renderView:(OSView*)view connectionCallbacks:(id<ConnectionCallbacks>)callback;
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view connectionCallbacks:(id<ConnectionCallbacks>)callback;
#else
- (id) initWithConfig:(StreamConfiguration*)config renderView:(NSView*)view connectionCallbacks:(id<ConnectionCallbacks>)callback;
#endif
- (void) stopStream; - (void) stopStream;

View File

@@ -11,10 +11,6 @@
#import "HttpManager.h" #import "HttpManager.h"
#import "Utils.h" #import "Utils.h"
#if TARGET_OS_IPHONE
#import "OnScreenControls.h"
#endif
#import "StreamView.h" #import "StreamView.h"
#import "ServerInfoResponse.h" #import "ServerInfoResponse.h"
#import "HttpResponse.h" #import "HttpResponse.h"
@@ -24,17 +20,12 @@
@implementation StreamManager { @implementation StreamManager {
StreamConfiguration* _config; StreamConfiguration* _config;
#if TARGET_OS_IPHONE OSView* _renderView;
UIView* _renderView;
#else
NSView* _renderView;
#endif
id<ConnectionCallbacks> _callbacks; id<ConnectionCallbacks> _callbacks;
Connection* _connection; Connection* _connection;
} }
#if TARGET_OS_IPHONE - (id) initWithConfig:(StreamConfiguration*)config renderView:(OSView*)view connectionCallbacks:(id<ConnectionCallbacks>)callbacks {
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view connectionCallbacks:(id<ConnectionCallbacks>)callbacks {
self = [super init]; self = [super init];
_config = config; _config = config;
_renderView = view; _renderView = view;
@@ -43,17 +34,6 @@
_config.riKeyId = arc4random(); _config.riKeyId = arc4random();
return self; return self;
} }
#else
- (id) initWithConfig:(StreamConfiguration*)config renderView:(NSView*)view connectionCallbacks:(id<ConnectionCallbacks>)callbacks {
self = [super init];
_config = config;
_renderView = view;
_callbacks = callbacks;
_config.riKey = [Utils randomBytes:16];
_config.riKeyId = arc4random();
return self;
}
#endif
- (void)main { - (void)main {
[CryptoManager generateKeyPairUsingSSl]; [CryptoManager generateKeyPairUsingSSl];

View File

@@ -11,11 +11,8 @@
@import AVFoundation; @import AVFoundation;
@interface VideoDecoderRenderer : NSObject @interface VideoDecoderRenderer : NSObject
#if TARGET_OS_IPHONE
- (id)initWithView:(UIView*)view; - (id)initWithView:(OSView*)view;
#else
- (id)initWithView:(NSView*)view;
#endif
- (void)setupWithVideoFormat:(int)videoFormat; - (void)setupWithVideoFormat:(int)videoFormat;

View File

@@ -11,11 +11,7 @@
#include "Limelight.h" #include "Limelight.h"
@implementation VideoDecoderRenderer { @implementation VideoDecoderRenderer {
#if TARGET_OS_IPHONE OSView *_view;
UIView *_view;
#else
NSView *_view;
#endif
AVSampleBufferDisplayLayer* displayLayer; AVSampleBufferDisplayLayer* displayLayer;
Boolean waitingForSps, waitingForPps, waitingForVps; Boolean waitingForSps, waitingForPps, waitingForVps;
@@ -31,11 +27,7 @@
displayLayer = [[AVSampleBufferDisplayLayer alloc] init]; displayLayer = [[AVSampleBufferDisplayLayer alloc] init];
displayLayer.bounds = _view.bounds; displayLayer.bounds = _view.bounds;
#if TARGET_OS_IPHONE displayLayer.backgroundColor = [OSColor blackColor].CGColor;
displayLayer.backgroundColor = [UIColor blackColor].CGColor;
#else
displayLayer.backgroundColor = [NSColor blackColor].CGColor;
#endif
displayLayer.position = CGPointMake(CGRectGetMidX(_view.bounds), CGRectGetMidY(_view.bounds)); displayLayer.position = CGPointMake(CGRectGetMidX(_view.bounds), CGRectGetMidY(_view.bounds));
displayLayer.videoGravity = AVLayerVideoGravityResizeAspect; displayLayer.videoGravity = AVLayerVideoGravityResizeAspect;
@@ -61,8 +53,8 @@
formatDesc = nil; formatDesc = nil;
} }
} }
#if TARGET_OS_IPHONE
- (id)initWithView:(UIView*)view - (id)initWithView:(OSView*)view
{ {
self = [super init]; self = [super init];
@@ -72,20 +64,6 @@
return self; return self;
} }
#else
- (id)initWithView:(NSView*)view
{
self = [super init];
_view = view;
[self reinitializeDisplayLayer];
return self;
}
#endif
- (void)setupWithVideoFormat:(int)videoFormat - (void)setupWithVideoFormat:(int)videoFormat
{ {
@@ -248,20 +226,9 @@
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault,
3, /* count of parameter sets */
parameterSetPointers,
parameterSetSizes,
NAL_LENGTH_PREFIX_SIZE,
nil,
&formatDesc);
} else {
// This means Moonlight-common-c decided to give us an HEVC stream
// even though we said we couldn't support it. All we can do is abort().
abort();
}
#else #else
if (@available(macOS 10.13, *)) { if (@available(macOS 10.13, *)) {
#endif
status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault, status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault,
3, /* count of parameter sets */ 3, /* count of parameter sets */
parameterSetPointers, parameterSetPointers,
@@ -274,7 +241,6 @@
// even though we said we couldn't support it. All we can do is abort(). // even though we said we couldn't support it. All we can do is abort().
abort(); abort();
} }
#endif
if (status != noErr) { if (status != noErr) {
Log(LOG_E, @"Failed to create HEVC format description: %d", (int)status); Log(LOG_E, @"Failed to create HEVC format description: %d", (int)status);

View File

@@ -48,8 +48,6 @@
DC5EF54D2052FBDB00C9BF55 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF54C2052FBDB00C9BF55 /* ViewController.m */; }; DC5EF54D2052FBDB00C9BF55 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF54C2052FBDB00C9BF55 /* ViewController.m */; };
DC5EF5522052FBDB00C9BF55 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC5EF5512052FBDB00C9BF55 /* Assets.xcassets */; }; DC5EF5522052FBDB00C9BF55 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC5EF5512052FBDB00C9BF55 /* Assets.xcassets */; };
DC5EF5582052FBDB00C9BF55 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF5572052FBDB00C9BF55 /* main.m */; }; DC5EF5582052FBDB00C9BF55 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF5572052FBDB00C9BF55 /* main.m */; };
DC5EF5632052FBDB00C9BF55 /* Moonlight_macOSTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF5622052FBDB00C9BF55 /* Moonlight_macOSTests.m */; };
DC5EF56E2052FBDB00C9BF55 /* Moonlight_macOSUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5EF56D2052FBDB00C9BF55 /* Moonlight_macOSUITests.m */; };
DC5FA8FC205DBEE3008B7054 /* StreamConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F6205DBEE3008B7054 /* StreamConfiguration.m */; }; DC5FA8FC205DBEE3008B7054 /* StreamConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F6205DBEE3008B7054 /* StreamConfiguration.m */; };
DC5FA8FD205DBEE3008B7054 /* StreamManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F8205DBEE3008B7054 /* StreamManager.m */; }; DC5FA8FD205DBEE3008B7054 /* StreamManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F8205DBEE3008B7054 /* StreamManager.m */; };
DC5FA8FE205DBEE3008B7054 /* Connection.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F9205DBEE3008B7054 /* Connection.m */; }; DC5FA8FE205DBEE3008B7054 /* Connection.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5FA8F9205DBEE3008B7054 /* Connection.m */; };
@@ -125,6 +123,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
98878AE1206A261F00586E90 /* OSPortabilityDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OSPortabilityDefs.h; path = Limelight/OSPortabilityDefs.h; sourceTree = SOURCE_ROOT; };
DC0F7506205C04A90087B187 /* keepAlive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keepAlive.h; sourceTree = "<group>"; }; DC0F7506205C04A90087B187 /* keepAlive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keepAlive.h; sourceTree = "<group>"; };
DC0F7507205C04A90087B187 /* keepAlive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = keepAlive.m; sourceTree = "<group>"; }; DC0F7507205C04A90087B187 /* keepAlive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = keepAlive.m; sourceTree = "<group>"; };
DC153B34205A990800E7559B /* Moonlight macOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Moonlight macOS-Bridging-Header.h"; sourceTree = "<group>"; }; DC153B34205A990800E7559B /* Moonlight macOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Moonlight macOS-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -194,11 +193,7 @@
DC5EF5562052FBDB00C9BF55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; DC5EF5562052FBDB00C9BF55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DC5EF5572052FBDB00C9BF55 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; DC5EF5572052FBDB00C9BF55 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
DC5EF55E2052FBDB00C9BF55 /* Moonlight macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moonlight macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DC5EF55E2052FBDB00C9BF55 /* Moonlight macOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moonlight macOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
DC5EF5622052FBDB00C9BF55 /* Moonlight_macOSTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Moonlight_macOSTests.m; sourceTree = "<group>"; };
DC5EF5642052FBDB00C9BF55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DC5EF5692052FBDB00C9BF55 /* Moonlight macOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moonlight macOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DC5EF5692052FBDB00C9BF55 /* Moonlight macOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Moonlight macOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
DC5EF56D2052FBDB00C9BF55 /* Moonlight_macOSUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Moonlight_macOSUITests.m; sourceTree = "<group>"; };
DC5EF56F2052FBDB00C9BF55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DC5EF5CE2052FC8B00C9BF55 /* opus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus.h; sourceTree = "<group>"; }; DC5EF5CE2052FC8B00C9BF55 /* opus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus.h; sourceTree = "<group>"; };
DC5EF5CF2052FC8B00C9BF55 /* opus_multistream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus_multistream.h; sourceTree = "<group>"; }; DC5EF5CF2052FC8B00C9BF55 /* opus_multistream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus_multistream.h; sourceTree = "<group>"; };
DC5EF5D02052FC8B00C9BF55 /* opus_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus_types.h; sourceTree = "<group>"; }; DC5EF5D02052FC8B00C9BF55 /* opus_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = opus_types.h; sourceTree = "<group>"; };
@@ -460,8 +455,6 @@
children = ( children = (
DCECF42A205DBBAB00831862 /* moonlight-common_mac.xcodeproj */, DCECF42A205DBBAB00831862 /* moonlight-common_mac.xcodeproj */,
DC5EF5472052FBDB00C9BF55 /* Moonlight macOS */, DC5EF5472052FBDB00C9BF55 /* Moonlight macOS */,
DC5EF5612052FBDB00C9BF55 /* Moonlight macOSTests */,
DC5EF56C2052FBDB00C9BF55 /* Moonlight macOSUITests */,
DC5EF5462052FBDB00C9BF55 /* Products */, DC5EF5462052FBDB00C9BF55 /* Products */,
DC5EF5C92052FC8B00C9BF55 /* Frameworks */, DC5EF5C92052FC8B00C9BF55 /* Frameworks */,
); );
@@ -480,6 +473,7 @@
DC5EF5472052FBDB00C9BF55 /* Moonlight macOS */ = { DC5EF5472052FBDB00C9BF55 /* Moonlight macOS */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
98878AE1206A261F00586E90 /* OSPortabilityDefs.h */,
DC9CD51E20601658001A5DCD /* AppDelegate.m */, DC9CD51E20601658001A5DCD /* AppDelegate.m */,
DCAF0516205F3E6A00AD1DBA /* Limelight.xcdatamodeld */, DCAF0516205F3E6A00AD1DBA /* Limelight.xcdatamodeld */,
DCAF04FD205F38B100AD1DBA /* AppDelegate.h */, DCAF04FD205F38B100AD1DBA /* AppDelegate.h */,
@@ -500,24 +494,6 @@
path = "Moonlight macOS"; path = "Moonlight macOS";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DC5EF5612052FBDB00C9BF55 /* Moonlight macOSTests */ = {
isa = PBXGroup;
children = (
DC5EF5622052FBDB00C9BF55 /* Moonlight_macOSTests.m */,
DC5EF5642052FBDB00C9BF55 /* Info.plist */,
);
path = "Moonlight macOSTests";
sourceTree = "<group>";
};
DC5EF56C2052FBDB00C9BF55 /* Moonlight macOSUITests */ = {
isa = PBXGroup;
children = (
DC5EF56D2052FBDB00C9BF55 /* Moonlight_macOSUITests.m */,
DC5EF56F2052FBDB00C9BF55 /* Info.plist */,
);
path = "Moonlight macOSUITests";
sourceTree = "<group>";
};
DC5EF5962052FC4300C9BF55 /* Utility */ = { DC5EF5962052FC4300C9BF55 /* Utility */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -958,7 +934,6 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
DC5EF5632052FBDB00C9BF55 /* Moonlight_macOSTests.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -966,7 +941,6 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
DC5EF56E2052FBDB00C9BF55 /* Moonlight_macOSUITests.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -1129,7 +1103,7 @@
); );
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_LDFLAGS = ""; OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "fkx.Moonlight-macOS"; PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.Moonlight-macOS";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Moonlight macOS/Input/Moonlight macOS-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Moonlight macOS/Input/Moonlight macOS-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Moonlight-Swift.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = "Moonlight-Swift.h";
@@ -1178,7 +1152,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ""; OTHER_LDFLAGS = "";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_BUNDLE_IDENTIFIER = "fkx.Moonlight-macOS"; PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.Moonlight-macOS";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Moonlight macOS/Input/Moonlight macOS-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Moonlight macOS/Input/Moonlight macOS-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "Moonlight-Swift.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = "Moonlight-Swift.h";

View File

@@ -18,6 +18,8 @@
<string>1.0</string> <string>1.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.entertainment</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
@@ -28,7 +30,7 @@
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Felix. All rights reserved.</string> <string>Copyright © 2018 Moonlight Game Streaming Project. All rights reserved.</string>
<key>NSMainStoryboardFile</key> <key>NSMainStoryboardFile</key>
<string>Mac</string> <string>Mac</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -1,39 +0,0 @@
//
// Moonlight_macOSTests.m
// Moonlight macOSTests
//
// Created by Felix on 09.03.18.
// Copyright © 2018 Felix. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface Moonlight_macOSTests : XCTestCase
@end
@implementation Moonlight_macOSTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -1,40 +0,0 @@
//
// Moonlight_macOSUITests.m
// Moonlight macOSUITests
//
// Created by Felix on 09.03.18.
// Copyright © 2018 Felix. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface Moonlight_macOSUITests : XCTestCase
@end
@implementation Moonlight_macOSUITests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
self.continueAfterFailure = NO;
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
[[[XCUIApplication alloc] init] launch];
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
@end

View File

@@ -105,6 +105,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9832D1341BBCD5C50036EF48 /* TemporaryApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryApp.h; path = Database/TemporaryApp.h; sourceTree = "<group>"; }; 9832D1341BBCD5C50036EF48 /* TemporaryApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryApp.h; path = Database/TemporaryApp.h; sourceTree = "<group>"; };
9832D1351BBCD5C50036EF48 /* TemporaryApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TemporaryApp.m; path = Database/TemporaryApp.m; sourceTree = "<group>"; }; 9832D1351BBCD5C50036EF48 /* TemporaryApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TemporaryApp.m; path = Database/TemporaryApp.m; sourceTree = "<group>"; };
98878AE0206A226D00586E90 /* OSPortabilityDefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSPortabilityDefs.h; sourceTree = "<group>"; };
9890CF6A203B7EE1006C4B06 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; }; 9890CF6A203B7EE1006C4B06 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; };
98AB2E7F1CAD46830089BB98 /* moonlight-common.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "moonlight-common.xcodeproj"; path = "moonlight-common/moonlight-common.xcodeproj"; sourceTree = "<group>"; }; 98AB2E7F1CAD46830089BB98 /* moonlight-common.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "moonlight-common.xcodeproj"; path = "moonlight-common/moonlight-common.xcodeproj"; sourceTree = "<group>"; };
98D5856B1C0EA79600F6CC00 /* TemporaryHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryHost.h; path = Database/TemporaryHost.h; sourceTree = "<group>"; }; 98D5856B1C0EA79600F6CC00 /* TemporaryHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TemporaryHost.h; path = Database/TemporaryHost.h; sourceTree = "<group>"; };
@@ -447,6 +448,7 @@
FB1D59961BBCCB6400F482CA /* ComputerScrollView.m */, FB1D59961BBCCB6400F482CA /* ComputerScrollView.m */,
FB1D59981BBCCD7E00F482CA /* AppCollectionView.h */, FB1D59981BBCCD7E00F482CA /* AppCollectionView.h */,
FB1D59991BBCCD7E00F482CA /* AppCollectionView.m */, FB1D59991BBCCD7E00F482CA /* AppCollectionView.m */,
98878AE0206A226D00586E90 /* OSPortabilityDefs.h */,
); );
name = Moonlight; name = Moonlight;
path = Limelight; path = Limelight;

View File

@@ -26,7 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#if _MSC_VER <= 1600 #if _MSC_VER && _MSC_VER <= 1600
#define bool int #define bool int
#define true 1 #define true 1
#define false 0 #define false 0
@@ -71,15 +71,15 @@ struct Gamepad_device {
This function must be called from the same thread that will be calling Gamepad_processEvents() This function must be called from the same thread that will be calling Gamepad_processEvents()
and Gamepad_detectDevices(). */ and Gamepad_detectDevices(). */
void Gamepad_init(); void Gamepad_init(void);
/* Tears down all data structures created by the gamepad library and releases any memory that was /* Tears down all data structures created by the gamepad library and releases any memory that was
allocated. It is not necessary to call this function at application termination, but it's allocated. It is not necessary to call this function at application termination, but it's
provided in case you want to free memory associated with gamepads at some earlier time. */ provided in case you want to free memory associated with gamepads at some earlier time. */
void Gamepad_shutdown(); void Gamepad_shutdown(void);
/* Returns the number of currently attached gamepad devices. */ /* Returns the number of currently attached gamepad devices. */
unsigned int Gamepad_numDevices(); unsigned int Gamepad_numDevices(void);
/* Returns the specified Gamepad_device struct, or NULL if deviceIndex is out of bounds. */ /* Returns the specified Gamepad_device struct, or NULL if deviceIndex is out of bounds. */
struct Gamepad_device * Gamepad_deviceAtIndex(unsigned int deviceIndex); struct Gamepad_device * Gamepad_deviceAtIndex(unsigned int deviceIndex);
@@ -92,11 +92,11 @@ struct Gamepad_device * Gamepad_deviceAtIndex(unsigned int deviceIndex);
devices that have not yet been detected with Gamepad_detectDevices(). You can safely ignore devices that have not yet been detected with Gamepad_detectDevices(). You can safely ignore
these events, but be aware that your callbacks might receive a device ID that hasn't been seen these events, but be aware that your callbacks might receive a device ID that hasn't been seen
by your deviceAttachFunc. */ by your deviceAttachFunc. */
void Gamepad_detectDevices(); void Gamepad_detectDevices(void);
/* Reads pending input from all attached devices and calls the appropriate input callbacks, if any /* Reads pending input from all attached devices and calls the appropriate input callbacks, if any
have been registered. */ have been registered. */
void Gamepad_processEvents(); void Gamepad_processEvents(void);
/* Registers a function to be called whenever a device is attached. The specified function will be /* Registers a function to be called whenever a device is attached. The specified function will be
called only during calls to Gamepad_init() and Gamepad_detectDevices(), in the thread from called only during calls to Gamepad_init() and Gamepad_detectDevices(), in the thread from