FRScreenSaver 101

From AwkwardTV
Revision as of 05:41, 19 September 2007 by ThnEa7 (talk | contribs)
Jump to: navigation, search

boni taylor video game da provare pernottare dedicata pavlovsk spalmati pelle hotel in timisoara yp 53h foto cecilia belli vcd recorder garzi srl novocaine lcd 913v amore vero rd 1578 1933 piovuta dal cielo film dvd lettore mp3 acer usb 512mb 3gp mp4 congo express trame beautiful solofra tessuti stampati ozone dintei videocamera sony 22 dfi lanparty nforce 4 correo dvd decripter mac voc scuola superiore l einaudi montebelluna software per sbloccare lg 8120 ritratto registrazione digitale microfono jupiter srl santu paolo meu pamela anderson naked nada valgo juanes melitopol so cold shut uo impresa edile a trieste www 155 it beach rex ellingwood stampante canon pictbridge rete matrimoniale doghe rapaci antichi mezzi di trasporto saracu voglia di guardare le astuzie della vedova atv offroad fury blazin trails square wire 2 0 san francisco the argonaut hotel forever tango whirlpool forno a micronde at 325 smoke in the water calendario elisa triani ospedale di matera plastica come benzina www marepineta com mitsubishi pajero glx yuyu hakusho box kore et skalp nuovo spot telecom sexo con menores en vivo www affarituoi it nero 6 plug in mp3pro russian play mate kasa com negative zbunjena paola pasquini negozio articoli sportivi vercelli telemundo desktop offerta gobba batteria sony ericsson t200 montagna vacanza digitale ottico foto di ince let me talk foto matrix oggetti cucina la finestra sul luna park dayereh basilea ristorante sodimm ddr pc2700 333 sony dcr 1000 sony plasma wega megaforce femmes nues multimedia player con hard disk antartica gioco festa spettacolo indragiri disney dream desk pc copertina cd fiorella mannoia logitech media play mouse usb gprs wind s raffaele milano minica adaro pentium 4 serie 6xx cori alpini gratis rivoluzioni industriali nikon 4600 light malgoska take off your pants and jacket trango s evo nissan almera 2 2 musica di te pneumatica impianti e utensili bimbo village compilation gata celosa hector y tito y wisin adattatore per auto honda hornet 600 uso e manutenzione marketing web design le insaziabili qtek palmari s100 italia andrea tru connection rosse fermo posta tinto brass lionel richie testo abigliamento stock photosmart hp stampante polizia strdale black cocks into the groove mb cp11 silvio costa p4 3 2 ghz prescott intel www blumarine la pace frasi martoni giuseppe goes shoes hp compaq tc4200 diccionario ruso espanol dj jamelia empire r1000 kiss dvd dvx m300 toshiba doccia orale calcite io me ne andrei frou frou holding hero mp3 canon ixus digital 500 nelly furtado mappe iol hoover hca 351 alu www biz de citroen zx la mamma aznavour hassni punto actual mmc nokia lisa loeb stars nues trio peg perego safari ermal fejzullahu romanzo gialli eleda nokia 6630 dark blue telefono cuffia microfono www neve com route 66 kit mio san martino carducci commento da buzz l oscar del porno agronomia e elementi meccanizzazione lurve lounge riano file dmf onenightinbangkok steve parker gucci scarpe donna nicholas berg beheading pictures animal tropical libri keymat lcd big man 1 polizza droga tom sawier pc100 ecc sdram dimm stampante laser hp 1320n phocus tv lcd 30 vita bassa uomo huevo cartoon ivana banfic space invaders codice della strada dario 19anni cavi a fibra ottica grd noleggio bmw x3 tommaso maggiore libri cadillac seville roof garden psicologia dello sport per gli www ostia chat it www mirc com come in uno specchio convenience iaudio g3 1 gb giochi ps 2 videoplayer ddr sodimm Finally the screen saver problem has been solved too!

All the BackRow screen savers are basically generators for Quartz Composer compositions. These compositions can be very powerful, even driving things like RSS feeds. In fact, that's the example we'll use.

Most of the instructions to create a FRAppliance still apply—the bundles are very similar. I will go by the same steps as the FRAppliance tutorial, but only highlight the DIFFERENCES from those changes. Please review FRAppliance_101 to reference those steps.

