RetroArch/pkg/apple/WebServer/WebServer.m
Yoshi Sugawara a18512375b Support for tvOS
- add tvOS target
    - support code signing tvOS cores by adding an argument to the code signing cores script
    - use NSCachesDirectory for the documents directory
    - add some mfi controller handling logic to set non-game controllers to the last index to avoid interfering with operation
    - autodetect mfi controller for apple tv on startup - added autodetect to hid joypad
    - added a webserver to transfer files for tvOS
    - xcode: clean up project, remove unused folders
    - remove HAVE_MATERIALUI setting for tvos build, make it use XMB as default
    - added retroarch app icon courtesy of @MrJs
    - added auto-detect of mfi controller for apple tv
2019-01-29 10:13:46 -10:00

51 lines
1.1 KiB
Objective-C

//
// WebServer.m
// MAME4iOS
//
// Created by Yoshi Sugawara on 1/15/19.
// Copyright © 2019 Seleuco. All rights reserved.
//
#import "WebServer.h"
@implementation WebServer
#pragma mark - singleton method
+(WebServer*)sharedInstance {
static dispatch_once_t predicate = 0;
static id sharedObject = nil;
dispatch_once(&predicate, ^{
sharedObject = [[self alloc] init];
});
return sharedObject;
}
#pragma mark Init
-(instancetype)init {
if ( self = [super init] ) {
#if TARGET_OS_IOS
NSString* docsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
#elif TARGET_OS_TV
NSString* docsPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
#endif
_webUploader = [[GCDWebUploader alloc] initWithUploadDirectory:docsPath];
_webUploader.allowHiddenItems = YES;
}
return self;
}
-(void)startUploader {
if ( _webUploader.isRunning ) {
[_webUploader stop];
}
[_webUploader start];
}
-(void)stopUploader {
[_webUploader stop];
}
@end