Ignore:
Timestamp:
05/09/06 05:56:05 (19 years ago)
Author:
rchin
Message:
  • Updated to new mach_inject with support for x86
  • Updated nib files to 10.2+ format so that future updates to the f-script framework won't break fsa
  • Adjusted some code to work with the new x86 mach_inject (sends an additional argument)
  • Updates code to work with newer defines in cctools
Location:
trunk/Cocoa/F-Script Anywhere/Source/SCPatch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchClient/SCPatchClient.cpp

    r153 r217  
    3737
    3838        if(client->Initialize(client->mClientBundleID, client->mControllerBundleID, getpid()) != noErr)
    39                 return err_threadEntry_init_failed;
     39                return err_threadEntry_image_not_found;
    4040       
    4141        // Create a port to receive messages from our patch controller
    4242        if((err = client->StartListening(client->mClientBundleID, true, true)) != noErr)
    43                 return err_threadEntry_init_failed;
     43                return err_threadEntry_image_not_found;
    4444       
    4545        if((err = GetCurrentProcess(&psn)) != noErr ||
     
    4848                                                                  CFStringGetCStringPtr(client->mClientBundleID, kCFStringEncodingMacRoman),
    4949                                                                  sizeof(ProcessSerialNumber), &psn)) != noErr)
    50                 return err_threadEntry_init_failed;
     50                return err_threadEntry_image_not_found;
    5151
    5252        return noErr;
  • trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchController.cpp

    r153 r217  
    1717//-------------------------------------------------------------------------------------------------------------
    1818OSErr                           SCOSErrFrom_mac_err(mach_error_t error) {
    19         return (error & err_mac) ? (err & ^err_mac) : noErr;
     19        return (error & err_mac) ? (err_mac) : noErr;
    2020}
    2121
     
    323323                        if(err == noErr)
    324324                                error = InjectPatches(psn, params);
    325                        
    326325                        free(params);
    327326                }
    328327                CFRelease(str);
    329328        }
     329
    330330        if (error != err_none) return error;
    331331        else return mac_err(err);
     
    436436        // Find the loader
    437437        CFURLRef loaderURL = NULL;
     438#if defined(__ppc__) || defined(__ppc64__)
    438439        if(!err)
    439440                if((loaderURL = CFBundleCopyResourceURL(mBundle, CFSTR("SCPatchLoader"), CFSTR("bundle"), NULL)) == NULL)
    440441                        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 
    441447
    442448#if 0
     
    483489                fprintf(stderr, "Patcher got error %d\n", err);
    484490        }
    485        
     491
    486492        //      Clean up.
    487493        if(loaderURL)
  • trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchLoader.c

    r153 r217  
    199199
    200200//-------------------------------------------------------------------------------------------------------------
    201 mach_error_t INJECT_ENTRY( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize )
     201mach_error_t INJECT_ENTRY( ptrdiff_t codeOffset, void *paramBlock, size_t paramSize, char *dummy_pthread_struct )
    202202{
    203203        pthread_t                       thread;
     
    205205        struct sched_param      sched;
    206206        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
    208214    // 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__
    210217    codeOffset = 0;
    211 #endif
     218//#endif
    212219    // Stash the code offset where we can get at it later.
    213220    ((SCPatchLoaderParams *)paramBlock)->codeOffset = codeOffset;
Note: See TracChangeset for help on using the changeset viewer.