Results 1 to 2 of 2

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: MobileSubstrate Dylib Template for Xcode. Bam.

  1. #1
    Default MobileSubstrate Dylib Template for Xcode. Bam.
    Well, if you're anything like me, then you are absolutely sick of compiling MobileSubstrate plugins on your phone. There are reasons, and they all are bothersome. In fact, MobileSubstrate plugins are the last thing I was stuck compiling on my phone.

    So, I fixed that. By adding the SpringBoard headers to the appropriate places on my computer and adding libsubstrate to my build environment. [Of course, I also compiled it on my computer so I could compile and run MS plugins for the simulator]

    Which in itself would have been fine, except for the fact that Xcode doesn't want to compile dylibs for the iPhone. It will actively refuse to if you select "Build a dylib" and change the SDK to any iPhone SDK. Instead, you have to tell Xcode that you're compiling an application and set the dylib flags yourself. Then, take the application you've created, rename the binary, and discard the rest of the .app. Doing all that just was a waste of time.

    So, I put together a little template in xcode that will do most of what I want for me. I won't go on and on, as this is just a template, but it is a fantastic starting point for building a dylib, as templates should be. This will build the dylib and sets your first hook into SpringBoard.

    Unfortunately, you still have to rename the binary and discard the rest of the package (as xcode won't compile any other way). Also, don't forget to run ldid on the resulting dylib.

    Template: http://www.touchrepo.com/SampleCode/...trateDylib.zip
    Place the contents of that zip in /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application


    Note, this does require set up. The template assumes that your SpringBoard headers are all in order and are set up and ready to go in the standard header location. If they are not, then take this time to add the SpringBoard headers to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include/SpringBoard/ etc, all the way up to the 2.2.1 SDK (for 3.0, class-dump the 3.0 SpringBoard and place those in the 3.0.sdk's include directory). Do the same for all the Simulator SDKs if you wish to also compile MS plugins for the Simulator. The smart coder would use symlinks whenever possible here.

    Next, you will need to get a copy of libsubstrate from off of your phone. Copy that to /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/ If you have also compiled libsubstrate for yourself (for the simulator), place that in the Simulator's equivalent location.


    Once your headers and libraries are in place, go ahead select a "New Project" in Xcode and compile. You should now have an app. Again, append a dylib to that binary and discard the rest of the app bundle.

    Place the dylib on your phone in /Library/MobileSubstrate/DynamicLibraries, run ldid -S your.dylib, and respring!

    Enjoy!
    Attached Files Attached Files
    Last edited by SkylarEC; 2009-03-23 at 11:55 PM.

  2. The Following User Says Thank You to SkylarEC For This Useful Post:

    FreeApple (2011-04-18)

  3. #2
    AWSOME!!! great job... that is going to be so much easier

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •