Adds support for building Delta Lite (and Delta Lite beta)

Limits Delta Lite to NES games, and Delta Lite beta to NES and GBC games.
This commit is contained in:
Riley Testut 2019-09-14 15:32:51 -07:00
parent 6e380814aa
commit ebf3fc6c27
6 changed files with 59 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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)

View File

@ -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]
{

View File

@ -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