rem: MixBackend  = MB_MORPHOS; }
add: MixBackend  = MB_NATIVE; }  #if defined( ENABLE_WARPUP )
context: OpenLibs ( void ){  /* Intuition Library */  IntuitionBase = (struct IntuitionBase *) OpenLibrary( "intuition.library", 37 );  if( IntuitionBase == NULL)  {    Alert(AN_Unknown|AG_OpenLib|AO_Intuition);    return FALSE;  }  /* DOS Library */  DOSBase = (struct DosLibrary *) OpenLibrary( "dos.library", 37 );  if( DOSBase == NULL)  {    Req( "Unable to open 'dos.library'." );    return FALSE;  }  /* Graphics Library */  GfxBase = (struct GfxBase *) OpenLibrary( "graphics.library", 37 );  if( GfxBase == NULL)  {    Req( "Unable to open 'graphics.library'." );    return FALSE;  }  /* GadTools Library */  GadToolsBase = OpenLibrary( "gadtools.library", 37 );  if( GadToolsBase == NULL)  {    Req( "Unable to open 'gadtools.library'." );    return FALSE;  }  /* IFFParse Library */  IFFParseBase = OpenLibrary( "iffparse.library", 37 );  if( IFFParseBase == NULL)  {    Req( "Unable to open 'iffparse.library'." );    return FALSE;  }  /* Locale Library */  LocaleBase = (struct LocaleBase*) OpenLibrary( "locale.library", 38 );  /* Timer Device */  TimerIO = (struct timerequest *) AllocVec( sizeof(struct timerequest),                                             MEMF_PUBLIC | MEMF_CLEAR );  if( TimerIO == NULL)  {    Req( "Out of memory." );    return FALSE;  }  timeval = (struct timeval *) AllocVec( sizeof(struct timeval),                                         MEMF_PUBLIC | MEMF_CLEAR);  if( timeval == NULL)  {    Req( "Out of memory." );    return FALSE;  }  if( OpenDevice( "timer.device",                  UNIT_MICROHZ,                  (struct IORequest *)                  TimerIO,                  0) != 0 )  {    Req( "Unable to open 'timer.device'." );    return FALSE;  }  TimerBase = (struct Device *) TimerIO->tr_node.io_Device;  /* Utility Library */  UtilityBase = (struct UtilityBase *) OpenLibrary( "utility.library", 37 );  if( UtilityBase == NULL)  {    Req( "Unable to open 'utility.library'." );    return FALSE;  }  // Fill in some defaults...  AddByteMonoPtr         = AddByteMono;  AddByteStereoPtr       = AddByteStereo;  AddBytesMonoPtr        = AddBytesMono;  AddBytesStereoPtr      = AddBytesStereo;  AddWordMonoPtr         = AddWordMono;  AddWordStereoPtr       = AddWordStereo;  AddWordsMonoPtr        = AddWordsMono;  AddWordsStereoPtr      = AddWordsStereo;  AddByteMonoBPtr        = AddByteMonoB;  AddByteStereoBPtr      = AddByteStereoB;  AddBytesMonoBPtr       = AddBytesMonoB;  AddBytesStereoBPtr     = AddBytesStereoB;  AddWordMonoBPtr        = AddWordMonoB;  AddWordStereoBPtr      = AddWordStereoB;  AddWordsMonoBPtr       = AddWordsMonoB;  AddWordsStereoBPtr     = AddWordsStereoB;  AddLofiByteMonoPtr     = AddLofiByteMono;  AddLofiByteStereoPtr   = AddLofiByteStereo;  AddLofiBytesMonoPtr    = AddLofiBytesMono;  AddLofiBytesStereoPtr  = AddLofiBytesStereo;  AddLofiWordMonoPtr     = AddLofiWordMono;  AddLofiWordStereoPtr   = AddLofiWordStereo;  AddLofiWordsMonoPtr    = AddLofiWordsMono;  AddLofiWordsStereoPtr  = AddLofiWordsStereo;  AddLofiByteMonoBPtr    = AddLofiByteMonoB;  AddLofiByteStereoBPtr  = AddLofiByteStereoB;  AddLofiBytesMonoBPtr   = AddLofiBytesMonoB;  AddLofiBytesStereoBPtr = AddLofiBytesStereoB;  AddLofiWordMonoBPtr    = AddLofiWordMonoB;  AddLofiWordStereoBPtr  = AddLofiWordStereoB;  AddLofiWordsMonoBPtr   = AddLofiWordsMonoB;  AddLofiWordsStereoBPtr = AddLofiWordsStereoB;  /* MorphOS/PowerUp/WarpOS loading     Strategy:      1) If MorphOS is running, use it.      2) If PowerUp is running, but not WarpUp, use the m68k core      3) If neither of them are running, try WarpUp.  */  // Check if MorpOS/PowerUp/WarpUp is running.  {    struct Library* ppclib     = NULL;    struct Library* powerpclib = NULL;    Forbid();    MorphOSRes  = FindResident( "MorphOS" );        powerpclib = (struct Library *) FindName( &SysBase->LibList,                                              "powerpc.library" );    ppclib     = (struct Library *) FindName( &SysBase->LibList,                                              "ppc.library" );    Permit();    if( MorphOSRes == NULL && ! ( ppclib != NULL && powerpclib == NULL ) )    {      // Open WarpUp (but not if MorphOS or PowerUp is active)      PowerPCBase = OpenLibrary( "powerpc.library", 15 );    }  }  if( MorphOSRes != NULL )  {    MixBackend  = MB_MORPHOS;  }  else if( PowerPCBase != NULL )  {    MixBackend = MB_WARPUP;    /* Load our code to PPC..  */    PPCObject = AHILoadObject( "DEVS:ahi.device.elf" );    if( PPCObject != NULL )    {      ULONG* version = NULL;      ULONG* revision = NULL;      int r = ~0;      AHIGetELFSymbol( "__LIB_Version", (void*) &version );      AHIGetELFSymbol( "__LIB_Revision", (void*) &revision );          if( version != NULL && revision != NULL )      {        if( *version == Version && *revision == Revision )        {          r &= GetSymbol( AddByteMono     );          r &= GetSymbol( AddByteStereo   );          r &= GetSymbol( AddBytesMono    );          r &= GetSymbol( AddBytesStereo  );          r &= GetSymbol( AddWordMono     );          r &= GetSymbol( AddWordStereo   );          r &= GetSymbol( AddWordsMono    );          r &= GetSymbol( AddWordsStereo  );          r &= GetSymbol( AddByteMonoB    );          r &= GetSymbol( AddByteStereoB  );          r &= GetSymbol( AddBytesMonoB   );          r &= GetSymbol( AddBytesStereoB );          r &= GetSymbol( AddWordMonoB    );          r &= GetSymbol( AddWordStereoB  );          r &= GetSymbol( AddWordsMonoB   );          r &= GetSymbol( AddWordsStereoB );          r &= GetSymbol( AddLofiByteMono     );          r &= GetSymbol( AddLofiByteStereo   );          r &= GetSymbol( AddLofiBytesMono    );          r &= GetSymbol( AddLofiBytesStereo  );          r &= GetSymbol( AddLofiWordMono     );          r &= GetSymbol( AddLofiWordStereo   );          r &= GetSymbol( AddLofiWordsMono    );          r &= GetSymbol( AddLofiWordsStereo  );          r &= GetSymbol( AddLofiByteMonoB    );          r &= GetSymbol( AddLofiByteStereoB  );          r &= GetSymbol( AddLofiBytesMonoB   );          r &= GetSymbol( AddLofiBytesStereoB );          r &= GetSymbol( AddLofiWordMonoB    );          r &= GetSymbol( AddLofiWordStereoB  );          r &= GetSymbol( AddLofiWordsMonoB   );          r &= GetSymbol( AddLofiWordsStereoB );          if( r != 0 )          {            char buffer[ 2 ] = "0";                    GetVar( "PowerPC/UseDisable", buffer, sizeof buffer, 0 );                    if( buffer[ 0 ] == '1' )            {              // OK, then...            }            else            {              Req( "The WarpUp variable 'PowerPC/UseDisable' must be '1'." );              AHIUnloadObject( PPCObject );              PPCObject  = NULL;              MixBackend = MB_NATIVE;            }          }          else          {            Req( "Unable to fetch all symbols from ELF object." );            AHIUnloadObject( PPCObject );            PPCObject  = NULL;            MixBackend = MB_NATIVE;          }        }        else        {          Req( "'ahi.device.elf' version %ld.%ld doesn't match "               "'ahi.device' version %ld.%ld.",               *version, *revision, Version, Revision );          AHIUnloadObject( PPCObject );          PPCObject  = NULL;          MixBackend = MB_NATIVE;        }      }      else      {        Req( "Unable to fetch version information from 'ahi.device.elf'." );        AHIUnloadObject( PPCObject );        PPCObject  = NULL;        MixBackend = MB_NATIVE;      }    }    else    {      MixBackend = MB_NATIVE;    }  }  else   {    MixBackend = MB_NATIVE;  }  OpenahiCatalog(NULL, NULL);  {    char buf[2];        if( GetVar( "AHINoBetaRequester", buf, sizeof( buf ), 0 ) == -1 )    {      const char* backend = "Internal error";      switch( MixBackend )      {        case MB_NATIVE:          backend = "AmigaOS/" CPU;          break;        case MB_WARPUP:          backend = "WarpUp";          break;                  case MB_MORPHOS:          backend = "MorphOS/" CPU;          break;      }      Req( "This is a beta release of AHI. The latest supported \n"           "version is 4.180, which can be found at\n"           "<URL:http://www.lysator.liu.se/~lcs/ahi.html>.\n"           "\n"           "Detailed bug reports and patches are welcome.\n"           "Sound kernel in use: %s.\n"           "\n"           "/Martin Blom <martin@blom.org>\n",           backend );    }  }  return TRUE;}