Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

latest and greatest

  • Loading branch information...
commit 37152691e6d6a99bbeab9cd736037e4f6be32ac3 1 parent 110ca5f
Kevin Bradley authored December 19, 2012
4  TSS/TSSManager.h
@@ -9,8 +9,8 @@
9 9
 #import <Foundation/Foundation.h>
10 10
 #import "FWBundle.h"
11 11
 
12  
-	//#define BLOB_PLIST_BASE_URL @"https://dl.dropbox.com/u/16129573/FW"
13  
-#define BLOB_PLIST_BASE_URL @"http://files.firecore.com/FW"
  12
+#define BLOB_PLIST_BASE_URL @"https://dl.dropbox.com/u/16129573/FW"
  13
+	//#define BLOB_PLIST_BASE_URL @"http://files.firecore.com/FW"
14 14
 #define BLOB_PLIST_URL @"http://files.firecore.com/FW/k66ap.plist"
15 15
 
16 16
 enum {
2  bundles/AppleTV2,1_5.0.2_9B830.bundle/Info.plist
@@ -7,7 +7,7 @@
7 7
 	<key>DownloadUrl</key>
8 8
 	<string>http://appldnld.apple.com/AppleTV/041-4362.20120605.t8i4U/AppleTV2,1_5.0.2_9B830_Restore.ipsw</string>
9 9
 	<key>Filename</key>
10  
-	<string>AppleTV2,1_5.0.2_9B830_Restore</string>
  10
+	<string>AppleTV2,1_5.0.2_9B830_Restore.ipsw</string>
11 11
 	<key>FilesystemPatches</key>
12 12
 	<dict>
13 13
 		<key>Core Files Installation</key>
2  bundles/AppleTV2,1_5.0_9B206f.bundle/Info.plist
@@ -7,7 +7,7 @@
7 7
 	<key>DownloadUrl</key>
8 8
 	<string>http://appldnld.apple.com/AppleTV/041-4348.20120510.Axdep/AppleTV2,1_5.0_9B206f_Restore.ipsw</string>
9 9
 	<key>Filename</key>
10  
-	<string>AppleTV2,1_5.0_9B206f_Restore</string>
  10
+	<string>AppleTV2,1_5.0_9B206f_Restore.ipsw</string>
11 11
 	<key>FilesystemPatches</key>
12 12
 	<dict>
13 13
 		<key>Core Files Installation</key>
102  bundles/AppleTV2,1_5.1.1_10A831.bundle/Info.plist
... ...
@@ -0,0 +1,102 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3
+<plist version="1.0">
  4
+<dict>
  5
+	<key>DeleteBuildManifest</key>
  6
+	<false/>
  7
+	<key>DownloadUrl</key>
  8
+	<string>http://appldnld.apple.com/AppleTV/041-7275.20121128.qw234/AppleTV2,1_5.1.1_10A831_Restore.ipsw</string>
  9
+	<key>Filename</key>
  10
+	<string>AppleTV2,1_5.1.1_10A831_Restore.ipsw</string>
  11
+	<key>FilesystemPatches</key>
  12
+	<dict>
  13
+		<key>Filesystem Jailbreak</key>
  14
+		<array>
  15
+			<dict>
  16
+				<key>Action</key>
  17
+				<string>Patch</string>
  18
+				<key>File</key>
  19
+				<string>etc/fstab</string>
  20
+				<key>Name</key>
  21
+				<string>Filesystem Write Access</string>
  22
+				<key>Patch</key>
  23
+				<string>fstab.patch</string>
  24
+			</dict>
  25
+		</array>
  26
+	</dict>
  27
+	<key>FirmwarePatches</key>
  28
+	<dict>
  29
+		<key>Restore Ramdisk</key>
  30
+		<dict>
  31
+			<key>File</key>
  32
+			<string>038-6585-033.dmg</string>
  33
+			<key>IV</key>
  34
+			<string>9f23c76c9352ead1ae040ede2b7b503b</string>
  35
+			<key>Key</key>
  36
+			<string>f79071ebef1f9ae1d3d6d391fa781edb6508d6b9d1443b91bd561dd2ae9b5a21</string>
  37
+			<key>TypeFlag</key>
  38
+			<string>8</string>
  39
+		</dict>
  40
+		<key>iBEC</key>
  41
+		<dict>
  42
+			<key>File</key>
  43
+			<string>Firmware/dfu/iBEC.k66ap.RELEASE.dfu</string>
  44
+			<key>IV</key>
  45
+			<string>aac3f3fd4cd55925c548eba979a619bc</string>
  46
+			<key>Key</key>
  47
+			<string>cedeac04955b09d43ded783bd5d6144cf22ecc0f3b896af15677af9a1b887b9d</string>
  48
+			<key>Patch</key>
  49
+			<string>iBEC.k66ap.RELEASE.patch</string>
  50
+			<key>TypeFlag</key>
  51
+			<string>8</string>
  52
+		</dict>
  53
+		<key>iBSS</key>
  54
+		<dict>
  55
+			<key>File</key>
  56
+			<string>Firmware/dfu/iBSS.k66ap.RELEASE.dfu</string>
  57
+			<key>IV</key>
  58
+			<string>173044c02240ae5fed473913383d1acd</string>
  59
+			<key>Key</key>
  60
+			<string>2aff0ec73e280224062d7478ae397731669c64261d0643b385acded2535e5931</string>
  61
+			<key>Patch</key>
  62
+			<string>iBSS.k66ap.RELEASE.patch</string>
  63
+			<key>TypeFlag</key>
  64
+			<string>8</string>
  65
+		</dict>
  66
+	</dict>
  67
+	<key>Name</key>
  68
+	<string>AppleTV2,1_5.1.1_10A831</string>
  69
+	<key>PreInstalledPackages</key>
  70
+	<array>
  71
+		<string>org.saurik.cydia</string>
  72
+	</array>
  73
+	<key>RamdiskPatches</key>
  74
+	<dict>
  75
+		<key>asr</key>
  76
+		<dict>
  77
+			<key>File</key>
  78
+			<string>usr/sbin/asr</string>
  79
+			<key>Patch</key>
  80
+			<string>asr.patch</string>
  81
+		</dict>
  82
+	</dict>
  83
+	<key>RestoreRamdiskMountVolume</key>
  84
+	<string>ramdisk</string>
  85
+	<key>RootFilesystem</key>
  86
+	<string>038-6603-033.dmg</string>
  87
+	<key>RootFilesystemKey</key>
  88
+	<string>d7fd5868fd5533b894658cef38852f3bf0bbacea6375e2f579a9e8bf92f34007a71dcc85</string>
  89
+	<key>RootFilesystemMountVolume</key>
  90
+	<string>SundanceTide10A831.K66OS</string>
  91
+	<key>RootFilesystemSize</key>
  92
+	<string>1024</string>
  93
+	<key>SHA1</key>
  94
+	<string>1ff50161d8fb7d0a804aaea49f4b31d5690a3e4a</string>
  95
+	<key>platform</key>
  96
+	<string>3</string>
  97
+	<key>subplatform</key>
  98
+	<string>10</string>
  99
+	<key>Untethered</key>
  100
+	<false/>
  101
+</dict>
  102
+</plist>
BIN  bundles/AppleTV2,1_5.1.1_10A831.bundle/Services.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1.1_10A831.bundle/asr.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1.1_10A831.bundle/fstab.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1.1_10A831.bundle/iBEC.k66ap.RELEASE.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1.1_10A831.bundle/iBSS.k66ap.RELEASE.patch
Binary file not shown
102  bundles/AppleTV2,1_5.1_10A406e.bundle/Info.plist
... ...
@@ -0,0 +1,102 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3
+<plist version="1.0">
  4
+<dict>
  5
+	<key>DeleteBuildManifest</key>
  6
+	<false/>
  7
+	<key>DownloadUrl</key>
  8
+	<string>http://appldnld.apple.com/AppleTV/041-0803.20120924.LOop5/AppleTV2,1_5.1_10A406e_Restore.ipsw</string>
  9
+	<key>Filename</key>
  10
+	<string>AppleTV2,1_5.1_10A406e_Restore.ipsw</string>
  11
+	<key>FilesystemPatches</key>
  12
+	<dict>
  13
+		<key>Filesystem Jailbreak</key>
  14
+		<array>
  15
+			<dict>
  16
+				<key>Action</key>
  17
+				<string>Patch</string>
  18
+				<key>File</key>
  19
+				<string>etc/fstab</string>
  20
+				<key>Name</key>
  21
+				<string>Filesystem Write Access</string>
  22
+				<key>Patch</key>
  23
+				<string>fstab.patch</string>
  24
+			</dict>
  25
+		</array>
  26
+	</dict>
  27
+	<key>FirmwarePatches</key>
  28
+	<dict>
  29
+		<key>Restore Ramdisk</key>
  30
+		<dict>
  31
+			<key>File</key>
  32
+			<string>038-6513-011.dmg</string>
  33
+			<key>IV</key>
  34
+			<string>a6aac3af81e234cadf46b56905eca484</string>
  35
+			<key>Key</key>
  36
+			<string>5513783229d943c744f7c15efdddc5431caf0e38eb5b2e35ba617ac053247710</string>
  37
+			<key>TypeFlag</key>
  38
+			<string>8</string>
  39
+		</dict>
  40
+		<key>iBEC</key>
  41
+		<dict>
  42
+			<key>File</key>
  43
+			<string>Firmware/dfu/iBEC.k66ap.RELEASE.dfu</string>
  44
+			<key>IV</key>
  45
+			<string>4c6dde5eabbbd39870c9a922513af94c</string>
  46
+			<key>Key</key>
  47
+			<string>ddf3fc5a6394ad7c5781d2c613bd54d0ee84f0b9c39a2c4ba857f7ef19bbd72a</string>
  48
+			<key>Patch</key>
  49
+			<string>iBEC.k66ap.RELEASE.patch</string>
  50
+			<key>TypeFlag</key>
  51
+			<string>8</string>
  52
+		</dict>
  53
+		<key>iBSS</key>
  54
+		<dict>
  55
+			<key>File</key>
  56
+			<string>Firmware/dfu/iBSS.k66ap.RELEASE.dfu</string>
  57
+			<key>IV</key>
  58
+			<string>03c4fb6ab4104c693bd52991cea35dea</string>
  59
+			<key>Key</key>
  60
+			<string>1b081d4ea8f29d4535726c4a5fbf284d77484f25fc145c446d7e9e8acffbcf7e</string>
  61
+			<key>Patch</key>
  62
+			<string>iBSS.k66ap.RELEASE.patch</string>
  63
+			<key>TypeFlag</key>
  64
+			<string>8</string>
  65
+		</dict>
  66
+	</dict>
  67
+	<key>Name</key>
  68
+	<string>AppleTV2,1_5.1_10A406e</string>
  69
+	<key>PreInstalledPackages</key>
  70
+	<array>
  71
+		<string>org.saurik.cydia</string>
  72
+	</array>
  73
+	<key>RamdiskPatches</key>
  74
+	<dict>
  75
+		<key>asr</key>
  76
+		<dict>
  77
+			<key>File</key>
  78
+			<string>usr/sbin/asr</string>
  79
+			<key>Patch</key>
  80
+			<string>asr.patch</string>
  81
+		</dict>
  82
+	</dict>
  83
+	<key>RestoreRamdiskMountVolume</key>
  84
+	<string>ramdisk</string>
  85
+	<key>RootFilesystem</key>
  86
+	<string>038-1170-323.dmg</string>
  87
+	<key>RootFilesystemKey</key>
  88
+	<string>18354ead5a9e133c5979be55211c73d45cbdd36d6bd959386e2010093256e454459587d3</string>
  89
+	<key>RootFilesystemMountVolume</key>
  90
+	<string>Sundance10A406e.K66OS</string>
  91
+	<key>RootFilesystemSize</key>
  92
+	<string>1024</string>
  93
+	<key>SHA1</key>
  94
+	<string>a3f8e3955f460786d88b879f10be69a9858f1688</string>
  95
+	<key>platform</key>
  96
+	<string>3</string>
  97
+	<key>subplatform</key>
  98
+	<string>10</string>
  99
+	<key>Untethered</key>
  100
+	<false/>
  101
+</dict>
  102
+</plist>
BIN  bundles/AppleTV2,1_5.1_10A406e.bundle/Services.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1_10A406e.bundle/asr.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1_10A406e.bundle/fstab.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1_10A406e.bundle/iBEC.k66ap.RELEASE.patch
Binary file not shown
BIN  bundles/AppleTV2,1_5.1_10A406e.bundle/iBSS.k66ap.RELEASE.patch
Binary file not shown
4  tetherKit-Info.plist
@@ -19,13 +19,13 @@
19 19
 	<key>CFBundlePackageType</key>
20 20
 	<string>APPL</string>
21 21
 	<key>CFBundleShortVersionString</key>
22  
-	<string>0.8.7</string>
  22
+	<string>0.8.8</string>
23 23
 	<key>CFBundleSignature</key>
24 24
 	<string>????</string>
25 25
 	<key>CFBundleURLTypes</key>
26 26
 	<array/>
27 27
 	<key>CFBundleVersion</key>
28  
-	<string>590</string>
  28
+	<string>610</string>
29 29
 	<key>LSMinimumSystemVersion</key>
30 30
 	<string>${MACOSX_DEPLOYMENT_TARGET}</string>
31 31
 	<key>NSHumanReadableCopyright</key>
6  tetherKitAppDelegate.h
@@ -64,6 +64,10 @@ enum {
64 64
 	int _downloadRetries;
65 65
 	TSSDeviceID currentDevice;
66 66
 	
  67
+	BOOL itunesFullScreen;
  68
+	BOOL itunesShowingSideBar;
  69
+	
  70
+	
67 71
 }
68 72
 @property (nonatomic, retain) NSString *theEcid;
69 73
 @property (nonatomic, retain) NSString *deviceClass;
@@ -127,6 +131,8 @@ enum {
127 131
 - (IBAction)bootTethered:(id)sender;
128 132
 - (IBAction)dfuMode:(id)sender;
129 133
 - (BOOL)loadItunesWithIPSW:(NSString *)ipswString;
  134
+- (BOOL)loadiTunes11WithIPSW:(NSString *)ipsw;
  135
+- (BOOL)iTunesIsElevenPlus;
130 136
 - (IBAction)itunesRestore:(id)sender;
131 137
 - (void)setInstructionText:(NSString *)instructions;
132 138
 - (NSImage *)imageForMode:(int)inputMode;
309  tetherKitAppDelegate.m
@@ -1964,6 +1964,8 @@ - (IBAction)processOne:(id)sender //download and modify ipsw
1964 1964
 		NSString *sha = [[self currentBundle] SHA];
1965 1965
 		NSString *downloadLink = [[self currentBundle] downloadURL];
1966 1966
 		
  1967
+		sleep(2);
  1968
+		
1967 1969
 		[self showProgressViewWithText:NSLocalizedString(@"Validating IPSW...", @"Validating IPSW...")];
1968 1970
 		BOOL isValid = [nitoUtility validateFile:ipsw withChecksum:sha];
1969 1971
 		
@@ -2078,7 +2080,7 @@ - (IBAction)processOne:(id)sender //download and modify ipsw
2078 2080
 		[NSThread detachNewThreadSelector:@selector(customFW:) toTarget:self withObject:customFwDict];
2079 2081
 	}
2080 2082
 	
2081  
-}
  2083
