void CCodeCheckpointDebugMgr::ReadFile(const char* fileName)
{
	FILE * cpFile = gEnv->pCryPak->FOpen(fileName, "r");

	if(cpFile)
	{
		// Temporary buffer
		//char cBuffer[BUFF_SIZE];

		char* lineBlock = new char[BUFF_SIZE + 1];
		//char* appendBlock = lineBlock;

		while(int numRead = GetLine(lineBlock, cpFile))
		{
			ICodeCheckpointMgr* pCheckpointManager = gEnv->pCodeCheckpointMgr;
			if(pCheckpointManager)
				pCheckpointManager->GetCheckpointIndex(lineBlock);
			RegisterWatchPoint(lineBlock);
		}

		SAFE_DELETE_ARRAY(lineBlock);

		gEnv->pCryPak->FClose(cpFile);

	}
}
Esempio n. 2
0
void CFlowNode_WatchCodeCheckpoint::ResolveCheckpointStatus()
{
	if(!m_pCheckPoint)
	{
		ICodeCheckpointMgr *pCodeCheckpointMgr = gEnv->pCodeCheckpointMgr;

		if(pCodeCheckpointMgr)
		{
			// If handle is invalid (indicates first update)
			if(m_checkPointIdx == ~0)
			{
				string name(GetPortString(&m_actInfo, eInputPorts_Name));

				// And we have a name
				if(!name.empty())
				{
					// Query the code checkpoint manager for a handle to the CCCPOINT
					m_checkPointIdx = pCodeCheckpointMgr->GetCheckpointIndex(name.c_str());
					m_checkpointName = name;
					m_pCheckPoint = pCodeCheckpointMgr->GetCheckpoint(m_checkPointIdx);
				}
			}

			// Ensure we have a valid handle (GetHandle() should always return a valid handle)
			CRY_ASSERT(m_checkPointIdx != ~0);

			// If no checkpoint instance yet resolved
			if(!m_pCheckPoint)
			{
				// Query the manager for checkpoint using the handle
				m_pCheckPoint = pCodeCheckpointMgr->GetCheckpoint(m_checkPointIdx);
			}
		}
	}

	//Inform the code checkpoint debug manager that we want to observe this point
	if(!m_watchRequested)
	{
		CCodeCheckpointDebugMgr::RetrieveCodeCheckpointDebugMgr()->RegisterWatchPoint(m_checkpointName);
		m_watchRequested = true;
	}
}