Tutorial: Page (1) of 2 - 07/30/07 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook

Sniffing for Intel Macs with Director MX 2004 and Buddy API

New hardware can play nice with older software, and vice-versa By Kevin Schmitt

Believe it or not, there are still folks out there using Director for multimedia authoring, even as Adobe pushes the Flash platform ever forward and preps AIR as the technology of choice for desktop-based applications. And while it's been more than a year of silence since the "Director is not dead" proclamation was issued by Adobe's former Director Product Manager, in the interest of keeping the fires lit, here's a tidbit for how to make Director projectors (with the help of the essential Buddy API Xtra) recognize whether they're running on an Intel or a PowerPC-based Mac.

The question is: why?

First thing's first: "why" seems to be a valid question, as in, "why would you ever need to tell the difference between Mac architectures?" A valid question indeed, especially in light of how old the latest build of Director is as of this writing. It's still a Macromedia-branded product, for Pete's sake, and it's further dated by having both "MX" and "2004" directly in the title. Heck, you can't even build Intel-native projectors with it, which means the Rosetta translation technology, miraculous as it may be, will often mean lesser performance than on PowerPC-based Macs. In light of all that, Director is still a good choice for smaller projects that require rapid development, things like stub projectors that simply serve as a launching interface to CD ROM-based content or Web links, and Rosetta provides perfectly acceptable playback for these types of low-drag applications. As for why one would need to tell the difference between PowerPC and Intel Macs, a very specific example would be to look no further than Adobe's own Reader, which often gets distributed with such CD ROM products and is provided as either a PowerPC or Intel build (not as a single Universal build for both processor types). So, instead of having the user pick which CPU they happen to have, you can have Director call out to the Buddy API Xtra to find out and launch the appropriate installer.

Next question: how?

We're led now to the rather large problem of neither Director nor Buddy API having any native way to discern between PowerPC and Intel-based Macs. As I mentioned before, I consider Buddy API to be absolutely essential for Director development, providing all manner of system-related info and extending Director in myriad useful ways. And while it can do all kinds of things, such as tell which version of Windows or Mac OS it's running on, QuickTime information, file associations, and so on, it won't tell you what kind of processor your Mac has. However, it can determine whether a specific file exists on your system, which is the key to how we're going to solve this specific problem.

So, in theory, all we need to do is look for a file that the Intel version of Mac OS X has that the PowerPC version doesn't. Or vice-versa, as the case may be. And, as it turns out, there is at least one such instance: Intel Macs use EFI (or Extensible Firmware Interface) to boot, while PowerPC Macs don't. Consequently, Intel Macs have a file called boot.efi buried in the system folder, while PowerPC Macs lack such a file. There may be other examples, but boot.efi is something of a "low-hanging fruit," so to speak, and as such is ripe for the picking. So all we need to do is have Director tell Buddy API to look for the boot.efi file where it lives, and if it finds it, we know we're dealing with an Intel Mac. If it's not there, by process of elimination, we've got a PowerPC Mac on our hands. So let's spell out a bare bones example and get to the code to make that happen.

The steps

Let's gather the parts together first. You have to have Director MX 2004, of course, which I'll already assume that you do since you're reading this piece in the first place. You'll also need Buddy API, which you can use in its unregistered form for our purposes today. The unregistered version allows access to two functions, and while I highly recommend purchasing either the seven function or unlimited function version (since you won't be able to limit yourself to only two once you really get into it), two functions are all we'll need for this example. Lastly, it would help to have a PowerPC and an Intel Mac handy, but one or the other will suffice. The code here will work fine regardless of platform, and if you are working on a Windows box and need to know how to set Buddy API up to work in a cross-platform publishing environment, may I direct you to an ancient-but-relevant tutorial I wrote many moons ago:

With the software set up and Buddy API installed, let's move over to Director and get this sucker working. Launch Director and make a new movie (Command+N on Mac/Control+N on Windows), and before we forget, it's a good idea to embed the Buddy API Xtra into the movie right away. Head to the Modify menu, select the Movie submenu, and click on Xtras. This will bring up the Movie Xtras panel. Click the Add button, which will bring up the Add Xtras panel, and select Buddy API Xtra if you're on a Mac or budapi.x32 on Windows (fig. 1). Click OK on both panels to dismiss them, and we're set.


Figure 1: Mac on top, Windows on the bottom, just so you can see things on your preferred OS.


Page: 1 2 Next Page


Related Keywords:director mx 2004, buddy api

HOT THREADS on DMN Forums
Content-type: text/html  Rss  Add to Google Reader or
Homepage    Add to My AOL  Add to Excite MIX  Subscribe in
NewsGator Online 
Real-Time - what users are saying - Right Now!

Our Privacy Policy --- @ Copyright, 2015 Digital Media Online, All Rights Reserved