Run a virtual iPhone on an Apple Silicon Mac.
Swift
chore: swift format 6.2
Lakr657755eb99fb
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheIOMFBSwapEndPatcher.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheIOMFBSwapEndPatcher.swiftindex 036e64e4..57539aaf 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheIOMFBSwapEndPatcher.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheIOMFBSwapEndPatcher.swift@@ -313,7 +313,7 @@ public enum DyldSharedCacheIOMFBSwapEndPatcher {/// a change in how an operand renders cannot move the site.static func movRegisterImmediate(_ instruction: ARM64Instruction,- disassembler: ARM64Disassembler,+ disassembler _: ARM64Disassembler,) -> (register: String, immediate: Int64)? {guard instruction.mnemonic == "mov" else { return nil }guard let operands = instruction.detail?.operands, operands.count == 2,diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheXPCLWCRPatcher.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheXPCLWCRPatcher.swiftindex ba227660..b030bf38 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheXPCLWCRPatcher.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/DyldSharedCache/Patchers/DyldSharedCacheXPCLWCRPatcher.swift@@ -385,7 +385,7 @@ public enum DyldSharedCacheXPCLWCRPatcher {static func register(_ insn: ARM64Instruction,_ index: Int,- _ disassembler: ARM64Disassembler,+ _: ARM64Disassembler,) -> String? {guard let operands = insn.detail?.operands, index < operands.count else { return nil }let operand = operands[index]diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelPatcherBase.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelPatcherBase.swiftindex c33a9fd3..0f4c781a 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelPatcherBase.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Kernel/KernelPatcherBase.swift@@ -28,7 +28,9 @@ open class KernelPatcherBase {////// ``BufferedPatcher`` is how the pipeline reads a component's result, so the/// three concrete kernel patchers satisfy it from here.- public var patchedData: Data { buffer.data }+ public var patchedData: Data {+ buffer.data+ }/// Base virtual address of the kernelcache __TEXT segment.public var baseVA: UInt64 = 0diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareExternalPatchSets.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareExternalPatchSets.swiftindex a787b4e5..38448d05 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareExternalPatchSets.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareExternalPatchSets.swift@@ -27,16 +27,18 @@ final class FirmwareExternalPatchSets {private var loaded: [String: Loaded] = [:]- var isEmpty: Bool { loaded.isEmpty }+ var isEmpty: Bool {+ loaded.isEmpty+ }/// Map the set's executable and keep its principal for the rest of the run.////// The caller has already validated the manifest; this is the step that starts/// running the set's code.func add(_ bundle: VPhonePatchSetBundle) throws {- loaded[bundle.manifest.identifier] = Loaded(+ loaded[bundle.manifest.identifier] = try Loaded(bundle: bundle,- principal: try bundle.loadPrincipal(),+ principal: bundle.loadPrincipal(),)}diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swiftindex 6b47b75c..4d08c03a 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift@@ -17,8 +17,8 @@ import VPhonePatchKit@Suite("Bundled patch set catalogue")struct FirmwarePatchSetCatalogTests {- @Test("Every bundled set has a unique identifier and no duplicate patches")- func identifiersAreUnique() {+ @Test+ func `Every bundled set has a unique identifier and no duplicate patches`() {let setIdentifiers = FirmwarePatchSetCatalog.bundled.map(\.identifier)#expect(Set(setIdentifiers).count == setIdentifiers.count)@@ -26,8 +26,8 @@ struct FirmwarePatchSetCatalogTests {#expect(Set(patchIdentifiers).count == patchIdentifiers.count)}- @Test("No patch identifier is a record-site prefix of another")- func noAmbiguousPrefixes() {+ @Test+ func `No patch identifier is a record-site prefix of another`() {// Two declarations where one is a site of the other would make record// attribution depend on the order they happen to be checked in. The// resolver picks the longest, but a catalogue that needs that rule to@@ -41,8 +41,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("Every patch has a title, and a summary if it is boot-essential")- func patchesAreDescribed() {+ @Test+ func `Every patch has a title, and a summary if it is boot-essential`() {for patch in FirmwarePatchSetCatalog.allDeclarations {#expect(!patch.title.isEmpty, "\(patch.identifier) has no title")// The editor shows these beside a checkbox someone may untick. A@@ -53,8 +53,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("Every shipped preset resolves on each supported base")- func presetsResolve() throws {+ @Test+ func `Every shipped preset resolves on each supported base`() throws {for preset in FirmwarePatchSetCatalog.builtInPresets {for base in ["18.6.2", "26.0", "26.4", "27.0"] {for cloud in ["26.1", "26.4"] {@@ -76,8 +76,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("A preset resolves even when no version could be read")- func presetsResolveWithoutVersions() throws {+ @Test+ func `A preset resolves even when no version could be read`() throws {// `fw patch` can run against a tree whose manifests it could not parse.// Resolution must still succeed; the version-gated patches simply skip.let plan = try VPhonePatchPlan.resolve(@@ -90,8 +90,8 @@ struct FirmwarePatchSetCatalogTests {#expect(!plan.skippedByVersion.isEmpty)}- @Test("Standard leaves every manual-only patch off, on every base")- func standardExcludesManualOnly() throws {+ @Test+ func `Standard leaves every manual-only patch off, on every base`() throws {for base in ["18.6.2", "26.4", "27.0"] {let plan = try VPhonePatchPlan.resolve(preset: FirmwarePatchSetCatalog.standardPreset,@@ -105,8 +105,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("Extended is standard plus the manual-only patches, and nothing else")- func extendedDiffersOnlyByManualOnly() throws {+ @Test+ func `Extended is standard plus the manual-only patches, and nothing else`() throws {let standard = try VPhonePatchPlan.resolve(preset: FirmwarePatchSetCatalog.standardPreset,patchSets: FirmwarePatchSetCatalog.bundled,@@ -123,8 +123,8 @@ struct FirmwarePatchSetCatalogTests {#expect(standard.enabled.subtracting(extended.enabled).isEmpty)}- @Test("The two patches pinned by release are off everywhere else")- func versionPinnedPatchesAreOffByDefault() throws {+ @Test+ func `The two patches pinned by release are off everywhere else`() throws {// These two were flags once (`--force-exc-guard`, `--force-dsc-maxslide`).// They are now pinned to the release that needs them, so a base that does// not need them never gets them from a preset.@@ -145,8 +145,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("The Frida relaxations need cloudOS 26.4")- func fridaNeedsCapableCloudOS() throws {+ @Test+ func `The Frida relaxations need cloudOS 26.4`() throws {for cloud in ["26.1", "26.4"] {let plan = try VPhonePatchPlan.resolve(preset: FirmwarePatchSetCatalog.extendedPreset,@@ -161,8 +161,8 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("The hv_vmm_present halves move together, and only extended has them")- func hypervisorConcealmentIsOptInAsAPair() throws {+ @Test+ func `The hv_vmm_present halves move together, and only extended has them`() throws {// Two patches, one behaviour: the kernel OID rename and the shared-cache// mangle. A plan holding one without the other is broken either way round —// the rename alone breaks the graphics and ML paths, the mangle alone does@@ -199,23 +199,23 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("Every set's manifest survives a plist round trip")- func manifestsRoundTrip() throws {+ @Test+ func `Every set's manifest survives a plist round trip`() throws {for manifest in FirmwarePatchSetCatalog.bundled {let decoded = try VPhonePatchSetManifest.decode(manifest.encodedPlist())#expect(decoded == manifest, "\(manifest.identifier) did not round trip")}}- @Test("Every built-in preset survives a plist round trip")- func presetsRoundTrip() throws {+ @Test+ func `Every built-in preset survives a plist round trip`() throws {for preset in FirmwarePatchSetCatalog.builtInPresets {#expect(try VPhonePatchPreset.decode(preset.encodedPlist()) == preset)}}- @Test("The shipped preset plists match the built-in copies")- func shippedPresetsMatchBuiltIns() throws {+ @Test+ func `The shipped preset plists match the built-in copies`() throws {// The bundle reads the plists; a dev build falls back to the Swift copies.// They have to agree, or a VM built from an Xcode build and a VM built from// a staged bundle would get different patches.@@ -233,13 +233,13 @@ struct FirmwarePatchSetCatalogTests {}}- @Test("Standard comes first in a picker")- func standardSortsFirst() throws {+ @Test+ func `Standard comes first in a picker`() {#expect(FirmwarePatchSetCatalog.builtInPresets.first?.isStandard == true)}- @Test("No bundled set is external, so root cfw install never loads a file")- func bundledSetsOnly() {+ @Test+ func `No bundled set is external, so root cfw install never loads a file`() {for preset in FirmwarePatchSetCatalog.builtInPresets {#expect(!preset.usesExternalPatchSets)}diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetLoaderTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetLoaderTests.swiftindex 5a65d8ac..581e384e 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetLoaderTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetLoaderTests.swift@@ -50,7 +50,7 @@ private enum ExamplePatchSet {)try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)try? FileManager.default.removeItem(at: copy)- try FileManager.default.copyItem(at: try url(), to: copy)+ try FileManager.default.copyItem(at: url(), to: copy)try codesign(copy)return copy}@@ -78,9 +78,9 @@ private enum ExamplePatchSet {@Suite("Patch set bundles are read before they are loaded")struct PatchSetInspectionTests {- @Test("The manifest comes out of the bundle without loading any code")- func inspect() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `The manifest comes out of the bundle without loading any code`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())#expect(set.manifest.identifier == ExamplePatchSet.identifier)#expect(set.manifest.patches.count == 1)let patch = try #require(set.manifest.patches.first)@@ -91,16 +91,16 @@ struct PatchSetInspectionTests {#expect(patch.applicability.matches(iOSBase: VPhoneVersion("27.0"), cloudOS: nil))}- @Test("Anything that is not a patch set bundle is refused")- func notABundle() throws {+ @Test+ func `Anything that is not a patch set bundle is refused`() throws {let plain = URL(fileURLWithPath: "/usr/bin/codesign")#expect(throws: VPhonePatchSetError.notABundle(path: plain.path)) {try VPhonePatchSetBundle.inspect(at: plain)}}- @Test("A path with the right extension but no manifest is refused")- func missingManifest() throws {+ @Test+ func `A path with the right extension but no manifest is refused`() throws {let directory = ExamplePatchSet.temporaryDirectory()let empty = directory.appendingPathComponent("Empty.\(VPhonePatchSetBundle.pathExtension)",@@ -129,9 +129,9 @@ struct PatchSetInspectionTests {@Suite("What a patch set has to satisfy before it is loaded")struct PatchSetValidationTests {- @Test("The identifier the preset pinned has to be the one the manifest declares")- func identifierMismatch() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `The identifier the preset pinned has to be the one the manifest declares`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())#expect(throws: VPhonePatchSetError.identifierMismatch(path: set.url.path,expected: "com.example.other",@@ -143,9 +143,9 @@ struct PatchSetValidationTests {}}- @Test("A set built against a newer PatchKit is refused")- func patchKitTooOld() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A set built against a newer PatchKit is refused`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let ancient = try #require(VPhoneVersion("0.1"))#expect(throws: VPhonePatchSetError.patchKitTooOld(patchSet: ExamplePatchSet.identifier,@@ -158,8 +158,8 @@ struct PatchSetValidationTests {#expect(set.manifest.minimumPatchKitVersion <= .currentPatchKit)}- @Test("An ad hoc signed copy passes every check the loader makes")- func sealedCopyValidates() throws {+ @Test+ func `An ad hoc signed copy passes every check the loader makes`() throws {let directory = ExamplePatchSet.temporaryDirectory()defer { try? FileManager.default.removeItem(at: directory) }let copy = try ExamplePatchSet.sealedCopy(into: directory)@@ -171,8 +171,8 @@ struct PatchSetValidationTests {#expect(try !set.codeDirectoryHash().isEmpty)}- @Test("A set altered after signing no longer validates")- func tamperedCopyFails() throws {+ @Test+ func `A set altered after signing no longer validates`() throws {let directory = ExamplePatchSet.temporaryDirectory()defer { try? FileManager.default.removeItem(at: directory) }let copy = try ExamplePatchSet.sealedCopy(into: directory)@@ -206,9 +206,9 @@ struct PatchSetValidationTests {}}- @Test("A boot-chain-only set has no guest-side patch to refuse")- func bootChainOnly() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A boot-chain-only set has no guest-side patch to refuse`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let guestSide = set.manifest.patches.filter { !$0.target.isBootChain }#expect(guestSide.isEmpty)// The refusal itself is the resolver's rule and is covered where the@@ -243,8 +243,8 @@ struct PatchSetLoadingTests {)}- @Test("The exported factory loads and resolves VPhonePatchKit at runtime")- func loadPrincipal() throws {+ @Test+ func `The exported factory loads and resolves VPhonePatchKit at runtime`() throws {// Two things are load-bearing here. The link: the bundle's executable names// `@rpath/VPhonePatchKit.framework`, and dyld has to find the same framework// this process already has — a second copy would make the cast inside@@ -252,17 +252,17 @@ struct PatchSetLoadingTests {// different types. And the entry point: the set is reached through the C// symbol it exports, not through `NSPrincipalClass`, which cannot work for a// class whose superclass is resilient.- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()#expect(String(describing: type(of: principal)) == "VPhoneExamplePatchSet")// Loading twice hands back a second principal rather than failing: dlopen on// a mapped image returns its handle.- #expect(String(describing: type(of: try set.loadPrincipal())) == "VPhoneExamplePatchSet")+ #expect(try String(describing: type(of: set.loadPrincipal())) == "VPhoneExamplePatchSet")}- @Test("A component the manifest never declared is a loud error")- func componentUnsupported() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A component the manifest never declared is a loud error`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()var thrown: (any Error)?do {@@ -283,9 +283,9 @@ struct PatchSetLoadingTests {#expect(component == VPhoneFirmwareComponent.kernelcache.rawValue)}- @Test("The loaded patcher rewrites the string the preset named")- func patcherRewritesString() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `The loaded patcher rewrites the string the preset named`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()let original = Self.syntheticIBEC(anchor: "VPHONE-ANCHOR")@@ -308,14 +308,14 @@ struct PatchSetLoadingTests {let buffer = BinaryBuffer(patched)#expect(buffer.findAll(Data("VPHONE-ANCHOR".utf8)).isEmpty)let sites = buffer.findAll(Data("vphone-patch".utf8))- #expect(sites == [try #require(records.first).fileOffset])+ #expect(try sites == [#require(records.first).fileOffset])// The byte the shorter replacement freed is a NUL, not the old tail.- #expect(patched[try #require(sites.first) + 12] == 0)+ #expect(try patched[#require(sites.first) + 12] == 0)}- @Test("A replacement longer than the anchor is refused rather than shifting bytes")- func replacementCannotGrow() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A replacement longer than the anchor is refused rather than shifting bytes`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()let patcher = try principal.makePatcher(for: .iBEC,@@ -328,9 +328,9 @@ struct PatchSetLoadingTests {#expect(throws: (any Error).self) { try patcher.findAll() }}- @Test("A patcher whose patch the plan turned off writes nothing")- func gateTurnsThePatchOff() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A patcher whose patch the plan turned off writes nothing`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()let original = Self.syntheticIBEC(anchor: "VPHONE-ANCHOR")let parameters = [@@ -370,9 +370,9 @@ struct PatchSetLoadingTests {#expect(on.patchedData != original)}- @Test("Without the preset's parameters the set patches nothing")- func noParametersNoPatch() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `Without the preset's parameters the set patches nothing`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let principal = try set.loadPrincipal()let original = Self.syntheticIBEC(anchor: "VPHONE-ANCHOR")let patcher = try principal.makePatcher(@@ -402,9 +402,9 @@ struct PatchSetPlanIntegrationTests {)}- @Test("A preset naming the set by path resolves to its manifest")- func resolvesExternalReference() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A preset naming the set by path resolves to its manifest`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let plan = try VPhonePatchPlan.resolve(preset: preset(path: set.url.path),patchSets: [set.manifest],@@ -418,9 +418,9 @@ struct PatchSetPlanIntegrationTests {#expect(set.enabledComponents(in: plan) == [.iBEC])}- @Test("A set whose every patch is off is asked for no patcher at all")- func allPatchesOffContributesNothing() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `A set whose every patch is off is asked for no patcher at all`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())let plan = try VPhonePatchPlan.resolve(preset: preset(path: set.url.path,@@ -434,8 +434,8 @@ struct PatchSetPlanIntegrationTests {#expect(set.enabledComponents(in: plan).isEmpty)}- @Test("The pipeline loads the set the preset names and runs it over iBEC")- func pipelineRunsAnExternalSet() throws {+ @Test+ func `The pipeline loads the set the preset names and runs it over iBEC`() throws {// The whole path, without a restore tree: resolvePlan opens the bundle the// preset names — signature required, identifier pinned — buildComponentList// appends its patcher to the iBEC component, and patchData runs it.@@ -490,16 +490,16 @@ struct PatchSetPlanIntegrationTests {#expect(patched.count == anchored.count)}- @Test("A set the preset pins but never imported stops the run")- func unsignedExternalSetIsRefused() throws {+ @Test+ func `A set the preset pins but never imported stops the run`() throws {// The built product is linker-signed with no sealed resources, which is what// a set nobody imported looks like. resolvePlan has to refuse it rather than// load it, and the message has to point at `patchset import`.- let pipeline = FirmwarePipeline(+ let pipeline = try FirmwarePipeline(vmDirectory: URL(fileURLWithPath: NSTemporaryDirectory()),variant: .jb,verbose: false,- preset: preset(path: try ExamplePatchSet.url().path),+ preset: preset(path: ExamplePatchSet.url().path),patchSets: FirmwarePatchSetCatalog.bundled,)var thrown: (any Error)?@@ -517,9 +517,9 @@ struct PatchSetPlanIntegrationTests {}}- @Test("The preset has to name the identifier the file declares")- func presetPinsIdentity() throws {- let set = try VPhonePatchSetBundle.inspect(at: try ExamplePatchSet.url())+ @Test+ func `The preset has to name the identifier the file declares`() throws {+ let set = try VPhonePatchSetBundle.inspect(at: ExamplePatchSet.url())// What `resolvePlan` does with a preset whose pinned identifier does not// match the bundle at the path: refuse before loading, so swapping the file// cannot silently change which patches apply.diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetModelTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetModelTests.swiftindex a31f9fc4..a3440319 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetModelTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/PatchSetModelTests.swift@@ -14,8 +14,8 @@ import VPhonePatchKit@Suite("Version requirements")struct VPhoneVersionRequirementTests {- @Test("A product version splits into major, minor and patch")- func parsing() {+ @Test+ func `A product version splits into major, minor and patch`() {#expect(VPhoneVersion("27")?.major == 27)#expect(VPhoneVersion("27")?.minor == 0)#expect(VPhoneVersion("26.4")?.minor == 4)@@ -28,15 +28,15 @@ struct VPhoneVersionRequirementTests {#expect(VPhoneVersion("1.2.3.4") == nil)}- @Test("Trailing zeros do not change a version")- func trailingZeros() {+ @Test+ func `Trailing zeros do not change a version`() throws {#expect(VPhoneVersion("27") == VPhoneVersion("27.0"))#expect(VPhoneVersion("27.0") == VPhoneVersion("27.0.0"))- #expect(VPhoneVersion("26.4")! < VPhoneVersion("26.4.1")!)+ #expect(try #require(VPhoneVersion("26.4")) < VPhoneVersion("26.4.1")!)}- @Test("Each requirement matches exactly the releases it names")- func matching() {+ @Test+ func `Each requirement matches exactly the releases it names`() {let eighteen = VPhoneVersion("18.6.2")let twentySixZero = VPhoneVersion("26.0")let twentySixFour = VPhoneVersion("26.4")@@ -59,8 +59,8 @@ struct VPhoneVersionRequirementTests {#expect(!either.matches(twentySixFour))}- @Test("A version gate never matches an unreadable version")- func unknownVersion() {+ @Test+ func `A version gate never matches an unreadable version`() {// The one case that must not fail open: a patch pinned to a release must// not apply when nothing knows which release this is.for requirement: VPhoneVersionRequirement in [@@ -73,8 +73,8 @@ struct VPhoneVersionRequirementTests {}}- @Test("A requirement survives a plist round trip")- func coding() throws {+ @Test+ func `A requirement survives a plist round trip`() throws {let cases: [VPhoneVersionRequirement] = [.any,.major(27),@@ -91,8 +91,8 @@ struct VPhoneVersionRequirementTests {}}- @Test("An empty OneOf is refused, because it would match nothing")- func emptyOneOf() throws {+ @Test+ func `An empty OneOf is refused, because it would match nothing`() throws {let plist = """<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><array><dict>@@ -113,8 +113,8 @@ struct VPhoneVersionRequirementTests {@Suite("Patch selection")struct VPhonePatchSelectionTests {- @Test("All, allow and block each answer for a patch nobody named")- func includes() {+ @Test+ func `All, allow and block each answer for a patch nobody named`() {#expect(VPhonePatchSelection.all.includes("anything"))#expect(VPhonePatchSelection.allow(["a"]).includes("a"))#expect(!VPhonePatchSelection.allow(["a"]).includes("b"))@@ -122,8 +122,8 @@ struct VPhonePatchSelectionTests {#expect(VPhonePatchSelection.block(["a"]).includes("b"))}- @Test("Unchecking a box narrows every kind of selection")- func blocking() {+ @Test+ func `Unchecking a box narrows every kind of selection`() {#expect(VPhonePatchSelection.all.blocking(["a"]) == .block(["a"]))#expect(VPhonePatchSelection.allow(["a", "b"]).blocking(["a"]) == .allow(["b"]))#expect(VPhonePatchSelection.block(["a"]).blocking(["b"]) == .block(["a", "b"]))@@ -131,15 +131,15 @@ struct VPhonePatchSelectionTests {#expect(VPhonePatchSelection.allow(["a"]).blocking([]) == .allow(["a"]))}- @Test("Checking a box widens every kind of selection")- func allowing() {+ @Test+ func `Checking a box widens every kind of selection`() {#expect(VPhonePatchSelection.all.allowing(["a"]) == .all)#expect(VPhonePatchSelection.allow(["a"]).allowing(["b"]) == .allow(["a", "b"]))#expect(VPhonePatchSelection.block(["a", "b"]).allowing(["a"]) == .block(["b"]))}- @Test("A selection survives a plist round trip")- func coding() throws {+ @Test+ func `A selection survives a plist round trip`() throws {for selection: VPhonePatchSelection in [.all, .allow(["a", "b"]), .block(["c"])] {let encoder = PropertyListEncoder()encoder.outputFormat = .xml@@ -157,8 +157,8 @@ struct VPhonePatchDeclarationTests {VPhonePatchDeclaration(identifier: identifier, title: identifier, target: .firmware(.kernelcache))}- @Test("A declaration covers its own record and its per-site records")- func covers() {+ @Test+ func `A declaration covers its own record and its per-site records`() {let kcall = declaration("jb.kcall10")#expect(kcall.covers(recordIdentifier: "jb.kcall10"))#expect(kcall.covers(recordIdentifier: "jb.kcall10.sy_call"))@@ -170,15 +170,15 @@ struct VPhonePatchDeclarationTests {#expect(sandbox.covers(recordIdentifier: "sandbox_ext_267"))}- @Test("A bare textual prefix is not a site")- func doesNotOverreach() {+ @Test+ func `A bare textual prefix is not a site`() {let debugger = declaration("kernel.debugger")#expect(!debugger.covers(recordIdentifier: "kernel.debuggerless"))#expect(!debugger.covers(recordIdentifier: "kernel.debug"))}- @Test("A declaration survives a plist round trip, including its target")- func coding() throws {+ @Test+ func `A declaration survives a plist round trip, including its target`() throws {let cases: [VPhonePatchTarget] = [.firmware(.kernelcache),.dyldSharedCache,@@ -203,8 +203,8 @@ struct VPhonePatchDeclarationTests {}}- @Test("A guest path must be absolute inside the guest")- func relativeGuestPathRefused() throws {+ @Test+ func `A guest path must be absolute inside the guest`() throws {let plist = """<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><array><dict>@@ -269,8 +269,8 @@ struct VPhonePatchPlanTests {)}- @Test("A resolved plan turns on what the selection and the version gate agree on")- func enabled() throws {+ @Test+ func `A resolved plan turns on what the selection and the version gate agree on`() throws {let sets = [set("a", patches: [patch("always"),patch("only27", applicability: VPhonePatchApplicability(iOSBase: .major(27))),@@ -290,8 +290,8 @@ struct VPhonePatchPlanTests {#expect(!plan.isEnabled("only27"))}- @Test("A VM's own boxes compose onto the preset")- func overrides() throws {+ @Test+ func `A VM's own boxes compose onto the preset`() throws {let sets = [set("a", patches: [patch("one"), patch("two"), patch("three")])]let plan = try VPhonePatchPlan.resolve(preset: preset(["a"], selection: .block(["two", "three"])),@@ -304,8 +304,8 @@ struct VPhonePatchPlanTests {#expect(plan.enabled == ["two"])}- @Test("Checking a box cannot defeat a version gate")- func overrideRespectsVersion() throws {+ @Test+ func `Checking a box cannot defeat a version gate`() throws {let sets = [set("a", patches: [patch("only27", applicability: VPhonePatchApplicability(iOSBase: .major(27))),])]@@ -320,8 +320,8 @@ struct VPhonePatchPlanTests {#expect(plan.skippedByVersion == ["only27"])}- @Test("A record maps back to the declaration that owns it")- func recordAttribution() throws {+ @Test+ func `A record maps back to the declaration that owns it`() throws {let sets = [set("a", patches: [patch("kernel.sandbox"), patch("kernel.sandbox.mount_check_mount")])]let plan = try VPhonePatchPlan.resolve(preset: preset(["a"], selection: .allow(["kernel.sandbox"])),@@ -342,8 +342,8 @@ struct VPhonePatchPlanTests {#expect(!plan.isRecordEnabled("something.else"))}- @Test("A preset naming an absent set is an error")- func unknownPatchSet() {+ @Test+ func `A preset naming an absent set is an error`() {#expect(throws: VPhonePatchPlanError.unknownPatchSet(preset: "test", patchSet: "b")) {try VPhonePatchPlan.resolve(preset: preset(["b"]),@@ -354,8 +354,8 @@ struct VPhonePatchPlanTests {}}- @Test("A selection naming a patch nothing declares is an error")- func unknownPatch() {+ @Test+ func `A selection naming a patch nothing declares is an error`() {// The point of checking: a typo in a prewritten preset would otherwise be// an allow list that turns nothing on, or a block list that blocks nothing.#expect(throws: VPhonePatchPlanError.unknownPatch(preset: "test", identifier: "typo")) {@@ -368,8 +368,8 @@ struct VPhonePatchPlanTests {}}- @Test("Two sets declaring the same patch is an error")- func duplicatePatch() {+ @Test+ func `Two sets declaring the same patch is an error`() {#expect(throws: (any Error).self) {try VPhonePatchPlan.resolve(preset: preset(["a", "b"]),@@ -383,8 +383,8 @@ struct VPhonePatchPlanTests {}}- @Test("An unmet requirement is an error")- func missingRequirement() {+ @Test+ func `An unmet requirement is an error`() {#expect(throws: VPhonePatchPlanError.missingRequirement(patchSet: "b", capability: "cap.a")) {try VPhonePatchPlan.resolve(preset: preset(["b"]),@@ -398,8 +398,8 @@ struct VPhonePatchPlanTests {}}- @Test("A conflict is an error from either side")- func conflictIsSymmetric() throws {+ @Test+ func `A conflict is an error from either side`() throws {let a = set("a", patches: [patch("one")], provides: ["cap.a"])let bDeclares = set("b", patches: [patch("two")], conflictsWith: ["cap.a"])let bSilent = set("b", patches: [patch("two")], provides: ["cap.b"])@@ -426,8 +426,8 @@ struct VPhonePatchPlanTests {}}- @Test("A set needing a newer PatchKit is refused")- func patchKitTooOld() {+ @Test+ func `A set needing a newer PatchKit is refused`() {#expect(throws: (any Error).self) {try VPhonePatchPlan.resolve(preset: preset(["a"]),@@ -442,8 +442,8 @@ struct VPhonePatchPlanTests {}}- @Test("After puts the sets in order, and a cycle is an error")- func ordering() throws {+ @Test+ func `After puts the sets in order, and a cycle is an error`() throws {let plan = try VPhonePatchPlan.resolve(preset: preset(["c", "b", "a"]),patchSets: [@@ -469,8 +469,8 @@ struct VPhonePatchPlanTests {}}- @Test("A blocked boot-essential patch is reported, not refused")- func droppedBootEssentials() throws {+ @Test+ func `A blocked boot-essential patch is reported, not refused`() throws {// Blocking one is allowed: that is how an external set replaces it. It// must never be quiet, though.let plan = try VPhonePatchPlan.resolve(@@ -483,8 +483,8 @@ struct VPhonePatchPlanTests {#expect(plan.enabled == ["other"])}- @Test("A plan knows whether a component has anything left to do")- func componentExpectations() throws {+ @Test+ func `A plan knows whether a component has anything left to do`() throws {let sets = [VPhonePatchSetManifest(identifier: "a",name: "a",@@ -508,23 +508,23 @@ struct VPhonePatchPlanTests {@Suite("Patch gate")struct VPhonePatchGateTests {- @Test("An unrestricted gate applies everything")- func unrestricted() {+ @Test+ func `An unrestricted gate applies everything`() {let gate = VPhonePatchGate.unrestricted#expect(gate.isUnrestricted)#expect(gate.allows(record: "anything"))#expect(!gate.isUndeclared(record: "anything"))}- @Test("A gate answers about record identifiers, not just declarations")- func records() {+ @Test+ func `A gate answers about record identifiers, not just declarations`() {let gate = VPhonePatchGate(declared: ["jb.kcall10", "sandbox_ext"], enabled: ["jb.kcall10"])#expect(gate.allows(record: "jb.kcall10.sy_call"))#expect(!gate.allows(record: "sandbox_ext_267"))}- @Test("An undeclared record applies, and says so")- func undeclaredFailsOpen() {+ @Test+ func `An undeclared record applies, and says so`() {// Dropping bytes over a missing declaration would change the firmware// silently. Applying it and flagging the gap is the safer failure.let gate = VPhonePatchGate(declared: ["known"], enabled: [])@@ -534,8 +534,8 @@ struct VPhonePatchGateTests {#expect(!gate.allows(record: "known"))}- @Test("The longest declaration owns a record")- func longestWins() {+ @Test+ func `The longest declaration owns a record`() {let gate = VPhonePatchGate(declared: ["kernel.sandbox", "kernel.sandbox.mount_check_mount"],enabled: ["kernel.sandbox"],diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swiftindex d71de231..05e197e3 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift@@ -415,11 +415,21 @@ struct VPhoneCustomFirmwareInstaller {// The version branches stay: they and the declarations' applicability say// the same thing, and this is what a VM with no plan still follows.if version.hasPrefix("27.") {- if on("iomfb_force_kern") { try patch("patch-iomfb-force-kern", [dsc]) }- if on("dsc_maxslide.zero") { try patch("patch-dsc-maxslide", [dsc]) }- if on("lsd_embedded_reg.entitlement_gate") { try patch("patch-lsd-embedded-reg", [dsc]) }- if on("xpc_lwcr") { try patch("patch-xpc-lwcr", [dsc]) }- if on("lockdown_mode.sysctl_error_gate") { try patch("patch-lockdown-mode", [dsc]) }+ if on("iomfb_force_kern") {+ try patch("patch-iomfb-force-kern", [dsc])+ }+ if on("dsc_maxslide.zero") {+ try patch("patch-dsc-maxslide", [dsc])+ }+ if on("lsd_embedded_reg.entitlement_gate") {+ try patch("patch-lsd-embedded-reg", [dsc])+ }+ if on("xpc_lwcr") {+ try patch("patch-xpc-lwcr", [dsc])+ }+ if on("lockdown_mode.sysctl_error_gate") {+ try patch("patch-lockdown-mode", [dsc])+ }} else if version.hasPrefix("26.0") || version.hasPrefix("18.") {if on("dsc.iomfb_swapend") {try patch("patch-iomfb-swapend", [dsc, "--target-size", "0x560"])@@ -427,11 +437,15 @@ struct VPhoneCustomFirmwareInstaller {} else if forceDyldSharedCacheMaxSlide {// Superseded by the plan: `dsc_maxslide.zero` is pinned to iOS 27, so// a VM with a plan cannot force it onto a 26.x base any more.- if on("dsc_maxslide.zero") { try patch("patch-dsc-maxslide", [dsc, "--force"]) }+ if on("dsc_maxslide.zero") {+ try patch("patch-dsc-maxslide", [dsc, "--force"])+ }}// These former EXP patches pair with the kernel OID rename and the// camera DeviceTree additions in the public JB firmware pipeline.- if on("hv_vmm_dsc") { try patch("patch-hv-vmm-dsc", [dsc]) }+ if on("hv_vmm_dsc") {+ try patch("patch-hv-vmm-dsc", [dsc])+ }if on("camera_dsc") {try patch("patch-camera-dsc", [dsc, (dsc as NSString).appendingPathComponent("dyld_shared_cache_arm64e")])}@@ -464,7 +478,9 @@ struct VPhoneCustomFirmwareInstaller {preserveEntitlements: true,)}- if on("guest.gigalocker_rename") { try renameGigalocker(data: data) }+ if on("guest.gigalocker_rename") {+ try renameGigalocker(data: data)+ }if on("guest.gpu_bundle") {try installGPUBundle(restore: restore, system: system, owner: owner)}@@ -485,9 +501,15 @@ struct VPhoneCustomFirmwareInstaller {verb: "patch-mobileactivationd",)}- if on("watchdogd.hv_vmm_cache") { try patchWatchdog(system: system, work: work) }- if on("guest.vphoned") { try installVphoned(system: system, work: work) }- if on("guest.environment") { try installEnvironment(system: system) }+ if on("watchdogd.hv_vmm_cache") {+ try patchWatchdog(system: system, work: work)+ }+ if on("guest.vphoned") {+ try installVphoned(system: system, work: work)+ }+ if on("guest.environment") {+ try installEnvironment(system: system)+ }if on("launchd_jetsam.panic_guard_bypass") {try patchMachO(system: system,@@ -498,7 +520,9 @@ struct VPhoneCustomFirmwareInstaller {injectedDylibPath: "/vh",)}- if on("guest.debugserver") { try patchDebugserver(system: system, work: work) }+ if on("guest.debugserver") {+ try patchDebugserver(system: system, work: work)+ }if version.hasPrefix("27."), on("campo.entitlements") {try patchCampo(system: system, work: work)}diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swiftindex 6567ef9d..db98057c 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift@@ -371,7 +371,7 @@ struct VPhoneFirmwarePatchesCommand: ParsableCommand {if let name {let resolvedName = try VPhoneVirtualMachineSelection.resolveExisting(name, in: lib.library)vmName = resolvedName- selection = VPhonePatchPresetStore.selection(forVM: try lib.library.bundle(named: resolvedName).url)+ selection = try VPhonePatchPresetStore.selection(forVM: lib.library.bundle(named: resolvedName).url)}if let preset {selection.presetIdentifier = preset@@ -392,7 +392,7 @@ struct VPhoneFirmwarePatchesCommand: ParsableCommand {presets: presets,)if json {- print(try report.jsonText())+ try print(report.jsonText())} else {print(report.text())}diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swiftindex 7bf54f29..1e9cec7f 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift@@ -176,8 +176,12 @@ public struct VPhonePatchCatalogReport: Sendable {}let box = entry.enabled ? "[x]" : "[ ]"var notes: [String] = []- if entry.applicability != "any" { notes.append(entry.applicability) }- if entry.bootEssential { notes.append("boot-essential") }+ if entry.applicability != "any" {+ notes.append(entry.applicability)+ }+ if entry.bootEssential {+ notes.append("boot-essential")+ }let suffix = notes.isEmpty ? "" : " (\(notes.joined(separator: ", ")))"lines.append(" \(box) \(entry.identifier)\(suffix)")}diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetCommand.swiftindex dc96b1ba..f8ea4657 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetCommand.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetCommand.swift@@ -119,15 +119,23 @@ struct VPhonePatchSetInfoCommand: ParsableCommand {print("Identifier: \(manifest.identifier)")print("Name: \(manifest.name)")print("Version: \(manifest.version)")- if !manifest.summary.isEmpty { print("Summary: \(manifest.summary)") }+ if !manifest.summary.isEmpty {+ print("Summary: \(manifest.summary)")+ }print("Needs: PatchKit \(manifest.minimumPatchKitVersion)"+ " (this is \(VPhoneVersion.currentPatchKit))")- if !manifest.provides.isEmpty { print("Provides: \(manifest.provides.joined(separator: ", "))") }- if !manifest.requires.isEmpty { print("Requires: \(manifest.requires.joined(separator: ", "))") }+ if !manifest.provides.isEmpty {+ print("Provides: \(manifest.provides.joined(separator: ", "))")+ }+ if !manifest.requires.isEmpty {+ print("Requires: \(manifest.requires.joined(separator: ", "))")+ }if !manifest.conflictsWith.isEmpty {print("Conflicts: \(manifest.conflictsWith.joined(separator: ", "))")}- if !manifest.after.isEmpty { print("After: \(manifest.after.joined(separator: ", "))") }+ if !manifest.after.isEmpty {+ print("After: \(manifest.after.joined(separator: ", "))")+ }print("\nPatches (\(manifest.patches.count)):")for patch in manifest.patches {let essential = patch.bootEssential ? " [boot-essential]" : ""@@ -186,7 +194,7 @@ struct VPhonePatchSetImportCommand: ParsableCommand {print("[patchset import] \(installed.manifest.identifier) \(installed.manifest.version)"+ " — \(installed.manifest.patches.count) patches")print(" \(installed.url.path)")- print(" cdhash \(try installed.codeDirectoryHash())")+ try print(" cdhash \(installed.codeDirectoryHash())")// The real directory, not `~/.vphone`: a run with VPHONE_ROOT set reads its// presets from there, and a hint naming the wrong path is worse than none.print("\nName it from a preset in \(VPhonePatchPresetStore.userPresetsDirectory().path)/ as:")diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetStore.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetStore.swiftindex 8308a31c..9703d98f 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetStore.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchSetStore.swift@@ -93,7 +93,7 @@ public enum VPhonePatchSetStore {for name in names.sorted()where name.hasSuffix("." + VPhonePatchSetBundle.pathExtension){- sets.append(try VPhonePatchSetBundle.inspect(+ try sets.append(VPhonePatchSetBundle.inspect(at: directory.appendingPathComponent(name, isDirectory: true),))}@@ -138,11 +138,11 @@ public enum VPhonePatchSetStore {try installed.validate(expecting: candidate.manifest.identifier)var records = imported()- records[installed.manifest.identifier] = VPhoneImportedPatchSet(+ records[installed.manifest.identifier] = try VPhoneImportedPatchSet(identifier: installed.manifest.identifier,name: installed.manifest.name,version: installed.manifest.version,- codeDirectoryHash: try installed.codeDirectoryHash(),+ codeDirectoryHash: installed.codeDirectoryHash(),importedAt: Date(),)try write(records)diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/ARM64/ARM64Disassembler.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/ARM64/ARM64Disassembler.swiftindex 38ed5bf6..d9721f21 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/ARM64/ARM64Disassembler.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/ARM64/ARM64Disassembler.swift@@ -153,14 +153,14 @@ extension ARM64Operand {// MARK: - Register Identity-extension ARM64Register {- public static let invalid = ARM64Register(rawValue: AARCH64_REG_INVALID.rawValue)- public static let sp = ARM64Register(rawValue: AARCH64_REG_SP.rawValue)- public static let wzr = ARM64Register(rawValue: AARCH64_REG_WZR.rawValue)- public static let xzr = ARM64Register(rawValue: AARCH64_REG_XZR.rawValue)+public extension ARM64Register {+ static let invalid = ARM64Register(rawValue: AARCH64_REG_INVALID.rawValue)+ static let sp = ARM64Register(rawValue: AARCH64_REG_SP.rawValue)+ static let wzr = ARM64Register(rawValue: AARCH64_REG_WZR.rawValue)+ static let xzr = ARM64Register(rawValue: AARCH64_REG_XZR.rawValue)/// The 64-bit general register `x<number>`; x29 and x30 are FP and LR.- public static func x(_ number: Int) -> ARM64Register {+ static func x(_ number: Int) -> ARM64Register {precondition((0 ... 30).contains(number), "x\(number) is not a general register")return switch number {case 29: ARM64Register(rawValue: AARCH64_REG_FP.rawValue)@@ -170,13 +170,13 @@ extension ARM64Register {}/// The 32-bit general register `w<number>`.- public static func w(_ number: Int) -> ARM64Register {+ static func w(_ number: Int) -> ARM64Register {precondition((0 ... 30).contains(number), "w\(number) is not a general register")return ARM64Register(rawValue: AARCH64_REG_W0.rawValue + UInt32(number))}/// Canonical register name, such as "x0", "w1" or "wzr".- public var name: String? {+ var name: String? {guard let name = cs_reg_name(registerNameHandle, rawValue) else { return nil }return String(cString: name)}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Binary/BinaryBuffer.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Binary/BinaryBuffer.swiftindex 5179b7c8..ee7993ca 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Binary/BinaryBuffer.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Binary/BinaryBuffer.swift@@ -2,10 +2,10 @@import Foundation-extension Data {+public extension Data {/// Load a little-endian integer without assuming the buffer is naturally aligned.@inlinable- public func loadLE<T: FixedWidthInteger>(_: T.Type, at offset: Int) -> T {+ func loadLE<T: FixedWidthInteger>(_: T.Type, at offset: Int) -> T {precondition(offset >= 0 && offset + MemoryLayout<T>.size <= count)var value: T = .zero_ = Swift.withUnsafeMutableBytes(of: &value) { dst indiff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatchRecord.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatchRecord.swiftindex a1e8a763..8c0c7fd1 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatchRecord.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatchRecord.swift@@ -68,9 +68,9 @@ extension PatchRecord: CustomStringConvertible {}}-extension Data {+public extension Data {/// Lowercase hex, the spelling every patch log and record uses.- public var hex: String {+ var hex: String {map { String(format: "%02x", $0) }.joined()}}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatcherProtocol.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatcherProtocol.swiftindex 5daad30d..949aead7 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatcherProtocol.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/Patch/PatcherProtocol.swift@@ -36,38 +36,46 @@ public protocol BufferedPatcher: Patcher {var patchedData: Data { get }}-extension Patcher {+public extension Patcher {/// Log a message if verbose mode is enabled.- public func log(_ message: String) {+ func log(_ message: String) {if verbose {print(message)}}/// Every patch applies unless the patcher says otherwise.- public var gate: VPhonePatchGate { .unrestricted }+ var gate: VPhonePatchGate {+ .unrestricted+ }/// Whether the site emitting `recordIdentifier` should be written.- public func gateAllows(_ recordIdentifier: String) -> Bool {+ func gateAllows(_ recordIdentifier: String) -> Bool {gate.allowsReporting(record: recordIdentifier, component: component, verbose: verbose)}}-extension VPhonePatchGate {+public extension VPhonePatchGate {/// ``allows(record:)`` with the log line that explains the decision.////// The undeclared case is a manifest gap: the patch still applies, because/// dropping bytes over a missing declaration would change the firmware/// silently, and its warning prints whether or not verbose is on, so the gap/// shows up in an ordinary run.- public func allowsReporting(record recordIdentifier: String, component: String, verbose: Bool) -> Bool {- if isUnrestricted { return true }+ func allowsReporting(record recordIdentifier: String, component: String, verbose: Bool) -> Bool {+ if isUnrestricted {+ return true+ }if isUndeclared(record: recordIdentifier) {print(" [!] \(component): \(recordIdentifier) is declared by no patch set; applying it anyway")return true}- if allows(record: recordIdentifier) { return true }- if verbose { print(" [·] \(recordIdentifier): off in this preset") }+ if allows(record: recordIdentifier) {+ return true+ }+ if verbose {+ print(" [·] \(recordIdentifier): off in this preset")+ }return false}}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchApplicability.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchApplicability.swiftindex da2352af..42cfa6bb 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchApplicability.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchApplicability.swift@@ -43,8 +43,12 @@ public struct VPhonePatchApplicability: Sendable, Hashable, Codable {/// patch's plist entry stays empty rather than carrying two `Any` dicts.public func encode(to encoder: any Encoder) throws {var container = encoder.container(keyedBy: CodingKeys.self)- if iOSBase != .any { try container.encode(iOSBase, forKey: .iOSBase) }- if cloudOS != .any { try container.encode(cloudOS, forKey: .cloudOS) }+ if iOSBase != .any {+ try container.encode(iOSBase, forKey: .iOSBase)+ }+ if cloudOS != .any {+ try container.encode(cloudOS, forKey: .cloudOS)+ }}}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchDeclaration.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchDeclaration.swiftindex cefaa5c7..0d6cddca 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchDeclaration.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchDeclaration.swift@@ -25,7 +25,9 @@ public struct VPhonePatchDeclaration: Sendable, Hashable, Codable, Identifiable/// which essentials a plan dropped.public var bootEssential: Bool- public var id: String { identifier }+ public var id: String {+ identifier+ }public init(identifier: String,@@ -76,14 +78,20 @@ public struct VPhonePatchDeclaration: Sendable, Hashable, Codable, Identifiablevar container = encoder.container(keyedBy: CodingKeys.self)try container.encode(identifier, forKey: .identifier)try container.encode(title, forKey: .title)- if !summary.isEmpty { try container.encode(summary, forKey: .summary) }+ if !summary.isEmpty {+ try container.encode(summary, forKey: .summary)+ }try container.encode(target, forKey: .target)- if applicability != .always { try container.encode(applicability, forKey: .applicability) }- if bootEssential { try container.encode(bootEssential, forKey: .bootEssential) }+ if applicability != .always {+ try container.encode(applicability, forKey: .applicability)+ }+ if bootEssential {+ try container.encode(bootEssential, forKey: .bootEssential)+ }}}-extension VPhonePatchDeclaration {+public extension VPhonePatchDeclaration {/// Whether `recordIdentifier` came from this patch.////// A record either is the declaration itself or sits under it as@@ -92,7 +100,7 @@ extension VPhonePatchDeclaration {/// way — `jb.kcall10.sy_call` with a dot, `llb.rootfs_cbz_0x3b7` and/// `sandbox_ext_267` with an underscore. A bare textual prefix does not/// match, so `kernel.debuggerless` is not a site of `kernel.debugger`.- public func covers(recordIdentifier record: String) -> Bool {+ func covers(recordIdentifier record: String) -> Bool {record == identifier|| record.hasPrefix(identifier + ".")|| record.hasPrefix(identifier + "_")diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchGate.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchGate.swiftindex 1f22efd1..8fa8e91f 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchGate.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchGate.swift@@ -87,7 +87,9 @@ public struct VPhonePatchGate: Sendable, Hashable {/// True when the gate turns nothing off, so a caller can skip reporting.public var isUnrestricted: Bool {- if case .unrestricted = policy { return true }+ if case .unrestricted = policy {+ return true+ }return false}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPlan.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPlan.swiftindex 7c861439..d5c335b6 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPlan.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPlan.swift@@ -251,7 +251,9 @@ extension VPhonePatchPlan {for set in ordered {for patch in set.patches {guard selection.includes(patch.identifier) else {- if patch.bootEssential { droppedBootEssentials.append(patch.identifier) }+ if patch.bootEssential {+ droppedBootEssentials.append(patch.identifier)+ }continue}if patch.applicability.matches(iOSBase: iOSBase, cloudOS: cloudOS) {diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPreset.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPreset.swiftindex ad72aba4..cdb4dc46 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPreset.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchPreset.swift@@ -27,9 +27,9 @@ public enum VPhonePatchSetReference: Sendable, Hashable {case external(identifier: String, path: String)}-extension VPhonePatchSetReference {+public extension VPhonePatchSetReference {/// The set identity this reference expects, whichever way it points at it.- public var identifier: String {+ var identifier: String {switch self {case let .bundled(identifier): identifiercase let .external(identifier, _): identifier@@ -51,7 +51,9 @@ public struct VPhonePatchPreset: Sendable, Hashable, Codable, Identifiable {/// Free-form knobs a patch set reads, such as a size override.public var parameters: [String: String]- public var id: String { identifier }+ public var id: String {+ identifier+ }public init(identifier: String,@@ -73,12 +75,20 @@ public struct VPhonePatchPreset: Sendable, Hashable, Codable, Identifiable {public static let standardIdentifier = "standard"/// Whether this is the preset a VM gets by default.- public var isStandard: Bool { identifier == Self.standardIdentifier }+ public var isStandard: Bool {+ identifier == Self.standardIdentifier+ }/// True when the preset draws on a set from outside the bundle. Root/// `cfw install` refuses such a preset unless the set was imported first.public var usesExternalPatchSets: Bool {- patchSets.contains { if case .external = $0 { true } else { false } }+ patchSets.contains {+ if case .external = $0 {+ true+ } else {+ false+ }+ }}private enum CodingKeys: String, CodingKey {@@ -111,10 +121,14 @@ public struct VPhonePatchPreset: Sendable, Hashable, Codable, Identifiable {var container = encoder.container(keyedBy: CodingKeys.self)try container.encode(identifier, forKey: .identifier)try container.encode(title, forKey: .title)- if !summary.isEmpty { try container.encode(summary, forKey: .summary) }+ if !summary.isEmpty {+ try container.encode(summary, forKey: .summary)+ }try container.encode(patchSets, forKey: .patchSets)try container.encode(selection, forKey: .selection)- if !parameters.isEmpty { try container.encode(parameters, forKey: .parameters) }+ if !parameters.isEmpty {+ try container.encode(parameters, forKey: .parameters)+ }}}@@ -136,11 +150,11 @@ extension VPhonePatchSetReference: Codable {let container = try decoder.container(keyedBy: CodingKeys.self)switch try container.decode(Kind.self, forKey: .kind) {case .bundled:- self = .bundled(try container.decode(String.self, forKey: .identifier))+ self = try .bundled(container.decode(String.self, forKey: .identifier))case .external:- self = .external(- identifier: try container.decode(String.self, forKey: .identifier),- path: try container.decode(String.self, forKey: .path),+ self = try .external(+ identifier: container.decode(String.self, forKey: .identifier),+ path: container.decode(String.self, forKey: .path),)}}@@ -170,30 +184,32 @@ extension VPhonePatchSetReference: CustomStringConvertible {// MARK: - Plist IO-extension VPhonePatchPreset {+public extension VPhonePatchPreset {/// The bundle subdirectory holding the shipped presets.- public static let resourceDirectoryName = "patches_presets"+ static let resourceDirectoryName = "patches_presets"/// Read every preset in a `patches_presets` directory, sorted by identifier/// with `standard` first so a picker's order is stable.- public static func readAll(fromDirectory directory: URL) throws -> [VPhonePatchPreset] {+ static func readAll(fromDirectory directory: URL) throws -> [VPhonePatchPreset] {let names = try FileManager.default.contentsOfDirectory(atPath: directory.path)var presets: [VPhonePatchPreset] = []for name in names.sorted() where name.hasSuffix(".plist") {let url = directory.appendingPathComponent(name)- presets.append(try decode(Data(contentsOf: url)))+ try presets.append(decode(Data(contentsOf: url)))}return presets.sorted {- if $0.isStandard != $1.isStandard { return $0.isStandard }+ if $0.isStandard != $1.isStandard {+ return $0.isStandard+ }return $0.identifier < $1.identifier}}- public static func decode(_ data: Data) throws -> VPhonePatchPreset {+ static func decode(_ data: Data) throws -> VPhonePatchPreset {try PropertyListDecoder().decode(VPhonePatchPreset.self, from: data)}- public func encodedPlist() throws -> Data {+ func encodedPlist() throws -> Data {let encoder = PropertyListEncoder()encoder.outputFormat = .xmlreturn try encoder.encode(self)diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSelection.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSelection.swiftindex b46c045f..56f35070 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSelection.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSelection.swift@@ -16,10 +16,10 @@ public enum VPhonePatchSelection: Sendable, Hashable {case block(Set<String>)}-extension VPhonePatchSelection {+public extension VPhonePatchSelection {/// Whether the selection names this patch as enabled, before the version/// gate is consulted.- public func includes(_ identifier: String) -> Bool {+ func includes(_ identifier: String) -> Bool {switch self {case .all: truecase let .allow(identifiers): identifiers.contains(identifier)@@ -30,7 +30,7 @@ extension VPhonePatchSelection {/// The identifiers the selection names, whichever way it names them./// The resolver checks these against the declared patches so a typo is an/// error rather than an allow list that turns nothing on.- public var namedIdentifiers: Set<String> {+ var namedIdentifiers: Set<String> {switch self {case .all: []case let .allow(identifiers), let .block(identifiers): identifiers@@ -41,7 +41,7 @@ extension VPhonePatchSelection {////// Half of how a VM's own checkmarks compose with a preset: unchecking a patch/// narrows an allow list and widens a block list.- public func blocking(_ identifiers: Set<String>) -> VPhonePatchSelection {+ func blocking(_ identifiers: Set<String>) -> VPhonePatchSelection {guard !identifiers.isEmpty else { return self }switch self {case .all:@@ -59,7 +59,7 @@ extension VPhonePatchSelection {/// and narrows a block list. It changes only the selection — a patch whose/// version gate rules it out here still does not apply, so checking a box can/// never put a patch somewhere it was never meant to run.- public func allowing(_ identifiers: Set<String>) -> VPhonePatchSelection {+ func allowing(_ identifiers: Set<String>) -> VPhonePatchSelection {guard !identifiers.isEmpty else { return self }switch self {case .all:@@ -92,9 +92,9 @@ extension VPhonePatchSelection: Codable {case .all:self = .allcase .allow:- self = .allow(Set(try container.decode([String].self, forKey: .patches)))+ self = try .allow(Set(container.decode([String].self, forKey: .patches)))case .block:- self = .block(Set(try container.decode([String].self, forKey: .patches)))+ self = try .block(Set(container.decode([String].self, forKey: .patches)))}}diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetBundle.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetBundle.swiftindex 320afc96..a72ccf79 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetBundle.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetBundle.swift@@ -115,9 +115,9 @@ public struct VPhonePatchSetBundle: Sendable {throw VPhonePatchSetError.notABundle(path: resolved.path)}do {- return VPhonePatchSetBundle(+ return try VPhonePatchSetBundle(url: resolved,- manifest: try VPhonePatchSetManifest.read(fromBundle: resolved),+ manifest: VPhonePatchSetManifest.read(fromBundle: resolved),)} catch {throw VPhonePatchSetError.manifestUnreadable(diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetManifest.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetManifest.swiftindex 33020068..7c89733f 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetManifest.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetManifest.swift@@ -31,7 +31,9 @@ public struct VPhonePatchSetManifest: Sendable, Hashable, Codable, Identifiable/// Sets or capabilities that must run before this one, when both are present.public var after: [String]- public var id: String { identifier }+ public var id: String {+ identifier+ }public init(identifier: String,@@ -122,24 +124,34 @@ public struct VPhonePatchSetManifest: Sendable, Hashable, Codable, Identifiabletry container.encode(identifier, forKey: .identifier)try container.encode(name, forKey: .name)try container.encode(version, forKey: .version)- if !summary.isEmpty { try container.encode(summary, forKey: .summary) }+ if !summary.isEmpty {+ try container.encode(summary, forKey: .summary)+ }try container.encode(minimumPatchKitVersion, forKey: .minimumPatchKitVersion)try container.encode(patches, forKey: .patches)- if !requires.isEmpty { try container.encode(requires, forKey: .requires) }- if !provides.isEmpty { try container.encode(provides, forKey: .provides) }- if !conflictsWith.isEmpty { try container.encode(conflictsWith, forKey: .conflictsWith) }- if !after.isEmpty { try container.encode(after, forKey: .after) }+ if !requires.isEmpty {+ try container.encode(requires, forKey: .requires)+ }+ if !provides.isEmpty {+ try container.encode(provides, forKey: .provides)+ }+ if !conflictsWith.isEmpty {+ try container.encode(conflictsWith, forKey: .conflictsWith)+ }+ if !after.isEmpty {+ try container.encode(after, forKey: .after)+ }}}// MARK: - Plist IO-extension VPhonePatchSetManifest {+public extension VPhonePatchSetManifest {/// The path a patch-set bundle keeps its manifest at.- public static let resourceName = "Manifest.plist"+ static let resourceName = "Manifest.plist"/// Read a manifest from a `.vphonepatchset` bundle directory.- public static func read(fromBundle bundle: URL) throws -> VPhonePatchSetManifest {+ static func read(fromBundle bundle: URL) throws -> VPhonePatchSetManifest {let url = bundle.appendingPathComponent("Contents", isDirectory: true).appendingPathComponent("Resources", isDirectory: true)@@ -150,12 +162,12 @@ extension VPhonePatchSetManifest {return try decode(Data(contentsOf: url))}- public static func decode(_ data: Data) throws -> VPhonePatchSetManifest {+ static func decode(_ data: Data) throws -> VPhonePatchSetManifest {try PropertyListDecoder().decode(VPhonePatchSetManifest.self, from: data)}/// Encode as an XML plist, the form a patch set checks into source control.- public func encodedPlist() throws -> Data {+ func encodedPlist() throws -> Data {let encoder = PropertyListEncoder()encoder.outputFormat = .xmlreturn try encoder.encode(self)diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetPrincipal.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetPrincipal.swiftindex 7969537e..4c470211 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetPrincipal.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchSetPrincipal.swift@@ -105,8 +105,8 @@ open class VPhonePatchSetPrincipal {/// alone.open func makePatcher(for component: VPhoneFirmwareComponent,- data: Data,- context: VPhonePatchSetContext,+ data _: Data,+ context _: VPhonePatchSetContext,) throws -> any BufferedPatcher {throw VPhonePatchSetError.componentUnsupported(principal: String(describing: type(of: self)),diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchTarget.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchTarget.swiftindex e9c0ad36..28fbb6a5 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchTarget.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhonePatchTarget.swift@@ -59,7 +59,7 @@ extension VPhonePatchTarget: Codable {let kind = try container.decode(Kind.self, forKey: .kind)switch kind {case .firmware:- self = .firmware(try container.decode(VPhoneFirmwareComponent.self, forKey: .component))+ self = try .firmware(container.decode(VPhoneFirmwareComponent.self, forKey: .component))case .dyldSharedCache:self = .dyldSharedCachecase .prebootDeviceTree:diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhoneVersionRequirement.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhoneVersionRequirement.swiftindex bbf34940..2e47cb84 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhoneVersionRequirement.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchKit/PatchSet/VPhoneVersionRequirement.swift@@ -25,7 +25,7 @@ public enum VPhoneVersionRequirement: Sendable, Hashable {// MARK: - Matching-extension VPhoneVersionRequirement {+public extension VPhoneVersionRequirement {/// Whether `version` satisfies the requirement.////// A version the pipeline could not read satisfies only ``any``: a patch gated@@ -33,8 +33,10 @@ extension VPhoneVersionRequirement {////// Only major and minor are compared. A gate names a release, not a point/// update, so 18.6.2 satisfies `.major(18)` and `.atLeast(18, 6)` alike.- public func matches(_ version: VPhoneVersion?) -> Bool {- if case .any = self { return true }+ func matches(_ version: VPhoneVersion?) -> Bool {+ if case .any = self {+ return true+ }guard let version else { return false }switch self {case .any:@@ -75,16 +77,16 @@ extension VPhoneVersionRequirement: Codable {case .any:self = .anycase .major:- self = .major(try container.decode(Int.self, forKey: .major))+ self = try .major(container.decode(Int.self, forKey: .major))case .release:- self = .release(- major: try container.decode(Int.self, forKey: .major),- minor: try container.decode(Int.self, forKey: .minor),+ self = try .release(+ major: container.decode(Int.self, forKey: .major),+ minor: container.decode(Int.self, forKey: .minor),)case .atLeast:- self = .atLeast(- major: try container.decode(Int.self, forKey: .major),- minor: try container.decode(Int.self, forKey: .minor),+ self = try .atLeast(+ major: container.decode(Int.self, forKey: .major),+ minor: container.decode(Int.self, forKey: .minor),)case .oneOf:let options = try container.decode([VPhoneVersionRequirement].self, forKey: .options)diff --git a/VPhoneExecutable/VPhoneCommand/VPhonePatchSetExample/VPhoneExamplePatchSet.swift b/VPhoneExecutable/VPhoneCommand/VPhonePatchSetExample/VPhoneExamplePatchSet.swiftindex c0e02e0d..326a3037 100644--- a/VPhoneExecutable/VPhoneCommand/VPhonePatchSetExample/VPhoneExamplePatchSet.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhonePatchSetExample/VPhoneExamplePatchSet.swift@@ -52,7 +52,7 @@ public final class VPhoneExamplePatchSet: VPhonePatchSetPrincipal {/// The preset parameter naming what to put there.public static let replaceParameter = "ExampleReplaceString"- public override func makePatcher(+ override public func makePatcher(for component: VPhoneFirmwareComponent,data: Data,context: VPhonePatchSetContext,@@ -93,7 +93,9 @@ public final class VPhoneExampleStringPatcher: BufferedPatcher {public let gate: VPhonePatchGatepublic let buffer: BinaryBuffer- public var patchedData: Data { buffer.data }+ public var patchedData: Data {+ buffer.data+ }private let find: Stringprivate let replace: String@@ -155,7 +157,9 @@ public final class VPhoneExampleStringPatcher: BufferedPatcher {@discardableResultpublic func apply() throws -> Int {- if found.isEmpty { _ = try findAll() }+ if found.isEmpty {+ _ = try findAll()+ }for record in found {buffer.writeBytes(at: record.fileOffset, bytes: record.patchedBytes)log(" [+] \(record)")