Exemplo n.º 1
0
// DllInitialize isn't called/used for user mode version.
BOOL WINAPI DllInitialize(ULONG ulReason)
{
    BOOL    bRet = TRUE;

	switch(ulReason)
	{
		case DLL_PROCESS_ATTACH:
            VERBOSE(DLLTEXT("Process attach.\r\n"));

            // In kernel mode version, initializes semaphore.
            INIT_CRITICAL_SECTION();
            bRet = IS_VALID_CRITICAL_SECTION();
            break;

		case DLL_THREAD_ATTACH:
            VERBOSE(DLLTEXT("Thread attach.\r\n"));
			break;

		case DLL_PROCESS_DETACH:
            VERBOSE(DLLTEXT("Process detach.\r\n"));

            // In kernel mode version, deletes semaphore.
            DELETE_CRITICAL_SECTION();
			break;

		case DLL_THREAD_DETACH:
            VERBOSE(DLLTEXT("Thread detach.\r\n"));
			break;
	}

	return bRet;
}
Exemplo n.º 2
0
void timer_close()
{
	if ( Timer_inited )	{
		Timer_inited = 0;
#ifdef _WIN32
		timeEndPeriod(precision); 
#endif
		DELETE_CRITICAL_SECTION( Timer_lock );
	}
}
Exemplo n.º 3
0
// Close down the audiostream system.  Must call audiostream_init() before any audiostream functions can
// be used.
void audiostream_close()
{
	int i;
	if (Audiostream_inited == 0)
		return;

	for (i = 0; i < MAX_AUDIO_STREAMS; i++)
	{
		if (Audio_streams[i].status == ASF_USED)
		{
			Audio_streams[i].status = ASF_FREE;
			Audio_streams[i].Destroy();
		}
	}

	// Destroy AudioStreamServices object
	if (m_pass)
	{
		vm_free(m_pass);
		m_pass = NULL;
	}

	// free global buffers
	if (Wavedata_load_buffer)
	{
		vm_free(Wavedata_load_buffer);
		Wavedata_load_buffer = NULL;
	}

	if (Wavedata_service_buffer)
	{
		vm_free(Wavedata_service_buffer);
		Wavedata_service_buffer = NULL;
	}

	if (Compressed_buffer)
	{
		vm_free(Compressed_buffer);
		Compressed_buffer = NULL;
	}

	if (Compressed_service_buffer)
	{
		vm_free(Compressed_service_buffer);
		Compressed_service_buffer = NULL;
	}

	DELETE_CRITICAL_SECTION(Global_service_lock);

	Audiostream_inited = 0;
}
Exemplo n.º 4
0
void mouse_close()
{
	if (!mouse_inited)
		return;

#ifdef WIN32
	if (Mouse_mode == MOUSE_MODE_DI)
		di_cleanup();
#endif

	mouse_inited = 0;

	DELETE_CRITICAL_SECTION( mouse_lock );
}
Exemplo n.º 5
0
void key_close()
{
	if ( !key_inited ) return;

	#ifdef USE_DIRECTINPUT
		di_cleanup();
	#endif

	if ( Key_numlock_was_on ) {
		key_turn_on_numlock();
		Key_numlock_was_on = 0;
	}

	key_inited = 0;

	DELETE_CRITICAL_SECTION( key_lock );
}
Exemplo n.º 6
0
// called at shutdown. Makes sure all thread processing terminates.
void os_deinit()
{
	DELETE_CRITICAL_SECTION( Os_lock );

	SDL_Quit();
}
Exemplo n.º 7
0
// Destructor
AudioStream::~AudioStream(void)
{
	DELETE_CRITICAL_SECTION(write_lock);
}