Added ability to emulate SNES games

This commit is contained in:
Riley Testut 2015-09-12 19:49:21 -07:00
parent c59f4642cd
commit ed4807ba5d
5 changed files with 46 additions and 8 deletions

@ -1 +1 @@
Subproject commit 0d618e031f284cad733b1122c60e148601b24ad6 Subproject commit bf1cc72947630daf9c15615cc98c1a90ed91f3ee

@ -1 +1 @@
Subproject commit d99e5066db54aae4f987a8c2726be27b0eac6ee8 Subproject commit 288f6ac21bbca3a2fda293eb9af962a4c5dd3b80

View File

@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */ = {isa = PBXBuildFile; fileRef = BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */; }; BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */ = {isa = PBXBuildFile; fileRef = BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */; };
BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */; }; BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */; };
BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */; settings = {ASSET_TAGS = (); }; }; BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */; };
BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF5E7F451B9A652600AE44F8 /* Settings.storyboard */; settings = {ASSET_TAGS = (); }; }; BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF5E7F451B9A652600AE44F8 /* Settings.storyboard */; };
BF70798C1B6B464B0019077C /* ZipZap.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; }; BF70798C1B6B464B0019077C /* ZipZap.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; };
BF70798D1B6B464B0019077C /* ZipZap.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF70798D1B6B464B0019077C /* ZipZap.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; }; BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; };
@ -218,6 +218,7 @@
TargetAttributes = { TargetAttributes = {
BFFA71D61AAC406100EE9DD1 = { BFFA71D61AAC406100EE9DD1 = {
CreatedOnToolsVersion = 6.3; CreatedOnToolsVersion = 6.3;
DevelopmentTeam = 6XVY5G3U44;
}; };
}; };
}; };
@ -380,12 +381,15 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = Delta/Info.plist; INFOPLIST_FILE = Delta/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = ""; OTHER_CFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
}; };
@ -396,12 +400,15 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = Delta/Info.plist; INFOPLIST_FILE = Delta/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = ""; OTHER_CFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h";
}; };
name = Release; name = Release;

View File

@ -16,9 +16,11 @@ class EmulationViewController: UIViewController
/** Properties **/ /** Properties **/
let game: Game let game: Game
let emulatorCore: EmulatorCore let emulatorCore: EmulatorCore
@IBOutlet private(set) var controllerView: ControllerView!
//MARK: - Private Properties //MARK: - Private Properties
@IBOutlet private var controllerView: ControllerView!
@IBOutlet private var gameView: GameView!
@IBOutlet private var controllerViewHeightConstraint: NSLayoutConstraint! @IBOutlet private var controllerViewHeightConstraint: NSLayoutConstraint!
//MARK: - Initializers - //MARK: - Initializers -
@ -47,6 +49,9 @@ class EmulationViewController: UIViewController
{ {
super.viewDidLoad() super.viewDidLoad()
self.gameView.backgroundColor = UIColor.clearColor()
self.emulatorCore.addGameView(self.gameView)
let controllerSkin = ControllerSkin.defaultControllerSkinForGameUTI(self.game.UTI) let controllerSkin = ControllerSkin.defaultControllerSkinForGameUTI(self.game.UTI)
self.controllerView.controllerSkin = controllerSkin self.controllerView.controllerSkin = controllerSkin
@ -67,7 +72,7 @@ class EmulationViewController: UIViewController
{ {
super.viewDidLayoutSubviews() super.viewDidLayoutSubviews()
if Settings.localControllerPlayerIndex != nil if Settings.localControllerPlayerIndex != nil && self.controllerView.intrinsicContentSize() != CGSize(width: UIViewNoIntrinsicMetric, height: UIViewNoIntrinsicMetric)
{ {
let scale = self.view.bounds.width / self.controllerView.intrinsicContentSize().width let scale = self.view.bounds.width / self.controllerView.intrinsicContentSize().width
self.controllerViewHeightConstraint.constant = self.controllerView.intrinsicContentSize().height * scale self.controllerViewHeightConstraint.constant = self.controllerView.intrinsicContentSize().height * scale
@ -130,6 +135,16 @@ extension EmulationViewController: GameControllerReceiverType
UIDevice.currentDevice().vibrate() UIDevice.currentDevice().vibrate()
} }
if let input = input as? ControllerInput
{
switch input
{
case .Menu: self.controllerViewHeightConstraint.constant = 0
}
return
}
guard let input = input as? ControllerInput else { return } guard let input = input as? ControllerInput else { return }
print("Activated \(input)") print("Activated \(input)")

View File

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9046" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7702"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9046"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EmulationViewController" customModule="Delta" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EmulationViewController" customModule="Delta" customModuleProvider="target">
<connections> <connections>
<outlet property="controllerView" destination="vwI-ri-b2R" id="ntJ-HT-evx"/> <outlet property="controllerView" destination="vwI-ri-b2R" id="ntJ-HT-evx"/>
<outlet property="controllerViewHeightConstraint" destination="6qz-Ae-arR" id="H8i-pm-31E"/> <outlet property="controllerViewHeightConstraint" destination="6qz-Ae-arR" id="H8i-pm-31E"/>
<outlet property="gameView" destination="CgB-i0-wOA" id="WEE-aY-RJo"/>
<outlet property="view" destination="iN0-l3-epB" id="eD5-dV-r00"/> <outlet property="view" destination="iN0-l3-epB" id="eD5-dV-r00"/>
</connections> </connections>
</placeholder> </placeholder>
@ -16,6 +18,10 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CgB-i0-wOA" customClass="GameView" customModule="DeltaCore">
<rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="600" placeholderIntrinsicHeight="300" translatesAutoresizingMaskIntoConstraints="NO" id="vwI-ri-b2R" customClass="ControllerView" customModule="DeltaCore"> <view contentMode="scaleToFill" placeholderIntrinsicWidth="600" placeholderIntrinsicHeight="300" translatesAutoresizingMaskIntoConstraints="NO" id="vwI-ri-b2R" customClass="ControllerView" customModule="DeltaCore">
<rect key="frame" x="0.0" y="300" width="600" height="300"/> <rect key="frame" x="0.0" y="300" width="600" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -31,7 +37,14 @@
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstAttribute="bottom" secondItem="CgB-i0-wOA" secondAttribute="bottom" id="55v-Ds-7WA">
<variation key="heightClass=compact" constant="0.0"/>
</constraint>
<constraint firstItem="CgB-i0-wOA" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="961-Az-XO4"/>
<constraint firstAttribute="bottom" secondItem="vwI-ri-b2R" secondAttribute="bottom" id="Blz-Nt-ex2"/> <constraint firstAttribute="bottom" secondItem="vwI-ri-b2R" secondAttribute="bottom" id="Blz-Nt-ex2"/>
<constraint firstItem="CgB-i0-wOA" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="DyU-Bl-GaA"/>
<constraint firstItem="vwI-ri-b2R" firstAttribute="top" secondItem="CgB-i0-wOA" secondAttribute="bottom" id="IYC-AX-EDR"/>
<constraint firstAttribute="trailing" secondItem="CgB-i0-wOA" secondAttribute="trailing" id="JcG-hO-3pf"/>
<constraint firstAttribute="trailing" secondItem="vwI-ri-b2R" secondAttribute="trailing" id="YbQ-Se-7bk"/> <constraint firstAttribute="trailing" secondItem="vwI-ri-b2R" secondAttribute="trailing" id="YbQ-Se-7bk"/>
<constraint firstItem="vwI-ri-b2R" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ZYq-E4-bHb"/> <constraint firstItem="vwI-ri-b2R" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ZYq-E4-bHb"/>
<constraint firstItem="vwI-ri-b2R" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="mX7-Cl-eSm"/> <constraint firstItem="vwI-ri-b2R" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="mX7-Cl-eSm"/>
@ -39,11 +52,14 @@
<nil key="simulatedStatusBarMetrics"/> <nil key="simulatedStatusBarMetrics"/>
<variation key="default"> <variation key="default">
<mask key="constraints"> <mask key="constraints">
<exclude reference="55v-Ds-7WA"/>
<exclude reference="ZYq-E4-bHb"/> <exclude reference="ZYq-E4-bHb"/>
</mask> </mask>
</variation> </variation>
<variation key="heightClass=compact"> <variation key="heightClass=compact">
<mask key="constraints"> <mask key="constraints">
<include reference="55v-Ds-7WA"/>
<exclude reference="IYC-AX-EDR"/>
<include reference="ZYq-E4-bHb"/> <include reference="ZYq-E4-bHb"/>
</mask> </mask>
</variation> </variation>