From 75231029821c58628480d45ed3b114176d9ac50f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 1 Feb 2019 12:25:08 -0800 Subject: [PATCH 1/2] Adjusts keyboard input display priorities to favor special character keys --- Delta/Extensions/Input+Display.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Delta/Extensions/Input+Display.swift b/Delta/Extensions/Input+Display.swift index 6629abb..9d8c48f 100644 --- a/Delta/Extensions/Input+Display.swift +++ b/Delta/Extensions/Input+Display.swift @@ -35,6 +35,21 @@ extension Input case .rightTrigger: return 500 default: break } + + case .controller(.keyboard): + let input = KeyboardGameController.Input(input: self)! + + // We prefer to display keys with special characters (e.g. arrow keys, shift) over regular keys. + // If the input's localizedName == it's string value, we can assume it's a normal key, and return a lower priority. + // Otherwise, it has a special display character, and so we return a higher priority. + if input.localizedName == input.stringValue.uppercased() + { + return 500 + } + else + { + return 1000 + } default: break } From 1e144e5657ed5057eb181ff4f17aa107a681df53 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 1 Feb 2019 12:44:32 -0800 Subject: [PATCH 2/2] Adds support for NES games --- .gitmodules | 3 + Cores/NESDeltaCore | 1 + Delta.xcodeproj/project.pbxproj | 6 ++ .../xcshareddata/xcschemes/Delta.xcscheme | 30 ++++++--- Delta.xcworkspace/contents.xcworkspacedata | 7 ++- Delta/AppDelegate.swift | 2 +- Delta/Base.lproj/Settings.storyboard | 33 +++++++--- Delta/Database/DatabaseManager.swift | 2 +- .../Extensions/DeltaCoreProtocol+Delta.swift | 3 +- Delta/Extensions/Input+Display.swift | 7 +++ .../Game Selection/GamesViewController.swift | 2 +- .../ControllerInputsViewController.swift | 4 +- .../ControllersSettingsViewController.swift | 1 - Delta/Settings/Settings.swift | 3 +- Delta/Settings/SettingsViewController.swift | 20 ++---- Delta/Systems/System.swift | 62 ++++++++++--------- 16 files changed, 113 insertions(+), 73 deletions(-) create mode 160000 Cores/NESDeltaCore diff --git a/.gitmodules b/.gitmodules index 8c6f712..277187e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "Cores/GBCDeltaCore"] path = Cores/GBCDeltaCore url = git@github.com:rileytestut/GBCDeltaCore.git +[submodule "Cores/NESDeltaCore"] + path = Cores/NESDeltaCore + url = git@github.com:rileytestut/NESDeltaCore.git diff --git a/Cores/NESDeltaCore b/Cores/NESDeltaCore new file mode 160000 index 0000000..d83e51d --- /dev/null +++ b/Cores/NESDeltaCore @@ -0,0 +1 @@ +Subproject commit d83e51d06020045adc4403b9d77e604cf46e34f5 diff --git a/Delta.xcodeproj/project.pbxproj b/Delta.xcodeproj/project.pbxproj index 18855c9..8e96e03 100644 --- a/Delta.xcodeproj/project.pbxproj +++ b/Delta.xcodeproj/project.pbxproj @@ -97,6 +97,8 @@ BF8DDD241F4F6C880088A21B /* InputCalloutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8DDD231F4F6C880088A21B /* InputCalloutView.swift */; }; BF95E2771E4977BF0030E7AD /* GameMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF95E2761E4977BF0030E7AD /* GameMetadata.swift */; }; BF95E2791E4982A10030E7AD /* GamesDatabaseBrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF95E2781E4982A10030E7AD /* GamesDatabaseBrowserViewController.swift */; }; + BF98C9822204D9AB006B95AC /* NESDeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF98C9812204D9A1006B95AC /* NESDeltaCore.framework */; }; + BF98C9832204D9AB006B95AC /* NESDeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF98C9812204D9A1006B95AC /* NESDeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF99A5971DC2F9C400468E9E /* ControllerSkinTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF99A5961DC2F9C400468E9E /* ControllerSkinTableViewCell.swift */; }; BF99C6941D0A9AA600BA92BC /* SNESDeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; }; BF99C6951D0A9AA600BA92BC /* SNESDeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -140,6 +142,7 @@ BFF0742D1E9DC17500ACDF4A /* GBCDeltaCore.framework in Embed Frameworks */, BFEC732E1AAECC4A00650035 /* Roxas.framework in Embed Frameworks */, BF0418151D01E93400E85BCF /* GBADeltaCore.framework in Embed Frameworks */, + BF98C9832204D9AB006B95AC /* NESDeltaCore.framework in Embed Frameworks */, BF99C6951D0A9AA600BA92BC /* SNESDeltaCore.framework in Embed Frameworks */, BF072011219A3A9D00F05DA4 /* ZIPFoundation.framework in Embed Frameworks */, ); @@ -236,6 +239,7 @@ BF8DDD231F4F6C880088A21B /* InputCalloutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCalloutView.swift; sourceTree = ""; }; BF95E2761E4977BF0030E7AD /* GameMetadata.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameMetadata.swift; sourceTree = ""; }; BF95E2781E4982A10030E7AD /* GamesDatabaseBrowserViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamesDatabaseBrowserViewController.swift; sourceTree = ""; }; + BF98C9812204D9A1006B95AC /* NESDeltaCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = NESDeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BF99A5961DC2F9C400468E9E /* ControllerSkinTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllerSkinTableViewCell.swift; sourceTree = ""; }; BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BFAA1FEC1B8AA4FA00495943 /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; @@ -272,6 +276,7 @@ BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */, BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */, BF99C6941D0A9AA600BA92BC /* SNESDeltaCore.framework in Frameworks */, + BF98C9822204D9AB006B95AC /* NESDeltaCore.framework in Frameworks */, BF0418141D01E93400E85BCF /* GBADeltaCore.framework in Frameworks */, BF072010219A3A9D00F05DA4 /* ZIPFoundation.framework in Frameworks */, BFF0742C1E9DC17500ACDF4A /* GBCDeltaCore.framework in Frameworks */, @@ -546,6 +551,7 @@ BF9F4FCD1AAD7B25004C9500 /* Frameworks */ = { isa = PBXGroup; children = ( + BF98C9812204D9A1006B95AC /* NESDeltaCore.framework */, BF07200E219A3A9500F05DA4 /* ZIPFoundation.framework */, BFF0742B1E9DC17500ACDF4A /* GBCDeltaCore.framework */, BF0418131D01E93400E85BCF /* GBADeltaCore.framework */, diff --git a/Delta.xcodeproj/xcshareddata/xcschemes/Delta.xcscheme b/Delta.xcodeproj/xcshareddata/xcschemes/Delta.xcscheme index adb55e4..ee40b42 100644 --- a/Delta.xcodeproj/xcshareddata/xcschemes/Delta.xcscheme +++ b/Delta.xcodeproj/xcshareddata/xcschemes/Delta.xcscheme @@ -34,6 +34,20 @@ ReferencedContainer = "container:Cores/DeltaCore/DeltaCore.xcodeproj"> + + + + + BlueprintIdentifier = "BF8F2AAD1E9C879300F89F15" + BuildableName = "GBCDeltaCore.framework" + BlueprintName = "GBCDeltaCore" + ReferencedContainer = "container:Cores/GBCDeltaCore/GBCDeltaCore.xcodeproj"> + BlueprintIdentifier = "BFE8E9C91D010AF7009D623D" + BuildableName = "GBADeltaCore.framework" + BlueprintName = "GBADeltaCore" + ReferencedContainer = "container:Cores/GBADeltaCore/GBADeltaCore.xcodeproj"> + + + location = "group:Cores/GBCDeltaCore/GBCDeltaCore.xcodeproj"> + location = "group:Cores/GBADeltaCore/GBADeltaCore.xcodeproj"> diff --git a/Delta/AppDelegate.swift b/Delta/AppDelegate.swift index 3cd0d61..4bd1c7c 100644 --- a/Delta/AppDelegate.swift +++ b/Delta/AppDelegate.swift @@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate Settings.registerDefaults() - System.supportedSystems.forEach { Delta.register($0.deltaCore) } + System.allCases.forEach { Delta.register($0.deltaCore) } self.configureAppearance() diff --git a/Delta/Base.lproj/Settings.storyboard b/Delta/Base.lproj/Settings.storyboard index ed24fe3..bf93e16 100644 --- a/Delta/Base.lproj/Settings.storyboard +++ b/Delta/Base.lproj/Settings.storyboard @@ -1,12 +1,10 @@ - + - - - + @@ -19,7 +17,7 @@