By far, the easiest way to develop MS tweaks is to use Theos
Follow the instructions given on the link above to install theos, navigate to the folder you want to store the project in and run $THEOS/bin/nic.pl
to generate a template for your tweak.
The generated Tweak.xm file is where you put your code. To build the project just navigate to the project directory in Terminal and run make
. If have dpkg
on your system, then you can package up and install the project easily. Make sure OpenSSH
is installed on your iDevice and add this line to your project's makefile:
THEOS_DEVICE_IP = [INSERTDEVICESIPHERE]
Then run make package install
to build your project, package it in a .deb, transfer it over to your device and install it.
The code that actually goes in the Tweak.xm file is objective-C with a language that simplifies Mobile Substrate tasks called Logos, which is explained here: http://iphonedevwiki.net/index.php/Logos. Generally though, the code follows this format:
%hook classname //declares the class from your application you're going to override
-(void)functionyouwanttooveride {
dosomethingnew(); //put all your new code for the method here
return %orig; //this calls the original definition of the method and returns the result
}
%end //end hooking classname
To find out what classes and methods you need to override to do whatever you want to do, install class-dump
from cydia, ssh into your device and run class-dump -H path/to/your/binary -o /path/where/you/want/your/classheaders
. Then you just have to look through the resulting headers to find classes and methods that have names that seem relevant to what you're doing, and experiment with them.
Good luck!
functionyouwanttooverride
? How can I get the original code for the function, so that i can modify it? – Cowpea