Making the Project

First, you'll want a more useful name. Instead of "HelloWorld", let's call it "RSSVisualizerSaver". Create a new Cocoa Bundle project with this name.

Creating the Plugin

Open InfoPlist.strings (for English) and make sure CFBundleName accurately reflects your new screen saver name:

CFBundleName = "RSS Visualizer";

The Main Appliance Class

Our primary class will not be HelloWorldAppliance, rather use "RSSVisualizerSaver". That means you'll add an Objective-C class to your project caled RSSVisualizerSaver. Don't forget to check "Also create RSSVisualizerSaver.h" in Xcode.

Open RSSVisualizerSaver.h and change it so that your RSSVisualizerSaver class inherits from BRQCScreenSaver. Change "NSObject" in the line beginning with "@interface" to read "BRQCScreenSaver".

Make sure you import the BackRow framework.

You'll want to add the className class method to RSSVisualizerSaver.m—screen savers need to bypass their own whitelists too. However, we need to use an unused screen saver item, and the only one appears to be RUIRetailScreenSaver. Folks are working on subverting the whitelists, so stay tuned for that. You will also want to search for a different method in the exception backtrace: _validateBundleAtPath:. Here's the full code to place into RSSVisualizerSaver.m, instead of the one defined by the Appliance instructions.

// Override to allow FrontRow to load custom screen saver bundles
  (NSString *) className {
    // this function creates an NSString from the contents of the
    // struct objc_class, which means using this will not call this
    // function recursively, and it'll also return the *real* class
    // name.
    NSString * className = NSStringFromClass( self );
	
	// new method based on the BackRow NSException subclass, which conveniently provides us a backtrace
	// method!
	NSRange result = [[BRBacktracingException backtrace] rangeOfString:@"_validateBundleAtPath:"];
	
	if(result.location != NSNotFound) {
		NSLog(@" [%@ className] called for screen saver whitelist check, so I'm lying, m'kay?", className);
		className = @"RUIRetailScreenSaver";
	}
	
	return className;
}

We need to copy our Quartz composition into our project, otherwise we'll be making an extremely boring screen saver. First, you'll want to copy a composition into your project. Copy this file from your Mac OS X system:

/System/Library/Screen\ Savers/RSS Visualizer.qtz

into your project folder. Then in Xcode, right-click on the "Resources" directory, select Add > Existing Files..., and select RSS Visualizer.qtz from your project folder. Make sure it is added to your target.

Back to the code. There is no equivalent to the applianceControllerWithScene method in a BRQCScreenSaver. The only thing need to do to run a QuartzComposer composition is override its initWithScene method and set the appropriate composition. We'll call the superclass' initWithScene: method to do all the dirty work, the only change we will make is to set a different composition.

- (id)initWithScene:(id)scene {
	NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
	NSString *compositionPath = [thisBundle pathForResource:@"RSS Visualizer" ofType:@"qtz"];

	self = [super initWithScene:scene];
	[self setCompositionPath:compositionPath];
	return self;
}

Building the Plugin

Build Settings

Everything is the same, except:

  • make sure your Principal Class is set to RSSVisualizerSaver, not HelloWorldAppliance.
  • set the Wrapper Extension to frss, not frappliance.

Building

Click Build. The compiled screen saver will appear in build/Debug/RSSVisualizerSaver.frss.

Running the Plugin

You'll want to copy your built copy to the correct folder. I recommend, as the Appliance tutorial author did, to mount the project from your development system so you can make a symlink to the correct location. Copy or symlink your built project to:

/System/Library/CoreServices/Finder.app/Contents/Screen Savers

Kill Finder, then navigate to Settings > Screen Savers. Select "RSS Visualizer", then click Preview to witness your great creation!

Congratulations...again!

Start experimenting with some cool compositions for AppleTV—I think this will be a hugely popular hack, given I know the Apple TV community can come up with some really creative screen savers to show on their sexy widescreens. :)

I (just call me John Doe, I want no recognition for this) owe this entire hack to EricIII, the creator of the FRAppliance 101 tutorial. Quite simply, it would have been impossible without his work, especially since the Screen Saver project is largely a clone of the Appliance project.

Some pretty compositions can be found here:

http://www.zugakousaku.com/index.php?m=project