- Timestamp:
- 05/09/06 05:56:05 (19 years ago)
- Location:
- trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp
r153 r217 17 17 //------------------------------------------------------------------------------------------------------------- 18 18 OSErr SCOSErrFrom_mac_err(mach_error_t error) { 19 return (error & err_mac) ? (err & ^err_mac) : noErr;19 return (error & err_mac) ? (err_mac) : noErr; 20 20 } 21 21 … … 323 323 if(err == noErr) 324 324 error = InjectPatches(psn, params); 325 326 325 free(params); 327 326 } 328 327 CFRelease(str); 329 328 } 329 330 330 if (error != err_none) return error; 331 331 else return mac_err(err); … … 436 436 // Find the loader 437 437 CFURLRef loaderURL = NULL; 438 #if defined(__ppc__) || defined(__ppc64__) 438 439 if(!err) 439 440 if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader"), CFSTR("bundle"), NULL)) == NULL) 440 441 err = err_couldnt_find_injection_bundle; 442 #else 443 if(!err) 444 if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader-intel"), CFSTR("bundle"), NULL)) == NULL) 445 err = err_couldnt_find_injection_bundle; 446 #endif 441 447 442 448 #if 0 … … 483 489 fprintf(stderr, "Patcher got error %d\n", err); 484 490 } 485 491 486 492 // Clean up. 487 493 if(loaderURL) -
trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchLoader.c
r153 r217 199 199 200 200 //------------------------------------------------------------------------------------------------------------- 201 mach_error_t INJECT_ENTRY( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize )201 mach_error_t INJECT_ENTRY( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize, char *dummy_pthread_struct ) 202 202 { 203 203 pthread_t thread; … … 205 205 struct sched_param sched; 206 206 int policy; 207 207 #if defined (__i386__) 208 // On intel, per-pthread data is a zone of data that must be allocated. 209 // if not, all function trying to access per-pthread data (all mig functions for instance) 210 // will crash. 211 extern void __pthread_set_self(char*); 212 __pthread_set_self(dummy_pthread_struct); 213 #endif 208 214 // We need to fix up function addresses in gcc code, but not for code generated by CW. 209 #ifdef __MWERKS__ 215 // It turns out that this is not needed for gcc 4.0 216 //#ifdef __MWERKS__ 210 217 codeOffset = 0; 211 #endif218 //#endif 212 219 // Stash the code offset where we can get at it later. 213 220 ((SCPatchLoaderParams *)paramBlock)->codeOffset = codeOffset;
Note:
See TracChangeset
for help on using the changeset viewer.