freebies: December 2008 Archives

PseudoSubstrate 1.0

| | Comments (51)
Quick digest in one line: PseudoSubstrate, a replacement for MobileSubstrate (available in Cydia) is now available for the Installer.app, allowing to host and use the packages that use MobileSubstrate. The first package is also available now, named MySMS. PseudoSubstrate is used for situations when you don't have Cydia installed or prefer Installer over the former and requires no additional work from developers' side. And it's faster, too.

And a little background for the curious minds. Often the task of many utilities are to extend the functionality of existing applications, such as SpringBoard, SMS, and so on. Of course, to extend the application, some additional code created by a third party has to be loaded into the application memory and then alter the behavior of these applications. How is this done? Altering is performed by finding one of the common functions in the application that perform the task we'd like to alter (for example, function that sends an SMS message). Then a replacement "patch" function is written that accepts the same parameters as the original, and it is "swapped" with the original one. Usually these patches do something then call the original, so essentially nothing is lost functionality-wise.

Both Mobile Enhancer and MobileSubstrate are essentially bootstrappers that aid the patch modules in loading into the host application they are about to extend and to help them patch the functions by providing common interfaces that replace the original function with a patched one and provide facilities for calling the original afterwards. They're nothing else than that - iterating through a list of patch modules loading them one-by-one into the application you're launching and then providing some helpers to assist the modules into getting the job done (and don't conflict with other modules who potentially wish to patch the same function).

Of course, nothing is stopping a developer for creating their own bootstrapper, and this is what some of them still do. But it's more logical to adopt a single platform and then use it.

Mobile Enhancer exists since September 2007, and is a direct descendant (actually, in some aspects, it is an ARM port of it) of Application Enhancer by Unsanity, which is a Mac OS X library doing the same thing. MobileSubstrate was born sometime this year because apparently its author didn't like the fact Mobile Enhancer is closed source (but still free). I may be wrong in the reasoning, though, maybe the author will comment on his own.

As it often happens, free is not necessarily better. As any quick&dirty job, MobileSubstrate does what it's made for, but the way it does it is far from effective. But hey, it's open source, anyone can make it better, right?

You may think I might be biased, but let's look at the facts:
  • MobileSubstrate is using a simple way of patching C functions where multiple patches for the same function will conflict.
  • The way of patching Objective C methods used by MobileSubstrate is puzzling me. Instead of just swapping the IMP addresses of the functions, it does that, but also adds a new method into the class methods list. While I can understand, why (it's easier for the developer to write [self orig_patchedFunction:arg1] than gPatchedFunction(obj, sel, arg1);) but in the end it causes a separate call to objc_msgSend resulting in 50 to 400 extra instructions to be executed just to call the original function. Talk about speed, huh.
  • The way MobileSafety works (it controls the Safe Mode commonly seen in the SpringBoard) is okay for a UN*X diehard - but it relies on some assumptions it shouldn't. For example, it traps common signals sent when the app is crashed (SIGSEGV, SIGBUS, etc) but doesn't passes the extra information to next handlers in chain! Hello, this is 21st century, and we're not talking of command line tools here - it's done inside a full-fledged GUI app, and who knows, that extra information MobileSafety discards may be useful - you never know!
  • The loader itself is written in Objective C which means it is much more slower than compared to the one written in pure C - and that affects every application launch.

Well, I guess since it still gets the job done, I couldn't blame it much. It's a great concept which got executed fairly poorly - which is understandable as the author apparently have a day job and maybe has little time and/or knowledge for hacks like this (again, UN*X is not Mac OS X).

Either way... since MobileSubstrate is inferior to Mobile Enhancer, it was pretty easy to create a wrapper that would load MobileSubstrate libraries (using pure C, so it does it faster) and provide the functions provided by MobileSubstrate (that also work more correctly in some aspects) so the developers who use MobileSubstrate don't have to change anything in their applications - it will just magically work.

Enjoy.

Hood 1.1

| | Comments (29) | TrackBacks (1)
Slightly slower than we anticipated, but with more features than planned, Hood 1.1 hits the virtual shelves of our Installer.app repository now.

What's new? Plenty.
  • EDGE Toggle. Unlike other solutions (actually, all that I've seen around), this one disables and enables EDGE without touching the APN settings. For this reason, when you disable EDGE, the "E" icon will still be lit in the status bar (indicating that the network is up) but the respective service will be effectively down. This is much more reliable than before, and is actually the way Apple meant to implement it - the code hidden inside Preferences.app does the same.
  • Settings. Now you can access settings of Hood inside of Settings > RiP Dev > Hood preference pane. Very easy and convenient.
  • Process List. This feature is turned off by default, but you can enable it in the Settings. Hood will show a list of processes running on your iPhone, with the ability to quickly kill any of them by sliding your finger across the process name (much like you delete stuff in any table form on the iPhone). Be careful and don't kill stuff that you don't know, especially owned by root - or you may end up rebooting your iPhone!
  • Assignable Buttons. Remember these four button slots on top? Well, instead of creating a mess by stacking 16 icons each doing something next to each other, we are letting you choose which 4 options you want. Later on, when more toggles are added in (VPN and SSH are next in line, by the way), you will have a wider selection. Assignable in Settings, as well.
  • Really Quits Processes now. Version 1.0 only emulated the Home button press when you were hitting the Quit Application button. Which means - Safari, Mail.app and others were not completely closed (this is the same for most "other" managers too). Now the applications are properly killed and the memory is instantly released - as you can see on the pie chart.
  • New Icons. Thrasos Varnava did us a big favor and made up new and improved icons for the toggles. Thank you!
  • Bug fixes. Fixed a bug with Hood staying open when you lock the device with it open (or it auto-locks). Also fixed a few other cosmetic bugs.
  • Still free! Hood was and will remain free and lightweight tool, thanks to your comments, support and suggestions.

And now, the slides:
hood-11-general.jpghood-11-processes.jpghood-11-settings.jpg

Hood 1.1 is available now in the Installer.app category Utilities. Enjoy.

About this Archive

This page is a archive of entries in the freebies category from December 2008.

freebies: November 2008 is the previous archive.

freebies: February 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.

February 2009: Monthly Archives

Pages