예제 #1
0
void COpenALGameSystem::Shutdown()
{
	if (g_OpenALUpdateThread.IsAlive())
		g_OpenALUpdateThread.CallWorker(COpenALUpdateThread::EXIT);

	AUTO_LOCK_FM(m_vSamples);
	for (int i=0; i < m_vSamples.Count(); i++)
	{
		delete m_vSamples[i];
	}
    
	m_vSamples.RemoveAll();
    
	if (m_alDevice != NULL)
	{
		if (m_alContext != NULL)
		{
			alcMakeContextCurrent(NULL);
			alcDestroyContext(m_alContext);
			m_alContext = NULL;
		}

		alcCloseDevice(m_alDevice);
		m_alDevice = NULL;
	}

	FOR_EACH_LL(m_AudioGroups, i)
	{
		openal_groupdata_t* groupData = m_AudioGroups[i];
		delete groupData;
	}
예제 #2
0
bool COpenALGameSystem::Add(IOpenALSample *sample)
{
	AUTO_LOCK_FM(m_vSamples);
	m_vSamples.AddToTail(sample);
	m_grpGlobal->samples.AddToTail(sample);

	return true;
}
예제 #3
0
void XMemAlloc_RegisterDeallocation( void *p, DWORD dwAllocAttributes )
{
	if ( !g_pMemAlloc )
	{
		// core xallocs cannot be journaled until system is ready
		return;
	}

	AUTO_LOCK_FM( g_XMemAllocMutex );
	int size = XMemSize( p, dwAllocAttributes );
	MemAlloc_RegisterExternalDeallocation( XMem, p, size );
}
예제 #4
0
//-----------------------------------------------------------------------------
//	XBX_IsConsoleConnected
//
//-----------------------------------------------------------------------------
bool CXboxConsole::IsConsoleConnected()
{
	bool bConnected;
 
	if ( g_xbx_dbgValidEvent == NULL )
	{
		// init was never called
		return false;
	}

	AUTO_LOCK_FM( g_xbx_dbgChannelMutex );

	bConnected = ( WaitForSingleObject( g_xbx_dbgValidEvent, 0 ) == WAIT_OBJECT_0 );

	return bConnected;
}
예제 #5
0
bool COpenALGameSystem::Remove(IOpenALSample* sample)
{
    AUTO_LOCK_FM(m_vSamples);

    int index = m_vSamples.Find(sample);

    if (m_vSamples.IsValidIndex(index))
    {
        m_vSamples.Remove(index);
        m_grpGlobal->samples.FindAndRemove(sample);

        delete sample;
        sample = NULL;
    }

    return false;
}
예제 #6
0
//-----------------------------------------------------------------------------
//	XBX_SendRemoteCommand
//
//-----------------------------------------------------------------------------
void CXboxConsole::SendRemoteCommand( const char* dbgCommand, bool async )
{
	char cmdString[XBX_MAX_RCMDLENGTH];

	if ( XBX_NoXBDM() || !IsConsoleConnected() )
		return;

	AUTO_LOCK_FM( g_xbx_dbgChannelMutex );

	_snprintf( cmdString, sizeof( cmdString ), "%s!%s", XBX_DBGCOMMANDPREFIX, dbgCommand );
	HRESULT hr = DmSendNotificationString( cmdString );
	if ( FAILED( hr ) )
	{
		XBX_Error( "XBX_SendRemoteCommand: failed on %s", cmdString );
	}

	// wait for command completion
	if ( !async )
	{
		if (WaitForSingleObject( g_xbx_dbgCmdCompleteEvent, 5000 ) == WAIT_TIMEOUT)
		{
			// EGR Aug 22, 2007. debug failsafe added to prevent the console from mysteriously deadlocking during tests: 
			// this will hang rather than halt: XBX_Error("XBX_SendRemoveCommant: timed out waiting for `%s` to complete", cmdString);
			// and these will also deadlock because the debug channel is inaccesssible:
			/*
			XBX_DebugString( XMAKECOLOR(255,0,0), "XBX_SendRemoveCommant: timed out waiting for `" );
			XBX_DebugString( XMAKECOLOR(255,0,0), cmdString );
			XBX_DebugString( XMAKECOLOR(255,0,0), "` to complete.\n" );
			XBX_FlushDebugOutput();

			DebuggerBreakIfDebugging();
			*/

			// so we have no choice but to dump core:
			DmCrashDump(false);
		}
	}
}
예제 #7
0
//-----------------------------------------------------------------------------
//	_DebugCommandHandler
//
//-----------------------------------------------------------------------------
HRESULT __stdcall _DebugCommandHandler( const CHAR* strCommand, CHAR* strResponse, DWORD dwResponseLen, PDM_CMDCONT pdmcc )
{
	CHAR			buff[256];
	CHAR*			args[8];
	int				numArgs;

	AUTO_LOCK_FM( g_xbx_dbgCommandHandlerMutex );

    // skip over the command prefix and the exclamation mark
    strCommand += _xdbg_strlen( XBX_DBGCOMMANDPREFIX ) + 1;

	if ( strCommand[0] == '\0' )
	{
		// just a ping
		goto cleanUp;
	}

	// get command and optional arguments
	_xdbg_strcpyn( buff, strCommand, sizeof( buff ) );
	numArgs = _xdbg_tokenize( buff, args, sizeof( args )/sizeof( CHAR* ) );

    if ( _xdbg_strnicmp( args[0], "__connect__", 11 ) )
    {
		if ( numArgs > 1 && atoi( args[1] ) == VXCONSOLE_PROTOCOL_VERSION )
		{
			// initial connect - respond that we're connected
			_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "Connected To Application.", dwResponseLen );
			SetEvent( g_xbx_dbgValidEvent );

			// notify convar system to send its commands
			// allows vxconsole to re-connect during game
			_xdbg_strcpy( g_xbx_dbgRemoteBuf, "getcvars" );
			XBX_QueueEvent( XEV_REMOTECMD, ( int )g_xbx_dbgRemoteBuf, 0, 0 );
		}
		else
		{
			_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "Rejecting Connection: Wrong Protocol Version.", dwResponseLen );
		}
		goto cleanUp;
    }

	if ( _xdbg_strnicmp( args[0], "__disconnect__", 14 ) )
    {
		// respond that we're disconnected
        _xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "Disconnected.", dwResponseLen );
		ResetEvent( g_xbx_dbgValidEvent );
		goto cleanUp;
    }

    if ( _xdbg_strnicmp( args[0], "__complete__", 12 ) )
    {
		// remote server has finished command - respond to acknowledge
		_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "OK", dwResponseLen );

		// set the complete event - allows expected synchronous calling mechanism
		SetEvent( g_xbx_dbgCmdCompleteEvent );
        goto cleanUp;
    }

    if ( _xdbg_strnicmp( args[0], "__memory__", 10 ) )
    {		
		// get a current stat of available memory
		MEMORYSTATUS stat;
		GlobalMemoryStatus( &stat );
		g_xbx_freeMemory = stat.dwAvailPhys;

		if ( _xdbg_findtoken( args, numArgs, "quiet" ) > 0 )
		{
			_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "OK", dwResponseLen );
		}
		else
		{
			// 32 MB is reserved and fixed by OS, so not reporting
			_snprintf( strResponse, dwResponseLen, XBX_DBGRESPONSEPREFIX "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB", 
				stat.dwTotalPhys/( 1024.0f*1024.0f ) - 32.0f,
				( stat.dwTotalPhys - stat.dwAvailPhys )/( 1024.0f*1024.0f ) - 32.0f, 
				stat.dwAvailPhys/( 1024.0f*1024.0f ) );
		}
		goto cleanUp;
	}

	if ( g_xbx_dbgRemoteBuf[0] )
	{
		// previous command still pending
		_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "Cannot execute: Previous command still pending", dwResponseLen );
	}
	else
	{
		// add the command to the event queue to be processed by main app
		_xdbg_strcpy( g_xbx_dbgRemoteBuf, strCommand );
		XBX_QueueEvent( XEV_REMOTECMD, ( int )g_xbx_dbgRemoteBuf, 0, 0 );
		_xdbg_strcpyn( strResponse, XBX_DBGRESPONSEPREFIX "OK", dwResponseLen );
	}

cleanUp:
    return XBDM_NOERR;
}