diff options
-rwxr-xr-x | Library/firmware.sh | 18 | ||||
-rw-r--r-- | MobileCydia.mm | 49 |
2 files changed, 46 insertions, 21 deletions
diff --git a/Library/firmware.sh b/Library/firmware.sh index ac1381d..1bc6a41 100755 --- a/Library/firmware.sh +++ b/Library/firmware.sh @@ -104,13 +104,15 @@ EOF s/([A-Z])/-\L\1/g; s/^"([^ ]*)"/\1/; s/^-//; / 0$/ d; - ' | while read -r name value; do - pseudo "gsc.${name}" "${value}" "virtual GraphicsServices dependency" - - if [[ ${name} == ipad ]]; then - pseudo "gsc.wildcat" "${value}" "virtual virtual GraphicsServices dependency" - fi - done + ' | while read -r name value; do case "${name}" in + (ipad) for name in ipad wildcat; do + pseudo "gsc.${name}" "${value}" "this device has a very large screen" "iPad" + done;; + + (*) + pseudo "gsc.${name}" "${value}" "virtual GraphicsServices dependency" + ;; + esac; done fi if [[ ${cpu} == arm ]]; then @@ -141,5 +143,5 @@ if [[ ${cpu} == arm ]]; then cp -afT /User /var/mobile fi && rm -rf /User && ln -s "/var/mobile" /User - echo 5 >/var/lib/cydia/firmware.ver + echo 6 >/var/lib/cydia/firmware.ver fi diff --git a/MobileCydia.mm b/MobileCydia.mm index df2b988..cdce7c5 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -262,6 +262,8 @@ static NSString *Warning_; static bool AprilFools_; +static void (*$SBSSetInterceptsMenuButtonForever)(bool); + static bool IsReachable(const char *name) { SCNetworkReachabilityFlags flags; { SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, name)); @@ -9035,7 +9037,6 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi UCLocalize("DEVELOPER"), nil]; segment_ = [[[UISegmentedControl alloc] initWithItems:items] autorelease]; - [segment_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin)]; container_ = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [[self view] frame].size.width, 44.0f)] autorelease]; [container_ addSubview:segment_]; } @@ -9080,7 +9081,12 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; + [self resizeSegmentedControl]; +} +- (void) viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [segment_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin)]; [self resizeSegmentedControl]; } @@ -9340,6 +9346,20 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi @implementation Cydia +- (void) lockSuspend { + if (locked_++ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(true); + } +} + +- (void) unlockSuspend { + if (--locked_ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(false); + } +} + - (void) beginUpdate { [tabbar_ beginUpdate]; } @@ -9356,7 +9376,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi initWithTitle:(count == 1 ? UCLocalize("HALFINSTALLED_PACKAGE") : [NSString stringWithFormat:UCLocalize("HALFINSTALLED_PACKAGES"), count]) message:UCLocalize("HALFINSTALLED_PACKAGE_EX") delegate:self - cancelButtonTitle:UCLocalize("FORCIBLY_CLEAR") + cancelButtonTitle:[NSString stringWithFormat:UCLocalize("PARENTHETICAL"), UCLocalize("FORCIBLY_CLEAR"), UCLocalize("UNSAFE")] otherButtonTitles: UCLocalize("TEMPORARY_IGNORE"), nil @@ -9452,7 +9472,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi // - We already refreshed recently. // - We already auto-refreshed this launch. // - Auto-refresh is disabled. - if (recently || loaded_ || ManualRefresh) { + // - Cydia's server is not reachable + if (recently || loaded_ || ManualRefresh || !IsReachable("cydia.saurik.com")) { // If we are cancelling, we need to make sure it knows it's already loaded. loaded_ = true; @@ -9461,9 +9482,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi // We are going to load, so remember that. loaded_ = true; - // If we can reach the server, auto-refresh! - if (IsReachable("cydia.saurik.com")) - [tabbar_ performSelectorOnMainThread:@selector(setUpdate:) withObject:update waitUntilDone:NO]; + [tabbar_ performSelectorOnMainThread:@selector(setUpdate:) withObject:update waitUntilDone:NO]; } [pool release]; @@ -9710,9 +9729,9 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) confirmWithNavigationController:(UINavigationController *)navigation { Queuing_ = false; - ++locked_; + [self lockSuspend]; [self detachNewProgressSelector:@selector(perform_) toTarget:self forController:navigation title:@"RUNNING"]; - --locked_; + [self unlockSuspend]; } - (void) showSettings { @@ -9877,12 +9896,12 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi [hud showInView:[target view]]; - ++locked_; + [self lockSuspend]; return hud; } - (void) removeProgressHUD:(UIProgressHUD *)hud { - --locked_; + [self unlockSuspend]; [hud hide]; [hud removeFromSuperview]; [window_ setUserInteractionEnabled:YES]; @@ -10068,7 +10087,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi } - (void) addStashController { - ++locked_; + [self lockSuspend]; stash_ = [[[StashController alloc] init] autorelease]; [window_ addSubview:[stash_ view]]; } @@ -10076,7 +10095,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (void) removeStashController { [[stash_ view] removeFromSuperview]; stash_ = nil; - --locked_; + [self unlockSuspend]; } - (void) stash { @@ -10611,6 +10630,8 @@ int main(int argc, char *argv[]) { setuid(0); setgid(0); + system("mkdir -p /var/root/Library/Keyboard; cp -af /var/mobile/Library/Keyboard/UserDictionary.sqlite /var/root/Library/Keyboard/"); + /*Method alloc = class_getClassMethod([NSObject class], @selector(alloc)); alloc_ = alloc->method_imp; alloc->method_imp = (IMP) &Alloc_;*/ @@ -10765,7 +10786,7 @@ int main(int argc, char *argv[]) { int version([[NSString stringWithContentsOfFile:@"/var/lib/cydia/firmware.ver"] intValue]); - if (access("/User", F_OK) != 0 || version != 5) { + if (access("/User", F_OK) != 0 || version != 6) { _trace(); system("/usr/libexec/cydia/firmware.sh"); _trace(); @@ -10822,6 +10843,8 @@ int main(int argc, char *argv[]) { //UIKeyboardDisableAutomaticAppearance(); /* }}} */ + $SBSSetInterceptsMenuButtonForever = reinterpret_cast<void (*)(bool)>(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever")); + BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability")); bool fast = GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("armv7")); |