Run a virtual iPhone on an Apple Silicon Mac.
Swift
Make libprefsfix and libsigninfix selectable patches
zqxwce83b4cd46a16e
diff --git a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift b/VPhoneDaemon/Daemon/GuestAPI+Environment.swiftindex 0a2352cc..7ffff54f 100644--- a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift+++ b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift@@ -25,6 +25,11 @@ extension GuestAPI {"libvphoneaccelerometer.dylib","libvphoneattitude.dylib",]+ /// Must match `VPhoneGuestEnvironment.selectedLibraries`: the VM's patch selection owns these.+ static let environmentSelectedLibraries: Set = [+ "libprefsfix.dylib", "libsigninfix.dylib",+ "libvphonegyro.dylib", "libvphoneaccelerometer.dylib", "libvphoneattitude.dylib",+ ]static let environmentStaging = "/var/root/Library/Caches/vphone-environment"static func executeEnvironment(_ method: String, _ params: [String: Any]) throws -> [String: Any]? {@@ -60,8 +65,8 @@ extension GuestAPI {guard environmentLibraries.contains(name) else {throw GuestAPIError.invalidRequest("\(name) is not part of the vphone environment")}- if ["libvphonegyro.dylib", "libvphoneaccelerometer.dylib", "libvphoneattitude.dylib"].contains(name), !FileManager.default.fileExists(atPath: "/usr/lib/" + name) {- throw GuestAPIError.invalidRequest("Enable the motion sensor patch with cfw install or cfw update-environment first")+ if environmentSelectedLibraries.contains(name), !FileManager.default.fileExists(atPath: "/usr/lib/" + name) {+ throw GuestAPIError.invalidRequest("\(name) is off in this VM's patches; enable it with cfw install or cfw update-environment first")}let staged = URL(fileURLWithPath: environmentStaging + "/" + name)guard let data = try? Data(contentsOf: staged, options: .mappedIfSafe) else {diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swiftindex 54c6fa4a..558da655 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift@@ -29,6 +29,8 @@ public enum FirmwareGuestSystemPatchSet {public static let gyroscope = "system-backboardd-cfw-gyroscope"public static let accelerometer = "system-backboardd-cfw-accelerometer"public static let attitude = "system-apps-cfw-attitude"+ public static let followUpGroups = "system-preferences-cfw-followup_groups"+ public static let signInSheets = "system-apps-cfw-signin_sheets"public static let arm64eX1DyldBootstrap = "system-dyld-boot-arm64e_x1_bootstrap"public static let arm64eX1CacheBootstrap = "dyld-boot-arm64e_x1_bootstrap"public static let arm64eX1LaunchdBootstrap = "system-launchd-boot-arm64e_x1_bootstrap"@@ -439,6 +441,22 @@ public enum FirmwareGuestSystemPatchSet {bootEssential: true,),+ // MARK: Account prompts++ VPhonePatchDeclaration(+ identifier: followUpGroups,+ title: "Hide Settings follow-up groups",+ summary: "Installs libprefsfix.dylib, loaded by SystemHook into Settings. Hides the CoreFollowUp groups: Apple Account suggestions, services included with purchase, AppleCare, More for Your iPhone and Screen Time updates. Removing the library shows them again on the next Settings launch.",+ target: .guestFile(path: "/usr/lib/libprefsfix.dylib"),+ ),++ VPhonePatchDeclaration(+ identifier: signInSheets,+ title: "Suppress sign-in sheets",+ summary: "Installs libsigninfix.dylib, loaded by SystemHook into every app. Drops Apple Account, iCloud, Game Center and Media & Purchases sign-in sheets; account daemons are untouched. Removing the library restores the sheets on the next app launch.",+ target: .guestFile(path: "/usr/lib/libsigninfix.dylib"),+ ),+// MARK: MotionVPhonePatchDeclaration(diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swiftindex 4aee5869..58d13e31 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift@@ -251,6 +251,8 @@ public enum FirmwarePatchSetCatalog {"preboot-cfw-devicetree_microphone_array",RestoreRamDiskSealPatcher.patchIdentifier,"system-apps-cfw-attitude",+ FirmwareGuestSystemPatchSet.signInSheets,+ FirmwareGuestSystemPatchSet.followUpGroups,"system-backboardd-cfw-gyroscope","system-backboardd-cfw-accelerometer","system-campo-cfw-entitlements",diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swiftindex ff2474c6..36b89e3b 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift@@ -1555,6 +1555,8 @@ struct VPhoneCustomFirmwareInstaller {try system.removeItem(glowPath)}for (identifier, library) in [+ (FirmwareGuestSystemPatchSet.followUpGroups, "libprefsfix.dylib"),+ (FirmwareGuestSystemPatchSet.signInSheets, "libsigninfix.dylib"),(FirmwareGuestSystemPatchSet.gyroscope, "libvphonegyro.dylib"),(FirmwareGuestSystemPatchSet.accelerometer, "libvphoneaccelerometer.dylib"),(FirmwareGuestSystemPatchSet.attitude, "libvphoneattitude.dylib"),diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plistindex ef66455f..e87fe94a 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/homepod-mini.plist@@ -105,6 +105,8 @@<string>preboot-homepod-exp-audio_product</string><string>restoreramdisk-boot-apfs_sha3_hash</string><string>system-apps-cfw-attitude</string>+ <string>system-apps-cfw-signin_sheets</string>+ <string>system-preferences-cfw-followup_groups</string><string>system-backboardd-cfw-gyroscope</string><string>system-backboardd-cfw-accelerometer</string><string>system-campo-cfw-entitlements</string>diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos-4k.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos-4k.plistindex cec02f3e..1e89a07b 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos-4k.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos-4k.plist@@ -115,6 +115,8 @@<string>preboot-cfw-devicetree_microphone_array</string><string>restoreramdisk-boot-apfs_sha3_hash</string><string>system-apps-cfw-attitude</string>+ <string>system-apps-cfw-signin_sheets</string>+ <string>system-preferences-cfw-followup_groups</string><string>system-bluetoothd-cfw-btvc_le_connection</string><string>system-backboardd-cfw-gyroscope</string><string>system-backboardd-cfw-accelerometer</string>diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos.plistindex 47dbcb70..768d01e3 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/tvos.plist@@ -118,6 +118,8 @@<string>preboot-cfw-devicetree_microphone_array</string><string>restoreramdisk-boot-apfs_sha3_hash</string><string>system-apps-cfw-attitude</string>+ <string>system-apps-cfw-signin_sheets</string>+ <string>system-preferences-cfw-followup_groups</string><string>system-bluetoothd-cfw-btvc_le_connection</string><string>system-backboardd-cfw-gyroscope</string><string>system-backboardd-cfw-accelerometer</string>diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swiftindex 08c76339..a1607638 100644--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneGuestEnvironment.swift@@ -25,5 +25,8 @@ public enum VPhoneGuestEnvironment {/// Selection installs/removes these. A live hash sync may replace an/// installed copy, but must never reinstall a patch the user turned off.- public static let selectedLibraries: Set<String> = ["libvphonegyro.dylib", "libvphoneaccelerometer.dylib", "libvphoneattitude.dylib"]+ public static let selectedLibraries: Set<String> = [+ "libprefsfix.dylib", "libsigninfix.dylib",+ "libvphonegyro.dylib", "libvphoneaccelerometer.dylib", "libvphoneattitude.dylib",+ ]}