From 1f774c2cf1ebda7c93cc91cffd8de7a1afba2444 Mon Sep 17 00:00:00 2001 From: khanhduytran0 Date: Fri, 29 May 2026 07:33:55 +0700 Subject: [PATCH] Fix stuff --- BypassMirroringUnlock.x | 33 ++++++++++++++++++++++++++++++--- FixDDI.x | 21 +++++++++++++++------ FixNonUI.x | 28 ++++++++++++++++++++++++++++ Makefile | 5 +++-- NineteenPatches.x | 2 +- filter.plist | 4 +++- 6 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 FixNonUI.x diff --git a/BypassMirroringUnlock.x b/BypassMirroringUnlock.x index 59dff7b..1eb138d 100644 --- a/BypassMirroringUnlock.x +++ b/BypassMirroringUnlock.x @@ -1,14 +1,41 @@ +@import Foundation; + +@interface SBContinuitySessionSystemEventMonitor : NSObject +- (BOOL)isUILocked; +- (void)_setUILocked:(BOOL)locked; +@end %group Hook_SpringBoard_iOS18 %hook _SBContinuitySessionStateMachine -- (void)_moveToInvalidStateForReasons:(id)reasons postToDelegate:(BOOL)post { - // Do nothing +- (void)_moveToInvalidStateForReasons:(NSArray *)reasons postToDelegate:(BOOL)post { + for (NSString *reason in reasons) { + if ([reason hasPrefix:@"block."]) { + return; + } + } + %orig(reasons, post); +} +%end + +%hook SBContinuitySessionSystemEventMonitor +- (void)_setUILocked:(BOOL)locked { + %orig(YES); +} + +- (BOOL)isUILocked { + if (!%orig()) { + [self _setUILocked:YES]; + } + return YES; } %end %end %ctor { + NSString *processName = NSProcessInfo.processInfo.processName; if (@available(iOS 18.0, *)) { - %init(Hook_SpringBoard_iOS18); + if ([processName isEqualToString:@"SpringBoard"]) { + %init(Hook_SpringBoard_iOS18); + } } } diff --git a/FixDDI.x b/FixDDI.x index 2f9a95f..ad00619 100644 --- a/FixDDI.x +++ b/FixDDI.x @@ -3,6 +3,15 @@ #import #import "SignedPDI.h" +#define IMG4_DGST_MAX_LEN (48u) +typedef uint16_t img4_struct_version_t; +typedef struct _img4_chip img4_chip_t; +typedef uint64_t img4_chip_instance_omit_t; +typedef struct _img4_dgst { + img4_struct_version_t i4d_version; + size_t i4d_len; + uint8_t i4d_bytes[IMG4_DGST_MAX_LEN]; +} img4_dgst_t; typedef struct _img4_chip_instance { img4_struct_version_t chid_version; const img4_chip_t *chid_chip_family; @@ -45,6 +54,7 @@ typedef struct _img4_nonce { } img4_nonce_t; const char *container_system_group_path_for_identifier(int, const char *group, void *error); +errno_t img4_chip_instantiate(const img4_chip_t *chip, img4_chip_instance_t *chip_instance); errno_t img4_nonce_domain_copy_nonce(const img4_nonce_domain_t *nd, img4_nonce_t *n); int img4_firmware_execute(void* fw, const void *chip, const void *nonce); @@ -93,13 +103,12 @@ BOOL gCalledImg4Execute = NO; } // Fix boardID = 9 -%hookf(errno_t -img4_chip_instantiate, const img4_chip_t *chip, img4_chip_instance_t *chip_instance) { +%hookf(errno_t, img4_chip_instantiate, const img4_chip_t *chip, img4_chip_instance_t *chip_instance) { errno_t result = %orig; - if(!result && chip_instance->chip_bord == 9) { - chip_instance->chip_bord = 10; - chip_instance->chip_chip = 0x8101; - chip_instance->chip_ecid = 0; + if(!result && chip_instance->chid_bord == 9) { + chip_instance->chid_bord = 10; + chip_instance->chid_chip = 0x8101; + chip_instance->chid_ecid = 0; } return result; } diff --git a/FixNonUI.x b/FixNonUI.x new file mode 100644 index 0000000..c79bb4f --- /dev/null +++ b/FixNonUI.x @@ -0,0 +1,28 @@ +@import Darwin; +@import Foundation; + +%group Hook_NonUI +%hookf(kern_return_t, mach_port_construct, ipc_space_t task, mach_port_options_ptr_t options, mach_port_context_t context, mach_port_name_t *name) { + options->flags &= ~0x10000; // fix EXC_GUARD crash + return %orig; +} +%end + +%group Hook_SwitchBoard +Boolean SMJobSubmit(CFStringRef domain, CFDictionaryRef job, id auth, CFErrorRef *outError); +%hookf(Boolean, SMJobSubmit, CFStringRef domain, CFDictionaryRef job, id auth, CFErrorRef *outError) { + NSMutableDictionary *mutableJob = [(__bridge NSDictionary *)job mutableCopy]; + mutableJob[@"EnablePressuredExit"] = @(NO); + mutableJob[@"EnableTransactions"] = @(NO); + return %orig(domain, (__bridge CFDictionaryRef)mutableJob, auth, outError); +} +%end + +%ctor { + NSString *processName = NSProcessInfo.processInfo.processName; + if ([processName isEqualToString:@"hidd.nonui"]) { + %init(Hook_NonUI); + } else if ([processName isEqualToString:@"SwitchBoard"]) { + %init(Hook_SwitchBoard); + } +} diff --git a/Makefile b/Makefile index aa62a32..3634c78 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TARGET := iphone:clang:latest:15.0 +TARGET := iphone:clang:18.4:15.0 INSTALL_TARGET_PROCESSES = appstorecomponentsd installd managedappdistributiond SpringBoard MobileStorageMounter THEOS_PACKAGE_SCHEME := rootless @@ -6,9 +6,10 @@ include $(THEOS)/makefiles/common.mk TWEAK_NAME = aintuitweaks -aintuitweaks_FILES = BypassMarketplace.x BypassMirroringUnlock.x FixDDI.x NineteenPatches.x +aintuitweaks_FILES = BypassMarketplace.x BypassMirroringUnlock.x FixDDI.x NineteenPatches.x FixNonUI.x aintuitweaks_CFLAGS = -fobjc-arc aintuitweaks_FRAMEWORKS = IOKit +aintuitweaks_PRIVATE_FRAMEWORKS = ServiceManagement aintuitweaks_LIBRARIES = image4 aintuitweaks_CODESIGN_FLAGS = -Cadhoc -S diff --git a/NineteenPatches.x b/NineteenPatches.x index 9237c7c..d1c651f 100644 --- a/NineteenPatches.x +++ b/NineteenPatches.x @@ -6,6 +6,6 @@ uint32_t xpacd_x0 = 0xdac147e0; uint32_t ret = 0xd65f03c0; if (symbol && symbol[-1] == ret && symbol[0] == ret) { - MSHookMemory(symbol-4, &xpacd_x0, sizeof(uint32_t)); + MSHookMemory(symbol-1, &xpacd_x0, sizeof(uint32_t)); } } diff --git a/filter.plist b/filter.plist index ca7fc60..9eb5210 100644 --- a/filter.plist +++ b/filter.plist @@ -4,6 +4,8 @@ "com.apple.UIKit", ); Executables = ( + SwitchBoard, + "hidd.nonui", SpringBoard, appstorecomponentsd, installd, @@ -11,4 +13,4 @@ MobileStorageMounter, ); }; -} +} \ No newline at end of file