[Features] Moves Settings.Name + Settings.NotificationUserInfoKey to DeltaFeatures

Also refactors from enums to RawRepresentable structs to support arbitrary values.
This commit is contained in:
Riley Testut 2023-04-13 15:41:55 -05:00
parent c3af9f7209
commit 9406cfe6cc
6 changed files with 93 additions and 22 deletions

View File

@ -166,6 +166,7 @@
BFFDF03723E3BB2600931B96 /* libSnes9x.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF03623E3BB2600931B96 /* libSnes9x.a */; }; BFFDF03723E3BB2600931B96 /* libSnes9x.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF03623E3BB2600931B96 /* libSnes9x.a */; };
BFFDF03F23E3C28A00931B96 /* libGambatte.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF03D23E3C0F000931B96 /* libGambatte.a */; }; BFFDF03F23E3C28A00931B96 /* libGambatte.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF03D23E3C0F000931B96 /* libGambatte.a */; };
BFFDF04623E3D3A600931B96 /* libMupen64Plus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF04523E3D3A600931B96 /* libMupen64Plus.a */; }; BFFDF04623E3D3A600931B96 /* libMupen64Plus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF04523E3D3A600931B96 /* libMupen64Plus.a */; };
D517F6BA29E730DA000D14D0 /* SettingsName.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5A9C01929DDFBDD00A8D610 /* SettingsName.swift */; };
D524F4A1273DE9A100D500B2 /* AltKit in Frameworks */ = {isa = PBXBuildFile; productRef = D524F4A0273DE9A100D500B2 /* AltKit */; }; D524F4A1273DE9A100D500B2 /* AltKit in Frameworks */ = {isa = PBXBuildFile; productRef = D524F4A0273DE9A100D500B2 /* AltKit */; };
D524F4A3273DE9C000D500B2 /* ProcessInfo+JIT.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524F4A2273DE9C000D500B2 /* ProcessInfo+JIT.swift */; }; D524F4A3273DE9C000D500B2 /* ProcessInfo+JIT.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524F4A2273DE9C000D500B2 /* ProcessInfo+JIT.swift */; };
D524F4A5273DEBB400D500B2 /* ServerManager+Delta.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524F4A4273DEBB400D500B2 /* ServerManager+Delta.swift */; }; D524F4A5273DEBB400D500B2 /* ServerManager+Delta.swift in Sources */ = {isa = PBXBuildFile; fileRef = D524F4A4273DEBB400D500B2 /* ServerManager+Delta.swift */; };
@ -174,6 +175,7 @@
D53415A7298C78BC00FD67B1 /* Contributors.plist in Resources */ = {isa = PBXBuildFile; fileRef = D53415A6298C78BC00FD67B1 /* Contributors.plist */; }; D53415A7298C78BC00FD67B1 /* Contributors.plist in Resources */ = {isa = PBXBuildFile; fileRef = D53415A6298C78BC00FD67B1 /* Contributors.plist */; };
D539103229E88B6C0006B350 /* DeltaPreviews.h in Headers */ = {isa = PBXBuildFile; fileRef = D539103129E88B6C0006B350 /* DeltaPreviews.h */; settings = {ATTRIBUTES = (Public, ); }; }; D539103229E88B6C0006B350 /* DeltaPreviews.h in Headers */ = {isa = PBXBuildFile; fileRef = D539103129E88B6C0006B350 /* DeltaPreviews.h */; settings = {ATTRIBUTES = (Public, ); }; };
D539104029E88BC40006B350 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D539103F29E88BC40006B350 /* ContentView.swift */; }; D539104029E88BC40006B350 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D539103F29E88BC40006B350 /* ContentView.swift */; };
D54F710229E89DCB009C069A /* SettingsUserInfoKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */; };
D5864970297734280081477E /* CheatMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = D586496F297734280081477E /* CheatMetadata.swift */; }; D5864970297734280081477E /* CheatMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = D586496F297734280081477E /* CheatMetadata.swift */; };
D586497229774ABD0081477E /* CheatBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D586497129774ABD0081477E /* CheatBase.swift */; }; D586497229774ABD0081477E /* CheatBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D586497129774ABD0081477E /* CheatBase.swift */; };
D5864978297756CE0081477E /* CheatBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5864977297756CE0081477E /* CheatBaseView.swift */; }; D5864978297756CE0081477E /* CheatBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5864977297756CE0081477E /* CheatBaseView.swift */; };
@ -404,11 +406,13 @@
D539102F29E88B6B0006B350 /* DeltaPreviews.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DeltaPreviews.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D539102F29E88B6B0006B350 /* DeltaPreviews.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DeltaPreviews.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D539103129E88B6C0006B350 /* DeltaPreviews.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeltaPreviews.h; sourceTree = "<group>"; }; D539103129E88B6C0006B350 /* DeltaPreviews.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeltaPreviews.h; sourceTree = "<group>"; };
D539103F29E88BC40006B350 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; D539103F29E88BC40006B350 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsUserInfoKey.swift; sourceTree = "<group>"; };
D586496F297734280081477E /* CheatMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatMetadata.swift; sourceTree = "<group>"; }; D586496F297734280081477E /* CheatMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatMetadata.swift; sourceTree = "<group>"; };
D586497129774ABD0081477E /* CheatBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatBase.swift; sourceTree = "<group>"; }; D586497129774ABD0081477E /* CheatBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatBase.swift; sourceTree = "<group>"; };
D5864977297756CE0081477E /* CheatBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatBaseView.swift; sourceTree = "<group>"; }; D5864977297756CE0081477E /* CheatBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatBaseView.swift; sourceTree = "<group>"; };
D5A98CE1284EF14B00E023E5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; D5A98CE1284EF14B00E023E5 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
D5A9BFFD29DDECF100A8D610 /* Feature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feature.swift; sourceTree = "<group>"; }; D5A9BFFD29DDECF100A8D610 /* Feature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feature.swift; sourceTree = "<group>"; };
D5A9C01929DDFBDD00A8D610 /* SettingsName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsName.swift; sourceTree = "<group>"; };
D5AAF27629884F8600F21ACF /* CheatDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatDevice.swift; sourceTree = "<group>"; }; D5AAF27629884F8600F21ACF /* CheatDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheatDevice.swift; sourceTree = "<group>"; };
D5D797E5298D946200738869 /* Contributor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contributor.swift; sourceTree = "<group>"; }; D5D797E5298D946200738869 /* Contributor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contributor.swift; sourceTree = "<group>"; };
D5D797E7298DC9E200738869 /* cheatbase.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = cheatbase.zip; sourceTree = "<group>"; }; D5D797E7298DC9E200738869 /* cheatbase.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = cheatbase.zip; sourceTree = "<group>"; };
@ -963,6 +967,15 @@
path = Launch; path = Launch;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D517F6BB29E737F5000D14D0 /* Types */ = {
isa = PBXGroup;
children = (
D5A9C01929DDFBDD00A8D610 /* SettingsName.swift */,
D54F710129E89DCB009C069A /* SettingsUserInfoKey.swift */,
);
path = Types;
sourceTree = "<group>";
};
D539103029E88B6C0006B350 /* DeltaPreviews */ = { D539103029E88B6C0006B350 /* DeltaPreviews */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -997,6 +1010,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D5A9BFFD29DDECF100A8D610 /* Feature.swift */, D5A9BFFD29DDECF100A8D610 /* Feature.swift */,
D517F6BB29E737F5000D14D0 /* Types */,
); );
path = DeltaFeatures; path = DeltaFeatures;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1479,7 +1493,9 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D517F6BA29E730DA000D14D0 /* SettingsName.swift in Sources */,
D5D7C20429E60F2000663793 /* Feature.swift in Sources */, D5D7C20429E60F2000663793 /* Feature.swift in Sources */,
D54F710229E89DCB009C069A /* SettingsUserInfoKey.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -1212,6 +1212,8 @@ private extension GameViewController
self.updateAudio() self.updateAudio()
case .syncingService, .isAltJITEnabled: break case .syncingService, .isAltJITEnabled: break
default: break
} }
} }

View File

@ -9,6 +9,7 @@
import Foundation import Foundation
import DeltaCore import DeltaCore
import DeltaFeatures
import MelonDSDeltaCore import MelonDSDeltaCore
import Roxas import Roxas
@ -18,29 +19,23 @@ extension Notification.Name
static let settingsDidChange = Notification.Name("SettingsDidChangeNotification") static let settingsDidChange = Notification.Name("SettingsDidChangeNotification")
} }
extension Settings extension Settings.NotificationUserInfoKey
{ {
enum NotificationUserInfoKey: String static let system: Settings.NotificationUserInfoKey = "system"
{ static let traits: Settings.NotificationUserInfoKey = "traits"
case name static let core: Settings.NotificationUserInfoKey = "core"
}
case system extension Settings.Name
case traits {
static let localControllerPlayerIndex: Settings.Name = "localControllerPlayerIndex"
case core static let translucentControllerSkinOpacity: Settings.Name = "translucentControllerSkinOpacity"
} static let preferredControllerSkin: Settings.Name = "preferredControllerSkin"
static let syncingService: Settings.Name = "syncingService"
enum Name: String static let isButtonHapticFeedbackEnabled: Settings.Name = "isButtonHapticFeedbackEnabled"
{ static let isThumbstickHapticFeedbackEnabled: Settings.Name = "isThumbstickHapticFeedbackEnabled"
case localControllerPlayerIndex static let isAltJITEnabled: Settings.Name = "isAltJITEnabled"
case translucentControllerSkinOpacity static let respectSilentMode: Settings.Name = "respectSilentMode"
case preferredControllerSkin
case syncingService
case isButtonHapticFeedbackEnabled
case isThumbstickHapticFeedbackEnabled
case isAltJITEnabled
case respectSilentMode
}
} }
extension Settings extension Settings
@ -50,6 +45,9 @@ extension Settings
case recent case recent
case manual case manual
} }
typealias Name = SettingsName
typealias NotificationUserInfoKey = SettingsUserInfoKey
} }
struct Settings struct Settings

View File

@ -309,6 +309,7 @@ private extension SettingsViewController
} }
case .localControllerPlayerIndex, .preferredControllerSkin, .translucentControllerSkinOpacity, .respectSilentMode, .isButtonHapticFeedbackEnabled, .isThumbstickHapticFeedbackEnabled, .isAltJITEnabled: break case .localControllerPlayerIndex, .preferredControllerSkin, .translucentControllerSkinOpacity, .respectSilentMode, .isButtonHapticFeedbackEnabled, .isThumbstickHapticFeedbackEnabled, .isAltJITEnabled: break
default: break
} }
} }

View File

@ -0,0 +1,24 @@
//
// SettingsTypes.swift
// Delta
//
// Created by Riley Testut on 4/5/23.
// Copyright © 2023 Riley Testut. All rights reserved.
//
import Foundation
public struct SettingsName: RawRepresentable, Hashable, ExpressibleByStringLiteral
{
public let rawValue: String
public init(rawValue: String)
{
self.rawValue = rawValue
}
public init(stringLiteral rawValue: String)
{
self.rawValue = rawValue
}
}

View File

@ -0,0 +1,30 @@
//
// SettingsUserInfoKey.swift
// DeltaFeatures
//
// Created by Riley Testut on 4/13/23.
// Copyright © 2023 Riley Testut. All rights reserved.
//
import Foundation
public extension SettingsUserInfoKey
{
public static let name: SettingsUserInfoKey = "name"
public static let value: SettingsUserInfoKey = "value"
}
public struct SettingsUserInfoKey: RawRepresentable, Hashable, ExpressibleByStringLiteral
{
public let rawValue: String
public init(rawValue: String)
{
self.rawValue = rawValue
}
public init(stringLiteral rawValue: String)
{
self.rawValue = rawValue
}
}