+} //end process one
2082 2084
 
2083 2085
 - (void)customFW:(NSDictionary *)theDict //called inside process one
2084 2086
 {
@@ -2557,6 +2559,37 @@ - (void)activateiTunes
2557 2559
 	
2558 2560
 }
2559 2561
 
  2562
+	//click button 1 of scroll area 1 of splitter group 1 of window 1
  2563
+
  2564
+
  2565
+- (BOOL)iTunesIsElevenPlus
  2566
+{
  2567
+	NSBundle *itunesBundle = [NSBundle bundleWithPath:@"/Applications/iTunes.app"];
  2568
+	NSDictionary *itunesDict = [itunesBundle infoDictionary];
  2569
+	NSString *versionNumber = [itunesDict valueForKey:@"CFBundleShortVersionString"];
  2570
+	NSComparisonResult theResult = [versionNumber compare:@"11" options:NSNumericSearch];
  2571
+	NSLog(@"iTunes version: %@", versionNumber);
  2572
+		//NSLog(@"theversion: %@  installed version %@", theVersion, installedVersion);
  2573
+	if ( theResult == NSOrderedDescending )
  2574
+	{
  2575
+			//NSLog(@"%@ is greater than %@", versionNumber, @"10.4");
  2576
+		
  2577
+		return YES;
  2578
+		
  2579
+	} else if ( theResult == NSOrderedAscending ){
  2580
+		
  2581
+			//NSLog(@"%@ is greater than %@", @"10.4", versionNumber);
  2582
+		return NO;
  2583
+		
  2584
+	} else if ( theResult == NSOrderedSame ) {
  2585
+		
  2586
+			//NSLog(@"%@ is equal to %@", versionNumber, @"10.4");
  2587
+		return YES;
  2588
+	}
  2589
+	
  2590
+	return NO;
  2591
+}
  2592
