Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Stop paired device-tree patches reading as missing, and say a restore erases

Jackyd5f84a498eb3
diff --git a/Documents/Guides/launchpad-cli.md b/Documents/Guides/launchpad-cli.md
index 3d34628c..6c2f74a1 100644
--- a/Documents/Guides/launchpad-cli.md
+++ b/Documents/Guides/launchpad-cli.md
@@ -37,7 +37,7 @@ each from a bundle at a different time:
| --- | --- | --- |
| Host Programs | `vphone-cli`, `vphone-vm` | The bound bundle, on every command. A new binding applies at the next start. |
| Guest Environment | vphoned and the hook dylibs | `cfw install` at creation, and `cfw update-environment` (stopped machine) later. |
-| Boot Chain | Patched firmware, restore, CFW patches | `fw patch`, `restore` and `cfw install` at creation. After that, `vphone-cli fw set-patches` changes the choice and `vphone-cli fw patches <vm>` lists what has not reached the guest: guest patches apply at the next `cfw update-environment`, AVPBooter at the next `fw patch` while the restore tree is kept, and the rest of the boot chain only with a restore. Launchpad shows the count in the inspector. |
+| Boot Chain | Patched firmware, restore, CFW patches | `fw patch`, `restore` and `cfw install` at creation. After that, `vphone-cli fw set-patches` changes the choice and `vphone-cli fw patches <vm>` lists what has not reached the guest: guest patches apply at the next `cfw update-environment`, AVPBooter at the next `fw patch` while the restore tree is kept, and the rest of the boot chain only with a restore, which erases the guest (an in-place restore cannot keep its data). Launchpad shows the count in the inspector. |
The **default** bundle (formerly "active") decides only the version
`vm create` binds when `--bundle` is not given, and what `exec` and
diff --git a/Research/Firmware/post_creation_patch_changes.md b/Research/Firmware/post_creation_patch_changes.md
index 281416f6..eb74b096 100644
--- a/Research/Firmware/post_creation_patch_changes.md
+++ b/Research/Firmware/post_creation_patch_changes.md
@@ -51,7 +51,7 @@ Counts are declarations in `FirmwarePatcher/PatchSets/*.swift`.
| --- | --- | --- | --- | --- |
| AVPBooter | 1 | VM root, `romImages.avpBooter`, read every boot | `fw patch` itself | works, but `fw patch` refuses without a restore tree |
| iBSS, iBEC | 7 | restore tree only | DFU during a restore | irrelevant to an installed guest; only the next restore uses them |
-| LLB | 6 | NOR (personalized by idevicerestore, `LlbImageData`) | restore | needs a restore; `restore --no-erase` exists but is unvalidated |
+| LLB | 6 | NOR (personalized by idevicerestore, `LlbImageData`) | restore | needs a restore, which erases the guest: an in-place one cannot keep its data (`native_restore_architecture.md`, 2026-10-05) |
| kernelcache, DeviceTree, TXM | 54 + 30 + 6 | Preboot (personalized) | restore | Preboot can be rewritten by a host mount — `cfw install` already edits `devicetree.img4` there; nothing does it for the kernelcache or TXM |
| Guest (dyld cache, Mach-O, files, entitlements, Preboot DT) | 34 | System / Preboot volumes of `Disk.img` | `cfw install`, partly `cfw update-environment` | turning on works by re-running; turning off does nothing |
@@ -146,8 +146,21 @@ patches plus the late ones the old installer added.
kernelcache, TXM or DeviceTree into Preboot was dropped before implementation;
those three, LLB, iBSS and iBEC change only through a restore, and AVPBooter only
through `fw patch`, which needs the restore tree (`--keep-artifacts`).
-`restore --no-erase` (row 4 of `Research/Restore/native_restore_architecture.md`)
-is still unvalidated.
+A restore always erases the guest: `restore --no-erase` was tried on a test VM
+on 2026-10-05 and replaces the kernel but erases the Data volume as well,
+so it now refuses (row 4 and "An in-place restore cannot keep a guest's data"
+in `Research/Restore/native_restore_architecture.md`).
+
+**Paired DeviceTree patches.** `devicetree-cfw-ipad_audio`,
+`devicetree-cfw-product_haptics_node` and
+`devicetree-cfw-product_audio_microphone_array` write into the tree a restore
+installs; `preboot-cfw-devicetree_board_audio`, `_haptics` and
+`_microphone_array` write the same change into the Preboot tree of a VM restored
+before them. `FirmwareGuestSystemPatchSet.prebootRepairs` names the pairs, and
+the drift report reads the tree patch as applied when its Preboot repair is
+live, so a VM restored before the tree patches no longer shows them as needing
+a restore. The Launchpad inspector says in the open how many boot-chain patches
+are pending and that only a restore, which erases the guest, applies them.
## Validation (2026-10-04)
diff --git a/Research/Restore/native_restore_architecture.md b/Research/Restore/native_restore_architecture.md
index 98a9bf6e..2c7bd441 100644
--- a/Research/Restore/native_restore_architecture.md
+++ b/Research/Restore/native_restore_architecture.md
@@ -151,7 +151,7 @@ it is not checked and needs a phone or VM in DFU.
| 1 | `restore` (online, default) | `pmd3 restore-update` | `erase=true, ticket_path=NULL` | VM boots | **device**, but both halves are now proven separately: the online TSS fetch by row 2 and the erase-and-flash by row 3. What has not been run is the two in one invocation. Options mapping is `unit`: `RestoreOptionsTests.defaultsAreAnOnlineEraseRestore` |
| 2 | `restore --get-shsh` | `pmd3 restore-get-shsh` | `shsh_only=true` | `.shsh` semantically equal to the Python's, same filename | ✅ **DONE 2026-09-23.** Real TSS round trip against a DFU-booted `dfu-spike`: ApNonce and SepNonce read from the device, `Received SHSH blobs`, saved as `206C763772858301.shsh` — the `%016X` name `VPhoneRestoreLayout.shshOutput` promises. The blob is a TSS response (`@ServerVersion 2.1.0`, 5,803-byte `ApImg4Ticket`), binary plist where the Python wrote XML — a serialization difference, not a semantic one |
| 3 | `restore --offline` | AEA decrypt in place → `--tss <first .shsh>` | AEA decrypt in place → `ticket_path=<same file>` | ① `noSHSH` with no blob ② `noRestoreDir` with no tree ③ multiple `.shsh` → sorted first ④ VM boots | ✅ **DONE 2026-09-23.** ①②③ `unit` and also run through the CLI (see below); ④ a full flash of `dfu-spike` from the 26.1/23B85 tree with the cached ticket: four `.dmg.aea` decrypted in place, filesystem sent, system volume sealed, `Status: Restore Finished`, exit 0, and the device left DFU |
-| 4 | `restore --no-erase` | `Behavior.Update` | `erase=false` | user data survives | **device.** The flag did not exist until 2026-09-23 — see below. Mapping is `unit`: `RestoreOptionsTests.updateInPlaceClearsErase` |
+| 4 | `restore --no-erase` | `Behavior.Update` | `erase=false` | user data survives | ❌ **Not possible (2026-10-05), and the flag now refuses.** Run on a test VM, an in-place restore replaces the kernel but erases the Data volume — see "An in-place restore cannot keep a guest's data" below. The library mapping is still `unit`: `RestoreOptionsTests.updateInPlaceClearsErase` |
| 5 | metadata on success | writes `restore-info.json` | same | contents identical | ✅ **DONE 2026-09-23.** Written only after the restore returned: `{"ios":{"version":"26.1","build":"23B85"},"cloudOS":{"version":"26.1","build":"23B85"}}` |
| 6 | failure | no `restore-info.json`, exit code passed through | same | exit codes match | **device.** The bridge's own rejections are `unit` (`RestoreRunnerTests`); a failure from inside idevicerestore is not |
| 7 | verbosity | `-v` → one, `-vv`/`-vvv` → two `-v` | `debug_level` | logs comparably detailed | **device.** The level enum matches upstream's one for one and that is `unit` (`RestoreEventTests.levelsMatchIdevicerestoresEnum`) |
@@ -264,6 +264,57 @@ comparison.
opened it through libzip; this build has no libzip, so the check moved to the
front where the error is legible.
+## An in-place restore cannot keep a guest's data (2026-10-05)
+
+The question was whether a boot-chain patch change — a kernel patch turned on
+after creation — could reach an installed guest without losing its data, the
+way an iOS update does. Row 4 was the only candidate. It was run on a dedicated
+test VM (`iPhone17,3` 27.0 `24A435` + cloudOS 26.4 `23E5207q`), with a marker
+file written to `/var/mobile/Documents` through vphoned before each round,
+`kernel-exp-display_refresh_120hz` toggled with `fw set-patches` and `fw patch`,
+then `vm launch --dfu`, `restore --no-erase`, `cfw install` and a boot.
+
+1. **As shipped: restored fails part way, after the system volume is written.**
+ The hybrid manifest `fw prepare` writes has one identity, *Darwin Cloud
+ Customer Erase Install*. idevicerestore falls back to it for an update, but
+ restored later asks for the Upgrade identity's boot objects
+ (`PersonalizedBootObjectV3` for `Ap,SecurePageTableMonitor`):
+ `Unable to find a matching build identity`, `Unable to successfully restore
+ device`. The command still exited 0 and recorded the restore as done — a
+ separate bug, fixed (below). The marker was gone afterwards.
+2. **With an Upgrade identity added (a copy of the Erase one with
+ `RestoreBehavior` `Update`): the restore completes, the kernel is replaced,
+ the data is not kept.** `Variant: … Upgrade Install`, `Status: Restore
+ Finished`; the Preboot `kernelcache` was rewritten and the guest booted. But
+ restored ran `Creating partition map (11)`, `Creating filesystem (12)`,
+ `Creating Protected Volume (67)` and `Creating system key bag (50)`: the
+ cloudOS restore ramdisk (`094-39914-031.dmg`), the only one this hybrid
+ restores with, erases whatever behaviour it is told. The marker was gone.
+ cloudOS ships no Upgrade identity and no update ramdisk for
+ `vresearch101ap`: all seven of its identities are Erase.
+3. **With the iPhone's update ramdisk (`043-69093-769.dmg` and its trust
+ cache) in that identity: the device never enters restore mode.** The iOS 27
+ ramdisk's launchd exits on the cloudOS 26.4 restore kernel —
+ `panic: initproc exited -- exit reason namespace 2 subcode 0x6` — as the
+ installed system would without the dyld cache patches `cfw install` applies,
+ which a ramdisk does not get.
+
+So a restore always erases a vphone guest. `restore --no-erase` now refuses
+with that reason instead of re-imaging the system volume and failing (it stays
+as a hidden flag so a script gets the reason rather than a usage error), and
+`fw set-patches`, `fw patches` and the Launchpad inspector say that a
+boot-chain change reaches an existing guest only through a restore that erases
+it. Making it possible would mean an update ramdisk that boots on the cloudOS
+restore kernel — patching the iPhone's, as the installed system is patched —
+which was not attempted.
+
+**The exit-status bug.** `restore_device` in `Transfer/restore.c` sets
+`FLAG_QUIT` on the first handler error, reads one more message, and that
+message's handler overwrote `err` with 0, so a restore that restored had already
+given up on returned success and `restore-info.json` and the patch receipt were
+written. It now keeps the first fatal error. Round 3 above, with this fix,
+exited 1 and stopped before `cfw install`.
+
## Still open
**FDR equivalence.** The Python ran `Restore(..., ignore_fdr=False)`;
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
index b7452ed3..4efa1421 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
@@ -396,6 +396,17 @@ public enum FirmwareGuestSystemPatchSet {
/// guest's tree.
public static let prebootMicrophoneArray = "preboot-cfw-devicetree_microphone_array"
+ /// The boot-chain DeviceTree patch each Preboot repair stands in for.
+ /// `fw patch` writes the first into the tree a restore installs; the
+ /// repair writes the same change into the tree a VM restored before that
+ /// patch existed already has. Either one puts the change in the guest, so
+ /// the drift report counts the pair as one.
+ public static let prebootRepairs: [String: String] = [
+ "devicetree-cfw-ipad_audio": prebootBoardAudio,
+ "devicetree-cfw-product_haptics_node": prebootHaptics,
+ "devicetree-cfw-product_audio_microphone_array": prebootMicrophoneArray,
+ ]
+
/// The preset parameter `system-systemversion-cfw-build_version` reads.
public static let buildVersionParameter = "BuildVersion"
}
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchDrift.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchDrift.swift
index 084978f8..a5d8074b 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchDrift.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchDrift.swift
@@ -134,6 +134,11 @@ public enum FirmwarePatchDrift {
/// - planned: The plan's enabled patches, or nil with no plan.
/// - applied: The receipt's patches by part, or nil with no receipt. A
/// part missing from it leaves its patches' `applied` nil.
+ /// - standIns: A patch and the patch that puts the same change into
+ /// the guest another way, such as a boot-chain DeviceTree patch and the
+ /// Preboot repair for a VM restored before it
+ /// (`FirmwareGuestSystemPatchSet.prebootRepairs`). When the stand-in is
+ /// live, the patch reads as applied, whatever its own part records.
/// - part: The receipt's rule for naming a target's part.
public static func states(
declarations: [VPhonePatchDeclaration],
@@ -141,16 +146,25 @@ public enum FirmwarePatchDrift {
planned: Set<String>?,
applied: [String: Set<String>]?,
notApplicable: Set<String> = [],
+ standIns: [String: String] = [:],
part: (VPhonePatchTarget) -> String,
) -> [PatchState] {
- declarations.map { declaration in
- let part = part(declaration.target)
+ let partOf = part
+ let targets = Dictionary(declarations.map { ($0.identifier, $0.target) }, uniquingKeysWith: { first, _ in first })
+ return declarations.map { declaration in
+ let part = partOf(declaration.target)
let isWanted = wanted.contains(declaration.identifier)
// A patch the guest has nothing for reads as whatever is wanted,
// so turning it on or off is never reported as pending.
- let isApplied = applied?[part].map {
+ var isApplied = applied?[part].map {
notApplicable.contains(declaration.identifier) ? isWanted : $0.contains(declaration.identifier)
}
+ if let standIn = standIns[declaration.identifier],
+ let standInTarget = targets[standIn],
+ applied?[partOf(standInTarget)]?.contains(standIn) == true
+ {
+ isApplied = true
+ }
return PatchState(
identifier: declaration.identifier,
target: declaration.target,
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchDriftTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchDriftTests.swift
index c5d4abe0..7d35c112 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchDriftTests.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchDriftTests.swift
@@ -37,6 +37,7 @@ struct FirmwarePatchDriftTests {
patch("txm", .firmware(.txm)),
patch("dyld", .dyldSharedCache),
patch("dt", .prebootDeviceTree),
+ patch("tree-node", .firmware(.deviceTree)),
]
}
@@ -116,6 +117,7 @@ struct FirmwarePatchDriftTests {
planned: Set<String>?,
applied: [String: Set<String>]?,
notApplicable: Set<String> = [],
+ standIns: [String: String] = [:],
) -> [String: FirmwarePatchDrift.PatchState] {
let list = FirmwarePatchDrift.states(
declarations: declarations,
@@ -123,6 +125,7 @@ struct FirmwarePatchDriftTests {
planned: planned,
applied: applied,
notApplicable: notApplicable,
+ standIns: standIns,
part: part,
)
return Dictionary(uniqueKeysWithValues: list.map { ($0.identifier, $0) })
@@ -166,6 +169,38 @@ struct FirmwarePatchDriftTests {
#expect(unknown["dt"]?.isPending == true)
}
+ @Test
+ func `A boot-chain patch whose Preboot stand-in is live is not pending`() {
+ // Restored before the tree patch existed: the plan has no "tree-node",
+ // but the Preboot repair "dt" put the same change into the guest.
+ let live = states(
+ wanted: ["tree-node", "dt"],
+ planned: ["dt"],
+ applied: ["Guest": ["dt"]],
+ standIns: ["tree-node": "dt"],
+ )
+ #expect(live["tree-node"]?.applied == true)
+ #expect(live["tree-node"]?.isPending == false)
+ // Without the repair live, the tree patch still needs a restore.
+ let missing = states(
+ wanted: ["tree-node", "dt"],
+ planned: ["dt"],
+ applied: ["Guest": []],
+ standIns: ["tree-node": "dt"],
+ )
+ #expect(missing["tree-node"]?.isPending == true)
+ #expect(missing["tree-node"]?.delivery == .restore)
+ }
+
+ @Test
+ func `Every Preboot stand-in names a declared Preboot repair and a declared tree patch`() {
+ let byID = Dictionary(FirmwarePatchSetCatalog.allDeclarations.map { ($0.identifier, $0.target) }, uniquingKeysWith: { a, _ in a })
+ for (treePatch, repair) in FirmwareGuestSystemPatchSet.prebootRepairs {
+ #expect(byID[treePatch] == .firmware(.deviceTree), "\(treePatch)")
+ #expect(byID[repair] == .prebootDeviceTree, "\(repair)")
+ }
+ }
+
@Test
func `A part recorded empty means off, not unknown`() {
let result = states(
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
index aae19a77..03eff513 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
@@ -468,7 +468,7 @@ struct VPhoneFirmwareSetPatchesCommand: ParsableCommand {
the restore tree (`--keep-artifacts`).
Guest (system, dyld cache, `cfw update-environment` (root), which
Preboot device tree) applies this choice both on and off.
- LLB, kernelcache, TXM, only a restore.
+ LLB, kernelcache, TXM, only a restore, which erases the guest's data.
DeviceTree
iBSS, iBEC used only while restoring.
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift
index ad21dcaa..9212327c 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhonePatchCatalogReport.swift
@@ -99,6 +99,7 @@ public struct VPhonePatchCatalogReport: Sendable {
planned: plan.map { Set($0.enabledPatches) },
applied: receipt.map { $0.parts.mapValues { Set($0.patches) } },
notApplicable: Set(receipt?.parts.values.flatMap(\.notApplicable) ?? []),
+ standIns: FirmwareGuestSystemPatchSet.prebootRepairs,
part: VPhoneVirtualMachinePatchReceipt.part(for:),
)
}
@@ -408,8 +409,7 @@ public struct VPhonePatchCatalogReport: Sendable {
|| part == VPhoneFirmwareComponent.iBEC.rawValue:
"used only while restoring, so the change matters at the next restore and not to this guest."
case .restore:
- "only a restore writes \(part), and restoring in place"
- + " (`restore --no-erase`) is not validated yet."
+ "only a restore writes \(part), and a restore erases the guest's data: there is no in-place one."
case .updateEnvironment:
"run `sudo vphone-cli cfw update-environment \(vm)`"
+ " (in Launchpad: Update Guest Environment), with the machine off."
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Restore/VPhoneRestoreCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Restore/VPhoneRestoreCommand.swift
index db067882..b21e24ff 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Restore/VPhoneRestoreCommand.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Restore/VPhoneRestoreCommand.swift
@@ -40,11 +40,19 @@ struct VPhoneRestoreCommand: ParsableCommand {
@Option(name: .shortAndLong, help: "Device UDID (optional)") var udid: String?
@Option(name: .shortAndLong, help: "Device ECID (default: read from the bundle's udid-prediction.txt)")
var ecid: String?
- /// The Python exposed this as `--erase/--no-erase`, defaulting to erase, and
- /// `VPhoneRestoreOptions.erase` has carried it since the port. Only the flag
- /// was missing, which left `Behavior.Update` reachable from the library and
- /// its unit test but not from the command line.
- @Flag(name: .customLong("no-erase"), help: "Update in place instead of erasing (upstream's Behavior.Update)")
+ /// Refused: an in-place restore cannot keep a vphone guest's data. Tried on
+ /// a test VM (iPhone 27.0 24A435 + cloudOS 26.4, 2026-10-05), it fails
+ /// three ways, see `Research/Restore/native_restore_architecture.md`: the
+ /// hybrid manifest has no Upgrade identity, so restored fails after the
+ /// system volume is written; with one, the cloudOS restore ramdisk, the
+ /// only one a vphone guest boots, still creates the partition map and a
+ /// new system key bag, which erases the Data volume; and the iPhone's
+ /// update ramdisk panics (initproc exits) on the cloudOS restore kernel.
+ /// The flag stays so a script using it gets this reason, not a usage error.
+ @Flag(name: .customLong("no-erase"), help: ArgumentHelp(
+ "Not supported: an in-place restore erases a vphone guest's data anyway",
+ visibility: .hidden,
+ ))
var noErase = false
@Flag(name: .customShort("v"), help: "Increase verbosity: -v tool detail, -vv guest serial, -vvv internal trace")
var verboseCount: Int
@@ -54,6 +62,14 @@ struct VPhoneRestoreCommand: ParsableCommand {
/// used to be. A failure therefore throws instead of returning an exit
/// code — which keeps the two halves that mattered, the non-zero exit and
/// `restore-info.json` staying unwritten.
+ func validate() throws {
+ if noErase {
+ throw ValidationError(
+ "An in-place restore cannot keep this guest's data: the cloudOS restore ramdisk a vphone guest restores with only erases. Restore without --no-erase.",
+ )
+ }
+ }
+
func run() throws {
let v = max(VPhoneVerbosity.info, VPhoneVerbosity(count: verboseCount))
let name = try VPhoneVirtualMachineSelection.resolveExisting(name, in: lib.library)
@@ -107,7 +123,7 @@ struct VPhoneRestoreCommand: ParsableCommand {
vmDir: bundle.url,
ecid: ecidValue,
udid: udid,
- erase: !noErase,
+ erase: true,
ticketPath: ticket,
debugLevel: v.restoreDebugLevel,
onEvent: onEvent,
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/MobileRestoreCore/Transfer/restore.c b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/MobileRestoreCore/Transfer/restore.c
index 903fa609..34082cf0 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/MobileRestoreCore/Transfer/restore.c
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/MobileRestoreCore/Transfer/restore.c
@@ -5366,6 +5366,10 @@ static int restore_wait_for_reconnect(struct idevicerestore_client_t* client)
int restore_device(struct idevicerestore_client_t* client, plist_t build_identity)
{
int err = 0;
+ /* vphone: the first unrecoverable error. The loop reads one more message
+ after FLAG_QUIT is set, and its handler overwrote err with 0, so a
+ failed restore returned success. */
+ int fatal_err = 0;
char* type = NULL;
plist_t node = NULL;
plist_t message = NULL;
@@ -5699,6 +5703,8 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit
// an unrecoverable error, so we need to bail.
if (err < 0) {
logger(LL_ERROR, "Unable to successfully restore device\n");
+ if (fatal_err == 0)
+ fatal_err = err;
client->flags |= FLAG_QUIT;
}
@@ -5883,5 +5889,7 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit
#endif
restore_client_free(client);
+ if (err >= 0 && fatal_err < 0)
+ err = fatal_err;
return err;
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index d53475a4..c4aa3cda 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -13199,6 +13199,15 @@
"zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "客户机已包含为此虚拟机设定的全部补丁。" } }
}
},
+ "Boot chain: ^[%lld patch](inflect: true), applied only by restoring the machine, which erases its data." : {
+ "localizations" : {
+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Boot chain: ^[%lld patch](inflect: true), applied only by restoring the machine, which erases its data." } },
+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "起動チェーン:%lld 件のパッチ。マシンを復元した場合にのみ反映され、復元するとデータは消去されます。" } },
+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "부트 체인: 패치 %lld개. 머신을 복원해야만 반영되며, 복원하면 데이터가 지워집니다." } },
+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Chuỗi khởi động: %lld bản vá, chỉ được áp dụng khi khôi phục máy, việc này sẽ xoá dữ liệu của máy." } },
+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "启动链:%lld 个补丁,只有重新恢复虚拟机才会生效,而恢复会清除其数据。" } }
+ }
+ },
"Apply to Guest" : {
"localizations" : {
"en" : { "stringUnit" : { "state" : "translated", "value" : "Apply to Guest" } },
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
index def3de47..dd9ae550 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
@@ -292,6 +292,15 @@ struct VPhoneLaunchpadMachineInspector: View {
}
.help(pendingHelp(catalog, pending: pending))
}
+ // Said in the open rather than only in the tooltip:
+ // nothing in this section applies a boot-chain patch,
+ // so a count with no button would read as a dead end.
+ if catalog.pendingBootChainPatches > 0 {
+ Text("Boot chain: ^[\(catalog.pendingBootChainPatches) patch](inflect: true), applied only by restoring the machine, which erases its data.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
}
HStack {
Spacer()