Changeset 219 for trunk/Cocoa/F-Script Anywhere
- Timestamp:
- 05/09/06 09:13:54 (19 years ago)
- Location:
- trunk/Cocoa/F-Script Anywhere/Source
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/F-Script Anywhere/Source/English.lproj/MainMenu.nib/info.nib
r217 r219 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string>1 13 87 356 240 0 0 1280 1002</string>6 <string>133 139 356 240 0 0 1440 878 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>29</key> 10 <string> 53 213 232 44 0 0 1280 1002</string>10 <string>61 185 232 44 0 0 1440 878 </string> 11 11 </dict> 12 12 <key>IBFramework Version</key> … … 18 18 </array> 19 19 <key>IBSystem Version</key> 20 <string>8 H14</string>20 <string>8I1119</string> 21 21 </dict> 22 22 </plist> -
trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj
r218 r219 869 869 isa = XCBuildConfiguration; 870 870 buildSettings = { 871 ARCHS = ( 872 ppc, 873 i386, 874 ); 871 875 COPY_PHASE_STRIP = YES; 872 876 FRAMEWORK_SEARCH_PATHS = /Volumes/Ti/Library/Frameworks; … … 922 926 isa = XCBuildConfiguration; 923 927 buildSettings = { 928 ARCHS = ( 929 ppc, 930 i386, 931 ); 924 932 COPY_PHASE_STRIP = YES; 925 933 GCC_ENABLE_FIX_AND_CONTINUE = NO; … … 988 996 isa = XCBuildConfiguration; 989 997 buildSettings = { 998 ARCHS = ( 999 ppc, 1000 i386, 1001 ); 990 1002 COPY_PHASE_STRIP = YES; 991 1003 FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; -
trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.h
r153 r219 34 34 NSMutableDictionary *appsByPID; 35 35 NSMutableSet *patchedApps; 36 NSMutableSet *patchingApps; 36 NSMutableSet *patchingApps; 37 NSMutableArray *alwaysApps; 37 38 IBOutlet NSButton *installButton; 38 39 IBOutlet NSTableView *tableView; 40 BOOL finishedLaunch; 39 41 } 40 42 -
trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m
r153 r219 25 25 */ 26 26 27 #include <sys/types.h> 28 #include <sys/sysctl.h> 27 29 #import "FSAAppList.h" 28 30 #import "FSAnywhere.h" … … 39 41 NSString * const FSATableColumnIdentifier_appNameAndIcon = @"appNameAndIcon"; 40 42 NSString * const FSATableColumnIdentifier_checkMark = @"checkMark"; 43 NSString * const FSATableColumnIdentifier_always = @"always"; 41 44 42 45 NSString *FSACheckMarkCharacter; … … 52 55 NULL 53 56 }; 57 58 static int sysctlbyname_with_pid (const char *name, pid_t pid, 59 void *oldp, size_t *oldlenp, 60 void *newp, size_t newlen); 61 int is_pid_native (pid_t pid); 54 62 55 63 @implementation FSAAppList … … 84 92 patchingApps = [[NSMutableSet alloc] init]; 85 93 appsByPID = [[NSMutableDictionary alloc] init]; 94 if(!([[NSUserDefaults standardUserDefaults] objectForKey:@"AlwaysApps"])) 95 alwaysApps = [[NSMutableArray array] retain]; 96 else 97 alwaysApps = [[NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"AlwaysApps"]] retain]; 86 98 87 99 [[tableView tableColumnWithIdentifier: FSATableColumnIdentifier_appNameAndIcon] … … 91 103 setDataCell: [[[NSImageCell alloc] init] autorelease]]; 92 104 [window setResizeIncrements: NSMakeSize(1, [tableView cellHeight])]; 105 [tableView setTarget:self]; 106 [tableView setAction:@selector(clickInTable:)]; 93 107 94 108 [self update]; … … 169 183 return NO; 170 184 return appContainsLibMatching([bundleExecutableLoc fileSystemRepresentation], FSACocoaFrameworks); 185 } 186 187 -(BOOL)appIsNative:(DeVercruesseProcess *)app 188 { 189 return is_pid_native([app pid]); 171 190 } 172 191 … … 212 231 ( ( [app isCocoa] && ![self appIsPEF: app]) || 213 232 ( [app isCarbon] && [self appIsCocoa: app]))) { 214 [cocoaApps addObject: app]; 215 } 216 [appsByPID setObject: app forKey: [NSNumber numberWithInt: [app pid]]]; 233 if([self appIsNative:app]){ 234 [cocoaApps addObject: app]; 235 if(finishedLaunch){ 236 if([alwaysApps containsObject:[app name]] && ![patchedApps containsObject:app]) 237 [NSApp installBundleInAppWithPID:[app pid]]; 238 } 239 } 240 } 241 [appsByPID setObject: app forKey: [NSNumber numberWithInt: [app pid]]]; 217 242 } 218 243 … … 333 358 return FSAEllipsisImage; 334 359 } 335 } 360 } else if([columnIdentifier isEqualToString:FSATableColumnIdentifier_always]){ 361 if([alwaysApps containsObject:[[cocoaApps objectAtIndex: rowIndex] name]]) 362 return [NSNumber numberWithBool:YES]; 363 else 364 return [NSNumber numberWithBool:NO]; 365 } 336 366 return nil; 337 367 } … … 418 448 } 419 449 450 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 451 { 452 id anApp; 453 id e = [cocoaApps objectEnumerator]; 454 while(anApp = [e nextObject]){ 455 if([alwaysApps containsObject:[anApp name]] && ![patchedApps containsObject:anApp]){ 456 [NSApp installBundleInAppWithPID:[anApp pid]]; 457 } 458 } 459 finishedLaunch = YES; 460 } 461 420 462 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender; 421 463 { … … 423 465 } 424 466 467 -(void)clickInTable:(id)sender 468 { 469 if([sender clickedColumn] == 2){ 470 if([sender clickedRow] >= 0){ 471 NSString *appName = [[cocoaApps objectAtIndex:[sender clickedRow]] name]; 472 if(![alwaysApps containsObject:appName]){ 473 [NSApp installBundleInAppWithPID:[appName pid]]; 474 [alwaysApps addObject:appName]; 475 } else 476 [alwaysApps removeObject:appName]; 477 [[NSUserDefaults standardUserDefaults] setObject:alwaysApps forKey:@"AlwaysApps"]; 478 } 479 } 480 } 481 425 482 @end 483 484 static int sysctlbyname_with_pid (const char *name, pid_t pid, 485 void *oldp, size_t *oldlenp, 486 void *newp, size_t newlen) 487 { 488 if (pid == 0) { 489 if (sysctlbyname(name, oldp, oldlenp, newp, newlen) == -1) { 490 fprintf(stderr, "sysctlbyname_with_pid(0): sysctlbyname failed:" 491 "%s\n", strerror(errno)); 492 return -1; 493 } 494 } else { 495 int mib[CTL_MAXNAME]; 496 size_t len = CTL_MAXNAME; 497 if (sysctlnametomib(name, mib, &len) == -1) { 498 fprintf(stderr, "sysctlbyname_with_pid: sysctlnametomib failed:" 499 "%s\n", strerror(errno)); 500 return -1; 501 } 502 mib[len] = pid; 503 len++; 504 if (sysctl(mib, len, oldp, oldlenp, newp, newlen) == -1) { 505 fprintf(stderr, "sysctlbyname_with_pid: sysctl failed:" 506 "%s\n", strerror(errno)); 507 return -1; 508 } 509 } 510 return 0; 511 } 512 513 int is_pid_native (pid_t pid) 514 { 515 int ret = 0; 516 size_t sz = sizeof(ret); 517 518 if (sysctlbyname_with_pid("sysctl.proc_native", pid, 519 &ret, &sz, NULL, 0) == -1) { 520 if (errno == ENOENT) { 521 // sysctl doesn't exist, which means that this version of Mac OS 522 // pre-dates Rosetta, so the application must be native. 523 return 1; 524 } 525 fprintf(stderr, "is_pid_native: sysctlbyname_with_pid failed:" 526 "%s\n", strerror(errno)); 527 return -1; 528 } 529 return ret; 530 } -
trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp
r217 r219 436 436 // Find the loader 437 437 CFURLRef loaderURL = NULL; 438 #if defined(__ppc__) || defined(__ppc64__)439 438 if(!err) 440 439 if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader"), CFSTR("bundle"), NULL)) == NULL) 441 440 err = err_couldnt_find_injection_bundle; 442 #else443 if(!err)444 if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader-intel"), CFSTR("bundle"), NULL)) == NULL)445 err = err_couldnt_find_injection_bundle;446 #endif447 441 448 442 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.