+
2560 2593
 - (BOOL)iTunesIsTenFourPlus
2561 2594
 {
2562 2595
 	NSBundle *itunesBundle = [NSBundle bundleWithPath:@"/Applications/iTunes.app"];
@@ -2599,6 +2632,68 @@ - (BOOL)iTunesIsTenFive
2599 2632
 
2600 2633
 - (BOOL)iTunesScriptReady
2601 2634
 {
  2635
+	
  2636
+	NSDictionary *theError = nil;
  2637
+	NSMutableString *asString = [[NSMutableString alloc] init];
  2638
+	
  2639
+	[asString appendString:@"activate application \"iTunes\"\n"];
  2640
+		//[asString appendString:@"tell application \"System Events\"\n"];
  2641
+		//[asString appendString:@"tell Process \"iTunes\"\n"];
  2642
+		//[asString appendString:@"delay 5\n"];
  2643
+		//[asString appendString:@"end tell\n"];
  2644
+		//[asString appendString:@"end tell\n"];
  2645
+	
  2646
+	NSAppleScript *as = [[NSAppleScript alloc] initWithSource:asString];
  2647
+	[as executeAndReturnError:&theError];
  2648
+	[asString release];
  2649
+	asString = nil;
  2650
+	[as release];
  2651
+	
  2652
+		//use AXUI shit to get the bounds, much more elegant than doing it with applescript, should be more reliable / less error prone.
  2653
+	
  2654
+	AXUIElementRef _systemWideElement;
  2655
+    AXUIElementRef _focusedApp;
  2656
+    CFTypeRef _focusedWindow;
  2657
+		// CFTypeRef _position;
  2658
+    CFTypeRef _size;
  2659
+	CFStringRef _name;
  2660
+	CFNumberRef _fullScreen;
  2661
+	
  2662
+    _systemWideElement = AXUIElementCreateSystemWide();
  2663
+	
  2664
+		//Get the app that has the focus
  2665
+    AXUIElementCopyAttributeValue(_systemWideElement,
  2666
+								  (CFStringRef)kAXFocusedApplicationAttribute,
  2667
+								  (CFTypeRef*)&_focusedApp);
  2668
+	
  2669
+		//Get the window that has the focus
  2670
+    if(AXUIElementCopyAttributeValue((AXUIElementRef)_focusedApp,
  2671
+									 (CFStringRef)NSAccessibilityFocusedWindowAttribute,
  2672
+									 (CFTypeRef*)&_focusedWindow) == kAXErrorSuccess) {
  2673
+		
  2674
+		if(CFGetTypeID(_focusedWindow) == AXUIElementGetTypeID()) {
  2675
+			
  2676
+			AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow, (CFStringRef)CFSTR("AXFullScreen"), (CFTypeRef *)&_fullScreen);
  2677
+			
  2678
+			NSLog(@"is full screen: %@", _fullScreen);
  2679
+				//return (![_fullScreen boolValue]); //if its full screen we want to return false
  2680
+		if ([_fullScreen intValue] == 1)
  2681
+		{
  2682
+			NSLog(@"full screen, return false");
  2683
+			return (FALSE);
  2684
+		}
  2685
+			
  2686
+		}
  2687
+    } else {
  2688
+		NSLog(@"Cant determine iTunes bounds");
  2689
+		return TRUE;
  2690
+    }
  2691
+	
  2692
+	return TRUE; //default to it not being full screen, may not be idiot proof enough if something goes awry
  2693
+}
  2694
