Adds support for NES games
This commit is contained in:
parent
7523102982
commit
1e144e5657
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -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
|
||||
|
||||
1
Cores/NESDeltaCore
Submodule
1
Cores/NESDeltaCore
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d83e51d06020045adc4403b9d77e604cf46e34f5
|
||||
@ -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 = "<group>"; };
|
||||
BF95E2761E4977BF0030E7AD /* GameMetadata.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameMetadata.swift; sourceTree = "<group>"; };
|
||||
BF95E2781E4982A10030E7AD /* GamesDatabaseBrowserViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamesDatabaseBrowserViewController.swift; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
@ -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 */,
|
||||
|
||||
@ -34,6 +34,20 @@
|
||||
ReferencedContainer = "container:Cores/DeltaCore/DeltaCore.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "BF3C12F220438F3F0079A4B5"
|
||||
BuildableName = "NESDeltaCore.framework"
|
||||
BlueprintName = "NESDeltaCore"
|
||||
ReferencedContainer = "container:Cores/NESDeltaCore/NESDeltaCore.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
@ -56,10 +70,10 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "BFE8E9C91D010AF7009D623D"
|
||||
BuildableName = "GBADeltaCore.framework"
|
||||
BlueprintName = "GBADeltaCore"
|
||||
ReferencedContainer = "container:Cores/GBADeltaCore/GBADeltaCore.xcodeproj">
|
||||
BlueprintIdentifier = "BF8F2AAD1E9C879300F89F15"
|
||||
BuildableName = "GBCDeltaCore.framework"
|
||||
BlueprintName = "GBCDeltaCore"
|
||||
ReferencedContainer = "container:Cores/GBCDeltaCore/GBCDeltaCore.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
@ -70,10 +84,10 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
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">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
|
||||
7
Delta.xcworkspace/contents.xcworkspacedata
generated
7
Delta.xcworkspace/contents.xcworkspacedata
generated
@ -7,14 +7,17 @@
|
||||
<FileRef
|
||||
location = "group:Cores/DeltaCore/DeltaCore.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Cores/NESDeltaCore/NESDeltaCore.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Cores/SNESDeltaCore/SNESDeltaCore.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Cores/GBADeltaCore/GBADeltaCore.xcodeproj">
|
||||
location = "group:Cores/GBCDeltaCore/GBCDeltaCore.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Cores/GBCDeltaCore/GBCDeltaCore.xcodeproj">
|
||||
location = "group:Cores/GBADeltaCore/GBADeltaCore.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:External/Roxas/Roxas.xcodeproj">
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ssH-mM-uG6">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ssH-mM-uG6">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -19,7 +17,7 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<label key="tableFooterView" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delta 0.6.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Str-BY-agW">
|
||||
<rect key="frame" x="0.0" y="673" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="717" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@ -179,12 +177,29 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="XVO-TO-ncw" style="IBUITableViewCellStyleDefault" id="vIu-iy-kRM">
|
||||
<rect key="frame" x="0.0" y="419.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vIu-iy-kRM" id="FIZ-uw-fR7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="System Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XVO-TO-ncw">
|
||||
<rect key="frame" x="16" y="0.0" width="324" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Controller Opacity" footerTitle="Determines how translucent the controller appears, if supported by the controller skin." id="SwK-m9-8gt">
|
||||
<cells>
|
||||
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="Xxk-vo-eu4">
|
||||
<rect key="frame" x="0.0" y="483" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="527" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" tableViewCell="Xxk-vo-eu4" id="vxt-Ex-b4b">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||
@ -225,10 +240,10 @@
|
||||
<tableViewSection headerTitle="3D Touch" id="fdp-8c-oOc">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="c5i-qG-ir9" style="IBUITableViewCellStyleDefault" id="SSL-t4-QZj">
|
||||
<rect key="frame" x="0.0" y="611" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="655" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SSL-t4-QZj" id="hQB-Iy-bzy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="349" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="App Icon Shortcuts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="c5i-qG-ir9">
|
||||
@ -482,7 +497,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4bh-Lf-zgk">
|
||||
<rect key="frame" x="310" y="6" width="51" height="31"/>
|
||||
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="switchGameShortcutsModeWith:" destination="yXS-6u-1AN" eventType="valueChanged" id="bX8-gd-h4g"/>
|
||||
</connections>
|
||||
|
||||
@ -131,7 +131,7 @@ private extension DatabaseManager
|
||||
|
||||
self.performBackgroundTask { (context) in
|
||||
|
||||
for system in System.supportedSystems
|
||||
for system in System.allCases
|
||||
{
|
||||
guard let deltaControllerSkin = DeltaCore.ControllerSkin.standardControllerSkin(for: system.gameType) else { continue }
|
||||
|
||||
|
||||
@ -15,9 +15,10 @@ extension DeltaCoreProtocol
|
||||
|
||||
switch system
|
||||
{
|
||||
case .nes: return 1...4
|
||||
case .snes: return 1...4
|
||||
case .gba: return 1...3
|
||||
case .gbc: return 1...4
|
||||
case .gba: return 1...3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,13 @@ extension Input
|
||||
case .controller(.keyboard):
|
||||
let input = KeyboardGameController.Input(input: self)!
|
||||
|
||||
if input == .escape
|
||||
{
|
||||
// The iPad Smart Keyboard doesn't have an escape key, so return lower priority
|
||||
// to ensure it only appears if there is no other key mapped to the same input.
|
||||
return 100
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
@ -300,7 +300,7 @@ extension GamesViewController: ImportControllerDelegate
|
||||
{
|
||||
@IBAction private func importFiles()
|
||||
{
|
||||
var documentTypes = Set(System.supportedSystems.map { $0.gameType.rawValue })
|
||||
var documentTypes = Set(System.allCases.map { $0.gameType.rawValue })
|
||||
documentTypes.insert(kUTTypeZipArchive as String)
|
||||
|
||||
// Add GBA4iOS's exported UTIs in case user has GBA4iOS installed (which may override Delta's UTI declarations)
|
||||
|
||||
@ -21,7 +21,7 @@ class ControllerInputsViewController: UIViewController
|
||||
}
|
||||
}
|
||||
|
||||
var system: System = .snes {
|
||||
var system: System = System.allCases[0] {
|
||||
didSet {
|
||||
guard self.system != oldValue else { return }
|
||||
self.updateSystem()
|
||||
@ -167,7 +167,7 @@ private extension ControllerInputsViewController
|
||||
let popoverMenuController = PopoverMenuController(popoverViewController: navigationController)
|
||||
self.navigationItem.popoverMenuController = popoverMenuController
|
||||
|
||||
let items = System.supportedSystems.map { [unowned self, weak popoverMenuController, weak listMenuViewController] system -> MenuItem in
|
||||
let items = System.allCases.map { [unowned self, weak popoverMenuController, weak listMenuViewController] system -> MenuItem in
|
||||
let item = MenuItem(text: system.localizedShortName, image: #imageLiteral(resourceName: "CheatCodes")) { [weak popoverMenuController, weak listMenuViewController] item in
|
||||
listMenuViewController?.items.forEach { $0.isSelected = ($0 == item) }
|
||||
popoverMenuController?.isActive = false
|
||||
|
||||
@ -106,7 +106,6 @@ extension ControllersSettingsViewController
|
||||
case "controllerInputsSegue":
|
||||
let controllerInputsViewController = (segue.destination as! UINavigationController).topViewController as! ControllerInputsViewController
|
||||
controllerInputsViewController.gameController = self.gameController
|
||||
controllerInputsViewController.system = .snes
|
||||
|
||||
default: break
|
||||
}
|
||||
|
||||
@ -186,9 +186,10 @@ private extension Settings
|
||||
|
||||
switch system
|
||||
{
|
||||
case .nes: systemName = "nes"
|
||||
case .snes: systemName = "snes"
|
||||
case .gba: systemName = "gba"
|
||||
case .gbc: systemName = "gbc"
|
||||
case .gba: systemName = "gba"
|
||||
}
|
||||
|
||||
let orientation: String
|
||||
|
||||
@ -27,13 +27,6 @@ private extension SettingsViewController
|
||||
case controllers = "controllersSegue"
|
||||
case controllerSkins = "controllerSkinsSegue"
|
||||
}
|
||||
|
||||
enum ControllerSkinsRow: Int
|
||||
{
|
||||
case snes
|
||||
case gba
|
||||
case gbc
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsViewController: UITableViewController
|
||||
@ -113,13 +106,8 @@ class SettingsViewController: UITableViewController
|
||||
case Segue.controllerSkins:
|
||||
let systemControllerSkinsViewController = segue.destination as! SystemControllerSkinsViewController
|
||||
|
||||
let row = ControllerSkinsRow(rawValue: indexPath.row)!
|
||||
switch row
|
||||
{
|
||||
case .snes: systemControllerSkinsViewController.system = .snes
|
||||
case .gba: systemControllerSkinsViewController.system = .gba
|
||||
case .gbc: systemControllerSkinsViewController.system = .gbc
|
||||
}
|
||||
let system = System.allCases[indexPath.row]
|
||||
systemControllerSkinsViewController.system = system
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,7 +180,7 @@ extension SettingsViewController
|
||||
switch section
|
||||
{
|
||||
case .controllers: return 1 // Temporarily hide other controller indexes until controller logic is finalized
|
||||
case .controllerSkins: return System.supportedSystems.count
|
||||
case .controllerSkins: return System.allCases.count
|
||||
default:
|
||||
if isSectionHidden(section)
|
||||
{
|
||||
@ -227,7 +215,7 @@ extension SettingsViewController
|
||||
cell.detailTextLabel?.text = nil
|
||||
}
|
||||
|
||||
case .controllerSkins: cell.textLabel?.text = System.supportedSystems[indexPath.row].localizedName
|
||||
case .controllerSkins: cell.textLabel?.text = System.allCases[indexPath.row].localizedName
|
||||
default: break
|
||||
}
|
||||
|
||||
|
||||
@ -11,30 +11,14 @@ import DeltaCore
|
||||
import SNESDeltaCore
|
||||
import GBADeltaCore
|
||||
import GBCDeltaCore
|
||||
import NESDeltaCore
|
||||
|
||||
extension GameType
|
||||
{
|
||||
init?(fileExtension: String)
|
||||
{
|
||||
switch fileExtension.lowercased()
|
||||
{
|
||||
case "smc", "sfc", "fig": self = .snes
|
||||
case "gba": self = .gba
|
||||
case "gbc", "gb": self = .gbc
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum System
|
||||
enum System: CaseIterable
|
||||
{
|
||||
case nes
|
||||
case snes
|
||||
case gba
|
||||
case gbc
|
||||
|
||||
static var supportedSystems: [System] {
|
||||
return [.snes, .gba, .gbc]
|
||||
}
|
||||
case gba
|
||||
}
|
||||
|
||||
extension System
|
||||
@ -42,27 +26,30 @@ extension System
|
||||
var localizedName: String {
|
||||
switch self
|
||||
{
|
||||
case .nes: return NSLocalizedString("Nintendo", comment: "")
|
||||
case .snes: return NSLocalizedString("Super Nintendo", comment: "")
|
||||
case .gba: return NSLocalizedString("Game Boy Advance", comment: "")
|
||||
case .gbc: return NSLocalizedString("Game Boy Color", comment: "")
|
||||
case .gba: return NSLocalizedString("Game Boy Advance", comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
var localizedShortName: String {
|
||||
switch self
|
||||
{
|
||||
case .nes: return NSLocalizedString("NES", comment: "")
|
||||
case .snes: return NSLocalizedString("SNES", comment: "")
|
||||
case .gba: return NSLocalizedString("GBA", comment: "")
|
||||
case .gbc: return NSLocalizedString("GBC", comment: "")
|
||||
case .gba: return NSLocalizedString("GBA", comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
var year: Int {
|
||||
switch self
|
||||
{
|
||||
case .nes: return 1985
|
||||
case .snes: return 1990
|
||||
case .gba: return 2001
|
||||
case .gbc: return 1998
|
||||
case .gba: return 2001
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,21 +59,20 @@ extension System
|
||||
var deltaCore: DeltaCoreProtocol {
|
||||
switch self
|
||||
{
|
||||
case .nes: return NES.core
|
||||
case .snes: return SNES.core
|
||||
case .gba: return GBA.core
|
||||
case .gbc: return GBC.core
|
||||
case .gba: return GBA.core
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension System
|
||||
{
|
||||
|
||||
var gameType: GameType {
|
||||
switch self
|
||||
{
|
||||
case .nes: return .nes
|
||||
case .snes: return .snes
|
||||
case .gba: return .gba
|
||||
case .gbc: return .gbc
|
||||
case .gba: return .gba
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,9 +80,25 @@ extension System
|
||||
{
|
||||
switch gameType
|
||||
{
|
||||
case GameType.nes: self = .nes
|
||||
case GameType.snes: self = .snes
|
||||
case GameType.gba: self = .gba
|
||||
case GameType.gbc: self = .gbc
|
||||
case GameType.gba: self = .gba
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension GameType
|
||||
{
|
||||
init?(fileExtension: String)
|
||||
{
|
||||
switch fileExtension.lowercased()
|
||||
{
|
||||
case "nes": self = .nes
|
||||
case "smc", "sfc", "fig": self = .snes
|
||||
case "gbc", "gb": self = .gbc
|
||||
case "gba": self = .gba
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user