Index: /trunk/Cocoa/F-Script Anywhere/Source/English.lproj/MainMenu.nib/info.nib
===================================================================
--- /trunk/Cocoa/F-Script Anywhere/Source/English.lproj/MainMenu.nib/info.nib (revision 218)
+++ /trunk/Cocoa/F-Script Anywhere/Source/English.lproj/MainMenu.nib/info.nib (revision 219)
@@ -4,9 +4,9 @@
IBDocumentLocation
- 113 87 356 240 0 0 1280 1002
+ 133 139 356 240 0 0 1440 878
IBEditorPositions
29
- 53 213 232 44 0 0 1280 1002
+ 61 185 232 44 0 0 1440 878
IBFramework Version
@@ -18,5 +18,5 @@
IBSystem Version
- 8H14
+ 8I1119
Index: /trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj
===================================================================
--- /trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj (revision 218)
+++ /trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj (revision 219)
@@ -869,4 +869,8 @@
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = /Volumes/Ti/Library/Frameworks;
@@ -922,4 +926,8 @@
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
@@ -988,4 +996,8 @@
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
Index: /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.h
===================================================================
--- /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.h (revision 218)
+++ /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.h (revision 219)
@@ -34,7 +34,9 @@
NSMutableDictionary *appsByPID;
NSMutableSet *patchedApps;
- NSMutableSet *patchingApps;
+ NSMutableSet *patchingApps;
+ NSMutableArray *alwaysApps;
IBOutlet NSButton *installButton;
IBOutlet NSTableView *tableView;
+ BOOL finishedLaunch;
}
Index: /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m
===================================================================
--- /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m (revision 218)
+++ /trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m (revision 219)
@@ -25,4 +25,6 @@
*/
+#include
+#include
#import "FSAAppList.h"
#import "FSAnywhere.h"
@@ -39,4 +41,5 @@
NSString * const FSATableColumnIdentifier_appNameAndIcon = @"appNameAndIcon";
NSString * const FSATableColumnIdentifier_checkMark = @"checkMark";
+NSString * const FSATableColumnIdentifier_always = @"always";
NSString *FSACheckMarkCharacter;
@@ -52,4 +55,9 @@
NULL
};
+
+static int sysctlbyname_with_pid (const char *name, pid_t pid,
+ void *oldp, size_t *oldlenp,
+ void *newp, size_t newlen);
+int is_pid_native (pid_t pid);
@implementation FSAAppList
@@ -84,4 +92,8 @@
patchingApps = [[NSMutableSet alloc] init];
appsByPID = [[NSMutableDictionary alloc] init];
+ if(!([[NSUserDefaults standardUserDefaults] objectForKey:@"AlwaysApps"]))
+ alwaysApps = [[NSMutableArray array] retain];
+ else
+ alwaysApps = [[NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"AlwaysApps"]] retain];
[[tableView tableColumnWithIdentifier: FSATableColumnIdentifier_appNameAndIcon]
@@ -91,4 +103,6 @@
setDataCell: [[[NSImageCell alloc] init] autorelease]];
[window setResizeIncrements: NSMakeSize(1, [tableView cellHeight])];
+ [tableView setTarget:self];
+ [tableView setAction:@selector(clickInTable:)];
[self update];
@@ -169,4 +183,9 @@
return NO;
return appContainsLibMatching([bundleExecutableLoc fileSystemRepresentation], FSACocoaFrameworks);
+}
+
+-(BOOL)appIsNative:(DeVercruesseProcess *)app
+{
+ return is_pid_native([app pid]);
}
@@ -212,7 +231,13 @@
( ( [app isCocoa] && ![self appIsPEF: app]) ||
( [app isCarbon] && [self appIsCocoa: app]))) {
- [cocoaApps addObject: app];
- }
- [appsByPID setObject: app forKey: [NSNumber numberWithInt: [app pid]]];
+ if([self appIsNative:app]){
+ [cocoaApps addObject: app];
+ if(finishedLaunch){
+ if([alwaysApps containsObject:[app name]] && ![patchedApps containsObject:app])
+ [NSApp installBundleInAppWithPID:[app pid]];
+ }
+ }
+ }
+ [appsByPID setObject: app forKey: [NSNumber numberWithInt: [app pid]]];
}
@@ -333,5 +358,10 @@
return FSAEllipsisImage;
}
- }
+ } else if([columnIdentifier isEqualToString:FSATableColumnIdentifier_always]){
+ if([alwaysApps containsObject:[[cocoaApps objectAtIndex: rowIndex] name]])
+ return [NSNumber numberWithBool:YES];
+ else
+ return [NSNumber numberWithBool:NO];
+ }
return nil;
}
@@ -418,4 +448,16 @@
}
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ id anApp;
+ id e = [cocoaApps objectEnumerator];
+ while(anApp = [e nextObject]){
+ if([alwaysApps containsObject:[anApp name]] && ![patchedApps containsObject:anApp]){
+ [NSApp installBundleInAppWithPID:[anApp pid]];
+ }
+ }
+ finishedLaunch = YES;
+}
+
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender;
{
@@ -423,3 +465,66 @@
}
+-(void)clickInTable:(id)sender
+{
+ if([sender clickedColumn] == 2){
+ if([sender clickedRow] >= 0){
+ NSString *appName = [[cocoaApps objectAtIndex:[sender clickedRow]] name];
+ if(![alwaysApps containsObject:appName]){
+ [NSApp installBundleInAppWithPID:[appName pid]];
+ [alwaysApps addObject:appName];
+ } else
+ [alwaysApps removeObject:appName];
+ [[NSUserDefaults standardUserDefaults] setObject:alwaysApps forKey:@"AlwaysApps"];
+ }
+ }
+}
+
@end
+
+static int sysctlbyname_with_pid (const char *name, pid_t pid,
+ void *oldp, size_t *oldlenp,
+ void *newp, size_t newlen)
+{
+ if (pid == 0) {
+ if (sysctlbyname(name, oldp, oldlenp, newp, newlen) == -1) {
+ fprintf(stderr, "sysctlbyname_with_pid(0): sysctlbyname failed:"
+ "%s\n", strerror(errno));
+ return -1;
+ }
+ } else {
+ int mib[CTL_MAXNAME];
+ size_t len = CTL_MAXNAME;
+ if (sysctlnametomib(name, mib, &len) == -1) {
+ fprintf(stderr, "sysctlbyname_with_pid: sysctlnametomib failed:"
+ "%s\n", strerror(errno));
+ return -1;
+ }
+ mib[len] = pid;
+ len++;
+ if (sysctl(mib, len, oldp, oldlenp, newp, newlen) == -1) {
+ fprintf(stderr, "sysctlbyname_with_pid: sysctl failed:"
+ "%s\n", strerror(errno));
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int is_pid_native (pid_t pid)
+{
+ int ret = 0;
+ size_t sz = sizeof(ret);
+
+ if (sysctlbyname_with_pid("sysctl.proc_native", pid,
+ &ret, &sz, NULL, 0) == -1) {
+ if (errno == ENOENT) {
+ // sysctl doesn't exist, which means that this version of Mac OS
+ // pre-dates Rosetta, so the application must be native.
+ return 1;
+ }
+ fprintf(stderr, "is_pid_native: sysctlbyname_with_pid failed:"
+ "%s\n", strerror(errno));
+ return -1;
+ }
+ return ret;
+}
Index: /trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp
===================================================================
--- /trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp (revision 218)
+++ /trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp (revision 219)
@@ -436,13 +436,7 @@
// Find the loader
CFURLRef loaderURL = NULL;
-#if defined(__ppc__) || defined(__ppc64__)
if(!err)
if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader"), CFSTR("bundle"), NULL)) == NULL)
err = err_couldnt_find_injection_bundle;
-#else
- if(!err)
- if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader-intel"), CFSTR("bundle"), NULL)) == NULL)
- err = err_couldnt_find_injection_bundle;
-#endif
#if 0