If you build plugins for WarpOS, the hwPluginAPI
pointer that is passed to your
InitPlugin() will contain function pointers to PPC code. However,
many of these function pointers will immediately do a context switch and run on
the 68k context. You might already be aware of the fact that context switches are
quite expensive so you should do your best to minimize the number of context switches
your plugin has to perform. To achieve this, you need to know which of the functions
in the hwPluginAPI
base pointer run PPC-native and which of them need a context
switch. So here's an overview on the functions that don't need a context switch.
All other functions not listed here will immediately perform a context switch.
CRTBase:
malloc()
, calloc()
,
realloc()
, free()
, strdup()
, qsort()
, stricmp()
, strnicmp()
, toupper()
, tolower()
,
strtolower()
, strtoupper()
, gettimeofday()
, time()
, lrint()
, strtol()
,
strtoul()
, strtod()
, vsscanf()
, vsnprintf()
, atol()
, dtostr()
.
SysBase:
hw_GetSysTime()
,
hw_SubTime()
, hw_AddTime()
, hw_CmpTime()
, hw_Delay()
, hw_MasterControl()
(but this
function is only PPC-native when querying the HWMCP_GETPOWERPCBASE
tag to make Hollywood return its PowerPCBase
pointer to you), hw_TrackedAlloc()
, hw_TrackedFree()
,
hw_AllocSemaphore()
, hw_FreeSemaphore()
, hw_LockSemaphore()
, hw_UnLockSemaphore()
.
DOSBase:
GfxBase:
AudioBase:
RequesterBase:
FontBase:
FT2Base:
FT2Base
for WarpOS is not available before Hollywood 5.3.
You need to make sure that your plugin was opened by Hollywood 5.3 at
least before trying to make any calls in FT2Base
.
LuaBase:
ZBase:
JPEGBase:
PluginBase:
UtilityBase:
hw_CRC32()
,
hw_DecodeBase64()
, hw_EncodeBase64()
, and hw_MD5()
. The other functions
are implemented in 68k code and will do a context switch.
UnicodeBase:
LocaleBase:
Also, be careful about structure alignment when developing for WarpOS. The WarpOS version of Hollywood doesn't use the traditional Amiga structure alignment of 2 bytes but is optimized for performance. This means, for example, that 64-bit double values will always be aligned on an 8 byte boundary.