+
  2695
+- (BOOL)iTunesScriptReadyold
  2696
+{
2602 2697
 	//if ([self isMountainLion])
2603 2698
 	//{
2604 2699
 	//	return (TRUE);//mountain lion scripting actually works in full screen.
@@ -2611,7 +2706,7 @@ - (BOOL)iTunesScriptReady
2611 2706
 	[asString appendString:@"activate application \"iTunes\"\n"];
2612 2707
 	[asString appendString:@"tell application \"System Events\"\n"];
2613 2708
 	[asString appendString:@"tell Process \"iTunes\"\n"];
2614  
-	[asString appendString:@"delay 3\n"];
  2709
+	[asString appendString:@"delay 5\n"];
2615 2710
 	[asString appendString:@"end tell\n"];
2616 2711
 	[asString appendString:@"end tell\n"];
2617 2712
 	
@@ -2628,6 +2723,7 @@ - (BOOL)iTunesScriptReady
2628 2723
     CFTypeRef _focusedWindow;
2629 2724
    // CFTypeRef _position;
2630 2725
     CFTypeRef _size;
  2726
+	CFStringRef _name;
2631 2727
 	
2632 2728
     _systemWideElement = AXUIElementCreateSystemWide();
2633 2729
 	
@@ -2642,24 +2738,19 @@ - (BOOL)iTunesScriptReady
2642 2738
 									 (CFTypeRef*)&_focusedWindow) == kAXErrorSuccess) {
2643 2739
 		
2644 2740
 		if(CFGetTypeID(_focusedWindow) == AXUIElementGetTypeID()) {
2645  
-			//Get the Window's Current Position
2646  
-			//if(AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow,
2647  
-//											 (CFStringRef)NSAccessibilityPositionAttribute,
2648  
-//											 (CFTypeRef*)&_position) != kAXErrorSuccess) {
2649  
-//				NSLog(@"Can't Retrieve Window Position");
2650  
-//			}
2651  
-			//Get the Window's Current Size
  2741
+	
2652 2742
 			if(AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow,
2653 2743
 											 (CFStringRef)NSAccessibilitySizeAttribute,
2654 2744
 											 (CFTypeRef*)&_size) != kAXErrorSuccess) {
2655 2745
 				NSLog(@"Can't Retrieve Window Size");
  2746
+		
2656 2747
 			} else {
2657 2748
 				NSSize size;
2658 2749
 				
2659 2750
 				
2660 2751
 				if(AXValueGetType(_size) == kAXValueCGSizeType) {
2661 2752
 					AXValueGetValue(_size, kAXValueCGSizeType, (void*)&size);
2662  
-						//NSLog(@"itunes window size: %@", NSStringFromSize(size));
  2753
+						NSLog(@"itunes window size: %@", NSStringFromSize(size));
2663 2754
 					
2664 2755
 					
2665 2756
 					
@@ -2695,14 +2786,210 @@ - (BOOL)isFullScreen:(NSSize)theSize
2695 2786
 	
2696 2787
 }
2697 2788
 
  2789
+- (void)analyzeiTunes
  2790
+{
  2791
+	NSDictionary *theError = nil;
  2792
+	NSMutableString *asString = [[NSMutableString alloc] init];
  2793
+	[asString appendString:@"activate application \"iTunes\"\n"];
  2794
+	NSAppleScript *as = [[NSAppleScript alloc] initWithSource:asString];
  2795
+	[as executeAndReturnError:&theError];
  2796
+	[asString release];
  2797
+	asString = nil;
  2798
+	[as release];
  2799
+	
  2800
+	AXUIElementRef _systemWideElement;
  2801
+    AXUIElementRef _focusedApp;
  2802
+    CFTypeRef _focusedWindow;
  2803
+	
  2804
+	CFNumberRef _fullScreen;
  2805
+	CFArrayRef _children;
  2806
+	CFArrayRef _splitterChildren;
2698 2807
 
  2808
+	
  2809
+    _systemWideElement = AXUIElementCreateSystemWide();
  2810
+	
  2811
+		//Get the app that has the focus
  2812
+    AXUIElementCopyAttributeValue(_systemWideElement,
  2813
+								  (CFStringRef)kAXFocusedApplicationAttribute,
  2814
+								  (CFTypeRef*)&_focusedApp);
  2815
+	
  2816
+		//Get the window that has the focus
  2817
+    if(AXUIElementCopyAttributeValue((AXUIElementRef)_focusedApp,
  2818
+									 (CFStringRef)NSAccessibilityFocusedWindowAttribute,
  2819
+									 (CFTypeRef*)&_focusedWindow) == kAXErrorSuccess) {
  2820
+		
  2821
+		if(CFGetTypeID(_focusedWindow) == AXUIElementGetTypeID()) {
  2822
+			
  2823
+		
  2824
+			AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow, (CFStringRef)CFSTR("AXFullScreen"), (CFTypeRef *)&_fullScreen);
  2825
+			
  2826
+			NSLog(@"is full screen: %i", [_fullScreen intValue]);
  2827
+			
  2828
+			itunesFullScreen = [_fullScreen boolValue];
  2829
+			
  2830
+			AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow, (CFStringRef)kAXChildrenAttribute, (CFTypeRef *)&_children);
  2831
+			
  2832
+			if ([_children count] < 13)
  2833
+			{
  2834
+				AXUIElementCopyAttributeValue((AXUIElementRef)_focusedWindow, (CFStringRef)kAXChildrenAttribute, (CFTypeRef *)&_children);
  2835
+			}
  2836
+		
  2837
+			AXUIElementRef splitter = [_children objectAtIndex:13]; //if our children count is more than 1 (probably 6) we are showing sidebar
  2838
+			
  2839
+			AXUIElementCopyAttributeValue((AXUIElementRef)splitter, (CFStringRef)kAXChildrenAttribute, (CFTypeRef *)&_splitterChildren);
  2840
+			
  2841
+			if ([_splitterChildren count] > 1)
  2842
+			{
  2843
+				NSLog(@"showing sidebar!");
  2844
+			
  2845
+				itunesShowingSideBar = TRUE;
  2846
+			
  2847
+				/*
  2848
+				CFArrayRef _splitterChildren2;
  2849
+				CFArrayRef _scrollViewChildren;
  2850
+				CFTypeRef _role;
  2851
+				AXUIElementRef splitter2 = [_splitterChildren objectAtIndex:4]; //splitter group 1 again
  2852
+				AXUIElementCopyAttributeValue((AXUIElementRef)splitter2, (CFStringRef)CFSTR("AXChildren"), (CFTypeRef *)&_splitterChildren2);
  2853
+				AXUIElementRef scrollView = [_splitterChildren2 objectAtIndex:0]; //scroll view 1
  2854
+				AXUIElementCopyAttributeValue((AXUIElementRef)scrollView, (CFStringRef)CFSTR("AXChildren"), (CFTypeRef *)&_scrollViewChildren);
  2855
+				AXUIElementRef buttonView = [_scrollViewChildren lastObject]; //AXButton?
  2856
+				AXUIElementCopyAttributeValue((AXUIElementRef)buttonView,
  2857
+											  (CFStringRef)CFSTR("AXRole"),
  2858
+											  (CFTypeRef*)&_role);
  2859
+				
  2860
+				NSLog(@"know your role! %@", _role);
  2861
+				 
  2862
+				 */
  2863
+				
  2864
+					//found restore button, side bar is showing as expected
  2865
+				
  2866
+			} else { //not showing sidebar
  2867
+				
  2868
+				NSLog(@"not showing sidebar!");
  2869
+				
  2870
+				itunesShowingSideBar = FALSE;
  2871
+				
  2872
+				
  2873
+				/*
  2874
+				AXUIElementRef scrollView = [_splitterChildren objectAtIndex:0]; //scroll view 1
  2875
+				
  2876
+				
  2877
+				AXUIElementCopyAttributeValue((AXUIElementRef)scrollView, (CFStringRef)CFSTR("AXChildren"), (CFTypeRef *)&_scrollViewChildren);
  2878
+				
  2879
+				AXUIElementRef buttonView = [_scrollViewChildren lastObject]; //AXButton?
  2880
+				
  2881
+				AXUIElementCopyAttributeValue((AXUIElementRef)buttonView,
  2882
+											  (CFStringRef)CFSTR("AXRole"),
  2883
+											  (CFTypeRef*)&_role);
  2884
+				
  2885
+				NSLog(@"know your role! %@", _role);
  2886
+				
  2887
+				 //want to figure out how to press the button here but dont know how to modify with option key
  2888
+				 
  2889
+				*/
  2890
+			}
  2891
+			
  2892
+			
  2893
+		}
  2894
+		
  2895
+	
  2896
+	}	
  2897
+}
  2898
