David Cook
Well-known member
Hello everyone,
Does anyone know how to detect if an application is running in SheepShaver, Basilisk II, or Mini vMac? I'm writing a serial transfer utility and thought it would be nice to synchronize the real Macintosh's clock when it is connected to an emulated Mac.
For Basilisk II, I notice that it has a decent identifier in PDS slot #0.
The following code works: (I have a library of common routines that start with 'EL_' that check for nil pointers etc. Substitute for whatever you have.)
I assume this is a reliable approach. Does anyone know of a more preferred way?
Does anyone know how to detect SheepShaver or Mini vMac?
Thank you,
David
Does anyone know how to detect if an application is running in SheepShaver, Basilisk II, or Mini vMac? I'm writing a serial transfer utility and thought it would be nice to synchronize the real Macintosh's clock when it is connected to an emulated Mac.
For Basilisk II, I notice that it has a decent identifier in PDS slot #0.
The following code works: (I have a library of common routines that start with 'EL_' that check for nil pointers etc. Substitute for whatever you have.)
bool EL_IsEmulator(void)
{
bool isEmulator = false;
if (EL_IsTrapImplemented(_SlotManager))
{
OSErr errorCheck;
SpBlock slotSearch;
EL_MemoryClear(&slotSearch, sizeof(SpBlock));
slotSearch.spCategory = 1;
errorCheck = SNextTypeSRsrc(&slotSearch);
if (errorCheck == noErr)
{
slotSearch.spID = 2;
errorCheck = SGetCString(&slotSearch);
if (errorCheck == noErr)
{
char* slotNameCStringPtr = (char*) slotSearch.spResult;
if (EL_CStringCompare(slotNameCStringPtr, "Basilisk II Slot ROM", true, false) == 0)
{
isEmulator = true;
}
EL_DisposePtr(&slotNameCStringPtr);
}
}
}
return isEmulator;
}
I assume this is a reliable approach. Does anyone know of a more preferred way?
Does anyone know how to detect SheepShaver or Mini vMac?
Thank you,
David