Esempio n. 1
0
File: qal.c Progetto: jayschwa/q2pro
QALC_IMP
#undef QAL

#define QAL(type, func)  type q##func
QAL_IMP
#undef QAL

void QAL_Shutdown(void)
{
    if (context) {
        qalcMakeContextCurrent(NULL);
        qalcDestroyContext(context);
        context = NULL;
    }
    if (device) {
        qalcCloseDevice(device);
        device = NULL;
    }

#define QAL(type, func)  q##func = NULL
    QALC_IMP
    QAL_IMP
#undef QAL

    if (handle) {
        Sys_FreeLibrary(handle);
        handle = NULL;
    }

    if (al_driver)
        al_driver->flags &= ~CVAR_SOUND;
    if (al_device)
        al_device->flags &= ~CVAR_SOUND;
}
Esempio n. 2
0
/*
==============
Eng_KillEngine

Load failure on engine
==============
*/
void Eng_KillEngine( long *phMod )
{
	Sys_FreeLibrary( ghMod );
	ghMod = *phMod = 0;

	Eng_LoadStubs();
}
Esempio n. 3
0
/*
==============
Eng_Unload

Free engine .dll and reset interfaces
==============
*/
void Eng_Unload(void)
{
	if ( ghMod )
	{
		Sys_FreeLibrary(ghMod);
		ghMod = 0;
	}

	Eng_LoadStubs();

	gDLLState		= 0;
	gDLLStateInfo	= 0;
}
Esempio n. 4
0
//=======================================================================
//			DLL'S MANAGER SYSTEM
//=======================================================================
qboolean Sys_LoadLibrary( dll_info_t *dll )
{
	const dllfunc_t	*func;
	string		errorstring;

	// check errors
	if( !dll ) return false;	// invalid desc
	if( dll->link ) return true;	// already loaded

	if( !dll->name || !*dll->name )
		return false; // nothing to load

	MsgDev( D_NOTE, "Sys_LoadLibrary: Loading %s", dll->name );

	if( dll->fcts ) 
	{
		// lookup export table
		for( func = dll->fcts; func && func->name != NULL; func++ )
			*func->func = NULL;
	}

	if( !dll->link ) dll->link = LoadLibrary ( dll->name ); // environment pathes

	// no DLL found
	if( !dll->link ) 
	{
		Q_snprintf( errorstring, sizeof( errorstring ), "Sys_LoadLibrary: couldn't load %s\n", dll->name );
		goto error;
	}

	// Get the function adresses
	for( func = dll->fcts; func && func->name != NULL; func++ )
	{
		if( !( *func->func = Sys_GetProcAddress( dll, func->name )))
		{
			Q_snprintf( errorstring, sizeof( errorstring ), "Sys_LoadLibrary: %s missing or invalid function (%s)\n", dll->name, func->name );
			goto error;
		}
	}
          MsgDev( D_NOTE, " - ok\n" );

	return true;
error:
	MsgDev( D_NOTE, " - failed\n" );
	Sys_FreeLibrary( dll ); // trying to free 
	if( dll->crash ) Sys_Error( errorstring );
	else MsgDev( D_ERROR, errorstring );			

	return false;
}
Esempio n. 5
0
/*
==================
SNDDMA_FreeSound
==================
*/
void SNDDMA_FreeSound( void )
{
	if( pDS )
	{
		DS_DestroyBuffers();
		pDS->lpVtbl->Release( pDS );
		Sys_FreeLibrary( &dsound_dll );
	}

	pDS = NULL;
	pDSBuf = NULL;
	pDSPBuf = NULL;
	lpData = NULL;
	lpWaveHdr = NULL;
}
Esempio n. 6
0
void QAL_Shutdown (void)
{
    if (context)
	{
        qalcMakeContextCurrent (NULL);
        qalcDestroyContext (context);
        context = NULL;
    }
	
    if (device)
	{
        qalcCloseDevice (device);
        device = NULL;
    }

#define QAL(type,func)  q##func = NULL;
QALC_IMP
QAL_IMP
#undef QAL

    Sys_FreeLibrary (handle);
    handle = NULL;
}
Esempio n. 7
0
GameModule::~GameModule() {
	Sys_FreeLibrary(ptModuleHandle);
}
Esempio n. 8
0
/*
 * Shuts OpenAL down, frees all context and
 * device handles and unloads the shared lib.
 */