+
  2899
+- (BOOL)loadiTunes11WithIPSW:(NSString *)ipsw
  2900
+{
  2901
+	[self analyzeiTunes];
  2902
+	
  2903
+	NSDictionary *theError = nil;
  2904
+	
  2905
+	NSString *ipswString = [NSString stringWithFormat:@"set value of text field 1 of sheet 1 of window 1 to \"%@\"\n", ipsw];
  2906
+	
  2907
+	NSMutableString *asString = [[NSMutableString alloc] init];
  2908
+	
  2909
+	[asString appendString:@"activate application \"iTunes\"\n"];
  2910
+	[asString appendString:@"tell application \"System Events\"\n"];
  2911
+	[asString appendString:@"tell Process \"iTunes\"\n"];
  2912
+	
  2913
+		//if (![self iTunesScriptReady])
  2914
+	if(itunesFullScreen == TRUE)
  2915
+	{
  2916
+		NSLog(@"iTunes fullscreen?");
  2917
+		[asString appendString:@"delay 5\n"];
  2918
+		[asString appendString:@"key code 3 using {command down, control down}\n"];
  2919
+		[asString appendString:@"delay 5\n"];
  2920
+		
  2921
+	}
  2922
+	
  2923
+	[asString appendString:@"repeat until window 1 is not equal to null\n"];
  2924
+	[asString appendString:@"end repeat\n"];
  2925
+	[asString appendString:@"end tell\n"];
  2926
+	[asString appendString:@"end tell\n"];
  2927
+	
  2928
+	
  2929
+	[asString appendString:@"activate application \"iTunes\"\n"];
  2930
+	[asString appendString:@"tell application \"System Events\"\n"];
  2931
+	[asString appendString:@"tell Process \"iTunes\"\n"];
  2932
+	[asString appendString:@"key down option\n"]; //holding down option for option mouse down on restore button
  2933
+	
  2934
+	if (itunesShowingSideBar == TRUE)
  2935
+	{
  2936
+		
  2937
+		[asString appendString:@"click button 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1\n"];
  2938
+		
  2939
+	} else {
  2940
+		
  2941
+		[asString appendString:@"click button 1 of scroll area 1 of splitter group 1 of window 1\n"];
  2942
+	}
  2943
+	
  2944
+	
  2945
+	
  2946
+		//button 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1
  2947
+	[asString appendString:@"key up option\n"];
  2948
+	[asString appendString:@"end tell\n"];
  2949
+	[asString appendString:@"end tell\n"];
  2950
+	
  2951
+	[asString appendString:@"activate application \"iTunes\"\n"];
  2952
+	[asString appendString:@"tell application \"System Events\"\n"];
  2953
+	[asString appendString:@"tell Process \"iTunes\"\n"];
  2954
+	[asString appendString:@"key code 5 using {command down, shift down}\n"];
  2955
+	[asString appendString:ipswString];
  2956
+		//[asString appendString:@"click button 1 of sheet 1 of window 1\n"];
  2957
+	[asString appendString:@"key code 36\n"];
  2958
+	
  2959
+	[asString appendString:@"delay 3\n"];
  2960
+	[asString appendString:@"key code 36\n"];
  2961
+	[asString appendString:@"delay 3\n"];
  2962
+	[asString appendString:@"key code 36\n"];
  2963
+	[asString appendString:@"delay 3\n"];
  2964
+		//[asString appendString:@"click button 4 of window 1\n"];
  2965
+		//[asString appendString:@"click button 2 of window 1\n"];
  2966
+	[asString appendString:@"end tell\n"];
  2967
+	[asString appendString:@"end tell\n"];
  2968
+	
  2969
+	NSAppleScript *as = [[NSAppleScript alloc] initWithSource:asString];
  2970
+		//NSLog(@"applescript: %@", asString);
  2971
+	[as executeAndReturnError:&theError];
  2972
+	[asString release];
  2973
+	asString = nil;
  2974
+	[as release];
  2975
+	if (theError != nil)
  2976
+	{
  2977
+		NSLog(@"iTunes Scripting failed with error: %@", theError);
  2978
+		[self fixScript:self];
  2979
+		return FALSE;
  2980
+	}
  2981
+	return TRUE;
  2982
+}
2699 2983
 
2700 2984
 	//restore button for other devices: click button 2 of scroll area 3 of window 1
2701 2985
 
2702 2986
 - (BOOL)loadItunesWithIPSW:(NSString *)ipsw
2703 2987
 {
2704 2988
 	
2705  
-	
  2989
+	if ([self iTunesIsElevenPlus])
  2990
+	{
  2991
+		return [self loadiTunes11WithIPSW:ipsw];
  2992
+	}
2706 2993
 	
2707 2994
 	
2708 2995
 	

0 notes on commit 3715269

Please sign in to comment.
Something went wrong with that request. Please try again.