On May 11, 2006, at 3:16 PM, Jonathan Johnson wrote:
On May 11, 2006, at 3:36 PM, Norman Palardy wrote:
Interestingly enough on my MacBook Pro model holds "PowerMac"
Correct, but on a PowerPC based iMac G5, it yields "PowerMac8,2".
The difference is that all PPC based Macs have a bit of extra
information baked into them. If it's *just* "PowerMac", then it's
Rosetta.
However, the final code is this:
Function IsRosetta() As Boolean
Soft Declare Function sysctl Lib "System.framework" (p1 as Ptr,
p2 as Integer, p3 as Ptr, ByRef p4 as Integer, p5 as Integer, p6 as
Integer) as Integer
Const CTL_HW = 6
Const HW_MODEL = 2
Const Null = 0
dim mib as new MemoryBlock(8)
mib.Long(0) = CTL_HW
mib.Long(4) = HW_MODEL
dim model as new MemoryBlock(32)
dim len as Integer = model.Size
dim theResult as Integer = sysctl(mib, 2, model, len, Null, 0)
Return (theResult = 0) and (StrComp(model.StringValue(0,len),
"PowerMac" + Chr(0), 0) = 0)
End Function
Turns out the length returned includes one null byte at the end.
Ahhh ... ok
That makes more sense then
Thanks
No Gestalt selector that tells this any more ?
No, unfortunately not. All the Gestalt selectors will simply say
that you're on a PPC chip, with no unique identifying features that
are different from a plain-ol' G4.
Bummer since the Gestalt header has selectors for all sorts of chips
including intels
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>