diff --git a/Delta/AppDelegate.swift b/Delta/AppDelegate.swift index a98770a..3e63aed 100644 --- a/Delta/AppDelegate.swift +++ b/Delta/AppDelegate.swift @@ -38,11 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { Settings.registerDefaults() - #if BETA - System.allCases.forEach { Delta.register($0.deltaCore) } - #else - System.allCases.filter { $0 != .ds }.forEach { Delta.register($0.deltaCore) } - #endif + self.registerCores() #if DEBUG @@ -114,8 +110,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate } } -extension AppDelegate +private extension AppDelegate { + func registerCores() + { + #if LITE + + #if BETA + Delta.register(System.nes.deltaCore) + Delta.register(System.gbc.deltaCore) + #else + Delta.register(System.nes.deltaCore) + #endif + + #else + + #if BETA + System.allCases.forEach { Delta.register($0.deltaCore) } + #else + System.allCases.filter { $0 != .ds }.forEach { Delta.register($0.deltaCore) } + #endif + + #endif + } + func configureAppearance() { self.window?.tintColor = UIColor.deltaPurple diff --git a/Delta/Database/DatabaseManager.swift b/Delta/Database/DatabaseManager.swift index 691acab..a783937 100644 --- a/Delta/Database/DatabaseManager.swift +++ b/Delta/Database/DatabaseManager.swift @@ -201,12 +201,10 @@ extension DatabaseManager continue } - #if !BETA - guard system != .ds else { + guard System.registeredSystems.contains(system) else { errors.insert(.unsupported(url)) continue } - #endif let identifier: String diff --git a/Delta/Extensions/Bundle+SwizzleBundleID.swift b/Delta/Extensions/Bundle+SwizzleBundleID.swift index aafa753..cd324fb 100644 --- a/Delta/Extensions/Bundle+SwizzleBundleID.swift +++ b/Delta/Extensions/Bundle+SwizzleBundleID.swift @@ -13,11 +13,25 @@ extension Bundle { @objc private var swizzled_infoDictionary: [String : Any]? { var infoDictionary = self.swizzled_infoDictionary + + #if LITE + + #if BETA + infoDictionary?[kCFBundleIdentifierKey as String] = "com.rileytestut.Delta.Lite.Beta" + #else + infoDictionary?[kCFBundleIdentifierKey as String] = "com.rileytestut.Delta.Lite" + #endif + + #else + #if BETA infoDictionary?[kCFBundleIdentifierKey as String] = "com.rileytestut.Delta.AltStore.Beta" #else infoDictionary?[kCFBundleIdentifierKey as String] = "com.rileytestut.Delta.AltStore" #endif + + #endif + return infoDictionary } diff --git a/Delta/Game Selection/GamesViewController.swift b/Delta/Game Selection/GamesViewController.swift index 4c0aea3..8c91e21 100644 --- a/Delta/Game Selection/GamesViewController.swift +++ b/Delta/Game Selection/GamesViewController.swift @@ -322,14 +322,8 @@ private extension GamesViewController extension GamesViewController: ImportControllerDelegate { @IBAction private func importFiles() - { - #if BETA - let systems = System.allCases - #else - let systems = System.allCases.filter { $0 != .ds } - #endif - - var documentTypes = Set(systems.map { $0.gameType.rawValue }) + { + var documentTypes = Set(System.registeredSystems.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) diff --git a/Delta/Settings/SettingsViewController.swift b/Delta/Settings/SettingsViewController.swift index 5d1eb9a..78879e0 100644 --- a/Delta/Settings/SettingsViewController.swift +++ b/Delta/Settings/SettingsViewController.swift @@ -66,11 +66,19 @@ class SettingsViewController: UITableViewController if let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String { + #if LITE + self.versionLabel.text = NSLocalizedString(String(format: "Delta Lite %@", version), comment: "Delta Version") + #else self.versionLabel.text = NSLocalizedString(String(format: "Delta %@", version), comment: "Delta Version") + #endif } else { + #if LITE + self.versionLabel.text = NSLocalizedString("Delta Lite", comment: "") + #else self.versionLabel.text = NSLocalizedString("Delta", comment: "") + #endif } } @@ -118,7 +126,7 @@ class SettingsViewController: UITableViewController case Segue.controllerSkins: let systemControllerSkinsViewController = segue.destination as! SystemControllerSkinsViewController - let system = System.allCases[indexPath.row] + let system = System.registeredSystems[indexPath.row] systemControllerSkinsViewController.system = system } } @@ -232,13 +240,7 @@ extension SettingsViewController switch section { case .controllers: return 1 // Temporarily hide other controller indexes until controller logic is finalized - case .controllerSkins: - #if BETA - return System.allCases.count - #else - return System.allCases.filter { $0 != .ds}.count - #endif - + case .controllerSkins: return System.registeredSystems.count case .syncing: return SyncManager.shared.coordinator?.account == nil ? 1 : super.tableView(tableView, numberOfRowsInSection: sectionIndex) default: if isSectionHidden(section) @@ -274,7 +276,9 @@ extension SettingsViewController cell.detailTextLabel?.text = nil } - case .controllerSkins: cell.textLabel?.text = System.allCases[indexPath.row].localizedName + case .controllerSkins: + cell.textLabel?.text = System.registeredSystems[indexPath.row].localizedName + case .syncing: switch SyncingRow.allCases[indexPath.row] { diff --git a/Delta/Systems/System.swift b/Delta/Systems/System.swift index 389fbe2..9f049a5 100644 --- a/Delta/Systems/System.swift +++ b/Delta/Systems/System.swift @@ -23,6 +23,11 @@ enum System: CaseIterable case gbc case gba case ds + + static var registeredSystems: [System] { + let systems = System.allCases.filter { Delta.registeredCores.keys.contains($0.gameType) } + return systems + } } extension System