Run a virtual iPhone on an Apple Silicon Mac.
Swift
style: one parameter per line and a 120-column soft limit
Lakr00057d389a81
diff --git a/scripts/camfix/libcamfix.m b/scripts/camfix/libcamfix.mindex c2b73700..a11ee564 100644--- a/scripts/camfix/libcamfix.m+++ b/scripts/camfix/libcamfix.m@@ -155,8 +155,16 @@ static CMSampleBufferRef cfx_build_cmsb(void) {CVPixelBufferRef pb = NULL;CVReturn cvr = CVPixelBufferCreateWithBytes(- kCFAllocatorDefault, w, h, kCVPixelFormatType_32BGRA,- pixels, bpr, cfx_release_bytes, NULL, NULL, &pb);+ kCFAllocatorDefault,+ w,+ h,+ kCVPixelFormatType_32BGRA,+ pixels,+ bpr,+ cfx_release_bytes,+ NULL,+ NULL,+ &pb);if (cvr != kCVReturnSuccess || !pb) { free(pixels); return NULL; }CMVideoFormatDescriptionRef desc = NULL;OSStatus s = CMVideoFormatDescriptionCreateForImageBuffer(@@ -273,7 +281,14 @@ static void cfx_deliver_capturePhoto(id output, id delegate) {if (!sbuf) { cfxlog(@"[capturePhoto] build_cmsb returned NULL"); return; }cfxlog(@"[capturePhoto] dispatching deprecated didFinishProcessingPhotoSampleBuffer:");((void (*)(id, SEL, id, CMSampleBufferRef, CMSampleBufferRef, id, id, id))objc_msgSend)(- delegate, oldSel, output, sbuf, NULL, (id)nil, (id)nil, (id)nil);+ delegate,+ oldSel,+ output,+ sbuf,+ NULL,+ (id)nil,+ (id)nil,+ (id)nil);CFRelease(sbuf);return;}@@ -399,7 +414,10 @@ static id cfx_pv_initWithSession_hook(id self, SEL _cmd, AVCaptureSession *sessiid ret = ((Fn)cfx_orig_pv_initWithSession)(self, _cmd, session);BOOL forVcam = (session != nil) && cfx_session_is_for_vcam(session);cfxlog(@"[PVLayer initWithSession:%p] ret=%p forVcam=%d cls=%@",- session, ret, forVcam, NSStringFromClass([ret class]));+ session,+ ret,+ forVcam,+ NSStringFromClass([ret class]));if (ret && forVcam) cfx_adopt_preview_layer(ret);return ret;}@@ -413,7 +431,11 @@ static id cfx_pv_initWithSessionMakeConnection_hook(id self, SEL _cmd,self, _cmd, session, makeConnection);BOOL forVcam = (session != nil) && cfx_session_is_for_vcam(session);cfxlog(@"[PVLayer _initWithSession:%p makeConnection:%d] ret=%p forVcam=%d cls=%@",- session, makeConnection, ret, forVcam, NSStringFromClass([ret class]));+ session,+ makeConnection,+ ret,+ forVcam,+ NSStringFromClass([ret class]));if (ret && forVcam) cfx_adopt_preview_layer(ret);return ret;}@@ -497,7 +519,8 @@ static void cfx_start_scan_timer(void) {cfx_scan_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, q);dispatch_source_set_timer(cfx_scan_timer,dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)),- 1000000000ull, 100000000ull);+ 1000000000ull,+ 100000000ull);dispatch_source_set_event_handler(cfx_scan_timer, ^{@autoreleasepool { cfx_scan_preview_layers(); }});@@ -680,16 +703,27 @@ static NSData *cfx_build_jpeg_from_shm(void) {CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, copy, len, cfx_cg_release_data);CGImageRef img = CGImageCreate(- w, h, 8, 32, bpr, cs,+ w,+ h,+ 8,+ 32,+ bpr,+ cs,(CGBitmapInfo)(kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst),- dp, NULL, false, kCGRenderingIntentDefault);+ dp,+ NULL,+ false,+ kCGRenderingIntentDefault);CGDataProviderRelease(dp);CGColorSpaceRelease(cs);if (!img) return nil;NSMutableData *data = [NSMutableData data];CGImageDestinationRef dest = CGImageDestinationCreateWithData(- (CFMutableDataRef)data, (CFStringRef)@"public.jpeg", 1, NULL);+ (CFMutableDataRef)data,+ (CFStringRef)@"public.jpeg",+ 1,+ NULL);if (!dest) { CGImageRelease(img); return nil; }CGImageDestinationAddImage(dest, img, NULL);BOOL ok = CGImageDestinationFinalize(dest);@@ -711,9 +745,17 @@ static CGImageRef cfx_build_cgimage_from_shm(void) CF_RETURNS_RETAINED {CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, copy, len, cfx_cg_release_data);CGImageRef img = CGImageCreate(- w, h, 8, 32, bpr, cs,+ w,+ h,+ 8,+ 32,+ bpr,+ cs,(CGBitmapInfo)(kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst),- dp, NULL, false, kCGRenderingIntentDefault);+ dp,+ NULL,+ false,+ kCGRenderingIntentDefault);CGDataProviderRelease(dp);CGColorSpaceRelease(cs);return img;@@ -910,7 +952,9 @@ static id cfx_build_avcapturephoto_with_request(IOSurfaceRef surf,});if (result) {cfxlog(@"AVCapturePhoto built: %p (captureRequest=%p, sel=%@)",- result, captureRequest, NSStringFromSelector(initSel));+ result,+ captureRequest,+ NSStringFromSelector(initSel));}return result;}@@ -1007,8 +1051,9 @@ static void cfx_drive_capture(id output, id delegate, id settings) {IOSurfaceRef surf = cfx_build_iosurface_from_shm(&w, &h);if (!surf || !w || !h) {cfxlog(@"[drive] no IOSurface — falling back to error finish");- NSError *err = [NSError errorWithDomain:AVFoundationErrorDomain code:-11800- userInfo:@{NSLocalizedDescriptionKey:@"Unable to take the photo. Try again."}];+ NSError *err = [NSError errorWithDomain:AVFoundationErrorDomain+ code:-11800+ userInfo:@{NSLocalizedDescriptionKey:@"Unable to take the photo. Try again."}];SEL finishSel = @selector(captureOutput:didFinishCaptureForResolvedSettings:error:);if ([delegate respondsToSelector:finishSel]) {((void (*)(id, SEL, id, id, id))objc_msgSend)(delegate, finishSel, output, nil, err);diff --git a/scripts/tweakloader/TweakLoader.m b/scripts/tweakloader/TweakLoader.mindex 8ab85b24..88ec62c7 100644--- a/scripts/tweakloader/TweakLoader.m+++ b/scripts/tweakloader/TweakLoader.m@@ -158,10 +158,8 @@ static void TLOnImageAdded(const struct mach_header *mh, intptr_t slide) {dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{for (NSString *dylibPath in toLoad) {void *h = dlopen(dylibPath.fileSystemRepresentation, RTLD_NOW | RTLD_GLOBAL);- if (h) TLLog(@"framework-deferred-load %@ -> %p (triggered by %@)",- dylibPath, h, imagePath);- else TLLog(@"framework-deferred-load failed for %@: %s",- dylibPath, dlerror() ?: "unknown");+ if (h) TLLog(@"framework-deferred-load %@ -> %p (triggered by %@)", dylibPath, h, imagePath);+ else TLLog(@"framework-deferred-load failed for %@: %s", dylibPath, dlerror() ?: "unknown");}});}@@ -178,13 +176,11 @@ static void TLScheduleFrameworkTweak(NSString *dylibPath, NSArray *frameworks) {const char *p = _dyld_get_image_name(i);for (NSString *fw in frameworks) {if (TLPathMatchesFramework(p, fw)) {- TLLog(@"queueing %@ for async load (framework %@ already loaded as %s)",- dylibPath, fw, p);+ TLLog(@"queueing %@ for async load (framework %@ already loaded as %s)", dylibPath, fw, p);dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{void *h = dlopen(dylibPath.fileSystemRepresentation, RTLD_NOW | RTLD_GLOBAL);if (h) TLLog(@"framework-load %@ -> %p", dylibPath, h);- else TLLog(@"framework-load failed for %@: %s",- dylibPath, dlerror() ?: "unknown");+ else TLLog(@"framework-load failed for %@: %s", dylibPath, dlerror() ?: "unknown");});return;}diff --git a/scripts/vcamcaptured/libvcamcaptured.m b/scripts/vcamcaptured/libvcamcaptured.mindex 2483caf7..c60e4135 100644--- a/scripts/vcamcaptured/libvcamcaptured.m+++ b/scripts/vcamcaptured/libvcamcaptured.m@@ -361,8 +361,9 @@ static int vcc_patch_two_nops(uintptr_t pc) {// icache flush dance as vcc_patch_two_nops. Verifies the original word// matches `expected_word` before writing so an iOS version skew doesn't// silently corrupt the wrong code. Returns 1 on success.-static int vcc_patch_word(uintptr_t pc, uint32_t expected_word,- uint32_t new_word) {+static int vcc_patch_word(uintptr_t pc,+ uint32_t expected_word,+ uint32_t new_word) {uint32_t cur = ((const uint32_t *)pc)[0];if (cur != expected_word) {vcc_log(@" patch_word @ 0x%lx: expected 0x%08x, found 0x%08x — skip",@@ -402,8 +403,9 @@ static int vcc_patch_word(uintptr_t pc, uint32_t expected_word,// instruction encoding is a stable fingerprint (e.g. `mov w20, #-12783`// MOVN encodings used for error-prep). Returns the count patched.static unsigned vcc_scan_and_patch(const vcc_image_t *img,- uint32_t needle, uint32_t replacement,- const char *what) {+ uint32_t needle,+ uint32_t replacement,+ const char *what) {if (!img->text || !img->text_words) return 0;unsigned hits = 0;for (size_t i = 0; i < img->text_words; i++) {@@ -604,8 +606,11 @@ static BOOL vcc_slot_value_is_cfarray(uintptr_t slot_addr) {// statics emits one such pair per global it initializes; the first// one is `_sSourceList`.static unsigned vcc_collect_call_then_store_globals(- uintptr_t func, unsigned maxInsns, unsigned lookahead,- uintptr_t *out_addrs, unsigned cap) {+ uintptr_t func,+ unsigned maxInsns,+ unsigned lookahead,+ uintptr_t *out_addrs,+ unsigned cap) {if (!func || !out_addrs || !cap) return 0;func = (uintptr_t)ptrauth_strip((void *)func, ptrauth_key_function_pointer);uint32_t *ip = (uint32_t *)func;@@ -1295,25 +1300,27 @@ static void vcc_install_synthetic(void) {static IMP vcc_add_endpoint_orig_imp = NULL;-typedef BOOL (*VccAddEndpointFn)(id, SEL,- id /*endpoint*/,- id /*endpointUniqueID*/,- int /*endpointType*/,- int /*endpointPID*/,- int /*endpointProxyPID*/,- audit_token_t * /*auditToken*/,- audit_token_t * /*proxyAuditToken*/,- id /*endpointCameraUniqueID*/);--static BOOL vcc_add_endpoint_hook(id self, SEL _cmd,- id endpoint,- id endpointUniqueID,- int endpointType,- int endpointPID,- int endpointProxyPID,- audit_token_t *auditToken,- audit_token_t *proxyAuditToken,- id endpointCameraUniqueID) {+typedef BOOL (*VccAddEndpointFn)(id,+ SEL,+ id /*endpoint*/,+ id /*endpointUniqueID*/,+ int /*endpointType*/,+ int /*endpointPID*/,+ int /*endpointProxyPID*/,+ audit_token_t * /*auditToken*/,+ audit_token_t * /*proxyAuditToken*/,+ id /*endpointCameraUniqueID*/);++static BOOL vcc_add_endpoint_hook(id self,+ SEL _cmd,+ id endpoint,+ id endpointUniqueID,+ int endpointType,+ int endpointPID,+ int endpointProxyPID,+ audit_token_t *auditToken,+ audit_token_t *proxyAuditToken,+ id endpointCameraUniqueID) {vcc_log(@" +addEndpoint cameraID=%@ pid=%d type=%d endpointUniqueID=%@",endpointCameraUniqueID, endpointPID, endpointType, endpointUniqueID);if (!vcc_add_endpoint_orig_imp) return NO;@@ -1437,22 +1444,34 @@ static IMP vcc_iqsn_render_orig = NULL;static IMP vcc_rqsn_render_orig = NULL;typedef id (*VccIqsnInitFn)(- id self, SEL _cmd,- BOOL hfrSupport, BOOL ispJitterCompensationEnabled,- audit_token_t auditToken, id sinkID);+ id self,+ SEL _cmd,+ BOOL hfrSupport,+ BOOL ispJitterCompensationEnabled,+ audit_token_t auditToken,+ id sinkID);typedef id (*VccRqsnInitFn)(- id self, SEL _cmd,- uint32_t mediaType, audit_token_t auditToken, id sinkID,+ id self,+ SEL _cmd,+ uint32_t mediaType,+ audit_token_t auditToken,+ id sinkID,id cameraInfoByPortType);typedef void (*VccRenderFn)(- id self, SEL _cmd, CMSampleBufferRef cmsb, id input);+ id self,+ SEL _cmd,+ CMSampleBufferRef cmsb,+ id input);static id vcc_iqsn_init_hook(- id self, SEL _cmd,- BOOL hfrSupport, BOOL ispJitterCompensationEnabled,- audit_token_t auditToken, id sinkID) {+ id self,+ SEL _cmd,+ BOOL hfrSupport,+ BOOL ispJitterCompensationEnabled,+ audit_token_t auditToken,+ id sinkID) {VccIqsnInitFn orig = (VccIqsnInitFn)vcc_iqsn_init_orig;id ret = orig(self, _cmd, hfrSupport, ispJitterCompensationEnabled,auditToken, sinkID);@@ -1463,8 +1482,11 @@ static id vcc_iqsn_init_hook(}static id vcc_rqsn_init_hook(- id self, SEL _cmd,- uint32_t mediaType, audit_token_t auditToken, id sinkID,+ id self,+ SEL _cmd,+ uint32_t mediaType,+ audit_token_t auditToken,+ id sinkID,id cameraInfoByPortType) {VccRqsnInitFn orig = (VccRqsnInitFn)vcc_rqsn_init_orig;id ret = orig(self, _cmd, mediaType, auditToken, sinkID,@@ -1476,7 +1498,10 @@ static id vcc_rqsn_init_hook(}static void vcc_iqsn_render_hook(- id self, SEL _cmd, CMSampleBufferRef cmsb, id input) {+ id self,+ SEL _cmd,+ CMSampleBufferRef cmsb,+ id input) {vcc_render_call_count++;if (vcc_render_call_count <= 5 || (vcc_render_call_count & 63) == 1) {vcc_log(@" [IQSN render] self=%p cmsb=%p input=%p inputCls=%@ #%lu",@@ -1488,7 +1513,10 @@ static void vcc_iqsn_render_hook(}static void vcc_rqsn_render_hook(- id self, SEL _cmd, CMSampleBufferRef cmsb, id input) {+ id self,+ SEL _cmd,+ CMSampleBufferRef cmsb,+ id input) {vcc_render_call_count++;if (vcc_render_call_count <= 5 || (vcc_render_call_count & 63) == 1) {vcc_log(@" [RQSN render] self=%p cmsb=%p input=%p inputCls=%@ #%lu",@@ -1526,8 +1554,12 @@ static IMP vcc_copy_device_orig = NULL;// emit objc_retain on an integer register and crash inside the hook// prologue.-typedef id (*VccCopyDeviceFn)(id self, SEL _cmd, NSString *deviceID,- int clientPID, BOOL informClient, int *err);+typedef id (*VccCopyDeviceFn)(id self,+ SEL _cmd,+ NSString *deviceID,+ int clientPID,+ BOOL informClient,+ int *err);static Class vcc_synth_device_class = Nil;@@ -1536,8 +1568,12 @@ static void vcc_init_synth_device_class(void);__attribute__((ns_returns_retained))static id vcc_make_synth_device(NSString *deviceID);-static id vcc_copy_device_hook(id self, SEL _cmd, NSString *deviceID,- int clientPID, BOOL informClient, int *err) {+static id vcc_copy_device_hook(id self,+ SEL _cmd,+ NSString *deviceID,+ int clientPID,+ BOOL informClient,+ int *err) {vcc_log(@" [copyDeviceWithID] deviceID=%@ clientPID=%d inform=%d",deviceID, clientPID, informClient);@@ -1582,8 +1618,9 @@ static ptrdiff_t kBWFigCaptureDevice_deviceID_Offset = -1;// candidate in `names` (NULL-terminated) until one matches. Returns -1// if none match. Logs the outcome so a future iOS rename surfaces in// the install log instead of silently writing to a wrong slot.-static ptrdiff_t vcc_resolve_ivar(Class cls, const char *what,- const char *const *names) {+static ptrdiff_t vcc_resolve_ivar(Class cls,+ const char *what,+ const char *const *names) {if (!cls) {vcc_log(@" ivar %s: class missing", what ? what : "?");return -1;@@ -1644,8 +1681,10 @@ static id vcc_synth_copy_property(id self, SEL _cmd, id property, int *err) {}__attribute__((ns_returns_retained))-static id vcc_synth_copy_property_if_supported(id self, SEL _cmd,- id property, int *err) {+static id vcc_synth_copy_property_if_supported(id self,+ SEL _cmd,+ id property,+ int *err) {NSString *propStr = [property description];if (err) *err = 0;vcc_log(@" [SynthDev copyPropertyIfSupported:%@] -> nil", propStr);@@ -1761,8 +1800,10 @@ static ptrdiff_t kBWFigCaptureStream_streaming_Offset = -1;static CFStringRef vcc_cf_kSupportedFormatsArray = NULL;__attribute__((ns_returns_retained))-static id vcc_synth_stream_copy_property(id self, SEL _cmd, id property,- int *err) {+static id vcc_synth_stream_copy_property(id self,+ SEL _cmd,+ id property,+ int *err) {if (!vcc_cf_kSupportedFormatsArray) {vcc_cf_kSupportedFormatsArray =vcc_cfconst("kFigCaptureStreamProperty_SupportedFormatsArray");@@ -1786,16 +1827,20 @@ static id vcc_synth_stream_copy_property(id self, SEL _cmd, id property,}__attribute__((ns_returns_retained))-static id vcc_synth_stream_copy_property_if_supported(id self, SEL _cmd,- id property, int *err) {+static id vcc_synth_stream_copy_property_if_supported(id self,+ SEL _cmd,+ id property,+ int *err) {if (err) *err = 0;vcc_log(@" [SynthStream copyPropertyIfSupported:%@] -> nil",[property description]);return nil;}-static int vcc_synth_stream_get_property(id self, SEL _cmd, id property,- int *err) {+static int vcc_synth_stream_get_property(id self,+ SEL _cmd,+ id property,+ int *err) {NSString *propStr = [property description];// The daemon's session-start path queries PixelSize on the stream and// treats err=-12787 as fatal — propagates up to AVCaptureSessionRuntimeError@@ -1807,8 +1852,10 @@ static int vcc_synth_stream_get_property(id self, SEL _cmd, id property,return 0;}-static int vcc_synth_stream_get_property_if_supported(id self, SEL _cmd,- id property, int *err) {+static int vcc_synth_stream_get_property_if_supported(id self,+ SEL _cmd,+ id property,+ int *err) {if (err) *err = 0;vcc_log(@" [SynthStream getPropertyIfSupported:%@] -> 0 err=0",[property description]);@@ -1818,10 +1865,11 @@ static int vcc_synth_stream_get_property_if_supported(id self, SEL _cmd,// Catches the private _copyProperty:requireSupported:error: path. Same// effective result as -copyProperty:error: (canned values for known// keys, -12787 otherwise) — just a 3rd BOOL arg.-static id vcc_synth_stream_underscore_copy_property(id self, SEL _cmd,- id property,- BOOL requireSupported,- int *err) {+static id vcc_synth_stream_underscore_copy_property(id self,+ SEL _cmd,+ id property,+ BOOL requireSupported,+ int *err) {return vcc_synth_stream_copy_property(self, @selector(copyProperty:error:),property, err);}@@ -1830,8 +1878,10 @@ static id vcc_synth_stream_supported_properties(id self, SEL _cmd) {return [NSDictionary dictionary];}-static int vcc_synth_stream_set_property(id self, SEL _cmd, id property,- id value) {+static int vcc_synth_stream_set_property(id self,+ SEL _cmd,+ id property,+ id value) {vcc_log(@" [SynthStream setProperty:%@] (ignored)", [property description]);return 0;}@@ -1911,8 +1961,9 @@ static void vcc_init_synth_stream_class(void) {static NSMutableArray *vcc_synth_streams_strong_refs = nil;__attribute__((ns_returns_retained))-static id vcc_make_synth_stream(NSString *uniqueID, NSString *deviceID,- NSString *portType) {+static id vcc_make_synth_stream(NSString *uniqueID,+ NSString *deviceID,+ NSString *portType) {if (!vcc_synth_stream_class) vcc_init_synth_stream_class();if (!vcc_synth_stream_class) return nil;// Use +alloc via runtime — ARC-safe (class_createInstance is@@ -1960,11 +2011,19 @@ static id vcc_make_synth_stream(NSString *uniqueID, NSString *deviceID,// the input attributes count.static IMP vcc_copy_streams_orig = NULL;-typedef id (*VccCopyStreamsFn)(id self, SEL _cmd, NSArray *uniqueIDs,- id forDevice, int priority, int *err);--static id vcc_copy_streams_hook(id self, SEL _cmd, NSArray *uniqueIDs,- id forDevice, int priority, int *err) {+typedef id (*VccCopyStreamsFn)(id self,+ SEL _cmd,+ NSArray *uniqueIDs,+ id forDevice,+ int priority,+ int *err);++static id vcc_copy_streams_hook(id self,+ SEL _cmd,+ NSArray *uniqueIDs,+ id forDevice,+ int priority,+ int *err) {if (forDevice && object_getClass(forDevice) == vcc_synth_device_class) {vcc_log(@" [copyStreamsWithUniqueIDs forDevice:synth] ids=%@", uniqueIDs);NSMutableArray *out = [NSMutableArray array];@@ -1992,13 +2051,23 @@ static void vcc_install_copy_streams_hook(void) {}static IMP vcc_copy_streams_from_orig = NULL;-typedef id (*VccCopyStreamsFromFn)(id self, SEL _cmd, id fromDevice,- NSArray *positions, NSArray *deviceTypes,- int prio, BOOL allowsLoss, int *err);--static id vcc_copy_streams_from_hook(id self, SEL _cmd, id fromDevice,- NSArray *positions, NSArray *deviceTypes,- int prio, BOOL allowsLoss, int *err) {+typedef id (*VccCopyStreamsFromFn)(id self,+ SEL _cmd,+ id fromDevice,+ NSArray *positions,+ NSArray *deviceTypes,+ int prio,+ BOOL allowsLoss,+ int *err);++static id vcc_copy_streams_from_hook(id self,+ SEL _cmd,+ id fromDevice,+ NSArray *positions,+ NSArray *deviceTypes,+ int prio,+ BOOL allowsLoss,+ int *err) {if (fromDevice && object_getClass(fromDevice) == vcc_synth_device_class) {vcc_log(@" [copyStreamsFromDevice:synth positions=%@ deviceTypes=%@]",positions, deviceTypes);@@ -2329,8 +2398,10 @@ static void vcc_still_set_handler_hook(id self, SEL _cmd, id handler) {orig(self, _cmd, handler);}-static void vcc_still_render_hook(id self, SEL _cmd, CMSampleBufferRef sb,- id input) {+static void vcc_still_render_hook(id self,+ SEL _cmd,+ CMSampleBufferRef sb,+ id input) {vcc_log(@" [StillSink renderSampleBuffer:forInput:] self=%p sb=%p input=%@",self, sb, input);VccStillRenderFn orig = (VccStillRenderFn)vcc_still_render_orig;@@ -2370,8 +2441,10 @@ typedef void (*VccSessDidFinishStartingFn)(id self, SEL _cmd, id graph, int errotypedef void (*VccSessDidStartSourceFn)(id self, SEL _cmd, id graph, id node, int error);typedef void (*VccSessDidPrepareFn)(id self, SEL _cmd, id graph);-static void vcc_sess_didFinishStarting_hook(id self, SEL _cmd, id graph,- int error) {+static void vcc_sess_didFinishStarting_hook(id self,+ SEL _cmd,+ id graph,+ int error) {vcc_log(@" [Sess graph:didFinishStartingWithError:] self=%p graph=%p err=%d",self, graph, error);VccSessDidFinishStartingFn orig =@@ -2379,8 +2452,11 @@ static void vcc_sess_didFinishStarting_hook(id self, SEL _cmd, id graph,orig(self, _cmd, graph, error);}-static void vcc_sess_didStartSourceNode_hook(id self, SEL _cmd, id graph,- id node, int error) {+static void vcc_sess_didStartSourceNode_hook(id self,+ SEL _cmd,+ id graph,+ id node,+ int error) {vcc_log(@" [Sess graph:didStartSourceNode:error:] self=%p graph=%p node=%@ err=%d",self, graph, node, error);VccSessDidStartSourceFn orig =@@ -2482,8 +2558,10 @@ typedef void (*VccSessSettingsFn)(id self, SEL _cmd, id coord, id settings);typedef void (*VccSessWillPrepareFn)(id self, SEL _cmd, id coord, id settings, BOOL clientInitiated);typedef void (*VccSessWillCaptureFn)(id self, SEL _cmd, id coord, id settings, int err);-static void vcc_sess_willBeginPhoto_hook(id self, SEL _cmd, id coord,- long settingsID) {+static void vcc_sess_willBeginPhoto_hook(id self,+ SEL _cmd,+ id coord,+ long settingsID) {vcc_log(@" [Sess stillImageCoordinator:willBeginCaptureBeforeResolvingSettingsForID:] coord=%p id=%ld",coord, settingsID);VccSessWillBeginPhotoFn orig =@@ -2491,8 +2569,10 @@ static void vcc_sess_willBeginPhoto_hook(id self, SEL _cmd, id coord,orig(self, _cmd, coord, settingsID);}-static void vcc_sess_willBeginPhotoForSettings_hook(id self, SEL _cmd, id coord,- id settings) {+static void vcc_sess_willBeginPhotoForSettings_hook(id self,+ SEL _cmd,+ id coord,+ id settings) {vcc_log(@" [Sess stillImageCoordinator:willBeginCaptureForSettings:] coord=%p settings=%@",coord, settings);VccSessSettingsFn orig =@@ -2500,8 +2580,11 @@ static void vcc_sess_willBeginPhotoForSettings_hook(id self, SEL _cmd, id coord,orig(self, _cmd, coord, settings);}-static void vcc_sess_willPreparePhoto_hook(id self, SEL _cmd, id coord,- id settings, BOOL clientInitiated) {+static void vcc_sess_willPreparePhoto_hook(id self,+ SEL _cmd,+ id coord,+ id settings,+ BOOL clientInitiated) {vcc_log(@" [Sess stillImageCoordinator:willPrepareStillImageCaptureWithSettings:clientInitiated:] coord=%p settings=%@ ci=%d",coord, settings, clientInitiated);VccSessWillPrepareFn orig =@@ -2509,8 +2592,11 @@ static void vcc_sess_willPreparePhoto_hook(id self, SEL _cmd, id coord,orig(self, _cmd, coord, settings, clientInitiated);}-static void vcc_sess_willCapturePhoto_hook(id self, SEL _cmd, id coord,- id settings, int err) {+static void vcc_sess_willCapturePhoto_hook(id self,+ SEL _cmd,+ id coord,+ id settings,+ int err) {vcc_log(@" [Sess stillImageCoordinator:willCapturePhotoForSettings:error:] coord=%p settings=%@ err=%d",coord, settings, err);VccSessWillCaptureFn orig =@@ -2518,8 +2604,10 @@ static void vcc_sess_willCapturePhoto_hook(id self, SEL _cmd, id coord,orig(self, _cmd, coord, settings, err);}-static void vcc_sess_didCapturePhoto_hook(id self, SEL _cmd, id coord,- id settings) {+static void vcc_sess_didCapturePhoto_hook(id self,+ SEL _cmd,+ id coord,+ id settings) {vcc_log(@" [Sess stillImageCoordinator:didCapturePhotoForSettings:] coord=%p settings=%@",coord, settings);VccSessSettingsFn orig =@@ -2565,8 +2653,10 @@ static void vcc_install_still_coordinator_observation(void) {static IMP vcc_still_coord_enqueue_orig = NULL;typedef void (*VccStillCoordEnqueueFn)(id self, SEL _cmd, id settings, BOOL serviceIfNecessary);-static void vcc_still_coord_enqueue_hook(id self, SEL _cmd, id settings,- BOOL serviceIfNecessary) {+static void vcc_still_coord_enqueue_hook(id self,+ SEL _cmd,+ id settings,+ BOOL serviceIfNecessary) {vcc_log(@" [StillCoord enqueueRequest] self=%p settings=%@ service=%d",self, settings, serviceIfNecessary);VccStillCoordEnqueueFn orig =@@ -2599,15 +2689,26 @@ static void vcc_install_still_coord_node_observation(void) {// arguments to figure out which is missing.static IMP vcc_still_pipe_init_orig = NULL;-typedef id (*VccStillPipeInitFn)(id self, SEL _cmd, id config, id device,- id outputsByPortType, id captureStatusDelegate,- id inferenceScheduler, id graph, id name);+typedef id (*VccStillPipeInitFn)(id self,+ SEL _cmd,+ id config,+ id device,+ id outputsByPortType,+ id captureStatusDelegate,+ id inferenceScheduler,+ id graph,+ id name);__attribute__((ns_returns_retained))-static id vcc_still_pipe_init_hook(id self, SEL _cmd, id config, id device,- id outputsByPortType,- id captureStatusDelegate,- id inferenceScheduler, id graph, id name) {+static id vcc_still_pipe_init_hook(id self,+ SEL _cmd,+ id config,+ id device,+ id outputsByPortType,+ id captureStatusDelegate,+ id inferenceScheduler,+ id graph,+ id name) {vcc_log(@" [StillPipe init] self=%p config=%@ device=%@ outputs.count=%lu name=%@",self, config, device,(unsigned long)([outputsByPortType respondsToSelector:@selector(count)]@@ -2916,13 +3017,18 @@ static void vcc_drive_still_sink_once(void) {// pipeline will be built.static IMP vcc_parsed_cfg_init_orig = NULL;-typedef id (*VccParsedCfgInitFn)(id self, SEL _cmd, id sessionCfg,- BOOL clientSetsUserInitiated, id restrictions);+typedef id (*VccParsedCfgInitFn)(id self,+ SEL _cmd,+ id sessionCfg,+ BOOL clientSetsUserInitiated,+ id restrictions);__attribute__((ns_returns_retained))-static id vcc_parsed_cfg_init_hook(id self, SEL _cmd, id sessionCfg,- BOOL clientSetsUserInitiated,- id restrictions) {+static id vcc_parsed_cfg_init_hook(id self,+ SEL _cmd,+ id sessionCfg,+ BOOL clientSetsUserInitiated,+ id restrictions) {VccParsedCfgInitFn orig = (VccParsedCfgInitFn)vcc_parsed_cfg_init_orig;id ret = orig(self, _cmd, sessionCfg, clientSetsUserInitiated, restrictions);if (ret) {@@ -2957,7 +3063,9 @@ static id vcc_parsed_cfg_init_hook(id self, SEL _cmd, id sessionCfg,// Dump the still cfg's properties — what does it tell the graph builder?id connConfigs = nil, primaryConnConfig = nil, movieCfg = nil, pointCfg = nil;@try { connConfigs = [stillCfg valueForKey:@"stillImageConnectionConfigurations"]; } @catch (NSException *e) {}- @try { primaryConnConfig = [stillCfg valueForKey:@"primaryStillImageConnectionConfiguration"]; } @catch (NSException *e) {}+ @try {+ primaryConnConfig = [stillCfg valueForKey:@"primaryStillImageConnectionConfiguration"];+ } @catch (NSException *e) {}@try { movieCfg = [stillCfg valueForKey:@"movieFileVideoConnectionConfiguration"]; } @catch (NSException *e) {}@try { pointCfg = [stillCfg valueForKey:@"pointCloudDataConnectionConfiguration"]; } @catch (NSException *e) {}vcc_log(@" [ParsedCfg] stillCfgs[0].connCfgs=%@",diff --git a/scripts/vphoned/unarchive.m b/scripts/vphoned/unarchive.mindex 6508898e..c968a1b5 100644--- a/scripts/vphoned/unarchive.m+++ b/scripts/vphoned/unarchive.m@@ -54,7 +54,8 @@ int vp_extract_archive(NSString *archivePath, NSString *extractionPath, NSStringif (r < ARCHIVE_OK)NSLog(@"vphoned: archive_read_next_header: %s", archive_error_string(a));if (r < ARCHIVE_WARN) {- if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to read the app package (%s).", archive_error_string(a)];+ if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to read the app package (%s).",+ archive_error_string(a)];ret = 1; goto cleanup;}@@ -69,7 +70,9 @@ int vp_extract_archive(NSString *archivePath, NSString *extractionPath, NSStringif (r < ARCHIVE_OK)NSLog(@"vphoned: archive_write_header(%@): %s (r=%d)", currentFile, archive_error_string(ext), r);if (r < ARCHIVE_WARN) {- if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).", currentFile, archive_error_string(ext)];+ if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).",+ currentFile,+ archive_error_string(ext)];ret = 1; goto cleanup;}if (archive_entry_size(entry) > 0) {@@ -77,7 +80,9 @@ int vp_extract_archive(NSString *archivePath, NSString *extractionPath, NSStringif (r < ARCHIVE_OK)NSLog(@"vphoned: copy_data(%@): %s (r=%d)", currentFile, archive_error_string(ext), r);if (r < ARCHIVE_WARN) {- if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).", currentFile, archive_error_string(ext)];+ if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).",+ currentFile,+ archive_error_string(ext)];ret = 1; goto cleanup;}}@@ -86,7 +91,9 @@ int vp_extract_archive(NSString *archivePath, NSString *extractionPath, NSStringif (r < ARCHIVE_OK)NSLog(@"vphoned: archive_write_finish_entry(%@): %s (r=%d)", currentFile, archive_error_string(ext), r);if (r < ARCHIVE_WARN) {- if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).", currentFile, archive_error_string(ext)];+ if (errorOutput) *errorOutput = [NSString stringWithFormat:@"Unable to extract %@ (%s).",+ currentFile,+ archive_error_string(ext)];ret = 1; goto cleanup;}}diff --git a/scripts/vphoned/vphoned_apps.m b/scripts/vphoned/vphoned_apps.mindex cecf7452..32b51cc2 100644--- a/scripts/vphoned/vphoned_apps.m+++ b/scripts/vphoned/vphoned_apps.m@@ -181,7 +181,10 @@ NSDictionary *vp_handle_apps_command(NSDictionary *msg) {service,sel_registerName("terminateApplication:forReason:andReport:withDescription:"),- bundleID, 5, NO, @"vphoned terminate request");+ bundleID,+ 5,+ NO,+ @"vphoned terminate request");}} else {// Fallback: kill by PIDdiff --git a/scripts/vphoned/vphoned_hid.m b/scripts/vphoned/vphoned_hid.mindex c595ab28..d0f6f5dd 100644--- a/scripts/vphoned/vphoned_hid.m+++ b/scripts/vphoned/vphoned_hid.m@@ -61,7 +61,9 @@ BOOL vp_hid_load(void) {if (!gClient) { NSLog(@"vphoned: IOHIDEventSystemClientCreate returned NULL"); return NO; }dispatch_queue_attr_t attr = dispatch_queue_attr_make_with_qos_class(- DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INTERACTIVE, 0);+ DISPATCH_QUEUE_SERIAL,+ QOS_CLASS_USER_INTERACTIVE,+ 0);gHIDQueue = dispatch_queue_create("com.vphone.vphoned.hid", attr);NSLog(@"vphoned: IOKit loaded");diff --git a/scripts/vphoned/vphoned_install.m b/scripts/vphoned/vphoned_install.mindex c7918f3b..573af592 100644--- a/scripts/vphoned/vphoned_install.m+++ b/scripts/vphoned/vphoned_install.m@@ -356,7 +356,8 @@ static int vp_sign_app(NSString *appPath, NSString *certPath, NSString *ldidPathcontinue;}- NSMutableDictionary *entitlementsToUse = [vp_dump_entitlements_from_binary_at_path(bundleMainExecutablePath) mutableCopy];+ NSMutableDictionary *entitlementsToUse =+ [vp_dump_entitlements_from_binary_at_path(bundleMainExecutablePath) mutableCopy];if (!entitlementsToUse && [bundleMainExecutablePath isEqualToString:mainExecutablePath]) {entitlementsToUse = [@{@"application-identifier": @"TROLLTROLL.*",@@ -376,10 +377,12 @@ static int vp_sign_app(NSString *appPath, NSString *certPath, NSString *ldidPath} else if ([containerRequired isKindOfClass:[NSNumber class]]) {shouldWriteContainerRequired = [(NSNumber *)containerRequired boolValue];}- BOOL noContainer = [entitlementsToUse[@"com.apple.private.security.no-container"] respondsToSelector:@selector(boolValue)]+ BOOL noContainer =+ [entitlementsToUse[@"com.apple.private.security.no-container"] respondsToSelector:@selector(boolValue)]? [entitlementsToUse[@"com.apple.private.security.no-container"] boolValue]: NO;- BOOL noSandbox = [entitlementsToUse[@"com.apple.private.security.no-sandbox"] respondsToSelector:@selector(boolValue)]+ BOOL noSandbox =+ [entitlementsToUse[@"com.apple.private.security.no-sandbox"] respondsToSelector:@selector(boolValue)]? [entitlementsToUse[@"com.apple.private.security.no-sandbox"] boolValue]: NO;if (shouldWriteContainerRequired && !noContainer && !noSandbox) {@@ -418,7 +421,11 @@ static NSDictionary *vp_construct_groups_containers_for_entitlements(NSDictionarNSMutableDictionary *groupContainers = [NSMutableDictionary dictionary];for (NSString *groupID in groupIDs) {- MCMContainer *container = [mcmClass containerWithIdentifier:groupID createIfNecessary:YES existed:nil error:nil];+ MCMContainer *container = [mcmClass+ containerWithIdentifier:groupID+ createIfNecessary:YES+ existed:nil+ error:nil];if (container.url.path.length > 0) {groupContainers[groupID] = container.url.path;}@@ -447,7 +454,10 @@ static NSString *vp_construct_team_identifier_for_entitlements(NSDictionary *entreturn [teamIdentifier isKindOfClass:[NSString class]] ? teamIdentifier : nil;}-static NSDictionary *vp_construct_environment_variables_for_container_path(NSString *containerPath, BOOL isContainerized) {+static NSDictionary *vp_construct_environment_variables_for_container_path(+ NSString *containerPath,+ BOOL isContainerized+) {NSString *homeDir = isContainerized ? containerPath : @"/var/mobile";NSString *tmpDir = isContainerized ? [containerPath stringByAppendingPathComponent:@"tmp"] : @"/var/tmp";return @{@@ -540,7 +550,8 @@ static BOOL vp_register_path(NSString *path, BOOL unregister, BOOL forceSystem)}path = path.stringByResolvingSymlinksInPath.stringByStandardizingPath;- NSDictionary *appInfoPlist = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];+ NSDictionary *appInfoPlist =+ [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];NSString *appBundleID = appInfoPlist[@"CFBundleIdentifier"];if (appBundleID.length == 0) return NO;if ([vp_immutable_app_bundle_identifiers() containsObject:appBundleID.lowercaseString]) return NO;@@ -548,7 +559,9 @@ static BOOL vp_register_path(NSString *path, BOOL unregister, BOOL forceSystem)if (!unregister) {NSString *appExecutablePath = [path stringByAppendingPathComponent:appInfoPlist[@"CFBundleExecutable"]];NSMutableDictionary *dictToRegister = vp_registration_dictionary(- appBundleID, appExecutablePath, NSClassFromString(@"MCMAppDataContainer"));+ appBundleID,+ appExecutablePath,+ NSClassFromString(@"MCMAppDataContainer"));BOOL isRemovableSystemApp = [[NSFileManager defaultManager]fileExistsAtPath:[@"/System/Library/AppSignatures" stringByAppendingPathComponent:appBundleID]];@@ -579,7 +592,9 @@ static BOOL vp_register_path(NSString *path, BOOL unregister, BOOL forceSystem)NSString *pluginExecutablePath = [pluginPath stringByAppendingPathComponent:pluginExecutable];NSMutableDictionary *pluginDict = vp_registration_dictionary(- pluginBundleID, pluginExecutablePath, NSClassFromString(@"MCMPluginKitPluginDataContainer"));+ pluginBundleID,+ pluginExecutablePath,+ NSClassFromString(@"MCMPluginKitPluginDataContainer"));pluginDict[@"ApplicationType"] = @"PluginKitPlugin";pluginDict[@"Path"] = pluginPath;pluginDict[@"PluginOwnerBundleID"] = appBundleID;@@ -671,7 +686,11 @@ static int vp_install_app_from_package(return 170;}- MCMContainer *appContainer = [appContainerClass containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil];+ MCMContainer *appContainer = [appContainerClass+ containerWithIdentifier:appId+ createIfNecessary:NO+ existed:nil+ error:nil];if (appContainer) {NSURL *bundleContainerURL = appContainer.url;NSURL *appBundleURL = vp_find_app_url_in_bundle_url(bundleContainerURL);@@ -684,16 +703,23 @@ static int vp_install_app_from_package(}} else {NSError *mcmError = nil;- appContainer = [appContainerClass containerWithIdentifier:appId createIfNecessary:YES existed:nil error:&mcmError];+ appContainer = [appContainerClass+ containerWithIdentifier:appId+ createIfNecessary:YES+ existed:nil+ error:&mcmError];if (!appContainer || mcmError) {if (detailOutput) *detailOutput = mcmError.localizedDescription ?: @"Unable to prepare storage for the app.";return 170;}}- NSString *newAppBundlePath = [appContainer.url.path stringByAppendingPathComponent:appBundleToInstallPath.lastPathComponent];+ NSString *newAppBundlePath =+ [appContainer.url.path stringByAppendingPathComponent:appBundleToInstallPath.lastPathComponent];NSError *copyError = nil;- if (![[NSFileManager defaultManager] copyItemAtPath:appBundleToInstallPath toPath:newAppBundlePath error:©Error]) {+ if (![[NSFileManager defaultManager] copyItemAtPath:appBundleToInstallPath+ toPath:newAppBundlePath+ error:©Error]) {if (detailOutput) *detailOutput = copyError.localizedDescription ?: @"Unable to copy the app onto the guest.";return 178;}@@ -779,8 +805,12 @@ NSDictionary *vp_handle_custom_install(NSDictionary *msg) {certPath = nil;}- NSString *tmpPackagePath = [[NSTemporaryDirectory() stringByResolvingSymlinksInPath] stringByAppendingPathComponent:[NSUUID UUID].UUIDString];- if (![[NSFileManager defaultManager] createDirectoryAtPath:tmpPackagePath withIntermediateDirectories:NO attributes:nil error:nil]) {+ NSString *tmpPackagePath = [[NSTemporaryDirectory() stringByResolvingSymlinksInPath]+ stringByAppendingPathComponent:[NSUUID UUID].UUIDString];+ if (![[NSFileManager defaultManager] createDirectoryAtPath:tmpPackagePath+ withIntermediateDirectories:NO+ attributes:nil+ error:nil]) {NSMutableDictionary *response = vp_make_response(@"err", reqId);response[@"msg"] = @"Unable to prepare the guest for installation. Try again.";return response;diff --git a/scripts/vphoned/vphoned_settings.m b/scripts/vphoned/vphoned_settings.mindex 945550c0..a48f6f3f 100644--- a/scripts/vphoned/vphoned_settings.m+++ b/scripts/vphoned/vphoned_settings.m@@ -121,7 +121,9 @@ NSDictionary *vp_handle_settings_command(NSDictionary *msg) {NSMutableDictionary *r = vp_make_response(@"settings_get", reqId);if (keys) {CFDictionaryRef allValues = CFPreferencesCopyMultiple(- keys, (__bridge CFStringRef)domain, kCFPreferencesCurrentUser,+ keys,+ (__bridge CFStringRef)domain,+ kCFPreferencesCurrentUser,kCFPreferencesAnyHost);if (allValues) {// Convert to serializable dictdiff --git a/scripts/vphoned/vphoned_vcam.m b/scripts/vphoned/vphoned_vcam.mindex 4590151d..ab53aadb 100644--- a/scripts/vphoned/vphoned_vcam.m+++ b/scripts/vphoned/vphoned_vcam.m@@ -104,9 +104,13 @@ static ssize_t read_full(int fd, void *buf, size_t n) {return (ssize_t)got;}-static void publish_frame(uint32_t w, uint32_t h, uint32_t bpr,- uint32_t fmt, uint64_t ts_ns,- const uint8_t *pixels, size_t pixel_len) {+static void publish_frame(uint32_t w,+ uint32_t h,+ uint32_t bpr,+ uint32_t fmt,+ uint64_t ts_ns,+ const uint8_t *pixels,+ size_t pixel_len) {if (!s_shm_base) return;if (pixel_len > VPHONED_VCAM_SHM_MAX_PIXELS) {vvc_logf("vphoned_vcam: frame too large: %zu", pixel_len);@@ -184,8 +188,11 @@ static void handle_client(int fd) {if (!hdict || jerr || w == 0 || h == 0 || bpr == 0 ||pixel_len < (size_t)bpr * h) {vvc_logf("vphoned_vcam: invalid frame w=%u h=%u bpr=%u pixel_len=%zu jerr=%s",- w, h, bpr, pixel_len,- jerr ? jerr.localizedDescription.UTF8String : "(none)");+ w,+ h,+ bpr,+ pixel_len,+ jerr ? jerr.localizedDescription.UTF8String : "(none)");free(pixel_buf);break;}diff --git a/scripts/vpregister/vpregister.m b/scripts/vpregister/vpregister.mindex eac8380b..e966b674 100644--- a/scripts/vpregister/vpregister.m+++ b/scripts/vpregister/vpregister.m@@ -15,7 +15,8 @@registrationError:(NSError **)error;@endstatic BOOL register_app(LSApplicationWorkspace *ws, NSString *path) {- NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];+ NSDictionary *info =+ [NSDictionary dictionaryWithContentsOfFile:[path stringByAppendingPathComponent:@"Info.plist"]];NSString *bundleID = info[@"CFBundleIdentifier"];if (bundleID.length == 0) return NO;NSDictionary *dictToRegister = @{@@ -34,8 +35,11 @@ static BOOL register_app(LSApplicationWorkspace *ws, NSString *path) {// The containerized API returns NO even when registration succeeds, so a nil// registrationError is the success signal (same rule as vphoned_install.m's// containerized path).- [ws registerContainerizedApplicationWithInfoDictionaries:@[dictToRegister] operationUUID:[NSUUID UUID]- requestContext:nil saveObserver:nil registrationError:&err];+ [ws registerContainerizedApplicationWithInfoDictionaries:@[dictToRegister]+ operationUUID:[NSUUID UUID]+ requestContext:nil+ saveObserver:nil+ registrationError:&err];if (err) fprintf(stderr, " Unable to register: %s\n", err.description.UTF8String);return err == nil;}diff --git a/sources/FirmwarePatcher/AVPBooter/AVPBooterPatcher.swift b/sources/FirmwarePatcher/AVPBooter/AVPBooterPatcher.swiftindex 06472b96..fd86f04e 100644--- a/sources/FirmwarePatcher/AVPBooter/AVPBooterPatcher.swift+++ b/sources/FirmwarePatcher/AVPBooter/AVPBooterPatcher.swift@@ -147,8 +147,12 @@ public final class AVPBooterPatcher: Patcher {patches.append(record)if verbose {- print(String(format: " 0x%06X: %@ → %@ [avpbooter.dgst_bypass]",- fileOff, beforeStr, afterStr))+ print(String(+ format: " 0x%06X: %@ → %@ [avpbooter.dgst_bypass]",+ fileOff,+ beforeStr,+ afterStr+ ))}}}diff --git a/sources/FirmwarePatcher/Binary/MachOHelpers.swift b/sources/FirmwarePatcher/Binary/MachOHelpers.swiftindex 9d945608..d876987d 100644--- a/sources/FirmwarePatcher/Binary/MachOHelpers.swift+++ b/sources/FirmwarePatcher/Binary/MachOHelpers.swift@@ -52,8 +52,11 @@ public enum MachOParser {let fileSize = data.loadLE(UInt64.self, at: offset + 48)segments.append(MachOSegmentInfo(- name: name, vmAddr: vmAddr, vmSize: vmSize,- fileOffset: fileOff, fileSize: fileSize+ name: name,+ vmAddr: vmAddr,+ vmSize: vmSize,+ fileOffset: fileOff,+ fileSize: fileSize))}offset += Int(cmdsize)@@ -96,8 +99,11 @@ public enum MachOParser {let key = "\(segName),\(sectName)"sections[key] = MachOSectionInfo(- segmentName: segName, sectionName: sectName,- address: addr, size: size, fileOffset: fileOff+ segmentName: segName,+ sectionName: sectName,+ address: addr,+ size: size,+ fileOffset: fileOff)sectOff += 80}diff --git a/sources/FirmwarePatcher/Core/PatchRecord.swift b/sources/FirmwarePatcher/Core/PatchRecord.swiftindex 32d9e7c8..1c30b932 100644--- a/sources/FirmwarePatcher/Core/PatchRecord.swift+++ b/sources/FirmwarePatcher/Core/PatchRecord.swift@@ -57,11 +57,14 @@ public struct PatchRecord: Codable, Equatable, Sendable {extension PatchRecord: CustomStringConvertible {public var description: String {let addr = virtualAddress.map { String(format: " (VA 0x%llX)", $0) } ?? ""- return String(format: " 0x%06X%@: %@ → %@ [%@]",- fileOffset, addr,- beforeDisasm.isEmpty ? originalBytes.hex : beforeDisasm,- afterDisasm.isEmpty ? patchedBytes.hex : afterDisasm,- patchID)+ return String(+ format: " 0x%06X%@: %@ → %@ [%@]",+ fileOffset,+ addr,+ beforeDisasm.isEmpty ? originalBytes.hex : beforeDisasm,+ afterDisasm.isEmpty ? patchedBytes.hex : afterDisasm,+ patchID+ )}}diff --git a/sources/FirmwarePatcher/DeviceTree/DeviceTreePatcher.swift b/sources/FirmwarePatcher/DeviceTree/DeviceTreePatcher.swiftindex 55afae18..c8601eaa 100644--- a/sources/FirmwarePatcher/DeviceTree/DeviceTreePatcher.swift+++ b/sources/FirmwarePatcher/DeviceTree/DeviceTreePatcher.swift@@ -140,8 +140,11 @@ public final class DeviceTreePatcher: Patcher {pos += Self.align4(length)node.properties.append(DTProperty(- name: name, length: length, flags: flags,- value: value, valueOffset: valueOffset+ name: name,+ length: length,+ flags: flags,+ value: value,+ valueOffset: valueOffset))}@@ -331,11 +334,13 @@ public final class DeviceTreePatcher: Patcher {patches.append(record)if verbose {- print(String(format: " 0x%06X: %@ → %@ [%@]",- prop.valueOffset,- originalBytes.hex,- newValue.hex,- patch.patchID))+ print(String(+ format: " 0x%06X: %@ → %@ [%@]",+ prop.valueOffset,+ originalBytes.hex,+ newValue.hex,+ patch.patchID+ ))}}diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swiftindex 17f22f6a..89c761d0 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcher.swift@@ -35,7 +35,13 @@ public final class CryptexFilesystemPatcher: Patcher {// MARK: - Init- public init(buildManiest: Data, restoreDir: URL, verbose: Bool = true, noBinpack: Bool = false, noVphoned: Bool = false) {+ public init(+ buildManiest: Data,+ restoreDir: URL,+ verbose: Bool = true,+ noBinpack: Bool = false,+ noVphoned: Bool = false+ ) {self.buildManiest = buildManiestself.restoreDir = restoreDirself.verbose = verbose@@ -76,12 +82,21 @@ public final class CryptexFilesystemPatcher: Patcher {let mtreePath = try createMtree(filesystem: unencryptedImage)print("Creating digest database and root hash…")- let (digestDbPath, rootHashPath) = try createDigestAndHash(filesystem: unencryptedImage, mtree: mtreePath, remap: didEdit)+ let (digestDbPath, rootHashPath) = try createDigestAndHash(+ filesystem: unencryptedImage,+ mtree: mtreePath,+ remap: didEdit+ )let metadataPath = try compressCanonicalMetadata(mtree: mtreePath, digestDb: digestDbPath)let rootHashContainer = try wrapRootHash(rootHashPath)// update trustcache, metadata, root_hash path- let updatedManifest = try setUpdatedComponentsInManifest(filesystem: aeaImage, trustcache: trustcachePath, metadata: metadataPath, rootHash: rootHashContainer)+ let updatedManifest = try setUpdatedComponentsInManifest(+ filesystem: aeaImage,+ trustcache: trustcachePath,+ metadata: metadataPath,+ rootHash: rootHashContainer+ )rebuiltData = try serializePayload(updatedManifest)return 1@@ -137,7 +152,12 @@ public final class CryptexFilesystemPatcher: Patcher {try addExtraServices(targetMount: targetMount, cfwInput: cfwInputPath)}if !noVphoned || !noBinpack {- try injectLaunchDaemons(targetMount: targetMount, cfwInput: cfwInputPath, vphoned: !noVphoned, cfw: !noBinpack)+ try injectLaunchDaemons(+ targetMount: targetMount,+ cfwInput: cfwInputPath,+ vphoned: !noVphoned,+ cfw: !noBinpack+ )try patchLaunchdCacheLoader(targetMount: targetMount, cfwInput: cfwInputPath)}}@@ -170,7 +190,8 @@ public final class CryptexFilesystemPatcher: Patcher {let (osDevice, osMount) = try attachImage(path: osPath, readonly: true)defer { try? detachImage(deviceNode: osDevice) }- let destination = URL.init(filePath: targetMount).appending(path: appOS ? "/System/Cryptexes/App" : "/System/Cryptexes/OS")+ let destination = URL.init(filePath: targetMount)+ .appending(path: appOS ? "/System/Cryptexes/App" : "/System/Cryptexes/OS")try FileManager.default.removeItem(at: destination)try FileManager.default.createDirectory(at: destination, withIntermediateDirectories: false)try copyImageContents(source: URL.init(filePath: osMount), destination: destination)diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherAEA.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherAEA.swiftindex 6f3659bb..5ffeb7f8 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherAEA.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherAEA.swift@@ -138,7 +138,9 @@ extension CryptexFilesystemPatcher {guard let colonIndex = line.firstIndex(of: ":") else { return [] }let afterColon = line[line.index(after: colonIndex)...]- let beforeAscii = afterColon.split(separator: "|", maxSplits: 1, omittingEmptySubsequences: false).first ?? afterColon+ let beforeAscii = afterColon+ .split(separator: "|", maxSplits: 1, omittingEmptySubsequences: false)+ .first ?? afterColonlet tokens = beforeAscii.split(whereSeparator: \.isWhitespace)var bytes: [UInt8] = []diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherDiskImage.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherDiskImage.swiftindex 11174b70..1ea2bdbf 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherDiskImage.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherDiskImage.swift@@ -32,7 +32,12 @@ extension CryptexFilesystemPatcher {let destinationPath = destinationRoot.appendingPathComponent(suffix)guard let ok = try? destinationPath.checkResourceIsReachable(), ok else {// try FileManager.default.copyItem(at: fileURL, to: destinationPath)- let result = copyfile(fileURL.path, destinationPath.path, nil, copyfile_flags_t(COPYFILE_SECURITY | COPYFILE_DATA))+ let result = copyfile(+ fileURL.path,+ destinationPath.path,+ nil,+ copyfile_flags_t(COPYFILE_SECURITY | COPYFILE_DATA)+ )if result < 0 {print("Unable to copy \(destinationPath.path). Check permissions and free space, then try again.")}@@ -45,7 +50,12 @@ extension CryptexFilesystemPatcher {values.isSymbolicLink != vals.isSymbolicLink {try FileManager.default.removeItem(at: destinationPath)// try FileManager.default.copyItem(at: fileURL, to: destinationPath)- let result = copyfile(fileURL.path, destinationPath.path, nil, copyfile_flags_t(COPYFILE_SECURITY | COPYFILE_DATA))+ let result = copyfile(+ fileURL.path,+ destinationPath.path,+ nil,+ copyfile_flags_t(COPYFILE_SECURITY | COPYFILE_DATA)+ )if result < 0 {print("Unable to copy \(destinationPath.path). Check permissions and free space, then try again.")}diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherGuestPayload.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherGuestPayload.swiftindex 562e09d5..4e858a4d 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherGuestPayload.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherGuestPayload.swift@@ -41,9 +41,14 @@ extension CryptexFilesystemPatcher {if vphoned {let vphonedSrc = scriptDir.appendingPathComponent("vphoned")let vphonedLaunchdPlist = vphonedSrc.appending(path: "vphoned.plist")- try FileManager.default.copyItem(at: vphonedLaunchdPlist,- to: target.appending(path: "System/Library/LaunchDaemons/vphoned.plist"))- try FileManager.default.copyItem(at: vphonedLaunchdPlist, to: launchDaemonsPath.appending(path: vphonedLaunchdPlist.lastPathComponent))+ try FileManager.default.copyItem(+ at: vphonedLaunchdPlist,+ to: target.appending(path: "System/Library/LaunchDaemons/vphoned.plist")+ )+ try FileManager.default.copyItem(+ at: vphonedLaunchdPlist,+ to: launchDaemonsPath.appending(path: vphonedLaunchdPlist.lastPathComponent)+ )}if cfw {let launchDaemonsDir = cfwInput.appending(path: "cfw_input/jb/LaunchDaemons")diff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherManifest.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherManifest.swiftindex ab425271..163e7637 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherManifest.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherManifest.swift@@ -15,7 +15,12 @@ extension CryptexFilesystemPatcher {)}- func setUpdatedComponentsInManifest(filesystem: URL, trustcache: URL, metadata: URL, rootHash: URL) throws -> PlistDict {+ func setUpdatedComponentsInManifest(+ filesystem: URL,+ trustcache: URL,+ metadata: URL,+ rootHash: URL+ ) throws -> PlistDict {var root = try parsePlist(data: buildManiest)guard var buildIdentities = root["BuildIdentities"] as? [Any],buildIdentities.count > 0,@@ -25,28 +30,44 @@ extension CryptexFilesystemPatcher {var identityManifest = try getChildPlistDict(parent: buildIdentity, key: "Manifest")// We assume that the filesystem is already placed in the restore directory.- identityManifest = try updateManifestComponentPath(identityManifest: identityManifest, component: "OS", at: filesystem)+ identityManifest = try updateManifestComponentPath(+ identityManifest: identityManifest,+ component: "OS",+ at: filesystem+ )let newTrustcachePath = self.restoreDir.appending(path: "Firmware").appending(path: trustcache.lastPathComponent)if trustcache != newTrustcachePath && FileManager.default.fileExists(atPath: newTrustcachePath.path) {try FileManager.default.removeItem(at: newTrustcachePath)}try FileManager.default.moveItem(at: trustcache, to: newTrustcachePath)- identityManifest = try updateManifestComponentPath(identityManifest: identityManifest, component: "StaticTrustCache", at: newTrustcachePath)+ identityManifest = try updateManifestComponentPath(+ identityManifest: identityManifest,+ component: "StaticTrustCache",+ at: newTrustcachePath+ )let newMetadataPath = self.restoreDir.appending(path: "Firmware").appending(path: metadata.lastPathComponent)if metadata != newMetadataPath && FileManager.default.fileExists(atPath: newMetadataPath.path) {try FileManager.default.removeItem(at: newMetadataPath)}try FileManager.default.moveItem(at: metadata, to: newMetadataPath)- identityManifest = try updateManifestComponentPath(identityManifest: identityManifest, component: "Ap,SystemVolumeCanonicalMetadata", at: newMetadataPath)+ identityManifest = try updateManifestComponentPath(+ identityManifest: identityManifest,+ component: "Ap,SystemVolumeCanonicalMetadata",+ at: newMetadataPath+ )let newRootHashPath = self.restoreDir.appending(path: "Firmware").appending(path: rootHash.lastPathComponent)if rootHash != newRootHashPath && FileManager.default.fileExists(atPath: newRootHashPath.path) {try FileManager.default.removeItem(at: newRootHashPath)}try FileManager.default.moveItem(at: rootHash, to: newRootHashPath)- identityManifest = try updateManifestComponentPath(identityManifest: identityManifest, component: "SystemVolume", at: newRootHashPath)+ identityManifest = try updateManifestComponentPath(+ identityManifest: identityManifest,+ component: "SystemVolume",+ at: newRootHashPath+ )buildIdentity["Manifest"] = identityManifestbuildIdentities[0] = buildIdentitydiff --git a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherProcess.swift b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherProcess.swiftindex fafa512c..bbabdebf 100644--- a/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherProcess.swift+++ b/sources/FirmwarePatcher/Filesystem/CryptexFilesystemPatcherProcess.swift@@ -12,7 +12,12 @@ enum ProcessError: Error {}extension CryptexFilesystemPatcher {- func runProcess(_ launchPath: String, _ arguments: [String], sudo: Bool = false, output: URL? = nil) throws -> String {+ func runProcess(+ _ launchPath: String,+ _ arguments: [String],+ sudo: Bool = false,+ output: URL? = nil+ ) throws -> String {let process = Process()if sudo {let whoami = try runProcess("/usr/bin/whoami", [])@@ -37,7 +42,9 @@ extension CryptexFilesystemPatcher {try process.run()process.waitUntilExit()- let output = output == nil ? String(data: outPipe.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) : nil+ let output = output == nil+ ? String(data: outPipe.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8)+ : nilguard process.terminationStatus == 0 else {throw ProcessError.failed(process.terminationStatus, output ?? "")}diff --git a/sources/FirmwarePatcher/IBoot/IBootJBPatcher.swift b/sources/FirmwarePatcher/IBoot/IBootJBPatcher.swiftindex 9561c3f3..646d0a35 100644--- a/sources/FirmwarePatcher/IBoot/IBootJBPatcher.swift+++ b/sources/FirmwarePatcher/IBoot/IBootJBPatcher.swift@@ -125,8 +125,12 @@ public final class IBootJBPatcher: IBootPatcher {patches.append(record)if verbose {- print(String(format: " 0x%06X: %@ → %@ [ibss_jb.skip_generate_nonce]",- scan, beforeStr, afterStr))+ print(String(+ format: " 0x%06X: %@ → %@ [ibss_jb.skip_generate_nonce]",+ scan,+ beforeStr,+ afterStr+ ))}return true}diff --git a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootArgs.swift b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootArgs.swiftindex be6b97e9..5d44fa3f 100644--- a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootArgs.swift+++ b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootArgs.swift@@ -61,7 +61,8 @@ extension IBootPatcher {let raw = buffer.original// Find the anchor string- var anchor: Int? = raw.range(of: Data("rd=md0".utf8)).map { raw.distance(from: raw.startIndex, to: $0.lowerBound) }+ var anchor: Int? = raw.range(of: Data("rd=md0".utf8))+ .map { raw.distance(from: raw.startIndex, to: $0.lowerBound) }if anchor == nil {anchor = raw.range(of: Data("BootArgs".utf8)).map { raw.distance(from: raw.startIndex, to: $0.lowerBound) }}diff --git a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootxPrecondition.swift b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootxPrecondition.swiftindex ec73e8cd..6c0aa989 100644--- a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootxPrecondition.swift+++ b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchBootxPrecondition.swift@@ -90,8 +90,12 @@ extension IBootPatcher {return}let gate = gates.first!- emit(gate, ARM64.nop, id: "\(component).bootx_precondition",- description: "bootx precondition: NOP gate TBZ")+ emit(+ gate,+ ARM64.nop,+ id: "\(component).bootx_precondition",+ description: "bootx precondition: NOP gate TBZ"+ )}/// Enumerate 5-insn `MOVZ + 3×MOVK + RET` functions assembling a 64-bitdiff --git a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchImage4Callback.swift b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchImage4Callback.swiftindex 998da501..864dd050 100644--- a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchImage4Callback.swift+++ b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchImage4Callback.swift@@ -63,6 +63,11 @@ extension IBootPatcher {}emit(off, ARM64.nop, id: "\(component).image4_callback_bne", description: "image4 callback: b.ne → nop")- emit(off + 4, ARM64.movX0_0, id: "\(component).image4_callback_mov", description: "image4 callback: mov x0,x22 → mov x0,#0")+ emit(+ off + 4,+ ARM64.movX0_0,+ id: "\(component).image4_callback_mov",+ description: "image4 callback: mov x0,x22 → mov x0,#0"+ )}}diff --git a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchPanicBypass.swift b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchPanicBypass.swiftindex 21194ee6..752f9368 100644--- a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchPanicBypass.swift+++ b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchPanicBypass.swift@@ -34,9 +34,12 @@ extension IBootPatcher {if let ni = disasm.disassembleOne(in: buffer.original, at: step + 4),ni.mnemonic == "cbnz"{- emit(step + 4, ARM64.nop,- id: "\(component).panic_bypass",- description: "panic bypass: NOP cbnz w0")+ emit(+ step + 4,+ ARM64.nop,+ id: "\(component).panic_bypass",+ description: "panic bypass: NOP cbnz w0"+ )return}break // bl found but no cbnz — keep scanning other mov candidatesdiff --git a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchRootfsBypass.swift b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchRootfsBypass.swiftindex a797fce3..c21a05a3 100644--- a/sources/FirmwarePatcher/IBoot/Patches/IBootPatchRootfsBypass.swift+++ b/sources/FirmwarePatcher/IBoot/Patches/IBootPatchRootfsBypass.swift@@ -81,7 +81,12 @@ extension IBootPatcher {return}- emit(bhsSites[0], ARM64.nop, id: "\(component).rootfs_bhs_0x400", description: "rootfs: NOP b.hs size check (0x400)")+ emit(+ bhsSites[0],+ ARM64.nop,+ id: "\(component).rootfs_bhs_0x400",+ description: "rootfs: NOP b.hs size check (0x400)"+ )}/// Find `ldr xR, [xN, #0x78]; cbz xR` preceding the unique `mov w8, #0x110`@@ -114,8 +119,12 @@ extension IBootPatcher {i2.mnemonic == "cbz",i2.operandString.hasPrefix("x"){- emit(scan + 4, ARM64.nop, id: "\(component).rootfs_null_check_0x78",- description: "rootfs: NOP cbz x8 null check (#0x78)")+ emit(+ scan + 4,+ ARM64.nop,+ id: "\(component).rootfs_null_check_0x78",+ description: "rootfs: NOP cbz x8 null check (#0x78)"+ )return}scan -= 4diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiExecve.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiExecve.swiftindex 57e21ac6..152c3de9 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiExecve.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiExecve.swift@@ -93,9 +93,12 @@ extension KernelJBPatcher {continue}- emit(targetOff, ARM64.movW0_0,- patchID: "jb.amfi_execve.kill_return",- description: "mov w0,#0 [AMFI kill return → allow]")+ emit(+ targetOff,+ ARM64.movW0_0,+ patchID: "jb.amfi_execve.kill_return",+ description: "mov w0,#0 [AMFI kill return → allow]"+ )log(" [+] Patched kill return at 0x\(String(format: "%X", targetOff)) (func 0x\(String(format: "%X", funcStart)))")patched = truediff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiTrustcache.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiTrustcache.swiftindex 53f0702b..74023851 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiTrustcache.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchAmfiTrustcache.swift@@ -130,10 +130,34 @@ extension KernelJBPatcher {let va2 = fileOffsetToVA(funcStart + 8)let va3 = fileOffsetToVA(funcStart + 12)- emit(funcStart, ARM64.movX0_1, patchID: "amfi_trustcache_1", virtualAddress: va0, description: "mov x0,#1 [AMFIIsCDHashInTrustCache]")- emit(funcStart + 4, ARM64.cbzX2_8, patchID: "amfi_trustcache_2", virtualAddress: va1, description: "cbz x2,+8 [AMFIIsCDHashInTrustCache]")- emit(funcStart + 8, ARM64.strX0X2, patchID: "amfi_trustcache_3", virtualAddress: va2, description: "str x0,[x2] [AMFIIsCDHashInTrustCache]")- emit(funcStart + 12, ARM64.ret, patchID: "amfi_trustcache_4", virtualAddress: va3, description: "ret [AMFIIsCDHashInTrustCache]")+ emit(+ funcStart,+ ARM64.movX0_1,+ patchID: "amfi_trustcache_1",+ virtualAddress: va0,+ description: "mov x0,#1 [AMFIIsCDHashInTrustCache]"+ )+ emit(+ funcStart + 4,+ ARM64.cbzX2_8,+ patchID: "amfi_trustcache_2",+ virtualAddress: va1,+ description: "cbz x2,+8 [AMFIIsCDHashInTrustCache]"+ )+ emit(+ funcStart + 8,+ ARM64.strX0X2,+ patchID: "amfi_trustcache_3",+ virtualAddress: va2,+ description: "str x0,[x2] [AMFIIsCDHashInTrustCache]"+ )+ emit(+ funcStart + 12,+ ARM64.ret,+ patchID: "amfi_trustcache_4",+ virtualAddress: va3,+ description: "ret [AMFIIsCDHashInTrustCache]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchBsdInitAuth.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchBsdInitAuth.swiftindex c9376594..2dbeef11 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchBsdInitAuth.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchBsdInitAuth.swift@@ -78,10 +78,13 @@ extension KernelJBPatcher {return true}- emit(branchOff, ARM64.nop,- patchID: "jb.bsd_init_auth.nop_cbnz",- virtualAddress: fileOffsetToVA(branchOff),- description: "NOP cbnz (rootvp auth) [_bsd_init]")+ emit(+ branchOff,+ ARM64.nop,+ patchID: "jb.bsd_init_auth.nop_cbnz",+ virtualAddress: fileOffsetToVA(branchOff),+ description: "NOP cbnz (rootvp auth) [_bsd_init]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchCredLabel.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchCredLabel.swiftindex 59ff0361..b86902d3 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchCredLabel.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchCredLabel.swift@@ -101,10 +101,14 @@ extension KernelJBPatcher {// Write deny cavefor i in stride(from: 0, to: denyShellcode.count, by: 4) {- let chunk = denyShellcode[denyShellcode.index(denyShellcode.startIndex, offsetBy: i) ..< denyShellcode.index(denyShellcode.startIndex, offsetBy: i + 4)]- emit(dCaveOff + i, Data(chunk),- patchID: "jb.cred_label_update_execve.deny_cave",- description: "deny_trampoline+\(i) [_cred_label_update_execve C21-v3]")+ let chunk = denyShellcode[denyShellcode.index(denyShellcode.startIndex, offsetBy: i)+ ..< denyShellcode.index(denyShellcode.startIndex, offsetBy: i + 4)]+ emit(+ dCaveOff + i,+ Data(chunk),+ patchID: "jb.cred_label_update_execve.deny_cave",+ description: "deny_trampoline+\(i) [_cred_label_update_execve C21-v3]"+ )}// Redirect deny site → deny cave@@ -112,9 +116,12 @@ extension KernelJBPatcher {log(" [-] branch from deny site 0x\(String(format: "%X", dOff)) to cave out of range")return}- emit(dOff, branchToCave,- patchID: "jb.cred_label_update_execve.deny_redirect",- description: "b deny cave [_cred_label_update_execve C21-v3 exit @ 0x\(String(format: "%X", dOff))]")+ emit(+ dOff,+ branchToCave,+ patchID: "jb.cred_label_update_execve.deny_redirect",+ description: "b deny cave [_cred_label_update_execve C21-v3 exit @ 0x\(String(format: "%X", dOff))]"+ )}// 8. Build success shellcode (8 instrs = 32 bytes):@@ -147,10 +154,14 @@ extension KernelJBPatcher {}for i in stride(from: 0, to: successShellcode.count, by: 4) {- let chunk = successShellcode[successShellcode.index(successShellcode.startIndex, offsetBy: i) ..< successShellcode.index(successShellcode.startIndex, offsetBy: i + 4)]- emit(successCaveOff + i, Data(chunk),- patchID: "jb.cred_label_update_execve.success_cave",- description: "success_trampoline+\(i) [_cred_label_update_execve C21-v3]")+ let chunk = successShellcode[successShellcode.index(successShellcode.startIndex, offsetBy: i)+ ..< successShellcode.index(successShellcode.startIndex, offsetBy: i + 4)]+ emit(+ successCaveOff + i,+ Data(chunk),+ patchID: "jb.cred_label_update_execve.success_cave",+ description: "success_trampoline+\(i) [_cred_label_update_execve C21-v3]"+ )}// 9. Redirect success exits → success cave.@@ -159,9 +170,12 @@ extension KernelJBPatcher {log(" [-] branch from success exit 0x\(String(format: "%X", exitOff)) to cave out of range")return}- emit(exitOff, branchToCave,- patchID: "jb.cred_label_update_execve.success_redirect",- description: "b success cave [_cred_label_update_execve C21-v3 exit @ 0x\(String(format: "%X", exitOff))]")+ emit(+ exitOff,+ branchToCave,+ patchID: "jb.cred_label_update_execve.success_redirect",+ description: "b success cave [_cred_label_update_execve C21-v3 exit @ 0x\(String(format: "%X", exitOff))]"+ )}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDiskImages2.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDiskImages2.swiftindex a5ec9200..e4b74c38 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDiskImages2.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDiskImages2.swift@@ -142,10 +142,16 @@ extension KernelJBPatcher {// All three located — apply together.var ok = applyDI2AllocPortsSize(at: allocSite)- ok = applyFieldLoadMov800(at: f1, patchID: "di2_notif_boundcheck_d8",- desc: "mov wD,#0x800 [DI2 RegisterNotificationPort bound-check field1 @+0xd8]") && ok- ok = applyFieldLoadMov800(at: f2, patchID: "di2_notif_boundcheck_e8",- desc: "mov wD,#0x800 [DI2 RegisterNotificationPort bound-check field2 @+0xe8]") && ok+ ok = applyFieldLoadMov800(+ at: f1,+ patchID: "di2_notif_boundcheck_d8",+ desc: "mov wD,#0x800 [DI2 RegisterNotificationPort bound-check field1 @+0xd8]"+ ) && ok+ ok = applyFieldLoadMov800(+ at: f2,+ patchID: "di2_notif_boundcheck_e8",+ desc: "mov wD,#0x800 [DI2 RegisterNotificationPort bound-check field2 @+0xe8]"+ ) && okreturn ok}@@ -185,7 +191,13 @@ extension KernelJBPatcher {}/// Locate a unique `<mnemonic> wD,[xB,#disp]` field load in [funcStart,funcEnd).- private func findUniqueFieldLoad(funcStart: Int, funcEnd: Int, mnemonic: String, disp: Int64, requireWDest: Bool) -> Int? {+ private func findUniqueFieldLoad(+ funcStart: Int,+ funcEnd: Int,+ mnemonic: String,+ disp: Int64,+ requireWDest: Bool+ ) -> Int? {var hits: [Int] = []var off = funcStartwhile off + 4 <= funcEnd {@@ -207,10 +219,13 @@ extension KernelJBPatcher {let dst = xRegIndex(name),let bytes = ARM64Encoder.encodeMovzX(rd: dst, imm16: 0x4000, shift: 0)else { log(" [-] could not encode mov x1,#0x4000"); return false }- emit(lslOff, bytes,- patchID: "di2_allocports_size",- virtualAddress: fileOffsetToVA(lslOff),- description: "mov x1,#0x4000 [DI2 AllocPortsArray widen notif-ports alloc to 0x800 entries]")+ emit(+ lslOff,+ bytes,+ patchID: "di2_allocports_size",+ virtualAddress: fileOffsetToVA(lslOff),+ description: "mov x1,#0x4000 [DI2 AllocPortsArray widen notif-ports alloc to 0x800 entries]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDounmount.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDounmount.swiftindex e8e8e0cd..5ed17857 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDounmount.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchDounmount.swift@@ -26,10 +26,13 @@ extension KernelJBPatcher {return false}- emit(patchOff, ARM64.nop,- patchID: "jb.dounmount.nop_cleanup_bl",- virtualAddress: fileOffsetToVA(patchOff),- description: "NOP [_dounmount upstream cleanup call]")+ emit(+ patchOff,+ ARM64.nop,+ patchID: "jb.dounmount.nop_cleanup_bl",+ virtualAddress: fileOffsetToVA(patchOff),+ description: "NOP [_dounmount upstream cleanup call]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchFpfsScopedOpen.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchFpfsScopedOpen.swiftindex 18f73319..c9c7641b 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchFpfsScopedOpen.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchFpfsScopedOpen.swift@@ -34,10 +34,18 @@ extension KernelJBPatcher {guard let caveBytes = buildScopedOpenCave(caveOff: caveOff, realHookOff: realHookOff) else { return false }guard let newEntry = encodeAuthRebaseTarget(origVal: entryRaw, targetFoff: caveOff) else { return false }- emit(entryOff, newEntry, patchID: "jb.fpfs_scoped_open.ops_retarget",- description: "ops[267] -> FileProvider-scoped vnode_check_open trampoline")- emit(caveOff, caveBytes, patchID: "jb.fpfs_scoped_open.cave",- description: "trampoline: FileProvider daemons -> real check, else allow")+ emit(+ entryOff,+ newEntry,+ patchID: "jb.fpfs_scoped_open.ops_retarget",+ description: "ops[267] -> FileProvider-scoped vnode_check_open trampoline"+ )+ emit(+ caveOff,+ caveBytes,+ patchID: "jb.fpfs_scoped_open.cave",+ description: "trampoline: FileProvider daemons -> real check, else allow"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchHookCredLabel.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchHookCredLabel.swiftindex 14fd897d..e0928a01 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchHookCredLabel.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchHookCredLabel.swift@@ -86,13 +86,19 @@ extension KernelJBPatcher {return false}- emit(entryOff, newEntry,- patchID: "jb.hook_cred_label.ops_retarget",- description: "retarget ops[\(Self.hookCredLabelIndex)] to faithful C23 cave [_hook_cred_label_update_execve]")-- emit(caveOff, caveBytes,- patchID: "jb.hook_cred_label.c23_cave",- description: "faithful upstream C23 cave (vnode getattr -> uid/gid/P_SUGID fixup -> wrapper)")+ emit(+ entryOff,+ newEntry,+ patchID: "jb.hook_cred_label.ops_retarget",+ description: "retarget ops[\(Self.hookCredLabelIndex)] to faithful C23 cave [_hook_cred_label_update_execve]"+ )++ emit(+ caveOff,+ caveBytes,+ patchID: "jb.hook_cred_label.c23_cave",+ description: "faithful upstream C23 cave (vnode getattr -> uid/gid/P_SUGID fixup -> wrapper)"+ )_ = opsTablereturn truediff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucMacf.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucMacf.swiftindex 02d43c9b..6a3005e0 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucMacf.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucMacf.swift@@ -75,10 +75,13 @@ extension KernelJBPatcher {let delta = allowTarget - (off + 4)let va = fileOffsetToVA(off + 4)- emit(off + 4, patchBytes,- patchID: "iouc_macf_gate",- virtualAddress: va,- description: "b #0x\(String(format: "%X", delta)) [IOUC MACF deny → allow]")+ emit(+ off + 4,+ patchBytes,+ patchID: "iouc_macf_gate",+ virtualAddress: va,+ description: "b #0x\(String(format: "%X", delta)) [IOUC MACF deny → allow]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucSandbox.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucSandbox.swiftindex 1f450ba1..6a52ebaf 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucSandbox.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchIoucSandbox.swift@@ -79,10 +79,13 @@ extension KernelJBPatcher {let delta = allowTarget - denyEntrylet va = fileOffsetToVA(denyEntry)log(" [+] IOUC sandbox gate fn=0x\(String(format: "%X", funcStart)), cbnz=0x\(String(format: "%X", off)), deny=0x\(String(format: "%X", denyEntry)) → allow=0x\(String(format: "%X", allowTarget))")- emit(denyEntry, patchBytes,- patchID: "iouc_sandbox_gate",- virtualAddress: va,- description: "b #\(delta >= 0 ? "" : "-")0x\(String(format: "%X", abs(delta))) [IOUC sandbox deny → allow]")+ emit(+ denyEntry,+ patchBytes,+ patchID: "iouc_sandbox_gate",+ virtualAddress: va,+ description: "b #\(delta >= 0 ? "" : "-")0x\(String(format: "%X", abs(delta))) [IOUC sandbox deny → allow]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchKcall10.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchKcall10.swiftindex e5ab7700..02e80766 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchKcall10.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchKcall10.swift@@ -79,21 +79,38 @@ extension KernelJBPatcher {log(" [+] cave at 0x\(String(format: "%X", caveOff)) (0x\(String(format: "%X", caveBytes.count)) bytes)")// 6. Emit patches.- emit(caveOff, caveBytes,- patchID: "jb.kcall10.cave",- description: "kcall10 ABI-correct cave (target + 7 args -> uint64 x0)")-- emit(entry439,- encodeChainedAuthPtr(targetFoff: caveOff, nextVal: callNext,- diversity: Self.sysent_pac_diversity, key: 0, addrDiv: 0),- patchID: "jb.kcall10.sy_call",- description: "sysent[439].sy_call = cave 0x\(String(format: "%X", caveOff)) (auth rebase, div=0xBCAD, next=\(callNext)) [kcall10]")-- emit(entry439 + 8,- encodeChainedAuthPtr(targetFoff: mungerTarget, nextVal: mungeNext,- diversity: mungeDiv, key: mungeKey, addrDiv: mungeAddrDiv),- patchID: "jb.kcall10.sy_munge",- description: "sysent[439].sy_arg_munge32 = 8-arg helper 0x\(String(format: "%X", mungerTarget)) [kcall10]")+ emit(+ caveOff,+ caveBytes,+ patchID: "jb.kcall10.cave",+ description: "kcall10 ABI-correct cave (target + 7 args -> uint64 x0)"+ )++ emit(+ entry439,+ encodeChainedAuthPtr(+ targetFoff: caveOff,+ nextVal: callNext,+ diversity: Self.sysent_pac_diversity,+ key: 0,+ addrDiv: 0+ ),+ patchID: "jb.kcall10.sy_call",+ description: "sysent[439].sy_call = cave 0x\(String(format: "%X", caveOff)) (auth rebase, div=0xBCAD, next=\(callNext)) [kcall10]"+ )++ emit(+ entry439 + 8,+ encodeChainedAuthPtr(+ targetFoff: mungerTarget,+ nextVal: mungeNext,+ diversity: mungeDiv,+ key: mungeKey,+ addrDiv: mungeAddrDiv+ ),+ patchID: "jb.kcall10.sy_munge",+ description: "sysent[439].sy_arg_munge32 = 8-arg helper 0x\(String(format: "%X", mungerTarget)) [kcall10]"+ )// sy_return_type (u32) + sy_narg (u16) + sy_arg_bytes (u16)var metadata = Data(count: 8)@@ -102,9 +119,12 @@ extension KernelJBPatcher {ptr.storeBytes(of: Self.kcall10_narg.littleEndian, toByteOffset: 4, as: UInt16.self)ptr.storeBytes(of: Self.kcall10_arg_bytes.littleEndian, toByteOffset: 6, as: UInt16.self)}- emit(entry439 + 16, metadata,- patchID: "jb.kcall10.sysent_meta",- description: "sysent[439].sy_return_type=7,sy_narg=8,sy_arg_bytes=0x20 [kcall10]")+ emit(+ entry439 + 16,+ metadata,+ patchID: "jb.kcall10.sysent_meta",+ description: "sysent[439].sy_return_type=7,sy_narg=8,sy_arg_bytes=0x20 [kcall10]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchLoadDylinker.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchLoadDylinker.swiftindex 20f435fb..2726a0c1 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchLoadDylinker.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchLoadDylinker.swift@@ -37,10 +37,13 @@ extension KernelJBPatcher {guard let bBytes = ARM64Encoder.encodeB(from: blOff, to: allowTarget) else { continue }log(" [+] dyld anchor func at 0x\(String(format: "%X", funcStart)), patch BL at 0x\(String(format: "%X", blOff))")- emit(blOff, bBytes,- patchID: "jb.load_dylinker.policy_bypass",- virtualAddress: fileOffsetToVA(blOff),- description: "b #0x\(String(format: "%X", allowTarget - blOff)) [_load_dylinker policy bypass]")+ emit(+ blOff,+ bBytes,+ patchID: "jb.load_dylinker.policy_bypass",+ virtualAddress: fileOffsetToVA(blOff),+ description: "b #0x\(String(format: "%X", allowTarget - blOff)) [_load_dylinker policy bypass]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchMacMount.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchMacMount.swiftindex a8104c0f..f8635134 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchMacMount.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchMacMount.swift@@ -65,14 +65,20 @@ extension KernelJBPatcher {return false}- emit(branchOff, ARM64.nop,- patchID: "kernelcache_jb.mac_mount.flag_gate",- virtualAddress: va1,- description: "NOP [___mac_mount upstream flag gate]")- emit(movOff, clearBytes,- patchID: "kernelcache_jb.mac_mount.state_clear",- virtualAddress: va2,- description: "mov x,xzr [___mac_mount upstream state clear]")+ emit(+ branchOff,+ ARM64.nop,+ patchID: "kernelcache_jb.mac_mount.flag_gate",+ virtualAddress: va1,+ description: "NOP [___mac_mount upstream flag gate]"+ )+ emit(+ movOff,+ clearBytes,+ patchID: "kernelcache_jb.mac_mount.state_clear",+ virtualAddress: va2,+ description: "mov x,xzr [___mac_mount upstream state clear]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchNvram.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchNvram.swiftindex 7d721feb..dc0fd4ce 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchNvram.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchNvram.swift@@ -56,10 +56,13 @@ extension KernelJBPatcher {let patchOff = unique[0]let va = fileOffsetToVA(patchOff)- emit(patchOff, ARM64.nop,- patchID: "kernelcache_jb.nvram_verify_permission",- virtualAddress: va,- description: "NOP [verifyPermission NVRAM]")+ emit(+ patchOff,+ ARM64.nop,+ patchID: "kernelcache_jb.nvram_verify_permission",+ virtualAddress: va,+ description: "NOP [verifyPermission NVRAM]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPortToMap.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPortToMap.swiftindex ea4e62da..42c50eb5 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPortToMap.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPortToMap.swift@@ -50,10 +50,13 @@ extension KernelJBPatcher {continue}- emit(back + 4, bBytes,- patchID: "jb.port_to_map.skip_panic",- virtualAddress: fileOffsetToVA(back + 4),- description: "b 0x\(String(format: "%X", branchTarget)) [_convert_port_to_map skip panic]")+ emit(+ back + 4,+ bBytes,+ patchID: "jb.port_to_map.skip_panic",+ virtualAddress: fileOffsetToVA(back + 4),+ description: "b 0x\(String(format: "%X", branchTarget)) [_convert_port_to_map skip panic]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPostValidation.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPostValidation.swiftindex fd018979..48acc8b2 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPostValidation.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchPostValidation.swift@@ -84,10 +84,13 @@ extension KernelJBPatcher {}let patchOff = uniqueHits[0]- emit(patchOff, ARM64.cmpW0W0,- patchID: "jb.post_validation.cmp_w0_w0",- virtualAddress: fileOffsetToVA(patchOff),- description: "cmp w0,w0 [postValidation additional]")+ emit(+ patchOff,+ ARM64.cmpW0W0,+ patchID: "jb.post_validation.cmp_w0_w0",+ virtualAddress: fileOffsetToVA(patchOff),+ description: "cmp w0,w0 [postValidation additional]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcPidinfo.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcPidinfo.swiftindex 354a66ab..7ea626ad 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcPidinfo.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcPidinfo.swift@@ -70,14 +70,20 @@ extension KernelJBPatcher {let guardA = matches[0] + 4 // cbz Xdlet guardB = matches[0] + 12 // cbz/cbnz wN- emit(guardA, ARM64.nop,- patchID: "jb.proc_pidinfo.nop_guard_a",- virtualAddress: fileOffsetToVA(guardA),- description: "NOP [_proc_pidinfo pid-0 guard A]")- emit(guardB, ARM64.nop,- patchID: "jb.proc_pidinfo.nop_guard_b",- virtualAddress: fileOffsetToVA(guardB),- description: "NOP [_proc_pidinfo pid-0 guard B]")+ emit(+ guardA,+ ARM64.nop,+ patchID: "jb.proc_pidinfo.nop_guard_a",+ virtualAddress: fileOffsetToVA(guardA),+ description: "NOP [_proc_pidinfo pid-0 guard A]"+ )+ emit(+ guardB,+ ARM64.nop,+ patchID: "jb.proc_pidinfo.nop_guard_b",+ virtualAddress: fileOffsetToVA(guardB),+ description: "NOP [_proc_pidinfo pid-0 guard B]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcSecurity.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcSecurity.swiftindex 27f0eb9c..f6550e87 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcSecurity.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchProcSecurity.swift@@ -23,14 +23,20 @@ extension KernelJBPatcher {return false}- emit(policy, ARM64.movX0_0,- patchID: "jb.proc_security_policy.mov_x0_0",- virtualAddress: fileOffsetToVA(policy),- description: "mov x0,#0 [_proc_security_policy]")- emit(policy + 4, ARM64.ret,- patchID: "jb.proc_security_policy.ret",- virtualAddress: fileOffsetToVA(policy + 4),- description: "ret [_proc_security_policy]")+ emit(+ policy,+ ARM64.movX0_0,+ patchID: "jb.proc_security_policy.mov_x0_0",+ virtualAddress: fileOffsetToVA(policy),+ description: "mov x0,#0 [_proc_security_policy]"+ )+ emit(+ policy + 4,+ ARM64.ret,+ patchID: "jb.proc_security_policy.ret",+ virtualAddress: fileOffsetToVA(policy + 4),+ description: "ret [_proc_security_policy]"+ )return true}}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSandboxExtended.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSandboxExtended.swiftindex 8b08c9ba..6750510f 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSandboxExtended.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSandboxExtended.swift@@ -105,10 +105,13 @@ extension KernelJBPatcher {withUnsafeBytes(of: newEntry.littleEndian) { src innewBytes.replaceSubrange(0 ..< 8, with: src)}- emit(entryOff, newBytes,- patchID: "sandbox_ext_\(idx)",- virtualAddress: nil,- description: "ops[\(idx)] -> allow stub [_hook_\(hookName)]")+ emit(+ entryOff,+ newBytes,+ patchID: "sandbox_ext_\(idx)",+ virtualAddress: nil,+ description: "ops[\(idx)] -> allow stub [_hook_\(hookName)]"+ )patched += 1}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSecureRoot.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSecureRoot.swiftindex 05139fd0..244a0dcc 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSecureRoot.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSecureRoot.swift@@ -51,10 +51,13 @@ extension KernelJBPatcher {log(" [-] could not encode mov \(destReg), #0")return false}- emit(off, patchBytes,- patchID: "jb.io_secure_bsd_root.zero_return",- virtualAddress: fileOffsetToVA(off),- description: "mov \(destReg), #0 [_IOSecureBSDRoot SecureRootName allow]")+ emit(+ off,+ patchBytes,+ patchID: "jb.io_secure_bsd_root.zero_return",+ virtualAddress: fileOffsetToVA(off),+ description: "mov \(destReg), #0 [_IOSecureBSDRoot SecureRootName allow]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSharedRegion.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSharedRegion.swiftindex f1cf2a56..06fffd9a 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSharedRegion.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSharedRegion.swift@@ -51,10 +51,13 @@ extension KernelJBPatcher {let patchOff = hits[0]let va = fileOffsetToVA(patchOff)- emit(patchOff, ARM64.cmpX0X0,- patchID: "kernelcache_jb.shared_region_map",- virtualAddress: va,- description: "cmp x0,x0 [_shared_region_map_and_slide_setup]")+ emit(+ patchOff,+ ARM64.cmpX0X0,+ patchID: "kernelcache_jb.shared_region_map",+ virtualAddress: va,+ description: "cmp x0,x0 [_shared_region_map_and_slide_setup]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSpawnPersona.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSpawnPersona.swiftindex d6f3efdb..384e8f03 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSpawnPersona.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSpawnPersona.swift@@ -37,14 +37,20 @@ extension KernelJBPatcher {let (firstCbz, secondCbz) = siteslet va1 = fileOffsetToVA(firstCbz)let va2 = fileOffsetToVA(secondCbz)- emit(firstCbz, ARM64.nop,- patchID: "kernelcache_jb.spawn_validate_persona.cbz1",- virtualAddress: va1,- description: "NOP [_spawn_validate_persona pid-slot guard]")- emit(secondCbz, ARM64.nop,- patchID: "kernelcache_jb.spawn_validate_persona.cbz2",- virtualAddress: va2,- description: "NOP [_spawn_validate_persona persona-slot guard]")+ emit(+ firstCbz,+ ARM64.nop,+ patchID: "kernelcache_jb.spawn_validate_persona.cbz1",+ virtualAddress: va1,+ description: "NOP [_spawn_validate_persona pid-slot guard]"+ )+ emit(+ secondCbz,+ ARM64.nop,+ patchID: "kernelcache_jb.spawn_validate_persona.cbz2",+ virtualAddress: va2,+ description: "NOP [_spawn_validate_persona persona-slot guard]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSyscallmask.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSyscallmask.swiftindex c0947537..c1b2b449 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSyscallmask.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchSyscallmask.swift@@ -79,17 +79,26 @@ extension KernelJBPatcher {// mov x17, x0 (save RO selector that was in x0 before the pre-setter BL)let movX17X0: UInt32 = 0xAA00_03F1 // ORR X17, XZR, X0- emit(callOff, ARM64.encodeU32(movX17X0),- patchID: "jb.syscallmask.save_selector",- description: "mov x17,x0 [syscallmask C22 save RO selector]")-- emit(branchOff, branchToCave,- patchID: "jb.syscallmask.tail_redirect",- description: "b cave [syscallmask C22 mutate mask then setter]")-- emit(caveOff, caveBytes,- patchID: "jb.syscallmask.c22_cave",- description: "syscallmask C22 cave (ff blob 0x\(String(format: "%X", Self.syscallmaskFFBlobSize)) + structural mutator + setter tail)")+ emit(+ callOff,+ ARM64.encodeU32(movX17X0),+ patchID: "jb.syscallmask.save_selector",+ description: "mov x17,x0 [syscallmask C22 save RO selector]"+ )++ emit(+ branchOff,+ branchToCave,+ patchID: "jb.syscallmask.tail_redirect",+ description: "b cave [syscallmask C22 mutate mask then setter]"+ )++ emit(+ caveOff,+ caveBytes,+ patchID: "jb.syscallmask.c22_cave",+ description: "syscallmask C22 cave (ff blob 0x\(String(format: "%X", Self.syscallmaskFFBlobSize)) + structural mutator + setter tail)"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskConversion.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskConversion.swiftindex 8b4a597f..4fda5e25 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskConversion.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskConversion.swift@@ -43,10 +43,13 @@ extension KernelJBPatcher {let site = candidates[0]let va = fileOffsetToVA(site)- emit(site, ARM64.cmpXzrXzr,- patchID: "task_conversion_eval",- virtualAddress: va,- description: "cmp xzr,xzr [_task_conversion_eval_internal]")+ emit(+ site,+ ARM64.cmpXzrXzr,+ patchID: "task_conversion_eval",+ virtualAddress: va,+ description: "cmp xzr,xzr [_task_conversion_eval_internal]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskForPid.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskForPid.swiftindex 36ff2579..98412615 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskForPid.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchTaskForPid.swift@@ -53,10 +53,13 @@ extension KernelJBPatcher {let patchOff = hits[0]let va = fileOffsetToVA(patchOff)- emit(patchOff, ARM64.nop,- patchID: "kernelcache_jb.task_for_pid",- virtualAddress: va,- description: "NOP [_task_for_pid pid==0 gate]")+ emit(+ patchOff,+ ARM64.nop,+ patchID: "kernelcache_jb.task_for_pid",+ virtualAddress: va,+ description: "NOP [_task_for_pid pid==0 gate]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThidCrash.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThidCrash.swiftindex 54082098..d4c55a3b 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThidCrash.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThidCrash.swift@@ -47,10 +47,13 @@ extension KernelJBPatcher {log(" [+] variable at foff 0x\(String(format: "%X", low32)) (value=\(targetVal), found via sysctl_oid at str+0x\(String(format: "%X", delta)))")let va = fileOffsetToVA(low32)- emit(low32, Data([0, 0, 0, 0]),- patchID: "kernelcache_jb.thid_should_crash",- virtualAddress: va,- description: "zero [_thid_should_crash]")+ emit(+ low32,+ Data([0, 0, 0, 0]),+ patchID: "kernelcache_jb.thid_should_crash",+ virtualAddress: va,+ description: "zero [_thid_should_crash]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThreadSetState.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThreadSetState.swiftindex 16aa45e3..7d722e3a 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThreadSetState.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchThreadSetState.swift@@ -69,10 +69,13 @@ extension KernelJBPatcher {log(" [-] failed to assemble/verify cleared flags at 0x\(String(format: "%X", setterOff))")return false}- emit(setterOff, bytes,- patchID: "kernelcache_frida.thread_set_state_entitlement_flag",- virtualAddress: fileOffsetToVA(setterOff),- description: "clear TSSF_CHECK_ENTITLEMENT (0x201 -> 0x1) [thread_set_state user setter, --frida]")+ emit(+ setterOff,+ bytes,+ patchID: "kernelcache_frida.thread_set_state_entitlement_flag",+ virtualAddress: fileOffsetToVA(setterOff),+ description: "clear TSSF_CHECK_ENTITLEMENT (0x201 -> 0x1) [thread_set_state user setter, --frida]"+ )}return true}diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmFault.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmFault.swiftindex 261c48f9..8354a874 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmFault.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmFault.swift@@ -47,10 +47,13 @@ extension KernelJBPatcher {if candidateSites.count == 1 {let patchOff = candidateSites.first!let va = fileOffsetToVA(patchOff)- emit(patchOff, ARM64.nop,- patchID: "kernelcache_jb.vm_fault_enter_prepare",- virtualAddress: va,- description: "NOP [_vm_fault_enter_prepare]")+ emit(+ patchOff,+ ARM64.nop,+ patchID: "kernelcache_jb.vm_fault_enter_prepare",+ virtualAddress: va,+ description: "NOP [_vm_fault_enter_prepare]"+ )return true} else if candidateSites.count > 1 {let list = candidateSites.sorted().map { String(format: "0x%X", $0) }.joined(separator: ", ")diff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmMapDelete.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmMapDelete.swiftindex eb92ffd3..7b25a88a 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmMapDelete.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmMapDelete.swift@@ -59,10 +59,13 @@ extension KernelJBPatcher {}for (gate, bytes) in replacements {- emit(gate.offset, bytes,- patchID: "kernelcache_frida.vm_map_delete_immutable_code",- virtualAddress: fileOffsetToVA(gate.offset),- description: "\(gate.nonzero ? "tbnz" : "tbz") entry max_protection.X [vm_map_delete immutable-code \(gate.shape), --frida]")+ emit(+ gate.offset,+ bytes,+ patchID: "kernelcache_frida.vm_map_delete_immutable_code",+ virtualAddress: fileOffsetToVA(gate.offset),+ description: "\(gate.nonzero ? "tbnz" : "tbz") entry max_protection.X [vm_map_delete immutable-code \(gate.shape), --frida]"+ )}return true}@@ -117,8 +120,12 @@ extension KernelJBPatcher {exec == argTarget.targetelse { continue }return VmMapDeleteGate(- offset: Int(insns[i + 1].address), register: flagsReg,- nonzero: false, target: exec, shape: "shape-A")+ offset: Int(insns[i + 1].address),+ register: flagsReg,+ nonzero: false,+ target: exec,+ shape: "shape-A"+ )}// Shape B: developer mode is checked first, then the current-X test branches@@ -132,8 +139,12 @@ extension KernelJBPatcher {exec == permTargetelse { continue }return VmMapDeleteGate(- offset: Int(insns[i].address), register: flagsReg,- nonzero: true, target: exec, shape: "shape-B")+ offset: Int(insns[i].address),+ register: flagsReg,+ nonzero: true,+ target: exec,+ shape: "shape-B"+ )}return nildiff --git a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swiftindex 9e019253..116434d9 100644--- a/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift+++ b/sources/FirmwarePatcher/Kernel/JBPatches/KernelJBPatchVmProtect.swift@@ -50,10 +50,13 @@ extension KernelJBPatcher {return false}let delta = target - brOff- emit(brOff, bBytes,- patchID: "kernelcache_jb.vm_map_protect",- virtualAddress: fileOffsetToVA(brOff),- description: "b #0x\(String(format: "%X", delta)) [_vm_map_protect skip W^X downgrade]")+ emit(+ brOff,+ bBytes,+ patchID: "kernelcache_jb.vm_map_protect",+ virtualAddress: fileOffsetToVA(brOff),+ description: "b #0x\(String(format: "%X", delta)) [_vm_map_protect skip W^X downgrade]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchApfsGraft.swift b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchApfsGraft.swiftindex f9544bdf..438ec003 100644--- a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchApfsGraft.swift+++ b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchApfsGraft.swift@@ -68,10 +68,13 @@ extension KernelPatcher {}if let blTarget = decodeBL(at: scan), blTarget == vrhFunc {let va = fileOffsetToVA(scan)- emit(scan, ARM64.movW0_0,- patchID: "apfs_graft",- virtualAddress: va,- description: "mov w0,#0 [_apfs_graft]")+ emit(+ scan,+ ARM64.movW0_0,+ patchID: "apfs_graft",+ virtualAddress: va,+ description: "mov w0,#0 [_apfs_graft]"+ )return true}scan += 4diff --git a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchDebugger.swift b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchDebugger.swiftindex 03d93fb3..94a92c3b 100644--- a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchDebugger.swift+++ b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchDebugger.swift@@ -58,14 +58,20 @@ extension KernelPatcher {/// Emit the two patch instructions at the function entry point.private func emitDebugger(at offset: Int) {let va = fileOffsetToVA(offset)- emit(offset, ARM64.movX0_1,- patchID: "kernel.debugger.mov_x0_1",- virtualAddress: va,- description: "mov x0,#1 [_PE_i_can_has_debugger]")- emit(offset + 4, ARM64.ret,- patchID: "kernel.debugger.ret",- virtualAddress: va.map { $0 + 4 },- description: "ret [_PE_i_can_has_debugger]")+ emit(+ offset,+ ARM64.movX0_1,+ patchID: "kernel.debugger.mov_x0_1",+ virtualAddress: va,+ description: "mov x0,#1 [_PE_i_can_has_debugger]"+ )+ emit(+ offset + 4,+ ARM64.ret,+ patchID: "kernel.debugger.ret",+ virtualAddress: va.map { $0 + 4 },+ description: "ret [_PE_i_can_has_debugger]"+ )}/// Return true if the raw 32-bit instruction is ADRP x8, <page>.diff --git a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchPostValidation.swift b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchPostValidation.swiftindex e970cb2d..b3db4199 100644--- a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchPostValidation.swift+++ b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchPostValidation.swift@@ -46,10 +46,13 @@ extension KernelPatcher {guard insn.mnemonic == "tbnz" else { continue }let va = fileOffsetToVA(scan)- emit(scan, ARM64.nop,- patchID: "kernel.post_validation.nop_tbnz",- virtualAddress: va,- description: "NOP \(insn.mnemonic) \(insn.operandString) [txm post-validation]")+ emit(+ scan,+ ARM64.nop,+ patchID: "kernel.post_validation.nop_tbnz",+ virtualAddress: va,+ description: "NOP \(insn.mnemonic) \(insn.operandString) [txm post-validation]"+ )return true}}@@ -143,10 +146,13 @@ extension KernelPatcher {}let patchOff = uniqueHits[0]- emit(patchOff, ARM64.cmpW0W0,- patchID: "kernel.post_validation.cmp_w0_w0",- virtualAddress: fileOffsetToVA(patchOff),- description: "cmp w0,w0 (was cmp w0,#imm) [postValidation]")+ emit(+ patchOff,+ ARM64.cmpW0W0,+ patchID: "kernel.post_validation.cmp_w0_w0",+ virtualAddress: fileOffsetToVA(patchOff),+ description: "cmp w0,w0 (was cmp w0,#imm) [postValidation]"+ )return true}diff --git a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchSandbox.swift b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchSandbox.swiftindex 595761d8..2148d6d9 100644--- a/sources/FirmwarePatcher/Kernel/Patches/KernelPatchSandbox.swift+++ b/sources/FirmwarePatcher/Kernel/Patches/KernelPatchSandbox.swift@@ -69,14 +69,20 @@ extension KernelPatcher {}let va = fileOffsetToVA(funcOff)- emit(funcOff, ARM64.movX0_0,- patchID: "kernel.sandbox.\(hook.name).mov_x0_0",- virtualAddress: va,- description: "mov x0,#0 [_hook_\(hook.name)]")- emit(funcOff + 4, ARM64.ret,- patchID: "kernel.sandbox.\(hook.name).ret",- virtualAddress: va.map { $0 + 4 },- description: "ret [_hook_\(hook.name)]")+ emit(+ funcOff,+ ARM64.movX0_0,+ patchID: "kernel.sandbox.\(hook.name).mov_x0_0",+ virtualAddress: va,+ description: "mov x0,#0 [_hook_\(hook.name)]"+ )+ emit(+ funcOff + 4,+ ARM64.ret,+ patchID: "kernel.sandbox.\(hook.name).ret",+ virtualAddress: va.map { $0 + 4 },+ description: "ret [_hook_\(hook.name)]"+ )log(" [+] ops[\(hook.index)] \(hook.name) at foff 0x\(String(format: "%X", funcOff))")patchedCount += 1diff --git a/sources/FirmwarePatcher/Manifest/FirmwareManifest.swift b/sources/FirmwarePatcher/Manifest/FirmwareManifest.swiftindex 124525e8..b32065a0 100644--- a/sources/FirmwarePatcher/Manifest/FirmwareManifest.swift+++ b/sources/FirmwarePatcher/Manifest/FirmwareManifest.swift@@ -100,7 +100,11 @@ public enum FirmwareManifest {let buildIdentity = try buildEraseIdentity(cloudIdentities: cloudIdentities,iPhoneIdentities: iPhoneIdentities,- prod: prod, res: res, vp: vp, vpr: vpr, iErase: iErase+ prod: prod,+ res: res,+ vp: vp,+ vpr: vpr,+ iErase: iErase)// Assemble BuildManifest.@@ -203,7 +207,11 @@ public enum FirmwareManifest {static func buildEraseIdentity(cloudIdentities C: [PlistDict],iPhoneIdentities I: [PlistDict],- prod: Int, res: Int, vp: Int, vpr: Int, iErase: Int+ prod: Int,+ res: Int,+ vp: Int,+ vpr: Int,+ iErase: Int) throws -> PlistDict {// Identity base from vresearch101ap PROD.var bi = deepCopyPlistDict(C[prod])diff --git a/sources/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift b/sources/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swiftindex 8edd3708..da7ee82a 100644--- a/sources/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift+++ b/sources/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift@@ -222,7 +222,13 @@ extension FirmwarePipeline {return switch variant {case .less:[{ data, verbose in- CryptexFilesystemPatcher(buildManiest: data, restoreDir: restoreDir, verbose: verbose, noBinpack: self.noBinpack, noVphoned: self.noVphoned)+ CryptexFilesystemPatcher(+ buildManiest: data,+ restoreDir: restoreDir,+ verbose: verbose,+ noBinpack: self.noBinpack,+ noVphoned: self.noVphoned+ )}]case .regular, .dev, .jb, .exp:[]diff --git a/sources/FirmwarePatcher/Pipeline/FirmwarePipelineDiscovery.swift b/sources/FirmwarePatcher/Pipeline/FirmwarePipelineDiscovery.swiftindex 9f32fb71..fe8fee31 100644--- a/sources/FirmwarePatcher/Pipeline/FirmwarePipelineDiscovery.swift+++ b/sources/FirmwarePatcher/Pipeline/FirmwarePipelineDiscovery.swift@@ -76,8 +76,10 @@ extension FirmwarePipeline {}}- let leftDate = (try? lhs.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate) ?? .distantPast- let rightDate = (try? rhs.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate) ?? .distantPast+ let leftDate = (try? lhs.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate)+ ?? .distantPast+ let rightDate = (try? rhs.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate)+ ?? .distantPastif leftDate != rightDate {return leftDate > rightDate}diff --git a/sources/FirmwarePatcher/TXM/TXMDevPatcher.swift b/sources/FirmwarePatcher/TXM/TXMDevPatcher.swiftindex 4a17fd8e..a9c631ae 100644--- a/sources/FirmwarePatcher/TXM/TXMDevPatcher.swift+++ b/sources/FirmwarePatcher/TXM/TXMDevPatcher.swift@@ -293,17 +293,23 @@ public final class TXMDevPatcher: TXMPatcher {return}- emit(body, ARM64.movW0_0xA1,- patchID: "txm_dev.selector24_bypass_mov",- description: "selector24 bypass: mov w0, #0xa1 (PASS)")+ emit(+ body,+ ARM64.movW0_0xA1,+ patchID: "txm_dev.selector24_bypass_mov",+ description: "selector24 bypass: mov w0, #0xa1 (PASS)"+ )guard let bInsn = ARM64Encoder.encodeB(from: body + 4, to: epilogueOff) else {log(" [-] TXM: selector24 branch encoding failed")return}- emit(body + 4, bInsn,- patchID: "txm_dev.selector24_bypass_b",- description: "selector24 bypass: b epilogue")+ emit(+ body + 4,+ bInsn,+ patchID: "txm_dev.selector24_bypass_b",+ description: "selector24 bypass: b epilogue"+ )return}@@ -343,9 +349,12 @@ public final class TXMDevPatcher: TXMPatcher {return}- emit(cands[0], ARM64.movX0_1,- patchID: "txm_dev.get_task_allow",- description: "get-task-allow: bl -> mov x0,#1")+ emit(+ cands[0],+ ARM64.movX0_1,+ patchID: "txm_dev.get_task_allow",+ description: "get-task-allow: bl -> mov x0,#1"+ )}/// Selector 42|29 patch via dynamic cave shellcode + branch redirect.@@ -412,24 +421,50 @@ public final class TXMDevPatcher: TXMPatcher {log(" [-] TXM: selector42|29 branch-to-cave encoding failed")return}- emit(stubOff, branchToShellcode,- patchID: "txm_dev.sel42_29_branch",- description: "selector42|29: branch to shellcode")+ emit(+ stubOff,+ branchToShellcode,+ patchID: "txm_dev.sel42_29_branch",+ description: "selector42|29: branch to shellcode"+ )// Shellcode body at cave- emit(cave, ARM64.nop, patchID: "txm_dev.sel42_29_shell_nop", description: "selector42|29 shellcode pad: udf -> nop")- emit(cave + 4, ARM64.movX0_1, patchID: "txm_dev.sel42_29_shell_mov1", description: "selector42|29 shellcode: mov x0,#1")- emit(cave + 8, ARM64.strbW0X20_30, patchID: "txm_dev.sel42_29_shell_strb", description: "selector42|29 shellcode: strb w0,[x20,#0x30]")- emit(cave + 12, ARM64.movX0X20, patchID: "txm_dev.sel42_29_shell_mov20", description: "selector42|29 shellcode: mov x0,x20")+ emit(+ cave,+ ARM64.nop,+ patchID: "txm_dev.sel42_29_shell_nop",+ description: "selector42|29 shellcode pad: udf -> nop"+ )+ emit(+ cave + 4,+ ARM64.movX0_1,+ patchID: "txm_dev.sel42_29_shell_mov1",+ description: "selector42|29 shellcode: mov x0,#1"+ )+ emit(+ cave + 8,+ ARM64.strbW0X20_30,+ patchID: "txm_dev.sel42_29_shell_strb",+ description: "selector42|29 shellcode: strb w0,[x20,#0x30]"+ )+ emit(+ cave + 12,+ ARM64.movX0X20,+ patchID: "txm_dev.sel42_29_shell_mov20",+ description: "selector42|29 shellcode: mov x0,x20"+ )// Branch back to stub_off + 4 (skip the redirected first instruction)guard let branchBack = ARM64Encoder.encodeB(from: cave + 16, to: stubOff + 4) else {log(" [-] TXM: selector42|29 branch-back encoding failed")return}- emit(cave + 16, branchBack,- patchID: "txm_dev.sel42_29_shell_ret",- description: "selector42|29 shellcode: branch back")+ emit(+ cave + 16,+ branchBack,+ patchID: "txm_dev.sel42_29_shell_ret",+ description: "selector42|29 shellcode: branch back"+ )}/// Force debugger entitlement check to return true (BL → mov w0, #1).@@ -476,9 +511,12 @@ public final class TXMDevPatcher: TXMPatcher {return}- emit(cands[0], ARM64.movW0_1,- patchID: "txm_dev.debugger_entitlement",- description: "debugger entitlement: bl -> mov w0,#1")+ emit(+ cands[0],+ ARM64.movW0_1,+ patchID: "txm_dev.debugger_entitlement",+ description: "debugger entitlement: bl -> mov w0,#1"+ )}/// Developer-mode bypass: NOP conditional guard before deny log path.@@ -515,8 +553,11 @@ public final class TXMDevPatcher: TXMPatcher {return}- emit(cands[0], ARM64.nop,- patchID: "txm_dev.developer_mode_bypass",- description: "developer mode bypass")+ emit(+ cands[0],+ ARM64.nop,+ patchID: "txm_dev.developer_mode_bypass",+ description: "developer mode bypass"+ )}}diff --git a/sources/VPhoneCore/VPhoneBundleOps.swift b/sources/VPhoneCore/VPhoneBundleOps.swiftindex 7269ca1e..f0ec312b 100644--- a/sources/VPhoneCore/VPhoneBundleOps.swift+++ b/sources/VPhoneCore/VPhoneBundleOps.swift@@ -15,8 +15,14 @@ public enum VPhoneBundleOps {public let romSource: URLpublic let sepromSource: URL- public init(name: String, cpuCount: UInt, memoryMB: UInt64, diskSizeGB: UInt64,- romSource: URL, sepromSource: URL) {+ public init(+ name: String,+ cpuCount: UInt,+ memoryMB: UInt64,+ diskSizeGB: UInt64,+ romSource: URL,+ sepromSource: URL+ ) {self.name = name; self.cpuCount = cpuCount; self.memoryMB = memoryMBself.diskSizeGB = diskSizeGB; self.romSource = romSource; self.sepromSource = sepromSource}@@ -87,8 +93,10 @@ public enum VPhoneBundleOps {// MARK: - Config editingpublic static func updateConfig(- bundleNamed name: String, in library: VPhoneLibrary,- cpuCount: UInt?, memoryMB: UInt64?,+ bundleNamed name: String,+ in library: VPhoneLibrary,+ cpuCount: UInt?,+ memoryMB: UInt64?,networkMode: VPhoneVirtualMachineManifest.NetworkConfig.NetworkMode? = nil,bridgeInterface: String? = nil) throws -> VPhoneBundle {@@ -97,7 +105,8 @@ public enum VPhoneBundleOps {let network = editsNetwork? try VPhoneNetworking.merge(into: bundle.manifest.networkConfig,- mode: networkMode, bridgeInterface: bridgeInterface)+ mode: networkMode,+ bridgeInterface: bridgeInterface): nillet updated = bundle.manifest.updating(cpuCount: cpuCount,@@ -110,7 +119,9 @@ public enum VPhoneBundleOps {// MARK: - Rename / deletepublic static func rename(- bundleNamed name: String, to newName: String, in library: VPhoneLibrary+ bundleNamed name: String,+ to newName: String,+ in library: VPhoneLibrary) throws -> VPhoneBundle {try requireValidName(newName)let src = try library.bundle(named: name).url@@ -134,7 +145,9 @@ public enum VPhoneBundleOps {/// fresh device on next boot. NOTE: SEPStorage is copied as-is — cloning an/// already-restored VM may need a re-restore for a fully clean identity.public static func clone(- bundleNamed name: String, to newName: String, in library: VPhoneLibrary+ bundleNamed name: String,+ to newName: String,+ in library: VPhoneLibrary) throws -> VPhoneBundle {try requireValidName(newName)let src = try library.bundle(named: name).url@@ -202,8 +215,11 @@ public enum VPhoneBundleOps {/// where `totalBytes` is the bundle's on-disk logical size (minus excludes).@discardableResultpublic static func export(- bundleNamed name: String, to outFile: URL, includeIPSW: Bool,- compression: ExportCompression = .fast, in library: VPhoneLibrary,+ bundleNamed name: String,+ to outFile: URL,+ includeIPSW: Bool,+ compression: ExportCompression = .fast,+ in library: VPhoneLibrary,progress: ((Int64, Int64) -> Void)? = nil) throws -> URL {_ = try library.bundle(named: name) // validate it exists@@ -222,7 +238,10 @@ public enum VPhoneBundleOps {let consumer = ["-cf", outFile.path] + compression.tarArgs + ["@-"]let total = progress != nil- ? archivedLogicalSize(bundleDir: library.url(forName: name), libraryRoot: library.root, includeIPSW: includeIPSW)+ ? archivedLogicalSize(+ bundleDir: library.url(forName: name),+ libraryRoot: library.root,+ includeIPSW: includeIPSW): 0let err = try VPhoneProcessRunner.runCountingTarPipe(producerArgs: producer, sourceFile: nil, consumerArgs: consumer@@ -234,7 +253,9 @@ public enum VPhoneBundleOps {/// On-disk logical size of the members `export` will archive, mirroring the/// tar `--exclude` patterns so the progress total matches the streamed bytes.private static func archivedLogicalSize(- bundleDir: URL, libraryRoot: URL, includeIPSW: Bool+ bundleDir: URL,+ libraryRoot: URL,+ includeIPSW: Bool) -> Int64 {let fm = FileManager.defaultguard let en = fm.enumerator(@@ -259,7 +280,9 @@ public enum VPhoneBundleOps {/// `(bytesDone, totalBytes)` as the compressed file is fed into `tar -x`,/// where `totalBytes` is the archive's size on disk.public static func importArchive(- from inFile: URL, name: String?, in library: VPhoneLibrary,+ from inFile: URL,+ name: String?,+ in library: VPhoneLibrary,progress: ((Int64, Int64) -> Void)? = nil) throws -> VPhoneBundle {let fm = FileManager.defaultdiff --git a/sources/VPhoneCore/VPhoneFirmwarePicker.swift b/sources/VPhoneCore/VPhoneFirmwarePicker.swiftindex eff00901..c2a9a346 100644--- a/sources/VPhoneCore/VPhoneFirmwarePicker.swift+++ b/sources/VPhoneCore/VPhoneFirmwarePicker.swift@@ -67,7 +67,9 @@ public enum VPhoneFirmwarePicker {// MARK: - Promptsstatic func pickPairing(- maxRetries: Int, read: () -> String?, write: (String) -> Void+ maxRetries: Int,+ read: () -> String?,+ write: (String) -> Void) throws -> VPhoneFirmwarePairing {let pairings = VPhoneFirmwareCatalog.pairingslet w = pairings.map(\.iosName.count).max() ?? 0@@ -75,33 +77,43 @@ public enum VPhoneFirmwarePicker {"Select a firmware pairing to download:",pairings.map { $0.iosName.padding(toLength: w, withPad: " ", startingAt: 0)+ " (→ \($0.cloudosName))" },- maxRetries: maxRetries, read: read, write: write)+ maxRetries: maxRetries,+ read: read,+ write: write)let p = pairings[idx]write("→ \(p.iosName) + \(p.cloudosName)")return p}static func pickIPhone(- maxRetries: Int, read: () -> String?, write: (String) -> Void+ maxRetries: Int,+ read: () -> String?,+ write: (String) -> Void) throws -> VPhoneFirmwarePairing {let pairings = VPhoneFirmwareCatalog.pairingslet idx = try choose("Select an iPhone firmware to download:",pairings.map(\.iosName),- maxRetries: maxRetries, read: read, write: write)+ maxRetries: maxRetries,+ read: read,+ write: write)let p = pairings[idx]write("→ \(p.iosName)")return p}static func pickCloudOS(- maxRetries: Int, read: () -> String?, write: (String) -> Void+ maxRetries: Int,+ read: () -> String?,+ write: (String) -> Void) throws -> VPhoneCloudOSOption {let options = VPhoneFirmwareCatalog.cloudOSOptionslet idx = try choose("Select a cloudOS firmware to download:",options.map(\.name),- maxRetries: maxRetries, read: read, write: write)+ maxRetries: maxRetries,+ read: read,+ write: write)let c = options[idx]write("→ \(c.name)")return c@@ -109,8 +121,11 @@ public enum VPhoneFirmwarePicker {/// Show a numbered menu and read a 1-based index (mirrors VPhoneVMPicker).static func choose(- _ prompt: String, _ labels: [String],- maxRetries: Int, read: () -> String?, write: (String) -> Void+ _ prompt: String,+ _ labels: [String],+ maxRetries: Int,+ read: () -> String?,+ write: (String) -> Void) throws -> Int {write(prompt)let iw = String(labels.count).count // right-align indices so labels start in one columndiff --git a/sources/VPhoneCore/VPhoneLibrary.swift b/sources/VPhoneCore/VPhoneLibrary.swiftindex bcc49f53..7c67859f 100644--- a/sources/VPhoneCore/VPhoneLibrary.swift+++ b/sources/VPhoneCore/VPhoneLibrary.swift@@ -54,7 +54,9 @@ public struct VPhoneLibrary: Sendable {let fm = FileManager.defaultguard fm.fileExists(atPath: root.path) else { return ([], []) }let entries = try fm.contentsOfDirectory(- at: root, includingPropertiesForKeys: [.isDirectoryKey], options: [.skipsHiddenFiles])+ at: root,+ includingPropertiesForKeys: [.isDirectoryKey],+ options: [.skipsHiddenFiles])var bundles: [VPhoneBundle] = []var skipped: [VPhoneLibrarySkip] = []for url in entriesdiff --git a/sources/VPhoneCore/VPhoneNetworking.swift b/sources/VPhoneCore/VPhoneNetworking.swiftindex ae4472a8..f604eab4 100644--- a/sources/VPhoneCore/VPhoneNetworking.swift+++ b/sources/VPhoneCore/VPhoneNetworking.swift@@ -108,7 +108,8 @@ public enum VPhoneNetworking {}guard let iface = VZBridgedNetworkInterface.networkInterfaces.first(where: { $0.identifier == id }) else {throw VPhoneNetworkingError.bridgeInterfaceNotFound(- requested: id, available: availableBridgeInterfaces())+ requested: id,+ available: availableBridgeInterfaces())}let net = VZVirtioNetworkDeviceConfiguration()net.attachment = VZBridgedNetworkDeviceAttachment(interface: iface)diff --git a/sources/VPhoneCore/VPhoneProcessRunner.swift b/sources/VPhoneCore/VPhoneProcessRunner.swiftindex 800351dd..069eab5e 100644--- a/sources/VPhoneCore/VPhoneProcessRunner.swift+++ b/sources/VPhoneCore/VPhoneProcessRunner.swift@@ -264,7 +264,10 @@ public enum VPhoneProcessRunner {/// under a bare env, so `env` is passed inline as `KEY=value` — nothing else/// reaches the command. Returns the command's exit status.public static func runWithAdminPrivileges(- _ executable: URL, _ args: [String], env: [String: String] = [:], echo: Bool = true+ _ executable: URL,+ _ args: [String],+ env: [String: String] = [:],+ echo: Bool = true) throws -> Int32 {func shQuote(_ s: String) -> String { "'" + s.replacingOccurrences(of: "'", with: "'\\''") + "'" }var tokens = env.sorted { $0.key < $1.key }.map { "\($0.key)=\(shQuote($0.value))" }diff --git a/sources/VPhoneCore/VPhoneResources.swift b/sources/VPhoneCore/VPhoneResources.swiftindex 3f842cc7..673b538a 100644--- a/sources/VPhoneCore/VPhoneResources.swift+++ b/sources/VPhoneCore/VPhoneResources.swift@@ -220,7 +220,8 @@ public struct VPhoneResources: Sendable {log(" → Trying \(host.path)…")try? FileManager.default.removeItem(at: managedVenvDir)try FileManager.default.createDirectory(- at: Self.userDataRoot(), withIntermediateDirectories: true)+ at: Self.userDataRoot(),+ withIntermediateDirectories: true)guard (try? VPhoneProcessRunner.runStreaming(host, ["-m", "venv", managedVenvDir.path])) == 0 else {lastError = "Could not create a Python environment with \(host.path)"; continue}diff --git a/sources/VPhoneCore/VPhoneRestoreInfo.swift b/sources/VPhoneCore/VPhoneRestoreInfo.swiftindex 75424245..8bbf9f1f 100644--- a/sources/VPhoneCore/VPhoneRestoreInfo.swift+++ b/sources/VPhoneCore/VPhoneRestoreInfo.swift@@ -77,8 +77,10 @@ public struct VPhoneRestoreInfo: Codable, Equatable, Sendable {{guard let base = load(fromBundle: bundle) else { return nil }let merged = VPhoneRestoreInfo(- ios: base.ios, cloudOS: base.cloudOS,- variant: variant, device: device(forVariant: variant))+ ios: base.ios,+ cloudOS: base.cloudOS,+ variant: variant,+ device: device(forVariant: variant))try merged.write(toBundle: bundle)return merged}@@ -96,7 +98,8 @@ public struct VPhoneRestoreInfo: Codable, Equatable, Sendable {static func findRestoreDirectory(inBundle bundle: VPhoneBundle) -> URL? {let entries = (try? FileManager.default.contentsOfDirectory(- at: bundle.url, includingPropertiesForKeys: nil)) ?? []+ at: bundle.url,+ includingPropertiesForKeys: nil)) ?? []return entries.filter { $0.lastPathComponent.hasPrefix("iPhone") && $0.lastPathComponent.hasSuffix("_Restore") }.max { $0.lastPathComponent < $1.lastPathComponent }diff --git a/sources/VPhoneCore/VPhoneRestoreOps.swift b/sources/VPhoneCore/VPhoneRestoreOps.swiftindex 60c425c7..1a827862 100644--- a/sources/VPhoneCore/VPhoneRestoreOps.swift+++ b/sources/VPhoneCore/VPhoneRestoreOps.swift@@ -53,7 +53,8 @@ public enum VPhoneRestoreOps {for aea in entries where aea.lastPathComponent.hasSuffix(".dmg.aea") {guard try isAEAEncrypted(aea) else { continue }let code = try VPhoneProcessRunner.runStreaming(- URL(fileURLWithPath: "/usr/bin/env"), ["ipsw", "fw", "aea", "-o", dir.path, aea.path])+ URL(fileURLWithPath: "/usr/bin/env"),+ ["ipsw", "fw", "aea", "-o", dir.path, aea.path])guard code == 0 else { throw VPhoneRestoreError.aeaDecryptFailed(aea.lastPathComponent) }// ipsw wrote <dir>/<name minus .aea>; move it onto the .aea filename.// Confirm the decrypted output exists BEFORE removing the original (mv -f semantics).diff --git a/sources/vphone-cli/VPhoneCLI.swift b/sources/vphone-cli/VPhoneCLI.swiftindex 166379dc..54b76a16 100644--- a/sources/vphone-cli/VPhoneCLI.swift+++ b/sources/vphone-cli/VPhoneCLI.swift@@ -102,13 +102,17 @@ struct VPhoneBootCLI: ParsableCommand {return VPhoneVirtualMachine.Options(configURL: config,- romURL: manifest.romImages != nil ? manifest.resolve(path: manifest.romImages!.avpBooter, in: vmDir) : nil,+ romURL: manifest.romImages != nil+ ? manifest.resolve(path: manifest.romImages!.avpBooter, in: vmDir)+ : nil,nvramURL: manifest.resolve(path: manifest.nvramStorage, in: vmDir),diskURL: manifest.resolve(path: manifest.diskImage, in: vmDir),cpuCount: Int(manifest.cpuCount),memorySize: manifest.memorySize,sepStorageURL: manifest.resolve(path: manifest.sepStorage, in: vmDir),- sepRomURL: manifest.romImages != nil ? manifest.resolve(path: manifest.romImages!.avpSEPBooter, in: vmDir) : nil,+ sepRomURL: manifest.romImages != nil+ ? manifest.resolve(path: manifest.romImages!.avpSEPBooter, in: vmDir)+ : nil,screenWidth: manifest.screenConfig.width,screenHeight: manifest.screenConfig.height,screenPPI: manifest.screenConfig.pixelsPerInch,@@ -175,7 +179,10 @@ struct PatchFirmwareCLI: ParsableCommand {@Flag(name: [.customShort("q"), .customLong("quiet")], help: "Suppress per-component progress output.")var quiet: Bool = false- @Flag(name: .customLong("no-binpack"), help: "Exclude the SSH, VNC, ... binaries from being installed (patchless-only).")+ @Flag(+ name: .customLong("no-binpack"),+ help: "Exclude the SSH, VNC, ... binaries from being installed (patchless-only)."+ )var noBinpack: Bool = false@Flag(name: .customLong("no-vphoned"), help: "Exclude vphoned from being installed (patchless-only).")diff --git a/sources/vphone-cli/VPhoneCameraServer.swift b/sources/vphone-cli/VPhoneCameraServer.swiftindex d84e4f2f..2a28761a 100644--- a/sources/vphone-cli/VPhoneCameraServer.swift+++ b/sources/vphone-cli/VPhoneCameraServer.swift@@ -43,9 +43,13 @@ final class VPhoneCameraServer {private var connectionAttemptToken: UInt64 = 0private let sendQueue = DispatchQueue(- label: "com.vphone.camera.send", qos: .userInteractive)+ label: "com.vphone.camera.send",+ qos: .userInteractive+ )private let producerQueue = DispatchQueue(- label: "com.vphone.camera.producer", qos: .userInteractive)+ label: "com.vphone.camera.producer",+ qos: .userInteractive+ )var onConnectionStateChange: ((Bool) -> Void)?@@ -82,7 +86,8 @@ final class VPhoneCameraServer {case .testPattern:producer = VPhoneTestPatternProducer(width: Self.defaultWidth,- height: Self.defaultHeight)+ height: Self.defaultHeight+ )case .videoFile:guard let url = videoURL else {print("[camera] videoFile source requires a URL")@@ -94,7 +99,8 @@ final class VPhoneCameraServer {producer = try VPhoneVideoFileProducer(url: url,width: Self.defaultWidth,- height: Self.defaultHeight)+ height: Self.defaultHeight+ )print("[camera] video file source = \(url.lastPathComponent)")} catch {print("[camera] failed to open \(url.lastPathComponent): \(error)")diff --git a/sources/vphone-cli/VPhoneControl.swift b/sources/vphone-cli/VPhoneControl.swiftindex 63ddd8cb..53a7e541 100644--- a/sources/vphone-cli/VPhoneControl.swift+++ b/sources/vphone-cli/VPhoneControl.swift@@ -72,7 +72,8 @@ class VPhoneControl {private nonisolated(unsafe) var pendingRequests: [String: PendingRequest] = [:]private nonisolated func addPending(- id: String, handler: @escaping (Result<([String: Any], Data?), any Error>) -> Void+ id: String,+ handler: @escaping (Result<([String: Any], Data?), any Error>) -> Void) {pendingLock.lock()pendingRequests[id] = PendingRequest(handler: handler)@@ -509,7 +510,11 @@ class VPhoneControl {let hasImage = resp["has_image"] as? Bool ?? falselet changeCount = resp["change_count"] as? Int ?? 0return ClipboardContent(- text: text, types: types, hasImage: hasImage, changeCount: changeCount, imageData: data+ text: text,+ types: types,+ hasImage: hasImage,+ changeCount: changeCount,+ imageData: data)}@@ -562,9 +567,13 @@ class VPhoneControl {// MARK: - Locationfunc sendLocation(- latitude: Double, longitude: Double, altitude: Double,- horizontalAccuracy: Double, verticalAccuracy: Double,- speed: Double, course: Double+ latitude: Double,+ longitude: Double,+ altitude: Double,+ horizontalAccuracy: Double,+ verticalAccuracy: Double,+ speed: Double,+ course: Double) {nextRequestId += 1let msg: [String: Any] = [diff --git a/sources/vphone-cli/VPhoneControlKeychain.swift b/sources/vphone-cli/VPhoneControlKeychain.swiftindex ba3900b6..b3cec996 100644--- a/sources/vphone-cli/VPhoneControlKeychain.swift+++ b/sources/vphone-cli/VPhoneControlKeychain.swift@@ -19,7 +19,9 @@ extension VPhoneControl {}func addKeychainItem(- account: String = "vphone-test", service: String = "vphone", password: String = "testpass123"+ account: String = "vphone-test",+ service: String = "vphone",+ password: String = "testpass123") async throws {let req: [String: Any] = ["t": "keychain_add", "account": account, "service": service, "password": password,diff --git a/sources/vphone-cli/VPhoneCreateOrchestrator.swift b/sources/vphone-cli/VPhoneCreateOrchestrator.swiftindex 0fac2e1a..585752ba 100644--- a/sources/vphone-cli/VPhoneCreateOrchestrator.swift+++ b/sources/vphone-cli/VPhoneCreateOrchestrator.swift@@ -151,9 +151,13 @@ public struct VPhoneCreateOrchestrator {print("\n=== vm new ===")let spec = VPhoneBundleOps.NewBundleSpec(- name: options.name, cpuCount: options.cpuCount, memoryMB: options.memoryMB,+ name: options.name,+ cpuCount: options.cpuCount,+ memoryMB: options.memoryMB,diskSizeGB: options.diskSizeGB,- romSource: VPhoneBundleOps.defaultROMSource(), sepromSource: VPhoneBundleOps.defaultSEPROMSource())+ romSource: VPhoneBundleOps.defaultROMSource(),+ sepromSource: VPhoneBundleOps.defaultSEPROMSource()+ )let bundle = try VPhoneBundleOps.create(spec, in: library)print("created \(bundle.url.path)")@@ -162,8 +166,12 @@ public struct VPhoneCreateOrchestrator {print("\n=== fw patch ===")try runFWPatch(- variant: variantOption, isLess: isLess, enableFrida: options.enableFrida,- bundleURL: bundleURL, verbosity: v)+ variant: variantOption,+ isLess: isLess,+ enableFrida: options.enableFrida,+ bundleURL: bundleURL,+ verbosity: v+ )print("\n=== Restore phase ===")try runRestorePhase(bundleURL: bundleURL, verbosity: v)@@ -226,7 +234,9 @@ public struct VPhoneCreateOrchestrator {/// where Virtualization.framework PV=3 guest boot is unavailable.static func isNestedVMHost() throws -> Bool {let r = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/sbin/sysctl"), ["-n", "kern.hv_vmm_present"])+ URL(fileURLWithPath: "/usr/sbin/sysctl"),+ ["-n", "kern.hv_vmm_present"]+ )return VPhoneBootPatterns.parseHVVmmPresent(r.stdout)}@@ -250,7 +260,10 @@ public struct VPhoneCreateOrchestrator {for (key, value) in extras { env[key] = value }trace("spawn /usr/bin/sudo -A -v (env keys added: \(extras.keys.sorted().joined(separator: ", ")))", v)let result = try? VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/bin/sudo"), ["-A", "-v"], env: env)+ URL(fileURLWithPath: "/usr/bin/sudo"),+ ["-A", "-v"],+ env: env+ )return result?.succeeded == true}@@ -270,18 +283,28 @@ public struct VPhoneCreateOrchestrator {if isLess { env["VARIANT"] = "less" }if options.keepArtifacts { env["VPHONE_KEEP_ARTIFACTS"] = "1" }- trace("spawn /bin/bash \(resources.fwPrepareScript.path) (env keys: VPHONE_PYTHON, IPSW_DIR, VPHONE_SEAL_DIR)", v)+ trace(+ "spawn /bin/bash \(resources.fwPrepareScript.path) (env keys: VPHONE_PYTHON, IPSW_DIR, VPHONE_SEAL_DIR)",+ v+ )// Always streamed — silence during a multi-GB download reads as a hang.let code = try VPhoneProcessRunner.runStreaming(- URL(fileURLWithPath: "/bin/bash"), [resources.fwPrepareScript.path], cwd: bundleURL, env: env,- echo: true)+ URL(fileURLWithPath: "/bin/bash"),+ [resources.fwPrepareScript.path],+ cwd: bundleURL,+ env: env,+ echo: true+ )guard code == 0 else { throw VPhoneCreateError.fwPrepareFailed(code) }print("[+] Firmware prepared (iPhone + cloudOS merged into bundle).")}private func runFWPatch(- variant: PatchFirmwareCLI.VariantOption, isLess: Bool, enableFrida: Bool,- bundleURL: URL, verbosity v: VPhoneVerbosity+ variant: PatchFirmwareCLI.VariantOption,+ isLess: Bool,+ enableFrida: Bool,+ bundleURL: URL,+ verbosity v: VPhoneVerbosity) throws {// Mirrors the Makefile's `ifeq ($(UID),0)` gate on `fw_patch_less` —// only the `less` variant requires root.@@ -297,9 +320,14 @@ public struct VPhoneCreateOrchestrator {trace("in-process FirmwarePipeline.patchAll variant=\(variant.rawValue)", v)let pipeline = FirmwarePipeline(- vmDirectory: bundleURL, variant: variant.pipelineVariant, verbose: v.showsToolDetail,- noBinpack: false, noVphoned: false, forceExcGuard: false,- enableFrida: enableFrida)+ vmDirectory: bundleURL,+ variant: variant.pipelineVariant,+ verbose: v.showsToolDetail,+ noBinpack: false,+ noVphoned: false,+ forceExcGuard: false,+ enableFrida: enableFrida+ )let records = try pipeline.patchAll()print("[fw patch] applied \(records.count) patches for \(variant.rawValue)")}@@ -313,7 +341,11 @@ public struct VPhoneCreateOrchestrator {// managed process still reads it internally for panic/prompt matching.trace("spawn \(selfExecutable.path) --config \(configURL.path) --dfu (guest serial: off)", v)let dfu = VPhoneManagedProcess(- selfExecutable, ["--config", configURL.path, "--dfu"], cwd: bundleURL, echo: false)+ selfExecutable,+ ["--config", configURL.path, "--dfu"],+ cwd: bundleURL,+ echo: false+ )try dfu.start()defer { dfu.terminate() }@@ -338,7 +370,11 @@ public struct VPhoneCreateOrchestrator {+ verbosityArgstrace("spawn \(python.path) \(restoreArgs.joined(separator: " "))", v)let restoreCode = try VPhoneProcessRunner.runStreaming(- python, restoreArgs, cwd: bundleURL, echo: v.showsToolDetail)+ python,+ restoreArgs,+ cwd: bundleURL,+ echo: v.showsToolDetail+ )guard restoreCode == 0 else { throw VPhoneCreateError.restoreUpdateFailed(restoreCode) }recordRestoreVersions(bundleURL: bundleURL)@@ -420,7 +456,9 @@ public struct VPhoneCreateOrchestrator {let python = try resources.pythonExecutable()for _ in 1...90 {let result = try? VPhoneProcessRunner.runCapturing(- python, [resources.pmd3Bridge.path, "recovery-probe", "--ecid", "0x\(ecid)", "--timeout", "2"])+ python,+ [resources.pmd3Bridge.path, "recovery-probe", "--ecid", "0x\(ecid)", "--timeout", "2"]+ )if result?.succeeded == true {print("[+] Device endpoint is reachable")return@@ -458,23 +496,36 @@ public struct VPhoneCreateOrchestrator {scriptEnv["SUDO_USER"] = NSUserName()trace("osascript admin-privileges /bin/zsh \(args.joined(separator: " "))", v)code = try VPhoneProcessRunner.runWithAdminPrivileges(- URL(fileURLWithPath: "/bin/zsh"), args, env: scriptEnv, echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/zsh"),+ args,+ env: scriptEnv,+ echo: v.showsToolDetail+ )} else {var env = ProcessInfo.processInfo.environmentfor (key, value) in scriptEnv { env[key] = value }for (key, value) in sudoEnvExtras { env[key] = value }- let envKeys = (["VPHONE_PYTHON", "IPSW_DIR", "VPHONE_SEAL_DIR"] + sudoEnvExtras.keys.sorted()).joined(separator: ", ")+ let envKeys = (["VPHONE_PYTHON", "IPSW_DIR", "VPHONE_SEAL_DIR"] + sudoEnvExtras.keys.sorted())+ .joined(separator: ", ")trace("spawn /bin/zsh \(args.joined(separator: " ")) (env keys: \(envKeys))", v)// With an askpass credential sudo is non-interactive → honor verbosity.// Without one, sudo must prompt on the terminal → run as a foreground// job so its process group owns the tty (see runForeground).if sudoEnvExtras["SUDO_ASKPASS"] != nil {code = try VPhoneProcessRunner.runStreaming(- URL(fileURLWithPath: "/bin/zsh"), args, env: env, echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/zsh"),+ args,+ env: env,+ echo: v.showsToolDetail+ )} else {print("[*] CFW install needs root — sudo will prompt for your macOS password.")code = try VPhoneProcessRunner.runForeground(- URL(fileURLWithPath: "/bin/zsh"), args, env: env, echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/zsh"),+ args,+ env: env,+ echo: v.showsToolDetail+ )}}guard code == 0 else { throw VPhoneCreateError.cfwInstallFailed(code) }@@ -542,7 +593,11 @@ public struct VPhoneCreateOrchestrator {let configURL = bundleURL.appendingPathComponent("config.plist")trace("spawn \(selfExecutable.path) --config \(configURL.path) --headless (guest serial: off)", v)let vm = VPhoneManagedProcess(- selfExecutable, ["--config", configURL.path, "--headless"], cwd: bundleURL, echo: false)+ selfExecutable,+ ["--config", configURL.path, "--headless"],+ cwd: bundleURL,+ echo: false+ )try vm.start()defer { vm.terminate() }@@ -573,7 +628,11 @@ public struct VPhoneCreateOrchestrator {let args = ["--config", configURL.path, "--variant", "less"]trace("spawn \(selfExecutable.path) \(args.joined(separator: " ")) (echo=\(v.showsToolDetail))", v)let code = try VPhoneProcessRunner.runStreaming(- selfExecutable, args, cwd: bundleURL, echo: v.showsToolDetail)+ selfExecutable,+ args,+ cwd: bundleURL,+ echo: v.showsToolDetail+ )guard code == 0 else { throw VPhoneCreateError.lessBootFailed(code) }}}diff --git a/sources/vphone-cli/VPhoneFWCLI.swift b/sources/vphone-cli/VPhoneFWCLI.swiftindex c33c7ac3..7ca2588f 100644--- a/sources/vphone-cli/VPhoneFWCLI.swift+++ b/sources/vphone-cli/VPhoneFWCLI.swift@@ -15,7 +15,8 @@ struct VPhoneFWCommand: ParsableCommand {struct VPhoneFWCatalogCommand: ParsableCommand {static let configuration = CommandConfiguration(commandName: "catalog",- abstract: "Show the known iOS ↔ cloudOS firmware pairings (recommended per iOS build)")+ abstract: "Show the known iOS ↔ cloudOS firmware pairings (recommended per iOS build)"+ )@Flag(name: .shortAndLong, help: "Emit JSON") var json = false@@ -40,7 +41,9 @@ struct VPhoneFWCatalogCommand: ParsableCommand {struct VPhoneFWPrepareCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "prepare", abstract: "Download + merge IPSWs into a VM bundle")+ commandName: "prepare",+ abstract: "Download + merge IPSWs into a VM bundle"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@@ -79,8 +82,12 @@ struct VPhoneFWPrepareCommand: ParsableCommand {print("[trace] spawning: /bin/bash \(resources.fwPrepareScript.path) (env keys: VPHONE_PYTHON, IPSW_DIR, VPHONE_SEAL_DIR)")}let code = try VPhoneProcessRunner.runStreaming(- URL(fileURLWithPath: "/bin/bash"), [resources.fwPrepareScript.path], cwd: bundle.url, env: env,- echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/bash"),+ [resources.fwPrepareScript.path],+ cwd: bundle.url,+ env: env,+ echo: v.showsToolDetail+ )throw ExitCode(code)}}@@ -89,13 +96,17 @@ struct VPhoneFWPrepareCommand: ParsableCommand {struct VPhoneFWPatchCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "patch", abstract: "Patch the boot chain (native Swift FirmwarePipeline)")+ commandName: "patch",+ abstract: "Patch the boot chain (native Swift FirmwarePipeline)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?- @Option(name: [.customShort("V"), .long], help: "variant: regular | dev | jb | exp | less") var variant: PatchFirmwareCLI.VariantOption = .regular+ @Option(name: [.customShort("V"), .long], help: "variant: regular | dev | jb | exp | less")+ var variant: PatchFirmwareCLI.VariantOption = .regular@Flag(name: .customLong("force-exc-guard"), help: "Force the EXC_GUARD disable patch") var forceExcGuard = false- @Flag(name: .customLong("frida"), help: "Opt in to Frida Stalker kernel relaxations (jb/exp only)") var frida = false+ @Flag(name: .customLong("frida"), help: "Opt in to Frida Stalker kernel relaxations (jb/exp only)")+ var frida = false@Flag(name: .shortAndLong, help: "Suppress per-component progress") var quiet = falsefunc run() throws {@@ -116,7 +127,8 @@ struct VPhoneFWPatchCommand: ParsableCommand {noBinpack: false,noVphoned: false,forceExcGuard: forceExcGuard,- enableFrida: frida)+ enableFrida: frida+ )let records = try pipeline.patchAll()print("[fw patch] applied \(records.count) patches for \(variant.rawValue)")}diff --git a/sources/vphone-cli/VPhoneFileBrowserModel.swift b/sources/vphone-cli/VPhoneFileBrowserModel.swiftindex d83d09fa..431ac7af 100644--- a/sources/vphone-cli/VPhoneFileBrowserModel.swift+++ b/sources/vphone-cli/VPhoneFileBrowserModel.swift@@ -204,7 +204,10 @@ class VPhoneFileBrowserModel {await downloadDirectory(remotePath: child.path, name: child.name, to: localDir)} else {await downloadFile(- remotePath: child.path, name: child.name, size: child.size, to: localDir+ remotePath: child.path,+ name: child.name,+ size: child.size,+ to: localDir)}if error != nil { return }diff --git a/sources/vphone-cli/VPhoneFirmwareSelection.swift b/sources/vphone-cli/VPhoneFirmwareSelection.swiftindex cdb98ffe..9f807e19 100644--- a/sources/vphone-cli/VPhoneFirmwareSelection.swift+++ b/sources/vphone-cli/VPhoneFirmwareSelection.swift@@ -10,9 +10,11 @@ enum VPhoneFirmwareSelection {/// specified → returns the inputs unchanged (fw_prepare defaults fill gaps).static func resolve(iphone: String?, cloudos: String?) throws -> VPhoneFirmwareSources {try VPhoneFirmwarePicker.resolve(- iphone: iphone, cloudos: cloudos,+ iphone: iphone,+ cloudos: cloudos,isInteractive: isTTY,read: { readLine(strippingNewline: true) },- write: { err($0) })+ write: { err($0) }+ )}}diff --git a/sources/vphone-cli/VPhoneFrameProducer.swift b/sources/vphone-cli/VPhoneFrameProducer.swiftindex 43e492a9..a3fe1d31 100644--- a/sources/vphone-cli/VPhoneFrameProducer.swift+++ b/sources/vphone-cli/VPhoneFrameProducer.swift@@ -97,7 +97,8 @@ final class VPhoneTestPatternProducer: VPhoneFrameProducer, @unchecked Sendableheight: height,bytesPerRow: bytesPerRow,timestampNS: ts,- pixels: Data(bytes))+ pixels: Data(bytes)+ )}// MARK: - HSV helpers@@ -154,7 +155,8 @@ final class VPhoneVideoFileProducer: VPhoneFrameProducer, @unchecked Sendable {private func restartReader() throws {guard let track = asset.tracks(withMediaType: .video).first else {throw NSError(- domain: "VPhoneVideoFileProducer", code: 1,+ domain: "VPhoneVideoFileProducer",+ code: 1,userInfo: [NSLocalizedDescriptionKey:"\(url.lastPathComponent): no video track"])}@@ -169,7 +171,8 @@ final class VPhoneVideoFileProducer: VPhoneFrameProducer, @unchecked Sendable {r.add(output)guard r.startReading() else {throw NSError(- domain: "VPhoneVideoFileProducer", code: 2,+ domain: "VPhoneVideoFileProducer",+ code: 2,userInfo: [NSLocalizedDescriptionKey:"AVAssetReader.startReading failed: \(r.error?.localizedDescription ?? "?")"])}@@ -213,10 +216,12 @@ final class VPhoneVideoFileProducer: VPhoneFrameProducer, @unchecked Sendable {}}return VPhoneCameraFrame(- width: width, height: height,+ width: width,+ height: height,bytesPerRow: bytesPerRow,timestampNS: UInt64(ProcessInfo.processInfo.systemUptime * 1e9),- pixels: out)+ pixels: out+ )}// Slow path: resize via Core Image. Stretches to fit; pick aspect@@ -236,12 +241,15 @@ final class VPhoneVideoFileProducer: VPhoneFrameProducer, @unchecked Sendable {rowBytes: bytesPerRow,bounds: CGRect(x: 0, y: 0, width: width, height: height),format: .BGRA8,- colorSpace: CGColorSpaceCreateDeviceRGB())+ colorSpace: CGColorSpaceCreateDeviceRGB()+ )}return VPhoneCameraFrame(- width: width, height: height,+ width: width,+ height: height,bytesPerRow: bytesPerRow,timestampNS: UInt64(ProcessInfo.processInfo.systemUptime * 1e9),- pixels: out)+ pixels: out+ )}}diff --git a/sources/vphone-cli/VPhoneHostControl.swift b/sources/vphone-cli/VPhoneHostControl.swiftindex cbd842ab..acdbf836 100644--- a/sources/vphone-cli/VPhoneHostControl.swift+++ b/sources/vphone-cli/VPhoneHostControl.swift@@ -142,9 +142,13 @@ class VPhoneHostControl {// Draw into grayscale contextlet gray = CGColorSpaceCreateDeviceGray()guard let ctx = CGContext(- data: nil, width: dstW, height: dstH,- bitsPerComponent: 8, bytesPerRow: dstW,- space: gray, bitmapInfo: CGImageAlphaInfo.none.rawValue+ data: nil,+ width: dstW,+ height: dstH,+ bitsPerComponent: 8,+ bytesPerRow: dstW,+ space: gray,+ bitmapInfo: CGImageAlphaInfo.none.rawValue) else { return nil }// High contrast: bump brightness@@ -245,8 +249,10 @@ class VPhoneHostControl {return}view.injectTap(- pixelX: x, pixelY: y,- screenWidth: controller.screenWidth, screenHeight: controller.screenHeight+ pixelX: x,+ pixelY: y,+ screenWidth: controller.screenWidth,+ screenHeight: controller.screenHeight)result.ok = trueif wantScreen {@@ -276,8 +282,12 @@ class VPhoneHostControl {return}view.injectSwipe(- fromX: x1, fromY: y1, toX: x2, toY: y2,- screenWidth: controller.screenWidth, screenHeight: controller.screenHeight,+ fromX: x1,+ fromY: y1,+ toX: x2,+ toY: y2,+ screenWidth: controller.screenWidth,+ screenHeight: controller.screenHeight,durationMs: durationMs)result.ok = true@@ -382,7 +392,11 @@ class VPhoneHostControl {}private nonisolated static func writeResponse(- _ fd: Int32, ok: Bool, path: String? = nil, error: String? = nil, image: String? = nil+ _ fd: Int32,+ ok: Bool,+ path: String? = nil,+ error: String? = nil,+ image: String? = nil) {var dict: [String: Any] = ["ok": ok]if let path { dict["path"] = path }diff --git a/sources/vphone-cli/VPhoneMenuCamera.swift b/sources/vphone-cli/VPhoneMenuCamera.swiftindex 37624220..e606081d 100644--- a/sources/vphone-cli/VPhoneMenuCamera.swift+++ b/sources/vphone-cli/VPhoneMenuCamera.swift@@ -8,8 +8,11 @@ extension VPhoneMenuController {let item = NSMenuItem(title: "Camera", action: nil, keyEquivalent: "")let menu = NSMenu(title: "Camera")- let status = NSMenuItem(title: "Camera server: disconnected",- action: nil, keyEquivalent: "")+ let status = NSMenuItem(+ title: "Camera server: disconnected",+ action: nil,+ keyEquivalent: ""+ )status.isEnabled = falsecameraStatusItem = statusmenu.addItem(status)@@ -21,20 +24,26 @@ extension VPhoneMenuController {cameraSourceOffItem = offmenu.addItem(off)- let testPattern = makeItem("Source: Test Pattern",- action: #selector(setCameraSourceTestPattern))+ let testPattern = makeItem(+ "Source: Test Pattern",+ action: #selector(setCameraSourceTestPattern)+ )cameraSourceTestPatternItem = testPatternmenu.addItem(testPattern)- let videoFile = makeItem("Source: Video File…",- action: #selector(setCameraSourceVideoFile))+ let videoFile = makeItem(+ "Source: Video File…",+ action: #selector(setCameraSourceVideoFile)+ )cameraSourceVideoFileItem = videoFilemenu.addItem(videoFile)menu.addItem(NSMenuItem.separator())- let startStop = makeItem("Start Streaming",- action: #selector(toggleCameraStreaming))+ let startStop = makeItem(+ "Start Streaming",+ action: #selector(toggleCameraStreaming)+ )startStop.isEnabled = falsecameraStartStopItem = startStopmenu.addItem(startStop)diff --git a/sources/vphone-cli/VPhoneMenuConnect.swift b/sources/vphone-cli/VPhoneMenuConnect.swiftindex 47c650fc..5cdca345 100644--- a/sources/vphone-cli/VPhoneMenuConnect.swift+++ b/sources/vphone-cli/VPhoneMenuConnect.swift@@ -285,7 +285,8 @@ extension VPhoneMenuController {let display: Stringif let dict = value as? [String: Any] {let data = try JSONSerialization.data(- withJSONObject: dict, options: [.prettyPrinted, .sortedKeys]+ withJSONObject: dict,+ options: [.prettyPrinted, .sortedKeys])display = String(data: data, encoding: .utf8) ?? "\(dict)"} else {@@ -387,10 +388,14 @@ extension VPhoneMenuController {Task {do {try await control.settingsSet(- domain: domain, key: key, value: value, type: type.isEmpty ? nil : type+ domain: domain,+ key: key,+ value: value,+ type: type.isEmpty ? nil : type)showAlert(- title: "Write Setting", message: "Set \(domain).\(key) = \(rawValue)",+ title: "Write Setting",+ message: "Set \(domain).\(key) = \(rawValue)",style: .informational)} catch {diff --git a/sources/vphone-cli/VPhoneMenuController.swift b/sources/vphone-cli/VPhoneMenuController.swiftindex a30ffdcb..113b94bd 100644--- a/sources/vphone-cli/VPhoneMenuController.swift+++ b/sources/vphone-cli/VPhoneMenuController.swift@@ -66,7 +66,9 @@ class VPhoneMenuController {let appMenu = NSMenu(title: "vphone")#if canImport(VPhoneBuildInfo)let buildItem = NSMenuItem(- title: "Build: \(VPhoneBuildInfo.commitHash)", action: nil, keyEquivalent: ""+ title: "Build: \(VPhoneBuildInfo.commitHash)",+ action: nil,+ keyEquivalent: "")#elselet buildItem = NSMenuItem(title: "Build: unknown", action: nil, keyEquivalent: "")@@ -75,7 +77,9 @@ class VPhoneMenuController {appMenu.addItem(buildItem)appMenu.addItem(NSMenuItem.separator())appMenu.addItem(- withTitle: "Quit vphone", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"+ withTitle: "Quit vphone",+ action: #selector(NSApplication.terminate(_:)),+ keyEquivalent: "q")appMenuItem.submenu = appMenumainMenu.addItem(appMenuItem)@@ -89,10 +93,14 @@ class VPhoneMenuController {let windowMenuItem = NSMenuItem()let windowMenu = NSMenu(title: "Window")windowMenu.addItem(- withTitle: "Close", action: #selector(NSWindow.performClose(_:)), keyEquivalent: "w"+ withTitle: "Close",+ action: #selector(NSWindow.performClose(_:)),+ keyEquivalent: "w")windowMenu.addItem(- withTitle: "Minimize", action: #selector(NSWindow.performMiniaturize(_:)), keyEquivalent: "m"+ withTitle: "Minimize",+ action: #selector(NSWindow.performMiniaturize(_:)),+ keyEquivalent: "m")windowMenuItem.submenu = windowMenumainMenu.addItem(windowMenuItem)diff --git a/sources/vphone-cli/VPhoneRestoreCLI.swift b/sources/vphone-cli/VPhoneRestoreCLI.swiftindex cc633d19..30088d1b 100644--- a/sources/vphone-cli/VPhoneRestoreCLI.swift+++ b/sources/vphone-cli/VPhoneRestoreCLI.swift@@ -7,14 +7,17 @@ import VPhoneCorestruct VPhoneRestoreCommand: ParsableCommand {static let configuration = CommandConfiguration(commandName: "restore",- abstract: "DFU-restore firmware into a VM bundle (requires a running DFU boot)")+ abstract: "DFU-restore firmware into a VM bundle (requires a running DFU boot)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@Flag(name: .shortAndLong, help: "Only fetch the SHSH blob, do not restore") var getShsh = false- @Flag(name: .shortAndLong, help: "Offline restore (decrypt AEA images in place, use the cached .shsh)") var offline = false+ @Flag(name: .shortAndLong, help: "Offline restore (decrypt AEA images in place, use the cached .shsh)")+ var offline = false@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?+ @Option(name: .shortAndLong, help: "Device ECID (default: read from the bundle's udid-prediction.txt)")+ var ecid: String?@Option(name: .shortAndLong, help: "Resource base override (default: inferred from the running binary path)")var projectRoot: String?@Flag(name: .customShort("v"), help: "Increase verbosity: -v tool detail, -vv guest serial, -vvv internal trace")@@ -73,7 +76,9 @@ struct VPhoneRestoreCommand: ParsableCommand {/// restore already succeeded, so a metadata miss is only a warning.private func recordRestoreVersions(bundle: VPhoneBundle) {guard let info = VPhoneRestoreInfo.derive(fromBundle: bundle) else {- FileHandle.standardError.write(Data("warning: could not record restore versions (metadata not found)\n".utf8))+ FileHandle.standardError.write(+ Data("warning: could not record restore versions (metadata not found)\n".utf8)+ )return}do {@@ -97,15 +102,30 @@ struct VPhoneCFWCommand: ParsableCommand {struct VPhoneCFWInstallCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "install", abstract: "Install CFW into a VM bundle via host mount")+ commandName: "install",+ abstract: "Install CFW into a VM bundle via host mount"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@Option(name: [.customShort("V"), .long], help: "variant: regular | dev | jb | exp") var variant: String = "exp"- @Option(name: [.customShort("b"), .long], help: "(exp only) rewrite ProductBuildVersion to this build id") var spoofBuild: String?- @Flag(name: .customLong("force-dsc-maxslide"), help: "Zero the dyld cache maxSlide on non-27 bases (opt-in DSC-map fit)") var forceDSCMaxSlide = false- @Flag(name: .customLong("root-popup"), help: "Elevate via macOS's native authentication dialog (osascript) instead of the sudo re-exec") var rootPopup = false- @Flag(name: .customLong("keep-artifacts"), help: "Keep the extracted CFW input dirs (cfw_input/, cfw_jb_input/) after install (default: removed to save space)") var keepArtifacts = false+ @Option(name: [.customShort("b"), .long], help: "(exp only) rewrite ProductBuildVersion to this build id")+ var spoofBuild: String?+ @Flag(+ name: .customLong("force-dsc-maxslide"),+ help: "Zero the dyld cache maxSlide on non-27 bases (opt-in DSC-map fit)"+ )+ var forceDSCMaxSlide = false+ @Flag(+ name: .customLong("root-popup"),+ help: "Elevate via macOS's native authentication dialog (osascript) instead of the sudo re-exec"+ )+ var rootPopup = false+ @Flag(+ name: .customLong("keep-artifacts"),+ help: "Keep the extracted CFW input dirs (cfw_input/, cfw_jb_input/) after install (default: removed to save space)"+ )+ var keepArtifacts = false@Option(name: .shortAndLong, help: "Resource base override (default: inferred from the running binary path)")var projectRoot: String?@Flag(name: .customShort("v"), help: "Increase verbosity: -v tool detail, -vv guest serial, -vvv internal trace")@@ -141,7 +161,11 @@ struct VPhoneCFWInstallCommand: ParsableCommand {// Forward SUDO_USER (sudo would set it) so the script's chown-back runs.scriptEnv["SUDO_USER"] = NSUserName()code = try VPhoneProcessRunner.runWithAdminPrivileges(- URL(fileURLWithPath: "/bin/zsh"), args, env: scriptEnv, echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/zsh"),+ args,+ env: scriptEnv,+ echo: v.showsToolDetail+ )} else {var env = ProcessInfo.processInfo.environmentfor (key, value) in scriptEnv { env[key] = value }@@ -149,7 +173,11 @@ struct VPhoneCFWInstallCommand: ParsableCommand {print("[trace] spawning: /bin/zsh \(args.joined(separator: " ")) (env keys: VPHONE_PYTHON, IPSW_DIR, VPHONE_SEAL_DIR)")}code = try VPhoneProcessRunner.runStreaming(- URL(fileURLWithPath: "/bin/zsh"), args, env: env, echo: v.showsToolDetail)+ URL(fileURLWithPath: "/bin/zsh"),+ args,+ env: env,+ echo: v.showsToolDetail+ )}if code == 0 {if let info = try? VPhoneRestoreInfo.recordVariant(variant, toBundle: bundle), info.variant != nil {diff --git a/sources/vphone-cli/VPhoneScreenRecorder.swift b/sources/vphone-cli/VPhoneScreenRecorder.swiftindex 10cba51a..0365a249 100644--- a/sources/vphone-cli/VPhoneScreenRecorder.swift+++ b/sources/vphone-cli/VPhoneScreenRecorder.swift@@ -150,7 +150,10 @@ class VPhoneScreenRecorder {let utType = url.pathExtension.lowercased() == "png" ? "public.png" : "public.jpeg"guard let dest = CGImageDestinationCreateWithURL(- url as CFURL, utType as CFString, 1, nil+ url as CFURL,+ utType as CFString,+ 1,+ nil) else {throw CaptureError.encodingFailed}diff --git a/sources/vphone-cli/VPhoneVMCLI.swift b/sources/vphone-cli/VPhoneVMCLI.swiftindex 7d2ac38d..060b680f 100644--- a/sources/vphone-cli/VPhoneVMCLI.swift+++ b/sources/vphone-cli/VPhoneVMCLI.swift@@ -117,9 +117,13 @@ struct VPhoneVMNewCommand: ParsableCommand {func run() throws {let spec = VPhoneBundleOps.NewBundleSpec(- name: name, cpuCount: cpu, memoryMB: memory, diskSizeGB: diskSize,+ name: name,+ cpuCount: cpu,+ memoryMB: memory,+ diskSizeGB: diskSize,romSource: rom.map { URL(fileURLWithPath: $0) } ?? VPhoneBundleOps.defaultROMSource(),- sepromSource: seprom.map { URL(fileURLWithPath: $0) } ?? VPhoneBundleOps.defaultSEPROMSource())+ sepromSource: seprom.map { URL(fileURLWithPath: $0) } ?? VPhoneBundleOps.defaultSEPROMSource()+ )let bundle = try VPhoneBundleOps.create(spec, in: lib.library)print("created \(bundle.url.path)")}@@ -129,7 +133,9 @@ struct VPhoneVMNewCommand: ParsableCommand {struct VPhoneVMConfigCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "config", abstract: "Edit VM manifest fields (cpu/memory/network)")+ commandName: "config",+ abstract: "Edit VM manifest fields (cpu/memory/network)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@@ -143,8 +149,13 @@ struct VPhoneVMConfigCommand: ParsableCommand {let mode = try network.map(Self.parseMode)let name = try VPhoneVMSelection.resolveExisting(name, in: lib.library)let updated = try VPhoneBundleOps.updateConfig(- bundleNamed: name, in: lib.library, cpuCount: cpu, memoryMB: memory,- networkMode: mode, bridgeInterface: bridgeInterface)+ bundleNamed: name,+ in: lib.library,+ cpuCount: cpu,+ memoryMB: memory,+ networkMode: mode,+ bridgeInterface: bridgeInterface+ )let m = updated.manifestprint("updated \(updated.name): \(m.cpuCount) CPU, \(m.memorySize / (1024*1024)) MB, "+ "net=\(describeNetwork(m.networkConfig))")diff --git a/sources/vphone-cli/VPhoneVMCreateCLI.swift b/sources/vphone-cli/VPhoneVMCreateCLI.swiftindex 029e3057..a1d6c617 100644--- a/sources/vphone-cli/VPhoneVMCreateCLI.swift+++ b/sources/vphone-cli/VPhoneVMCreateCLI.swift@@ -9,22 +9,40 @@ struct VPhoneVMCreateCommand: ParsableCommand {discussion: "Runs the full pipeline for a fresh VM. Needs an internet connection "+ "(IPSW download), a non-nested macOS host, and sudo (CFW host-mount). "+ "The 'less' (patchless) variant must itself be run with sudo — the whole "- + "create runs as root, not just the fw-patch stage.")+ + "create runs as root, not just the fw-patch stage."+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "new VM name") var name: String- @Option(name: [.customShort("V"), .long], help: "variant: regular | dev | jb | exp | less") var variant: String = "regular"+ @Option(name: [.customShort("V"), .long], help: "variant: regular | dev | jb | exp | less")+ var variant: String = "regular"@Option(name: .shortAndLong, help: "iPhone IPSW URL or local path") var iphoneSource: String?@Option(name: .shortAndLong, help: "cloudOS IPSW URL or local path") var cloudosSource: String?@Option(name: .shortAndLong, help: "Disk size (GB)") var diskSize: UInt64 = 64@Option(name: .shortAndLong, help: "sudo password for the CFW host-mount install (via askpass; never logged)")var sudoPassword: String?- @Option(name: [.customShort("b"), .long], help: "(exp only) rewrite ProductBuildVersion to this build id") var spoofBuild: String?- @Flag(name: .customLong("force-dsc-maxslide"), help: "Zero the dyld cache maxSlide on non-27 bases (opt-in DSC-map fit)") var forceDSCMaxSlide = false- @Flag(name: .customLong("frida"), help: "Opt in to Frida Stalker support: install re.frida.server (latest GitHub release) + jb/exp kernel relaxations") var frida = false- @Flag(name: .customLong("root-popup"), help: "Elevate the CFW host-mount via macOS's native authentication dialog (osascript) instead of a sudo prompt") var rootPopup = false+ @Option(name: [.customShort("b"), .long], help: "(exp only) rewrite ProductBuildVersion to this build id")+ var spoofBuild: String?+ @Flag(+ name: .customLong("force-dsc-maxslide"),+ help: "Zero the dyld cache maxSlide on non-27 bases (opt-in DSC-map fit)"+ )+ var forceDSCMaxSlide = false+ @Flag(+ name: .customLong("frida"),+ help: "Opt in to Frida Stalker support: install re.frida.server (latest GitHub release) + jb/exp kernel relaxations"+ )+ var frida = false+ @Flag(+ name: .customLong("root-popup"),+ help: "Elevate the CFW host-mount via macOS's native authentication dialog (osascript) instead of a sudo prompt"+ )+ var rootPopup = false@Flag(help: "Prompt at first-boot stages instead of running non-interactively") var interactive = false- @Flag(name: .customLong("keep-artifacts"), help: "Keep intermediate build artifacts (built restore firmware, extracted base-IPSW caches, extracted CFW input dirs) instead of removing them after use. Source archives (.ipsw / .tar.zst) are always kept.")+ @Flag(+ name: .customLong("keep-artifacts"),+ help: "Keep intermediate build artifacts (built restore firmware, extracted base-IPSW caches, extracted CFW input dirs) instead of removing them after use. Source archives (.ipsw / .tar.zst) are always kept."+ )var keepArtifacts = false@Option(name: .shortAndLong, help: "Resource base override (default: inferred from the running binary path)")var projectRoot: String?@@ -37,14 +55,24 @@ struct VPhoneVMCreateCommand: ParsableCommand {// Prompt for any firmware component not supplied on the command line.let sources = try VPhoneFirmwareSelection.resolve(iphone: iphoneSource, cloudos: cloudosSource)let orchestrator = VPhoneCreateOrchestrator(- library: lib.library, resources: resources, selfExecutable: selfExe)+ library: lib.library,+ resources: resources,+ selfExecutable: selfExe+ )try orchestrator.run(.init(- name: name, variant: variant,- iphoneSource: sources.iphoneSource, cloudosSource: sources.cloudosSource,- sudoPassword: sudoPassword, spoofBuild: spoofBuild, forceDSCMaxSlide: forceDSCMaxSlide,- enableFrida: frida, rootPopup: rootPopup,- interactive: interactive, diskSizeGB: diskSize,+ name: name,+ variant: variant,+ iphoneSource: sources.iphoneSource,+ cloudosSource: sources.cloudosSource,+ sudoPassword: sudoPassword,+ spoofBuild: spoofBuild,+ forceDSCMaxSlide: forceDSCMaxSlide,+ enableFrida: frida,+ rootPopup: rootPopup,+ interactive: interactive,+ diskSizeGB: diskSize,verbosity: VPhoneVerbosity(count: verboseCount),- keepArtifacts: keepArtifacts))+ keepArtifacts: keepArtifacts+ ))}}diff --git a/sources/vphone-cli/VPhoneVMLaunchCLI.swift b/sources/vphone-cli/VPhoneVMLaunchCLI.swiftindex b69940a9..8642f9f6 100644--- a/sources/vphone-cli/VPhoneVMLaunchCLI.swift+++ b/sources/vphone-cli/VPhoneVMLaunchCLI.swift@@ -4,7 +4,9 @@ import VPhoneCorestruct VPhoneVMLaunchCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "launch", abstract: "Boot a VM bundle (runs host preflight first)")+ commandName: "launch",+ abstract: "Boot a VM bundle (runs host preflight first)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@@ -43,8 +45,11 @@ struct VPhoneVMLaunchCommand: ParsableCommand {var preflightEnv = ProcessInfo.processInfo.environmentpreflightEnv["VPHONE_CLI_BIN"] = bootBinary.pathlet pre = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/bin/zsh"), [layout.preflightScript.path] + preflightArgs,- cwd: resources.base, env: preflightEnv)+ URL(fileURLWithPath: "/bin/zsh"),+ [layout.preflightScript.path] + preflightArgs,+ cwd: resources.base,+ env: preflightEnv+ )if !pre.stdout.isEmpty { print(pre.stdout, terminator: "") }guard pre.succeeded else {FileHandle.standardError.write(Data(pre.stderr.utf8))@@ -94,7 +99,9 @@ struct VPhoneVMLaunchCommand: ParsableCommand {struct VPhoneVMStopCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "stop", abstract: "Stop a running VM bundle")+ commandName: "stop",+ abstract: "Stop a running VM bundle"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@@ -107,7 +114,9 @@ struct VPhoneVMStopCommand: ParsableCommand {func runningPIDs() -> [Int32] {guard let r = try? VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/sbin/lsof"), ["-t", "--", disk.path]) else { return [] }+ URL(fileURLWithPath: "/usr/sbin/lsof"),+ ["-t", "--", disk.path]+ ) else { return [] }return VPhoneLsof.parsePIDs(r.stdout)}diff --git a/sources/vphone-cli/VPhoneVMSelection.swift b/sources/vphone-cli/VPhoneVMSelection.swiftindex 5aca7209..24e37306 100644--- a/sources/vphone-cli/VPhoneVMSelection.swift+++ b/sources/vphone-cli/VPhoneVMSelection.swift@@ -10,10 +10,13 @@ enum VPhoneVMSelection {if let provided, !provided.isEmpty { return provided } // supplied name → no library scanlet names = try library.bundles().map(\.name).sorted() // no-name path: propagate real scan errorsreturn try VPhoneVMPicker.resolve(- provided: nil, names: names, libraryRoot: library.root.path,+ provided: nil,+ names: names,+ libraryRoot: library.root.path,isInteractive: isTTY,read: { readLine(strippingNewline: true) },- write: { err($0) })+ write: { err($0) }+ )}/// Resolve a NEW name (rename/clone destination): return it if given, else prompt for text.diff --git a/sources/vphone-cli/VPhoneVMTransferCLI.swift b/sources/vphone-cli/VPhoneVMTransferCLI.swiftindex 06a50365..30686827 100644--- a/sources/vphone-cli/VPhoneVMTransferCLI.swift+++ b/sources/vphone-cli/VPhoneVMTransferCLI.swift@@ -7,7 +7,8 @@ struct VPhoneVMCloneCommand: ParsableCommand {commandName: "clone",abstract: "Clone a VM bundle (fast APFS clone; resets device identity)",discussion: "The clone boots as a fresh device (nvram/machineIdentifier/shsh cleared). "- + "SEPStorage is copied as-is; a cloned, already-restored VM may need re-restoring.")+ + "SEPStorage is copied as-is; a cloned, already-restored VM may need re-restoring."+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "source VM name") var name: String?@@ -23,7 +24,9 @@ struct VPhoneVMCloneCommand: ParsableCommand {struct VPhoneVMExportCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "export", abstract: "Export a VM bundle to a compressed archive (.tzst, or .txz with --max)")+ commandName: "export",+ abstract: "Export a VM bundle to a compressed archive (.tzst, or .txz with --max)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "VM name") var name: String?@@ -36,9 +39,13 @@ struct VPhoneVMExportCommand: ParsableCommand {let compression: VPhoneBundleOps.ExportCompression = max ? .max : .fastlet bar = VPhoneProgressBar(label: "exporting \(name)")let outURL = try VPhoneBundleOps.export(- bundleNamed: name, to: URL(fileURLWithPath: out), includeIPSW: includeIpsw,- compression: compression, in: lib.library,- progress: { done, total in bar.update(done: done, total: total) })+ bundleNamed: name,+ to: URL(fileURLWithPath: out),+ includeIPSW: includeIpsw,+ compression: compression,+ in: lib.library,+ progress: { done, total in bar.update(done: done, total: total) }+ )bar.finish()print("exported \(name) → \(outURL.path)")}@@ -46,7 +53,9 @@ struct VPhoneVMExportCommand: ParsableCommand {struct VPhoneVMImportCommand: ParsableCommand {static let configuration = CommandConfiguration(- commandName: "import", abstract: "Import a VM bundle from a compressed archive (compressor auto-detected)")+ commandName: "import",+ abstract: "Import a VM bundle from a compressed archive (compressor auto-detected)"+ )@OptionGroup var lib: VPhoneLibraryOption@Argument(help: "input archive path") var input: String@@ -55,8 +64,11 @@ struct VPhoneVMImportCommand: ParsableCommand {func run() throws {let bar = VPhoneProgressBar(label: "importing")let bundle = try VPhoneBundleOps.importArchive(- from: URL(fileURLWithPath: input), name: name, in: lib.library,- progress: { done, total in bar.update(done: done, total: total) })+ from: URL(fileURLWithPath: input),+ name: name,+ in: lib.library,+ progress: { done, total in bar.update(done: done, total: total) }+ )bar.finish()print("imported → \(bundle.name)")}diff --git a/sources/vphone-cli/VPhoneVirtualMachine.swift b/sources/vphone-cli/VPhoneVirtualMachine.swiftindex b03847ef..1f546835 100644--- a/sources/vphone-cli/VPhoneVirtualMachine.swift+++ b/sources/vphone-cli/VPhoneVirtualMachine.swift@@ -137,14 +137,16 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {config.platform = platformconfig.cpuCount = max(options.cpuCount, VZVirtualMachineConfiguration.minimumAllowedCPUCount)config.memorySize = max(- options.memorySize, VZVirtualMachineConfiguration.minimumAllowedMemorySize+ options.memorySize,+ VZVirtualMachineConfiguration.minimumAllowedMemorySize)// Displaylet gfx = VZMacGraphicsDeviceConfiguration()gfx.displays = [VZMacGraphicsDisplayConfiguration(- widthInPixels: options.screenWidth, heightInPixels: options.screenHeight,+ widthInPixels: options.screenWidth,+ heightInPixels: options.screenHeight,pixelsPerInch: options.screenPPI),]@@ -371,7 +373,8 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {}nonisolated func virtualMachine(- _: VZVirtualMachine, networkDevice _: VZNetworkDevice,+ _: VZVirtualMachine,+ networkDevice _: VZNetworkDevice,attachmentWasDisconnectedWithError error: Error) {print("[vphone] Network error: \(error)")diff --git a/sources/vphone-cli/VPhoneVirtualMachineView.swift b/sources/vphone-cli/VPhoneVirtualMachineView.swiftindex 8154e314..cd57a02e 100644--- a/sources/vphone-cli/VPhoneVirtualMachineView.swift+++ b/sources/vphone-cli/VPhoneVirtualMachineView.swift@@ -133,7 +133,10 @@ class VPhoneVirtualMachineView: VZVirtualMachineView {let options: [NSPasteboard.ReadingOptionKey: Any] = [.urlReadingFileURLsOnly: true,]- guard let urls = sender.draggingPasteboard.readObjects(forClasses: [NSURL.self], options: options) as? [URL] else {+ guard let urls = sender.draggingPasteboard.readObjects(+ forClasses: [NSURL.self],+ options: options+ ) as? [URL] else {return nil}return urls.first(where: VPhoneInstallPackage.isSupportedFile)@@ -188,7 +191,12 @@ class VPhoneVirtualMachineView: VZVirtualMachineView {/// Inject a tap at pixel coordinates (matching screenshot image dimensions).func injectTap(pixelX: Double, pixelY: Double, screenWidth: Int, screenHeight: Int) {- let localPoint = pixelToLocal(pixelX: pixelX, pixelY: pixelY, screenWidth: screenWidth, screenHeight: screenHeight)+ let localPoint = pixelToLocal(+ pixelX: pixelX,+ pixelY: pixelY,+ screenWidth: screenWidth,+ screenHeight: screenHeight+ )let windowPoint = convert(localPoint, to: nil)if let downEvent = synthesizeMouseEvent(type: .leftMouseDown, at: windowPoint) {@@ -204,10 +212,20 @@ class VPhoneVirtualMachineView: VZVirtualMachineView {/// Inject a swipe from one pixel coordinate to another.func injectSwipe(- fromX: Double, fromY: Double, toX: Double, toY: Double,- screenWidth: Int, screenHeight: Int, durationMs: Int = 300+ fromX: Double,+ fromY: Double,+ toX: Double,+ toY: Double,+ screenWidth: Int,+ screenHeight: Int,+ durationMs: Int = 300) {- let startLocal = pixelToLocal(pixelX: fromX, pixelY: fromY, screenWidth: screenWidth, screenHeight: screenHeight)+ let startLocal = pixelToLocal(+ pixelX: fromX,+ pixelY: fromY,+ screenWidth: screenWidth,+ screenHeight: screenHeight+ )let endLocal = pixelToLocal(pixelX: toX, pixelY: toY, screenWidth: screenWidth, screenHeight: screenHeight)let startWindow = convert(startLocal, to: nil)let endWindow = convert(endLocal, to: nil)diff --git a/sources/vphone-cli/VPhoneWindowController.swift b/sources/vphone-cli/VPhoneWindowController.swiftindex f8903900..1fd7da96 100644--- a/sources/vphone-cli/VPhoneWindowController.swift+++ b/sources/vphone-cli/VPhoneWindowController.swift@@ -18,8 +18,13 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {}func showWindow(- for vm: VZVirtualMachine, screenWidth: Int, screenHeight: Int, screenScale: Double,- keyHelper: VPhoneKeyHelper, control: VPhoneControl, ecid: String?+ for vm: VZVirtualMachine,+ screenWidth: Int,+ screenHeight: Int,+ screenScale: Double,+ keyHelper: VPhoneKeyHelper,+ control: VPhoneControl,+ ecid: String?) {self.control = controlself.ecid = ecid@@ -34,7 +39,8 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {let scale = CGFloat(screenScale)let windowSize = NSSize(- width: CGFloat(screenWidth) / scale, height: CGFloat(screenHeight) / scale+ width: CGFloat(screenWidth) / scale,+ height: CGFloat(screenHeight) / scale)let window = NSWindow(@@ -100,7 +106,8 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {// MARK: - NSToolbarDelegatenonisolated func toolbar(- _: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier,+ _: NSToolbar,+ itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier,willBeInsertedIntoToolbar _: Bool) -> NSToolbarItem? {MainActor.assumeIsolated {@@ -109,7 +116,8 @@ class VPhoneWindowController: NSObject, NSToolbarDelegate {item.label = "Home"item.toolTip = "Home Button"item.image = NSImage(- systemSymbolName: "circle.circle", accessibilityDescription: "Home"+ systemSymbolName: "circle.circle",+ accessibilityDescription: "Home")item.target = selfitem.action = #selector(homePressed)diff --git a/tests/FirmwarePatcherTests/FirmwarePatcherTests.swift b/tests/FirmwarePatcherTests/FirmwarePatcherTests.swiftindex f1e5a528..01f54e52 100644--- a/tests/FirmwarePatcherTests/FirmwarePatcherTests.swift+++ b/tests/FirmwarePatcherTests/FirmwarePatcherTests.swift@@ -435,7 +435,9 @@ struct IM4PPayloadParityTests {.appendingPathComponent("ipsws/patch_refactor_input")let rawIBSS = try Data(contentsOf: baseDir.appendingPathComponent("raw_payloads/ibss.bin"))- let (im4pPayload, _) = try IM4PHandler.load(contentsOf: baseDir.appendingPathComponent("Firmware/dfu/iBSS.vresearch101.RELEASE.im4p"))+ let (im4pPayload, _) = try IM4PHandler.load(+ contentsOf: baseDir.appendingPathComponent("Firmware/dfu/iBSS.vresearch101.RELEASE.im4p")+ )#expect(im4pPayload == rawIBSS)diff --git a/tests/VPhoneCoreTests/BundleOpsTests.swift b/tests/VPhoneCoreTests/BundleOpsTests.swiftindex afd49e2e..36cfd445 100644--- a/tests/VPhoneCoreTests/BundleOpsTests.swift+++ b/tests/VPhoneCoreTests/BundleOpsTests.swift@@ -22,8 +22,13 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let spec = VPhoneBundleOps.NewBundleSpec(- name: "newvm", cpuCount: 8, memoryMB: 8192, diskSizeGB: 64,- romSource: rom, sepromSource: seprom)+ name: "newvm",+ cpuCount: 8,+ memoryMB: 8192,+ diskSizeGB: 64,+ romSource: rom,+ sepromSource: seprom+ )let bundle = try VPhoneBundleOps.create(spec, in: VPhoneLibrary(root: root))#expect(bundle.manifest.cpuCount == 8)@@ -32,7 +37,9 @@ struct BundleOpsTests {let size = (try FileManager.default.attributesOfItem(atPath: disk.path)[.size] as? NSNumber)?.int64Value#expect(size == Int64(64 * 1024 * 1024 * 1024))#expect(FileManager.default.fileExists(atPath: bundle.url.appendingPathComponent("SEPStorage").path))- #expect(FileManager.default.fileExists(atPath: bundle.url.appendingPathComponent("AVPBooter.vresearch1.bin").path))+ #expect(+ FileManager.default.fileExists(atPath: bundle.url.appendingPathComponent("AVPBooter.vresearch1.bin").path)+ )}@Test func rejectsDuplicateName() throws {@@ -41,8 +48,13 @@ struct BundleOpsTests {let rom = try fakeROM(); let seprom = try fakeROM()defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let spec = VPhoneBundleOps.NewBundleSpec(- name: "dup", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom)+ name: "dup",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ )_ = try VPhoneBundleOps.create(spec, in: VPhoneLibrary(root: root))#expect(throws: VPhoneLibraryError.self) {_ = try VPhoneBundleOps.create(spec, in: VPhoneLibrary(root: root))@@ -58,8 +70,16 @@ struct BundleOpsTests {for bad in ["", "a/b", ".hidden"] {#expect(throws: VPhoneLibraryError.self) {_ = try VPhoneBundleOps.create(- .init(name: bad, cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: bad,+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )}}}@@ -73,8 +93,16 @@ struct BundleOpsTests {.appendingPathComponent(UUID().uuidString + ".bin")#expect(throws: (any Error).self) {_ = try VPhoneBundleOps.create(- .init(name: "partial", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: missingRom, sepromSource: missingRom), in: lib)+ .init(+ name: "partial",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: missingRom,+ sepromSource: missingRom+ ),+ in: lib+ )}// The half-built directory must be removed so the name is reusable.#expect(!FileManager.default.fileExists(atPath: lib.url(forName: "partial").path))@@ -87,11 +115,18 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "cfg", cpuCount: 8, memoryMB: 8192, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)-- let updated = try VPhoneBundleOps.updateConfig(- bundleNamed: "cfg", in: lib, cpuCount: 4, memoryMB: nil)+ .init(+ name: "cfg",+ cpuCount: 8,+ memoryMB: 8192,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )++ let updated = try VPhoneBundleOps.updateConfig(bundleNamed: "cfg", in: lib, cpuCount: 4, memoryMB: nil)#expect(updated.manifest.cpuCount == 4)#expect(updated.manifest.memorySize == 8192 * 1024 * 1024)@@ -108,11 +143,24 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "net", cpuCount: 8, memoryMB: 8192, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "net",+ cpuCount: 8,+ memoryMB: 8192,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let updated = try VPhoneBundleOps.updateConfig(- bundleNamed: "net", in: lib, cpuCount: nil, memoryMB: nil, networkMode: .off)+ bundleNamed: "net",+ in: lib,+ cpuCount: nil,+ memoryMB: nil,+ networkMode: .off+ )#expect(updated.manifest.networkConfig.mode == .off)// Persisted across a fresh load, and cpu/memory untouched.let reloaded = try lib.bundle(named: "net").manifest@@ -127,12 +175,25 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "bad", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "bad",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )#expect(throws: VPhoneNetworkingError.hostOnlyUnsupported) {_ = try VPhoneBundleOps.updateConfig(- bundleNamed: "bad", in: lib, cpuCount: nil, memoryMB: nil, networkMode: .hostOnly)+ bundleNamed: "bad",+ in: lib,+ cpuCount: nil,+ memoryMB: nil,+ networkMode: .hostOnly+ )}// A rejected edit must not have mutated the on-disk manifest.#expect(try lib.bundle(named: "bad").manifest.networkConfig.mode == .nat)@@ -145,8 +206,16 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "old", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "old",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let renamed = try VPhoneBundleOps.rename(bundleNamed: "old", to: "shiny", in: lib)#expect(renamed.name == "shiny")@@ -164,8 +233,16 @@ struct BundleOpsTests {let lib = VPhoneLibrary(root: root)for n in ["a", "b"] {_ = try VPhoneBundleOps.create(- .init(name: n, cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: n,+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )}#expect(throws: VPhoneLibraryError.alreadyExists(name: "b")) {_ = try VPhoneBundleOps.rename(bundleNamed: "a", to: "b", in: lib)@@ -179,8 +256,16 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)let src = try VPhoneBundleOps.create(- .init(name: "src", cpuCount: 8, memoryMB: 4096, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "src",+ cpuCount: 8,+ memoryMB: 4096,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )// Simulate a booted/restored VM: identity artifacts present + non-empty machineIdentifier.let fm = FileManager.defaulttry Data([1, 2, 3]).write(to: src.url.appendingPathComponent("nvram.bin"))@@ -212,8 +297,16 @@ struct BundleOpsTests {let lib = VPhoneLibrary(root: root)for n in ["a", "b"] {_ = try VPhoneBundleOps.create(- .init(name: n, cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: n,+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )}#expect(throws: VPhoneLibraryError.alreadyExists(name: "b")) {_ = try VPhoneBundleOps.clone(bundleNamed: "a", to: "b", in: lib)@@ -227,8 +320,16 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 8, memoryMB: 4096, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 8,+ memoryMB: 4096,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let archive = root.appendingPathComponent("orig.tgz")try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib)@@ -252,8 +353,16 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let archive = root.appendingPathComponent("orig.tgz")try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib)// Importing back under the same existing name must fail.@@ -270,15 +379,31 @@ struct BundleOpsTests {let lib = VPhoneLibrary(root: root)// Existing "orig" (cpu 16) that must NOT be touched by the import._ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 16, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 16,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )// Archive of a DIFFERENT "orig" (cpu 4) from a separate library.let root2 = try makeRoot()defer { try? FileManager.default.removeItem(at: root2) }let lib2 = VPhoneLibrary(root: root2)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 4, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib2)+ .init(+ name: "orig",+ cpuCount: 4,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib2+ )let archive = root2.appendingPathComponent("orig.tgz")try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib2)@@ -295,16 +420,23 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)let b = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let restoreDir = b.url.appendingPathComponent("iPhone_Restore")try FileManager.default.createDirectory(at: restoreDir, withIntermediateDirectories: true)try Data([0]).write(to: restoreDir.appendingPathComponent("marker"))let archive = root.appendingPathComponent("orig.tgz")try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib)- let listing = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/bin/tar"), ["-tf", archive.path])+ let listing = try VPhoneProcessRunner.runCapturing(URL(fileURLWithPath: "/usr/bin/tar"), ["-tf", archive.path])#expect(listing.succeeded)#expect(!listing.stdout.contains("iPhone_Restore"))}@@ -316,8 +448,16 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }let lib = VPhoneLibrary(root: root)let b = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 2, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 2,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let fm = FileManager.defaulttry Data([0]).write(to: b.url.appendingPathComponent(".vphoned.signed"))try fm.createDirectory(at: b.url.appendingPathComponent("cfw_input/jb"), withIntermediateDirectories: true)@@ -329,8 +469,7 @@ struct BundleOpsTests {let archive = root.appendingPathComponent("orig.tgz")try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib)- let listing = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/bin/tar"), ["-tf", archive.path])+ let listing = try VPhoneProcessRunner.runCapturing(URL(fileURLWithPath: "/usr/bin/tar"), ["-tf", archive.path])#expect(listing.succeeded)#expect(!listing.stdout.contains(".vphoned.signed"))#expect(!listing.stdout.contains("cfw_input"))@@ -346,15 +485,15 @@ struct BundleOpsTests {defer { try? FileManager.default.removeItem(at: root) }// An archive with TWO top-level dirs is not a single bundle → badArchive.let src = root.appendingPathComponent("src")- try FileManager.default.createDirectory(- at: src.appendingPathComponent("a"), withIntermediateDirectories: true)- try FileManager.default.createDirectory(- at: src.appendingPathComponent("b"), withIntermediateDirectories: true)+ try FileManager.default.createDirectory(at: src.appendingPathComponent("a"), withIntermediateDirectories: true)+ try FileManager.default.createDirectory(at: src.appendingPathComponent("b"), withIntermediateDirectories: true)try Data([0]).write(to: src.appendingPathComponent("a/x"))try Data([0]).write(to: src.appendingPathComponent("b/y"))let archive = root.appendingPathComponent("multi.tgz")let made = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/bin/tar"), ["-czf", archive.path, "-C", src.path, "a", "b"])+ URL(fileURLWithPath: "/usr/bin/tar"),+ ["-czf", archive.path, "-C", src.path, "a", "b"]+ )#expect(made.succeeded)#expect(throws: VPhoneBundleOpsError.self) {@@ -411,18 +550,30 @@ struct BundleOpsTests {let rom = try fakeROM(); let seprom = try fakeROM()let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 6, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 6,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let archive = root.appendingPathComponent("orig.archive")if let compression {try VPhoneBundleOps.export(- bundleNamed: "orig", to: archive, includeIPSW: false, compression: compression, in: lib)+ bundleNamed: "orig",+ to: archive,+ includeIPSW: false,+ compression: compression,+ in: lib+ )} else {try VPhoneBundleOps.export(bundleNamed: "orig", to: archive, includeIPSW: false, in: lib)}let dstRoot = try makeRoot()- let imported = try VPhoneBundleOps.importArchive(- from: archive, name: "copy", in: VPhoneLibrary(root: dstRoot))+ let imported = try VPhoneBundleOps.importArchive(from: archive, name: "copy", in: VPhoneLibrary(root: dstRoot))return (archive, imported)}@@ -449,15 +600,32 @@ struct BundleOpsTests {let rom = try fakeROM(); let seprom = try fakeROM()let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 6, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 6,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let outDir = try makeRoot()let zstdOut = try VPhoneBundleOps.export(- bundleNamed: "orig", to: outDir, includeIPSW: false, in: lib)+ bundleNamed: "orig",+ to: outDir,+ includeIPSW: false,+ in: lib+ )#expect(zstdOut == outDir.appendingPathComponent("orig.tzst"))#expect(FileManager.default.fileExists(atPath: zstdOut.path))let xzOut = try VPhoneBundleOps.export(- bundleNamed: "orig", to: outDir, includeIPSW: false, compression: .max, in: lib)+ bundleNamed: "orig",+ to: outDir,+ includeIPSW: false,+ compression: .max,+ in: lib+ )#expect(xzOut == outDir.appendingPathComponent("orig.txz"))#expect(FileManager.default.fileExists(atPath: xzOut.path))}@@ -473,8 +641,16 @@ struct BundleOpsTests {let rom = try fakeROM(); let seprom = try fakeROM()let lib = VPhoneLibrary(root: root)_ = try VPhoneBundleOps.create(- .init(name: "orig", cpuCount: 6, memoryMB: 2048, diskSizeGB: 1,- romSource: rom, sepromSource: seprom), in: lib)+ .init(+ name: "orig",+ cpuCount: 6,+ memoryMB: 2048,+ diskSizeGB: 1,+ romSource: rom,+ sepromSource: seprom+ ),+ in: lib+ )let exp = Collector()let archive = root.appendingPathComponent("orig.tzst")diff --git a/tests/VPhoneCoreTests/BundleReportTests.swift b/tests/VPhoneCoreTests/BundleReportTests.swiftindex 95a8563a..4cbb84eb 100644--- a/tests/VPhoneCoreTests/BundleReportTests.swift+++ b/tests/VPhoneCoreTests/BundleReportTests.swift@@ -5,8 +5,10 @@ import Testingstruct BundleReportTests {@Test func mapsManifestFields() throws {let manifest = VPhoneVirtualMachineManifest(- cpuCount: 6, memorySize: 4 * 1024 * 1024 * 1024,- romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 6,+ memorySize: 4 * 1024 * 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )let bundle = VPhoneBundle(url: URL(fileURLWithPath: "/tmp/myvm"), manifest: manifest)let report = VPhoneBundleReport(bundle: bundle)@@ -18,27 +20,31 @@ struct BundleReportTests {@Test func carriesNetworkConfig() throws {let net = VPhoneVirtualMachineManifest.NetworkConfig(- mode: .bridged, macAddress: "00:11:22:33:44:55", bridgeInterface: "en0")+ mode: .bridged,+ macAddress: "00:11:22:33:44:55",+ bridgeInterface: "en0"+ )let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 2 * 1024 * 1024 * 1024,+ cpuCount: 2,+ memorySize: 2 * 1024 * 1024 * 1024,networkConfig: net,- romImages: .init(avpBooter: "a", avpSEPBooter: "b"))- let report = VPhoneBundleReport(- bundle: VPhoneBundle(url: URL(fileURLWithPath: "/tmp/b"), manifest: manifest))+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )+ let report = VPhoneBundleReport(bundle: VPhoneBundle(url: URL(fileURLWithPath: "/tmp/b"), manifest: manifest))#expect(report.network.mode == .bridged)#expect(report.network.bridgeInterface == "en0")- let back = try JSONDecoder().decode(- VPhoneBundleReport.self, from: try JSONEncoder().encode(report))+ let back = try JSONDecoder().decode(VPhoneBundleReport.self, from: try JSONEncoder().encode(report))#expect(back.network == net)}@Test func encodesToJSON() throws {let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 2 * 1024 * 1024 * 1024,- romImages: .init(avpBooter: "a", avpSEPBooter: "b"))- let report = VPhoneBundleReport(- bundle: VPhoneBundle(url: URL(fileURLWithPath: "/tmp/x"), manifest: manifest))+ cpuCount: 2,+ memorySize: 2 * 1024 * 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )+ let report = VPhoneBundleReport(bundle: VPhoneBundle(url: URL(fileURLWithPath: "/tmp/x"), manifest: manifest))let data = try JSONEncoder().encode(report)let back = try JSONDecoder().decode(VPhoneBundleReport.self, from: data)#expect(back == report)diff --git a/tests/VPhoneCoreTests/FirmwareCatalogReportTests.swift b/tests/VPhoneCoreTests/FirmwareCatalogReportTests.swiftindex 026ff65d..9a19cd68 100644--- a/tests/VPhoneCoreTests/FirmwareCatalogReportTests.swift+++ b/tests/VPhoneCoreTests/FirmwareCatalogReportTests.swift@@ -18,8 +18,7 @@ struct FirmwareCatalogReportTests {@Test func roundTripsJSON() throws {let report = VPhoneFirmwareCatalog.report- let back = try JSONDecoder().decode(- VPhoneFirmwareCatalogReport.self, from: try JSONEncoder().encode(report))+ let back = try JSONDecoder().decode(VPhoneFirmwareCatalogReport.self, from: try JSONEncoder().encode(report))#expect(back == report)}}diff --git a/tests/VPhoneCoreTests/FirmwarePickerTests.swift b/tests/VPhoneCoreTests/FirmwarePickerTests.swiftindex fcb0e60a..40a9e4e9 100644--- a/tests/VPhoneCoreTests/FirmwarePickerTests.swift+++ b/tests/VPhoneCoreTests/FirmwarePickerTests.swift@@ -34,23 +34,35 @@ struct FirmwarePickerTests {@Test func bothProvidedPassesThrough() throws {let out = try VPhoneFirmwarePicker.resolve(- iphone: "a.ipsw", cloudos: "b.dmg", isInteractive: true,- read: { nil }, write: { _ in })+ iphone: "a.ipsw",+ cloudos: "b.dmg",+ isInteractive: true,+ read: { nil },+ write: { _ in }+ )#expect(out == VPhoneFirmwareSources(iphoneSource: "a.ipsw", cloudosSource: "b.dmg"))}@Test func nonInteractivePassesThroughEvenWhenIncomplete() throws {let out = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: false,- read: { nil }, write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: false,+ read: { nil },+ write: { _ in }+ )#expect(out == VPhoneFirmwareSources(iphoneSource: nil, cloudosSource: nil))}@Test func emptyStringsTreatedAsUnset() throws {// Non-interactive + empty → passthrough as nil (no prompt), not "".let out = try VPhoneFirmwarePicker.resolve(- iphone: "", cloudos: "", isInteractive: false,- read: { nil }, write: { _ in })+ iphone: "",+ cloudos: "",+ isInteractive: false,+ read: { nil },+ write: { _ in }+ )#expect(out == VPhoneFirmwareSources(iphoneSource: nil, cloudosSource: nil))}@@ -60,8 +72,12 @@ struct FirmwarePickerTests {// "1" → first pairing (iOS 18.6.2 → cloudOS 26.1).let first = VPhoneFirmwareCatalog.pairings[0]let out = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- read: reader(["1"]), write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ read: reader(["1"]),+ write: { _ in }+ )#expect(out == VPhoneFirmwareSources(iphoneSource: first.iosURL, cloudosSource: first.cloudosURL))}@@ -70,8 +86,12 @@ struct FirmwarePickerTests {let p = VPhoneFirmwareCatalog.pairings[idx]#expect(p.iosName == "iOS 26.4")let out = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- read: reader([String(idx + 1)]), write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ read: reader([String(idx + 1)]),+ write: { _ in }+ )#expect(out.iphoneSource == p.iosURL)#expect(out.cloudosSource == p.cloudosURL)}@@ -82,8 +102,12 @@ struct FirmwarePickerTests {// cloudOS menu: [1]26.1 [2]26.2 [3]26.3 [4]26.4 → pick 4.let opts = VPhoneFirmwareCatalog.cloudOSOptionslet out = try VPhoneFirmwarePicker.resolve(- iphone: "custom.ipsw", cloudos: nil, isInteractive: true,- read: reader(["4"]), write: { _ in })+ iphone: "custom.ipsw",+ cloudos: nil,+ isInteractive: true,+ read: reader(["4"]),+ write: { _ in }+ )#expect(out.iphoneSource == "custom.ipsw") // untouched#expect(out.cloudosSource == opts[3].url) // chosen cloudOS 26.4}@@ -92,8 +116,12 @@ struct FirmwarePickerTests {let p = VPhoneFirmwareCatalog.pairings[3] // iOS 26.1 (menu 4)#expect(p.iosName == "iOS 26.1")let out = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: "custom.dmg", isInteractive: true,- read: reader(["4"]), write: { _ in })+ iphone: nil,+ cloudos: "custom.dmg",+ isInteractive: true,+ read: reader(["4"]),+ write: { _ in }+ )#expect(out.iphoneSource == p.iosURL) // chosen iPhone build#expect(out.cloudosSource == "custom.dmg") // untouched}@@ -103,8 +131,12 @@ struct FirmwarePickerTests {@Test func pairingMenuIsColumnAligned() throws {var lines: [String] = []_ = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- read: reader(["1"]), write: { lines.append($0) })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ read: reader(["1"]),+ write: { lines.append($0) }+ )let menu = lines.filter { $0.hasPrefix(" [") }#expect(menu.count == 25)// Label text starts in one column regardless of 1- vs 2-digit index.@@ -120,24 +152,37 @@ struct FirmwarePickerTests {@Test func retriesThenSucceeds() throws {let first = VPhoneFirmwareCatalog.pairings[0]let out = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- read: reader(["", "999", "garbage", "1"]), write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ read: reader(["", "999", "garbage", "1"]),+ write: { _ in }+ )#expect(out.iphoneSource == first.iosURL)}@Test func eofAborts() {#expect(throws: VPhoneFirmwarePickerError.aborted) {_ = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- read: { nil }, write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ read: { nil },+ write: { _ in }+ )}}@Test func tooManyInvalidThrows() {#expect(throws: VPhoneFirmwarePickerError.invalidSelection) {_ = try VPhoneFirmwarePicker.resolve(- iphone: nil, cloudos: nil, isInteractive: true,- maxRetries: 2, read: reader(["x", "y", "z"]), write: { _ in })+ iphone: nil,+ cloudos: nil,+ isInteractive: true,+ maxRetries: 2,+ read: reader(["x", "y", "z"]),+ write: { _ in }+ )}}}diff --git a/tests/VPhoneCoreTests/LaunchLayoutTests.swift b/tests/VPhoneCoreTests/LaunchLayoutTests.swiftindex cc72995e..21877ad3 100644--- a/tests/VPhoneCoreTests/LaunchLayoutTests.swift+++ b/tests/VPhoneCoreTests/LaunchLayoutTests.swift@@ -22,15 +22,19 @@ struct LaunchLayoutTests {@Test func stageVphonedCopiesWhenSourceExists() throws {let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)try FileManager.default.createDirectory(- at: root.appendingPathComponent(".build"), withIntermediateDirectories: true)+ at: root.appendingPathComponent(".build"),+ withIntermediateDirectories: true+ )defer { try? FileManager.default.removeItem(at: root) }try Data([1, 2, 3]).write(to: root.appendingPathComponent(".build/vphoned.signed"))let bundleDir = root.appendingPathComponent("bundle")try FileManager.default.createDirectory(at: bundleDir, withIntermediateDirectories: true)let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 1024 * 1024,- romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 2,+ memorySize: 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )let bundle = VPhoneBundle(url: bundleDir, manifest: manifest)let layout = VPhoneLaunchLayout(projectRoot: root)@@ -48,7 +52,10 @@ struct LaunchLayoutTests {let bundleDir = root.appendingPathComponent("bundle")try FileManager.default.createDirectory(at: bundleDir, withIntermediateDirectories: true)let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 1024 * 1024, romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 2,+ memorySize: 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )let bundle = VPhoneBundle(url: bundleDir, manifest: manifest)#expect(try VPhoneLaunchLayout(projectRoot: root).stageVphoned(into: bundle) == false)@@ -59,7 +66,9 @@ struct LaunchLayoutTests {@Test func stageVphonedOverwritesStaleDestination() throws {let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)try FileManager.default.createDirectory(- at: root.appendingPathComponent(".build"), withIntermediateDirectories: true)+ at: root.appendingPathComponent(".build"),+ withIntermediateDirectories: true+ )defer { try? FileManager.default.removeItem(at: root) }try Data([9, 9, 9, 9]).write(to: root.appendingPathComponent(".build/vphoned.signed"))@@ -68,7 +77,10 @@ struct LaunchLayoutTests {// Pre-populate dst with DIFFERENT bytes.try Data([1, 1]).write(to: bundleDir.appendingPathComponent(".vphoned.signed"))let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 1024 * 1024, romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 2,+ memorySize: 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )let bundle = VPhoneBundle(url: bundleDir, manifest: manifest)#expect(try VPhoneLaunchLayout(projectRoot: root).stageVphoned(into: bundle) == true)diff --git a/tests/VPhoneCoreTests/LibraryTests.swift b/tests/VPhoneCoreTests/LibraryTests.swiftindex decd5a2b..aa5c9a40 100644--- a/tests/VPhoneCoreTests/LibraryTests.swift+++ b/tests/VPhoneCoreTests/LibraryTests.swift@@ -17,9 +17,10 @@ struct LibraryTests {let dir = root.appendingPathComponent(name)try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)let manifest = VPhoneVirtualMachineManifest(- cpuCount: 8, memorySize: 8 * 1024 * 1024 * 1024,- romImages: .init(avpBooter: "AVPBooter.vresearch1.bin",- avpSEPBooter: "AVPSEPBooter.vresearch1.bin"))+ cpuCount: 8,+ memorySize: 8 * 1024 * 1024 * 1024,+ romImages: .init(avpBooter: "AVPBooter.vresearch1.bin", avpSEPBooter: "AVPSEPBooter.vresearch1.bin")+ )try manifest.write(to: dir.appendingPathComponent("config.plist"))}@@ -30,7 +31,9 @@ struct LibraryTests {try writeBundle("beta", in: root)// A stray dir without config.plist must be ignored.try FileManager.default.createDirectory(- at: root.appendingPathComponent("junk"), withIntermediateDirectories: true)+ at: root.appendingPathComponent("junk"),+ withIntermediateDirectories: true+ )let names = try VPhoneLibrary(root: root).bundles().map(\.name)#expect(names == ["alpha", "beta"])diff --git a/tests/VPhoneCoreTests/ManagedProcessTests.swift b/tests/VPhoneCoreTests/ManagedProcessTests.swiftindex ab6fc15b..be94c2d1 100644--- a/tests/VPhoneCoreTests/ManagedProcessTests.swift+++ b/tests/VPhoneCoreTests/ManagedProcessTests.swift@@ -7,7 +7,9 @@ struct ManagedProcessTests {// Emit a line after a short delay, then sleep; the matcher should catch it.let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"),- ["-c", "sleep 0.2; echo READY-NOW; sleep 2"], echo: false)+ ["-c", "sleep 0.2; echo READY-NOW; sleep 2"],+ echo: false+ )try p.start()let r = p.waitForOutput(matching: "READY-NOW", timeout: 5)#expect(r == .matched)@@ -15,16 +17,14 @@ struct ManagedProcessTests {}@Test func reportsExitBeforeMatch() throws {- let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"),- ["-c", "echo nope; exit 3"], echo: false)+ let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"), ["-c", "echo nope; exit 3"], echo: false)try p.start()let r = p.waitForOutput(matching: "WILL-NOT-APPEAR", timeout: 5)#expect(r == .exited(3))}@Test func timesOutWhenNoMatch() throws {- let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"),- ["-c", "sleep 3"], echo: false)+ let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"), ["-c", "sleep 3"], echo: false)try p.start()let r = p.waitForOutput(matching: "NEVER", timeout: 0.5)#expect(r == .timedOut)@@ -33,8 +33,7 @@ struct ManagedProcessTests {@Test func sendWritesToStdinAndDrivesTheChild() throws {// Child echoes a marker only after it reads a line from stdin.- let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"),- ["-c", "read line; echo GOT:$line"], echo: false)+ let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"), ["-c", "read line; echo GOT:$line"], echo: false)try p.start()p.send("hello")let r = p.waitForOutput(matching: "GOT:hello", timeout: 5)@@ -45,8 +44,11 @@ struct ManagedProcessTests {@Test func terminateForceKillsAResistantChild() throws {// Child IGNORES SIGINT and SIGTERM, so terminate() must escalate to SIGKILL// and waitUntilExit() must return (not hang).- let p = VPhoneManagedProcess(URL(fileURLWithPath: "/bin/sh"),- ["-c", "trap '' INT TERM; while :; do sleep 1; done"], echo: false)+ let p = VPhoneManagedProcess(+ URL(fileURLWithPath: "/bin/sh"),+ ["-c", "trap '' INT TERM; while :; do sleep 1; done"],+ echo: false+ )try p.start()_ = p.waitForOutput(matching: "NEVER", timeout: 0.4) // let it install the trapsp.terminate()diff --git a/tests/VPhoneCoreTests/ManifestTests.swift b/tests/VPhoneCoreTests/ManifestTests.swiftindex a4f94dcf..bf6ed25b 100644--- a/tests/VPhoneCoreTests/ManifestTests.swift+++ b/tests/VPhoneCoreTests/ManifestTests.swift@@ -7,8 +7,7 @@ struct ManifestTests {VPhoneVirtualMachineManifest(cpuCount: 8,memorySize: 8 * 1024 * 1024 * 1024,- romImages: .init(avpBooter: "AVPBooter.vresearch1.bin",- avpSEPBooter: "AVPSEPBooter.vresearch1.bin")+ romImages: .init(avpBooter: "AVPBooter.vresearch1.bin", avpSEPBooter: "AVPSEPBooter.vresearch1.bin"))}@@ -41,8 +40,7 @@ struct ManifestTests {try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)defer { try? FileManager.default.removeItem(at: dir) }- let net = VPhoneVirtualMachineManifest.NetworkConfig(- mode: .bridged, macAddress: "", bridgeInterface: "en0")+ let net = VPhoneVirtualMachineManifest.NetworkConfig(mode: .bridged, macAddress: "", bridgeInterface: "en0")let url = dir.appendingPathComponent("config.plist")try sampleManifest().updating(networkConfig: net).write(to: url)let loaded = try VPhoneVirtualMachineManifest.load(from: url)diff --git a/tests/VPhoneCoreTests/ProcessRunnerTests.swift b/tests/VPhoneCoreTests/ProcessRunnerTests.swiftindex 244a6928..3b54fd7f 100644--- a/tests/VPhoneCoreTests/ProcessRunnerTests.swift+++ b/tests/VPhoneCoreTests/ProcessRunnerTests.swift@@ -4,8 +4,7 @@ import Testingstruct ProcessRunnerTests {@Test func capturesStdoutAndZeroExit() throws {- let r = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/bin/echo"), ["hello", "world"])+ let r = try VPhoneProcessRunner.runCapturing(URL(fileURLWithPath: "/bin/echo"), ["hello", "world"])#expect(r.exitCode == 0)#expect(r.succeeded)#expect(r.stdout.trimmingCharacters(in: .whitespacesAndNewlines) == "hello world")@@ -13,15 +12,17 @@ struct ProcessRunnerTests {@Test func capturesNonzeroExit() throws {// `/usr/bin/false` exits 1 with no output.- let r = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/usr/bin/false"), [])+ let r = try VPhoneProcessRunner.runCapturing(URL(fileURLWithPath: "/usr/bin/false"), [])#expect(r.exitCode == 1)#expect(!r.succeeded)}@Test func passesCwd() throws {let r = try VPhoneProcessRunner.runCapturing(- URL(fileURLWithPath: "/bin/pwd"), [], cwd: URL(fileURLWithPath: "/tmp"))+ URL(fileURLWithPath: "/bin/pwd"),+ [],+ cwd: URL(fileURLWithPath: "/tmp")+ )// /tmp is a symlink to /private/tmp on macOS; accept either.let out = r.stdout.trimmingCharacters(in: .whitespacesAndNewlines)#expect(out == "/tmp" || out == "/private/tmp")diff --git a/tests/VPhoneCoreTests/ResourcesTests.swift b/tests/VPhoneCoreTests/ResourcesTests.swiftindex 7937a726..ef240aa9 100644--- a/tests/VPhoneCoreTests/ResourcesTests.swift+++ b/tests/VPhoneCoreTests/ResourcesTests.swift@@ -15,9 +15,13 @@ struct ResourcesTests {// Fake a dev tree: <root>/.build/release/vphone-cli with a <root>/scripts dir.let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)try FileManager.default.createDirectory(- at: root.appendingPathComponent(".build/release"), withIntermediateDirectories: true)+ at: root.appendingPathComponent(".build/release"),+ withIntermediateDirectories: true+ )try FileManager.default.createDirectory(- at: root.appendingPathComponent("scripts"), withIntermediateDirectories: true)+ at: root.appendingPathComponent("scripts"),+ withIntermediateDirectories: true+ )defer { try? FileManager.default.removeItem(at: root) }let exe = root.appendingPathComponent(".build/release/vphone-cli").pathlet r = VPhoneResources.resolve(executablePath: exe)diff --git a/tests/VPhoneCoreTests/RestoreInfoTests.swift b/tests/VPhoneCoreTests/RestoreInfoTests.swiftindex 0e4624b9..cc273ed6 100644--- a/tests/VPhoneCoreTests/RestoreInfoTests.swift+++ b/tests/VPhoneCoreTests/RestoreInfoTests.swift@@ -7,15 +7,21 @@ struct RestoreInfoTests {let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 1024 * 1024, romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 2,+ memorySize: 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )return VPhoneBundle(url: root, manifest: manifest)}/// Write a restore dir with the two BuildManifest plists. Omit a key by/// passing nil for its value to exercise the missing-key path.private func makeRestoreDir(- in bundle: VPhoneBundle, iosVersion: String?, iosBuild: String?,- cloudVersion: String?, cloudBuild: String?+ in bundle: VPhoneBundle,+ iosVersion: String?,+ iosBuild: String?,+ cloudVersion: String?,+ cloudBuild: String?) throws {let dir = bundle.url.appendingPathComponent("iPhone17,3_27.0_24A5390f_Restore")try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)@@ -33,8 +39,13 @@ struct RestoreInfoTests {@Test func derivesBothVersionsFromPlists() throws {let b = try makeBundle()defer { try? FileManager.default.removeItem(at: b.url) }- try makeRestoreDir(in: b, iosVersion: "27.0", iosBuild: "24A5390f",- cloudVersion: "26.4", cloudBuild: "23E5207q")+ try makeRestoreDir(+ in: b,+ iosVersion: "27.0",+ iosBuild: "24A5390f",+ cloudVersion: "26.4",+ cloudBuild: "23E5207q"+ )let info = VPhoneRestoreInfo.derive(fromBundle: b)#expect(info?.ios == .init(version: "27.0", build: "24A5390f"))#expect(info?.cloudOS == .init(version: "26.4", build: "23E5207q"))@@ -49,8 +60,13 @@ struct RestoreInfoTests {@Test func deriveNilWhenVersionKeyMissing() throws {let b = try makeBundle()defer { try? FileManager.default.removeItem(at: b.url) }- try makeRestoreDir(in: b, iosVersion: "27.0", iosBuild: "24A5390f",- cloudVersion: nil, cloudBuild: "23E5207q")+ try makeRestoreDir(+ in: b,+ iosVersion: "27.0",+ iosBuild: "24A5390f",+ cloudVersion: nil,+ cloudBuild: "23E5207q"+ )#expect(VPhoneRestoreInfo.derive(fromBundle: b) == nil)}@@ -59,7 +75,8 @@ struct RestoreInfoTests {defer { try? FileManager.default.removeItem(at: b.url) }let info = VPhoneRestoreInfo(ios: .init(version: "18.6.2", build: "22G100"),- cloudOS: .init(version: "26.1", build: "23B85"))+ cloudOS: .init(version: "26.1", build: "23B85")+ )try info.write(toBundle: b)#expect(VPhoneRestoreInfo.load(fromBundle: b) == info)}@@ -67,8 +84,13 @@ struct RestoreInfoTests {@Test func loadFallsBackToDeriveWhenNoJSON() throws {let b = try makeBundle()defer { try? FileManager.default.removeItem(at: b.url) }- try makeRestoreDir(in: b, iosVersion: "27.0", iosBuild: "24A5390f",- cloudVersion: "26.4", cloudBuild: "23E5207q")+ try makeRestoreDir(+ in: b,+ iosVersion: "27.0",+ iosBuild: "24A5390f",+ cloudVersion: "26.4",+ cloudBuild: "23E5207q"+ )// No restore-info.json written — load() must derive from the plists.let info = VPhoneRestoreInfo.load(fromBundle: b)#expect(info?.ios.version == "27.0")@@ -78,8 +100,13 @@ struct RestoreInfoTests {@Test func bundleReportCarriesRestoreInfo() throws {let b = try makeBundle()defer { try? FileManager.default.removeItem(at: b.url) }- try makeRestoreDir(in: b, iosVersion: "27.0", iosBuild: "24A5390f",- cloudVersion: "26.4", cloudBuild: "23E5207q")+ try makeRestoreDir(+ in: b,+ iosVersion: "27.0",+ iosBuild: "24A5390f",+ cloudVersion: "26.4",+ cloudBuild: "23E5207q"+ )let report = VPhoneBundleReport(bundle: b)#expect(report.restoreInfo?.ios.build == "24A5390f")#expect(report.restoreInfo?.cloudOS.build == "23E5207q")@@ -97,7 +124,8 @@ struct RestoreInfoTests {defer { try? FileManager.default.removeItem(at: b.url) }try VPhoneRestoreInfo(ios: .init(version: "18.6.2", build: "22G100"),- cloudOS: .init(version: "26.1", build: "23B85")).write(toBundle: b)+ cloudOS: .init(version: "26.1", build: "23B85")+ ).write(toBundle: b)let merged = try VPhoneRestoreInfo.recordVariant("exp", toBundle: b)#expect(merged?.variant == "exp")diff --git a/tests/VPhoneCoreTests/RestoreOpsTests.swift b/tests/VPhoneCoreTests/RestoreOpsTests.swiftindex 517783e3..defa727f 100644--- a/tests/VPhoneCoreTests/RestoreOpsTests.swift+++ b/tests/VPhoneCoreTests/RestoreOpsTests.swift@@ -6,7 +6,10 @@ struct RestoreOpsTests {private func bundle(in root: URL) throws -> VPhoneBundle {try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)let manifest = VPhoneVirtualMachineManifest(- cpuCount: 2, memorySize: 1024 * 1024, romImages: .init(avpBooter: "a", avpSEPBooter: "b"))+ cpuCount: 2,+ memorySize: 1024 * 1024,+ romImages: .init(avpBooter: "a", avpSEPBooter: "b")+ )return VPhoneBundle(url: root, manifest: manifest)}diff --git a/tests/VPhoneCoreTests/VMPickerTests.swift b/tests/VPhoneCoreTests/VMPickerTests.swiftindex e9fe0190..f0c971c4 100644--- a/tests/VPhoneCoreTests/VMPickerTests.swift+++ b/tests/VPhoneCoreTests/VMPickerTests.swift@@ -10,62 +10,103 @@ struct VMPickerTests {@Test func returnsProvidedNameUnchanged() throws {let out = try VPhoneVMPicker.resolve(- provided: "myvm", names: ["a", "b"], libraryRoot: "/r", isInteractive: true,- read: { nil }, write: { _ in })+ provided: "myvm",+ names: ["a", "b"],+ libraryRoot: "/r",+ isInteractive: true,+ read: { nil },+ write: { _ in }+ )#expect(out == "myvm") // no prompt when a name is supplied}@Test func nonInteractiveWithoutNameThrows() {#expect(throws: VPhoneVMPickerError.notInteractive) {_ = try VPhoneVMPicker.resolve(- provided: nil, names: ["a"], libraryRoot: "/r", isInteractive: false,- read: { nil }, write: { _ in })+ provided: nil,+ names: ["a"],+ libraryRoot: "/r",+ isInteractive: false,+ read: { nil },+ write: { _ in }+ )}}@Test func emptyLibraryThrows() {#expect(throws: VPhoneVMPickerError.emptyLibrary(root: "/r")) {_ = try VPhoneVMPicker.resolve(- provided: nil, names: [], libraryRoot: "/r", isInteractive: true,- read: { nil }, write: { _ in })+ provided: nil,+ names: [],+ libraryRoot: "/r",+ isInteractive: true,+ read: { nil },+ write: { _ in }+ )}}@Test func selectsByIndex() throws {let out = try VPhoneVMPicker.resolve(- provided: nil, names: ["alpha", "beta", "gamma"], libraryRoot: "/r",- isInteractive: true, read: reader(["2"]), write: { _ in })+ provided: nil,+ names: ["alpha", "beta", "gamma"],+ libraryRoot: "/r",+ isInteractive: true,+ read: reader(["2"]),+ write: { _ in }+ )#expect(out == "beta")}@Test func selectsByExactName() throws {let out = try VPhoneVMPicker.resolve(- provided: nil, names: ["alpha", "beta"], libraryRoot: "/r",- isInteractive: true, read: reader(["alpha"]), write: { _ in })+ provided: nil,+ names: ["alpha", "beta"],+ libraryRoot: "/r",+ isInteractive: true,+ read: reader(["alpha"]),+ write: { _ in }+ )#expect(out == "alpha")}@Test func retriesThenSucceeds() throws {// blank, out-of-range, bad-name, then a good index.let out = try VPhoneVMPicker.resolve(- provided: nil, names: ["alpha", "beta"], libraryRoot: "/r",- isInteractive: true, read: reader(["", "9", "nope", "1"]), write: { _ in })+ provided: nil,+ names: ["alpha", "beta"],+ libraryRoot: "/r",+ isInteractive: true,+ read: reader(["", "9", "nope", "1"]),+ write: { _ in }+ )#expect(out == "alpha")}@Test func eofAborts() {#expect(throws: VPhoneVMPickerError.aborted) {_ = try VPhoneVMPicker.resolve(- provided: nil, names: ["alpha"], libraryRoot: "/r", isInteractive: true,- read: { nil }, write: { _ in })+ provided: nil,+ names: ["alpha"],+ libraryRoot: "/r",+ isInteractive: true,+ read: { nil },+ write: { _ in }+ )}}@Test func tooManyInvalidThrows() {#expect(throws: VPhoneVMPickerError.invalidSelection) {_ = try VPhoneVMPicker.resolve(- provided: nil, names: ["alpha"], libraryRoot: "/r", isInteractive: true,- maxRetries: 2, read: reader(["x", "y", "z"]), write: { _ in })+ provided: nil,+ names: ["alpha"],+ libraryRoot: "/r",+ isInteractive: true,+ maxRetries: 2,+ read: reader(["x", "y", "z"]),+ write: { _ in }+ )}}}