EXPORT_C TInt CTestUtils::DisplayMenu(const TDesC& aTitle, TInt aMaxAttempts, TBool aAllowExit, TBool aClearScreenBefore, TBool aClearScreenAfter)
	{
	TBool logToFile = SetLogToFile(EFalse);
	TInt ret = DoDisplayMenu(aTitle, aMaxAttempts, aAllowExit, aClearScreenBefore, aClearScreenAfter);
	SetLogToFile(logToFile);
	return ret;
	}
Beispiel #2
0
void Logger::StartLogFile()
{
	const WCHAR* filePath = m_LogFilePath.c_str();
	if (_waccess(filePath, 0) == -1)
	{
		// Create empty log file.
		HANDLE file = CreateFile(filePath, GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
		if (file != INVALID_HANDLE_VALUE)
		{
			CloseHandle(file);
		}
		else
		{
			const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath);
			GetRainmeter().ShowMessage(nullptr, text.c_str(), MB_OK | MB_ICONERROR);
			SetLogToFile(false);
			return;
		}
	}

	SetLogToFile(true);
}
Beispiel #3
0
void Logger::DeleteLogFile()
{
	const WCHAR* filePath = m_LogFilePath.c_str();
	if (_waccess(filePath, 0) != -1)
	{
		const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath);
		const int res = GetRainmeter().ShowMessage(nullptr, text.c_str(), MB_YESNO | MB_ICONQUESTION);
		if (res == IDYES)
		{
			SetLogToFile(false);
			System::RemoveFile(m_LogFilePath);
		}
	}
}
Beispiel #4
0
void Logger::StopLogFile()
{
	SetLogToFile(false);
}
Beispiel #5
0
//=====================================================================================
LRESULT APIENTRY DebuggerDialog(HWND hDlg, unsigned message, LONG wParam, LONG lParam)
{
#ifndef _XBOX
	int i;
	int thingToDump;
	char temp[300];
	hWndDlg = hDlg;
	switch(message)
	{
	case WM_INITDIALOG:
		myDialogWnd = hDlg;
		sprintf(temp,"%s Debug %s",project_name, FILE_VERSION) ;
		SetWindowText(myDialogWnd, temp );
		SendDlgItemMessage(hDlg, IDC_LOG_COMBINERS, BM_SETCHECK, logCombiners ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_SETCHECK, logTriangles ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_TEXTURE_BUFFER, BM_SETCHECK, logTextureBuffer ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_SETCHECK, logVertex ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_TO_SCREEN, BM_SETCHECK, logToScreen ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_TO_FILE, BM_SETCHECK, logToFile ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_MATRIX, BM_SETCHECK, logMatrix ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_ENABLE_TEXTURE, BM_SETCHECK, debuggerEnableTexture ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_ZBUFFER, BM_SETCHECK, debuggerEnableZBuffer ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_CULLFACE, BM_SETCHECK, debuggerEnableCullFace ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_TEST_TRIS, BM_SETCHECK, debuggerEnableTestTris ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_ALPHA_TEST, BM_SETCHECK, debuggerEnableAlphaTest ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_WARNING, BM_SETCHECK, logWarning ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_SETCHECK, logTextures ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_SETCHECK, logUcodes ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_MICROCODE, BM_SETCHECK, logMicrocode ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_CONT_W_UNKNOWN, BM_SETCHECK, debuggerContinueWithUnknown ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_LOG_FOG, BM_SETCHECK, logFog ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_DETAILS, BM_SETCHECK, logDetails ? BST_CHECKED : BST_UNCHECKED, 0);
		SendDlgItemMessage(hDlg, IDC_WINFRAME, BM_SETCHECK, options.bWinFrameMode ? BST_CHECKED : BST_UNCHECKED, 0);

		SetDlgItemText(hDlg, IDC_MSG, "");
		SetDlgItemText(hDlg, IDC_BREAK_AT_COUNT, "");
		SetDlgItemText(hDlg, IDC_BREAK_AT_MUX, "");
		
		for( i=0; i<numberOfNextOthers; i++ )
		{ 
			SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_INSERTSTRING, i, (LPARAM) otherNexts[i]);
		}
		SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_SETCURSEL, NEXT_FLUSH_TRI, 0);

		for( i=0; i<numberOfThingsToDump; i++ )
		{ 
			SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_INSERTSTRING, i, (LPARAM) thingsToDump[i]);
		}
		SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_SETCURSEL, DUMP_CUR_TEXTURE_RGBA, 0);

		SetLogToFile(logToFile);

		msgBuf[0] = '\0';
		return(TRUE);
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case IDC_LOG_COMBINERS:
			logCombiners = (SendDlgItemMessage(hDlg, IDC_LOG_COMBINERS, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_TRIANGLES:
			logTriangles = (SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_TEXTURE_BUFFER:
			logTextureBuffer = (SendDlgItemMessage(hDlg, IDC_LOG_TEXTURE_BUFFER, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_VTX:
			logVertex = (SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_TO_SCREEN:
			logToScreen = (SendDlgItemMessage(hDlg, IDC_LOG_TO_SCREEN, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_TO_FILE:
			logToFile = (SendDlgItemMessage(hDlg, IDC_LOG_TO_FILE, BM_GETCHECK, 0, 0) == BST_CHECKED);
			SetLogToFile(logToFile);
			return(TRUE);
			break;
		case IDC_LOG_MATRIX:
			logMatrix = (SendDlgItemMessage(hDlg, IDC_LOG_MATRIX, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_ENABLE_TEXTURE:
			debuggerEnableTexture = (SendDlgItemMessage(hDlg, IDC_ENABLE_TEXTURE, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_ZBUFFER:
			debuggerEnableZBuffer = (SendDlgItemMessage(hDlg, IDC_ZBUFFER, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_CULLFACE:
			debuggerEnableCullFace = (SendDlgItemMessage(hDlg, IDC_CULLFACE, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_TEST_TRIS:
			debuggerEnableTestTris = (SendDlgItemMessage(hDlg, IDC_TEST_TRIS, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_ALPHA_TEST:
			debuggerEnableAlphaTest = (SendDlgItemMessage(hDlg, IDC_ALPHA_TEST, BM_GETCHECK, 0, 0) == BST_CHECKED);
			if( !debuggerEnableAlphaTest && CRender::g_pRender )	
				CRender::g_pRender->SetAlphaTestEnable(FALSE);
			return(TRUE);
			break;
		case IDC_LOG_WARNING:
			logWarning = (SendDlgItemMessage(hDlg, IDC_LOG_WARNING, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_FOG:
			logFog = (SendDlgItemMessage(hDlg, IDC_LOG_FOG, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_DETAILS:
			logDetails = (SendDlgItemMessage(hDlg, IDC_DETAILS, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_WINFRAME:
			options.bWinFrameMode = (SendDlgItemMessage(hDlg, IDC_WINFRAME, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_TEXTURES:
			logTextures = (SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_UCODE:
			logUcodes = (SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_LOG_MICROCODE:
			logMicrocode = (SendDlgItemMessage(hDlg, IDC_LOG_MICROCODE, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_CONT_W_UNKNOWN:
			debuggerContinueWithUnknown = (SendDlgItemMessage(hDlg, IDC_CONT_W_UNKNOWN, BM_GETCHECK, 0, 0) == BST_CHECKED);
			return(TRUE);
			break;
		case IDC_CLEAR:
			msgBuf[0] = '\0';
			SetDlgItemText(hDlg, IDC_MSG, "");
			break;
		case IDOK:
			EndDialog(hDlg, TRUE);
			return(TRUE);
		case IDCANCEL:
			EndDialog(hDlg, TRUE);
			return(TRUE);
		}

		if( !status.bGameIsRunning )
		{
			return(TRUE);
		}

		switch(LOWORD(wParam))
		{
		case IDC_PAUSE:
			debuggerPause = true;
			break;
		case IDC_GO:
			pauseAtNext = false;
			debuggerPause = false;
			logTriangles = FALSE;
			logVertex = FALSE;
			logMatrix = FALSE;
			logTextures = FALSE;
			logUcodes = FALSE;
			logMicrocode = FALSE;

			SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_SETCHECK, BST_UNCHECKED, 0);
			SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_SETCHECK, BST_UNCHECKED, 0);
			SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_SETCHECK, BST_UNCHECKED, 0);
			SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_SETCHECK, BST_UNCHECKED, 0);

			break;
		case IDC_NEXT:	//Next one of the others
			debuggerPause = false;
			pauseAtNext = true;
			eventToPause = SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_GETCURSEL, 0, 0);
			{
				char text[30];
				GetDlgItemText(hDlg,IDC_BREAK_AT_COUNT, text, 29);
				if( strlen(text)>0 )
				{
					countToPause = atoi(text);
				}
				else
				{
					countToPause = 0;
				}
				if( countToPause > 0x1000 )	
					countToPause=0;
				debuggerPauseCount = countToPause;
			}
			break;
		case IDC_DUMP:
			thingToDump = SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_GETCURSEL, 0, 0);
			DumpInfo(thingToDump);
			break;
		case IDC_UPDATE_SCREEN:
			CGraphicsContext::Get()->UpdateFrame();
			break;
		case IDC_CLEAR_BREAKPOINT:
			break;
		case IDC_SET_BREAKPOINT:
			break;
		case IDC_DROP_TEXTURE:
			gTextureManager.RecycleAllTextures();
			break;
		case IDC_DROP_COMBINER:
			debuggerDropCombiners = true;
			debuggerDropGeneralCombiners = true;
			debuggerDropDecodedMux = true;
			debuggerDropCombinerInfos = true;
			break;
		}
		return(TRUE);
		break;
	case WM_CLOSE:
		EndDialog(hDlg, TRUE);
		pauseAtNext = false;
		debuggerPause = false;
		logTriangles = FALSE;
		logVertex = FALSE;
		logMatrix = FALSE;
		//debuggerWinOpened = false;
		return(TRUE);
		break;
	}
#endif

	return(FALSE);
}