Exemplo n.º 1
0
LIBAPI bool ImplementAssert(bool test, const wchar *expression, const wchar *funcn, const wchar *file, int line, const wchar *desc)
{
	if (test) return false;
#ifndef _WIN32
	printf("%s\r\n\r\nFunction: %s\r\nFile: %s\r\nLine: %d\r\nExpression: %s\n",desc,funcn,file,line,expression);	
#else
	wchar buff[1024];
	if (desc==0) desc=_W("Assertion failed in following expression:");
	wsprintf(buff,1023,_W("%s(%d): %s: %s\r\n\t%s\r\n"),file,line,funcn,desc,expression);
	OutputDebugString(buff);
	if (SearchInMemory(file, line)==false)
	{
		DWORD threadId;
		wsprintf(buff,1023,_W("%s\r\n\r\nFunction: %s\r\nFile: %s\r\nLine: %d\r\nExpression: %s"),desc,funcn,file,line,expression);	
		HANDLE h=CreateThread(0,0,SafeMessageBox,(LPVOID)buff,0,&threadId);
		WaitForSingleObject(h,INFINITE);
		DWORD res;
		GetExitCodeThread(h,&res);
		CloseHandle(h);
		if (res==IDABORT) ExitProcess(-1);
		if (res==IDRETRY) {return true;}
		if (res==IDYES) SaveToMemory(file,line);
	}
#endif
	return false;
}
 GXBOOL RenderTargetImpl::SaveToFile(GXLPCWSTR szFilePath, GXLPCSTR pImageFormat)
 {
   clstd::MemBuffer buffer;
   if(SaveToMemory(&buffer, pImageFormat))
   {
     clstd::File file;
     if(file.CreateAlways(szFilePath))
     {
       file.Write(buffer);
       return TRUE;
     }
   }
   return FALSE;
 }