Skip to content

Commit 96359b7

Browse files
committed
Initial iOS/tvOS port
1 parent 5b42800 commit 96359b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5954
-42
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ debian/changelog
1414
android/Showtime/bin/
1515
android/Showtime/gen/
1616
android/Showtime/libs/
17+
*.xcuserstate
18+
project.xcworkspace/
19+
xcuserdata/
20+
InfoPlist.h

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "android"]
1717
path = android
1818
url = [email protected]:movian-android.git
19+
[submodule "ios/freetype2-ios"]
20+
path = ios/freetype2-ios
21+
url = https://github.com/andoma/freetype2-ios.git

Autobuild/ios.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set -e
2+
BUILDDIR="${PWD}/build.ios"
3+
4+
rm -rf "${BUILDDIR}"
5+
mkdir -p "${BUILDDIR}"
6+
7+
(cd ios && xcodebuild archive -scheme Movian -archivePath "${BUILDDIR}/app")
8+
9+
(cd ios && xcodebuild -exportArchive -archivePath "${BUILDDIR}/app.xcarchive" -exportPath "${BUILDDIR}/" -exportOptionsPlist nobitcode.plist)
10+
11+
artifact build.ios/Movian.ipa ipa application/octet-stream Movian.ipa
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
5+
</dependencies>
6+
<scenes>
7+
<!--Game View Controller-->
8+
<scene sceneID="tXr-a1-R10">
9+
<objects>
10+
<viewController id="BV1-FR-VrT" customClass="GameViewController" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="gUg-lF-avW"/>
13+
<viewControllerLayoutGuide type="bottom" id="9uR-A8-SVe"/>
14+
</layoutGuides>
15+
<glkView key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" enableSetNeedsDisplay="NO" id="DqR-QF-hDF">
16+
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
17+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18+
</glkView>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
21+
</objects>
22+
</scene>
23+
</scenes>
24+
</document>

ios/Movian-tvOS/Info.plist

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>Movian</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>GIT_REVISION</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UIMainStoryboardFile</key>
26+
<string>Main</string>
27+
<key>UIRequiredDeviceCapabilities</key>
28+
<array>
29+
<string>arm64</string>
30+
</array>
31+
</dict>
32+
</plist>

ios/Movian.xcodeproj/project.pbxproj

+3,192
Large diffs are not rendered by default.

ios/Movian/AppDelegate.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// AppDelegate.h
3+
// Movian
4+
//
5+
// Created by Andreas Öman on 03/06/15.
6+
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
12+
13+
@property (strong, nonatomic) UIWindow *window;
14+
15+
16+
@end
17+

ios/Movian/AppDelegate.m

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
//
2+
// AppDelegate.m
3+
// Movian
4+
//
5+
// Created by Andreas Öman on 03/06/15.
6+
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
11+
#include <unistd.h>
12+
#include <sys/stat.h>
13+
#include <stdio.h>
14+
15+
#include "arch/posix/posix.h"
16+
#include "main.h"
17+
#include "service.h"
18+
19+
20+
const char *htsversion;
21+
const char *htsversion_full;
22+
23+
uint32_t
24+
parse_version_int(const char *str)
25+
{
26+
int major = 0;
27+
int minor = 0;
28+
int commit = 0;
29+
sscanf(str, "%d.%d.%d", &major, &minor, &commit);
30+
31+
return
32+
major * 10000000 +
33+
minor * 100000 +
34+
commit;
35+
}
36+
37+
uint32_t
38+
app_get_version_int(void)
39+
{
40+
return parse_version_int(htsversion);
41+
}
42+
43+
44+
45+
@interface AppDelegate ()
46+
47+
@end
48+
49+
@implementation AppDelegate
50+
51+
52+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
53+
// Override point for customization after application launch.
54+
55+
char path[PATH_MAX];
56+
57+
NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
58+
NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"];
59+
htsversion_full = htsversion = strdup([version UTF8String]);
60+
61+
gconf.concurrency = (int)[[NSProcessInfo processInfo] activeProcessorCount];
62+
63+
#ifdef TARGET_OS_TV
64+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
65+
#else
66+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
67+
#endif
68+
NSString *libraryDirectory = [paths objectAtIndex:0];
69+
snprintf(path, sizeof(path), "%s/persistent", [libraryDirectory UTF8String]);
70+
mkdir(path, 0777);
71+
gconf.persistent_path = strdup(path);
72+
73+
paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
74+
libraryDirectory = [paths objectAtIndex:0];
75+
snprintf(path, sizeof(path), "%s/cache", [libraryDirectory UTF8String]);
76+
mkdir(path, 0777);
77+
gconf.cache_path = strdup(path);
78+
79+
posix_init();
80+
81+
main_init();
82+
83+
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
84+
NSString *docsdir = [paths objectAtIndex:0];
85+
86+
service_createp("Files", _p("Files"), [docsdir UTF8String],
87+
"files", NULL, 0, 1, SVC_ORIGIN_SYSTEM);
88+
89+
[UIApplication sharedApplication].idleTimerDisabled = YES;
90+
91+
return YES;
92+
}
93+
94+
- (void)applicationWillResignActive:(UIApplication *)application {
95+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
96+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
97+
printf("%s\n", __FUNCTION__);
98+
}
99+
100+
- (void)applicationDidEnterBackground:(UIApplication *)application {
101+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
102+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
103+
printf("%s\n", __FUNCTION__);
104+
}
105+
106+
- (void)applicationWillEnterForeground:(UIApplication *)application {
107+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
108+
printf("%s\n", __FUNCTION__);
109+
}
110+
111+
- (void)applicationDidBecomeActive:(UIApplication *)application {
112+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
113+
printf("%s\n", __FUNCTION__);
114+
}
115+
116+
- (void)applicationWillTerminate:(UIApplication *)application {
117+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
118+
printf("%s\n", __FUNCTION__);
119+
}
120+
121+
@end
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
</dependencies>
7+
<objects>
8+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
9+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10+
<view contentMode="scaleToFill" id="iN0-l3-epB">
11+
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
12+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13+
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
14+
<nil key="simulatedStatusBarMetrics"/>
15+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
16+
<point key="canvasLocation" x="548" y="455"/>
17+
</view>
18+
</objects>
19+
</document>

ios/Movian/Base.lproj/Main.storyboard

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
</dependencies>
7+
<scenes>
8+
<!--Game View Controller-->
9+
<scene sceneID="tXr-a1-R10">
10+
<objects>
11+
<viewController id="BV1-FR-VrT" customClass="GameViewController" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="8aa-yV-Osq"/>
14+
<viewControllerLayoutGuide type="bottom" id="qHh-Mt-9TT"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="3se-qz-xqx" customClass="GLKView">
17+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
20+
</view>
21+
</viewController>
22+
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
23+
</objects>
24+
</scene>
25+
</scenes>
26+
</document>

ios/Movian/GameViewController.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// GameViewController.h
3+
// Movian
4+
//
5+
// Created by Andreas Öman on 03/06/15.
6+
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import <GLKit/GLKit.h>
11+
12+
@interface GameViewController : GLKViewController
13+
14+
@end

0 commit comments

Comments
 (0)