From ed4807ba5dec24b017e82ded56e83bd78da513f4 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Sat, 12 Sep 2015 19:49:21 -0700 Subject: [PATCH] Added ability to emulate SNES games --- Cores/DeltaCore | 2 +- Cores/SNESDeltaCore | 2 +- Delta.xcodeproj/project.pbxproj | 11 +++++++++-- Delta/EmulationViewController.swift | 19 +++++++++++++++++-- Delta/EmulationViewController.xib | 20 ++++++++++++++++++-- 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/Cores/DeltaCore b/Cores/DeltaCore index 0d618e0..bf1cc72 160000 --- a/Cores/DeltaCore +++ b/Cores/DeltaCore @@ -1 +1 @@ -Subproject commit 0d618e031f284cad733b1122c60e148601b24ad6 +Subproject commit bf1cc72947630daf9c15615cc98c1a90ed91f3ee diff --git a/Cores/SNESDeltaCore b/Cores/SNESDeltaCore index d99e506..288f6ac 160000 --- a/Cores/SNESDeltaCore +++ b/Cores/SNESDeltaCore @@ -1 +1 @@ -Subproject commit d99e5066db54aae4f987a8c2726be27b0eac6ee8 +Subproject commit 288f6ac21bbca3a2fda293eb9af962a4c5dd3b80 diff --git a/Delta.xcodeproj/project.pbxproj b/Delta.xcodeproj/project.pbxproj index 7cc8de7..3dc0c68 100644 --- a/Delta.xcodeproj/project.pbxproj +++ b/Delta.xcodeproj/project.pbxproj @@ -9,8 +9,8 @@ /* Begin PBXBuildFile section */ BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */ = {isa = PBXBuildFile; fileRef = BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */; }; 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 = (); }; }; - BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF5E7F451B9A652600AE44F8 /* Settings.storyboard */; 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 */; }; 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, ); }; }; BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; }; @@ -218,6 +218,7 @@ TargetAttributes = { BFFA71D61AAC406100EE9DD1 = { CreatedOnToolsVersion = 6.3; + DevelopmentTeam = 6XVY5G3U44; }; }; }; @@ -380,12 +381,15 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = Delta/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_CFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -396,12 +400,15 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = Delta/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_CFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.rileytestut.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "Delta/Delta-Bridging-Header.h"; }; name = Release; diff --git a/Delta/EmulationViewController.swift b/Delta/EmulationViewController.swift index e533cd6..c214016 100644 --- a/Delta/EmulationViewController.swift +++ b/Delta/EmulationViewController.swift @@ -16,9 +16,11 @@ class EmulationViewController: UIViewController /** Properties **/ let game: Game let emulatorCore: EmulatorCore - @IBOutlet private(set) var controllerView: ControllerView! //MARK: - Private Properties + @IBOutlet private var controllerView: ControllerView! + @IBOutlet private var gameView: GameView! + @IBOutlet private var controllerViewHeightConstraint: NSLayoutConstraint! //MARK: - Initializers - @@ -47,6 +49,9 @@ class EmulationViewController: UIViewController { super.viewDidLoad() + self.gameView.backgroundColor = UIColor.clearColor() + self.emulatorCore.addGameView(self.gameView) + let controllerSkin = ControllerSkin.defaultControllerSkinForGameUTI(self.game.UTI) self.controllerView.controllerSkin = controllerSkin @@ -67,7 +72,7 @@ class EmulationViewController: UIViewController { 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 self.controllerViewHeightConstraint.constant = self.controllerView.intrinsicContentSize().height * scale @@ -130,6 +135,16 @@ extension EmulationViewController: GameControllerReceiverType 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 } print("Activated \(input)") diff --git a/Delta/EmulationViewController.xib b/Delta/EmulationViewController.xib index a882018..b191768 100644 --- a/Delta/EmulationViewController.xib +++ b/Delta/EmulationViewController.xib @@ -1,13 +1,15 @@ - + - + + + @@ -16,6 +18,10 @@ + + + + @@ -31,7 +37,14 @@ + + + + + + + @@ -39,11 +52,14 @@ + + +