void
QAL_Shutdown()
{
    if (context)
   	{
        qalcMakeContextCurrent( NULL );
        qalcDestroyContext( context );
        context = NULL;
    }

	if (device)
	{
        qalcCloseDevice( device );
        device = NULL;
    }

	/* Disconnect function pointers used
	   for OpenAL management calls */
	qalcCreateContext = NULL;
	qalcMakeContextCurrent = NULL;
	qalcProcessContext = NULL;
	qalcSuspendContext = NULL;
	qalcDestroyContext = NULL;
	qalcGetCurrentContext = NULL;
	qalcGetContextsDevice = NULL;
	qalcOpenDevice = NULL;
	qalcCloseDevice = NULL;
	qalcGetError = NULL;
	qalcIsExtensionPresent = NULL;
	qalcGetProcAddress = NULL;
	qalcGetEnumValue = NULL;
	qalcGetString = NULL;
	qalcGetIntegerv = NULL;
	qalcCaptureOpenDevice = NULL;
	qalcCaptureCloseDevice = NULL;
	qalcCaptureStart = NULL;
	qalcCaptureStop = NULL;
	qalcCaptureSamples = NULL;

	/* Disconnect OpenAL
	 * function pointers */
	qalEnable = NULL;
	qalDisable = NULL;
	qalIsEnabled = NULL;
	qalGetString = NULL;
	qalGetBooleanv = NULL;
	qalGetIntegerv = NULL;
	qalGetFloatv = NULL;
	qalGetDoublev = NULL;
	qalGetBoolean = NULL;
	qalGetInteger = NULL;
	qalGetFloat = NULL;
	qalGetDouble = NULL;
	qalGetError = NULL;
	qalIsExtensionPresent = NULL;
	qalGetProcAddress = NULL;
	qalGetEnumValue = NULL;
	qalListenerf = NULL;
	qalListener3f = NULL;
	qalListenerfv = NULL;
	qalListeneri = NULL;
	qalListener3i = NULL;
	qalListeneriv = NULL;
	qalGetListenerf = NULL;
	qalGetListener3f = NULL;
	qalGetListenerfv = NULL;
	qalGetListeneri = NULL;
	qalGetListener3i = NULL;
	qalGetListeneriv = NULL;
	qalGenSources = NULL;
	qalDeleteSources = NULL;
	qalIsSource = NULL;
	qalSourcef = NULL;
	qalSource3f = NULL;
	qalSourcefv = NULL;
	qalSourcei = NULL;
	qalSource3i = NULL;
	qalSourceiv = NULL;
	qalGetSourcef = NULL;
	qalGetSource3f = NULL;
	qalGetSourcefv = NULL;
	qalGetSourcei = NULL;
	qalGetSource3i = NULL;
	qalGetSourceiv = NULL;
	qalSourcePlayv = NULL;
	qalSourceStopv = NULL;
	qalSourceRewindv = NULL;
	qalSourcePausev = NULL;
	qalSourcePlay = NULL;
	qalSourceStop = NULL;
	qalSourceRewind = NULL;
	qalSourcePause = NULL;
	qalSourceQueueBuffers = NULL;
	qalSourceUnqueueBuffers = NULL;
	qalGenBuffers = NULL;
	qalDeleteBuffers = NULL;
	qalIsBuffer = NULL;
	qalBufferData = NULL;
	qalBufferf = NULL;
	qalBuffer3f = NULL;
	qalBufferfv = NULL;
	qalBufferi = NULL;
	qalBuffer3i = NULL;
	qalBufferiv = NULL;
	qalGetBufferf = NULL;
	qalGetBuffer3f = NULL;
	qalGetBufferfv = NULL;
	qalGetBufferi = NULL;
	qalGetBuffer3i = NULL;
	qalGetBufferiv = NULL;
	qalDopplerFactor = NULL;
	qalDopplerVelocity = NULL;
	qalSpeedOfSound = NULL;
	qalDistanceModel = NULL;
	qalGenFilters = NULL;
	qalFilteri = NULL;
	qalFilterf = NULL;
	qalDeleteFilters = NULL;

	if (handle)
	{
		/* Unload the shared lib */
		Sys_FreeLibrary(handle);
		handle = NULL;
	}
}
Esempio n. 9
0
/*
==============
Eng_Load

Try to load the engine with specified command line, etc. etc. and the specified .dll
==============
*/
int Eng_Load( const char *cmdline, struct exefuncs_s *pef, int memory, void *pmembase, const char *psz, int iSubMode )
{
	char	szLastDLL[ 100 ];
	long hMod = (long)NULL;

#if defined( _DEBUG )
	char *p;

	if ( psz && !stricmp( psz, "swds.dll" ) && CheckParm( "-force", &p ) && p )
	{
		psz = p;
	}
#endif

	// Are we loading a different engine?
	if ( psz && ghMod && !strcmp( psz, szLastDLL ) )
	{
		return 1;
	}

	if ( ghMod )
	{
		Eng_KillEngine( &hMod );
	}
	
	if ( !psz )
	{
		hMod = 0;
		Eng_LoadStubs();
	}
	else if ( !ghMod )
	{
		hMod = Sys_LoadLibrary( (char *)psz );
		if ( !hMod )
		{
			return 0;
		}

		// Load function table from engine
		if ( !Eng_LoadFunctions( hMod ) )
		{
			Sys_FreeLibrary( hMod );
			Eng_LoadStubs();
			return 0;
		}

		// Activate engine
		Eng_SetState( DLL_ACTIVE );
	}

	Eng_SetSubState( iSubMode );

	snprintf( szLastDLL, sizeof( szLastDLL ), "%s", psz );

	ghMod		= hMod;

	if ( ghMod )
	{
		static char *szEmpty = "";

		char *p = (char *)cmdline;
		if ( !p )
		{
			p = szEmpty;
		}

		if ( !engineapi.Game_Init( p, (unsigned char *)pmembase, memory, pef, NULL, 1) )
		{
			Sys_FreeLibrary(ghMod);
			ghMod = hMod = 0;
			return 0;
		}
		
		if ( engineapi.SetStartupMode )
		{
			engineapi.SetStartupMode( 1 );
		}
		
		if ( engineapi.Host_Frame )
		{
			Eng_Frame( 1, 0.05 );
		}

		if ( engineapi.SetStartupMode )
		{
			engineapi.SetStartupMode( 0 );
		}
	}
	return 1;
}