void CLightingEditor::OnRender()
{
	if ( !IsEditorActive() )
		return;

	const EDITOR_DBG_MODES dbg = GetDebugMode();
	if ( dbg != EDITOR_DBG_OFF && g_ShaderEditorSystem->IsReady() )
	{
		const char *pszDebugList[] = {
			"dbg_editor_ppe_lighting",
			"dbg_editor_ppe_depth",
			"dbg_editor_ppe_normals",
		};
		Assert( dbg >= 1 && dbg <= 3 );
		const char *pszDebugName = pszDebugList[ dbg - 1 ];

		int iDbgIndex = shaderEdit->GetPPEIndex( pszDebugName );
		if ( iDbgIndex != -1 )
			shaderEdit->DrawPPEOnDemand( iDbgIndex );
	}

	RenderSprites();

	RenderSelection();

	RenderHelpers();
}
Exemple #2
0
bool wxDebugContext::PrintStatistics(bool detailed)
{
  {
    const wxChar* appName = wxT("application");
    wxString appNameStr;
    if (wxTheApp)
    {
        appNameStr = wxTheApp->GetAppName();
        appName = appNameStr.c_str();
        OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, static_cast<const wxChar *>(wxNow().c_str()));
    }
    else
    {
      OutputDumpLine( wxT("----- Memory statistics -----") );
    }
  }

  bool currentMode = GetDebugMode();
  SetDebugMode(false);

  long noNonObjectNodes = 0;
  long noObjectNodes = 0;
  long totalSize = 0;

  wxDebugStatsStruct *list = NULL;

  wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL );
  if (!from)
    from = wxDebugContext::GetHead ();

  wxMemStruct *st;
  for (st = from; st != 0; st = st->m_next)
  {
    void* data = st->GetActualData();
    if (detailed && (data != (void*) wxLog::GetActiveTarget()))
    {
      wxChar *className = (wxChar*) wxT("nonobject");
      if (st->m_isObject && st->GetActualData())
      {
        wxObject *obj = (wxObject *)st->GetActualData();
        if (obj->GetClassInfo()->GetClassName())
          className = (wxChar*)obj->GetClassInfo()->GetClassName();
      }
      wxDebugStatsStruct *stats = FindStatsStruct(list, className);
      if (!stats)
      {
        stats = (wxDebugStatsStruct *)malloc(sizeof(wxDebugStatsStruct));
        stats->instanceClass = className;
        stats->instanceCount = 0;
        stats->totalSize = 0;
        list = InsertStatsStruct(list, stats);
      }
      stats->instanceCount ++;
      stats->totalSize += st->RequestSize();
    }

    if (data != (void*) wxLog::GetActiveTarget())
    {
        totalSize += st->RequestSize();
        if (st->m_isObject)
            noObjectNodes ++;
        else
            noNonObjectNodes ++;
    }
  }

  if (detailed)
  {
    while (list)
    {
      OutputDumpLine(wxT("%ld objects of class %s, total size %ld"),
          list->instanceCount, list->instanceClass, list->totalSize);
      wxDebugStatsStruct *old = list;
      list = old->next;
      free((char *)old);
    }
    OutputDumpLine(wxEmptyString);
  }

  SetDebugMode(currentMode);

  OutputDumpLine(wxT("Number of object items: %ld"), noObjectNodes);
  OutputDumpLine(wxT("Number of non-object items: %ld"), noNonObjectNodes);
  OutputDumpLine(wxT("Total allocated size: %ld"), totalSize);
  OutputDumpLine(wxEmptyString);
  OutputDumpLine(wxEmptyString);

  return true;
}
BOOL WeightTableWindow::WtIsChecked(int id)
	{
	switch (id)
		{
		//5.1.01
		case IDC_RIGHTJUSTIFY: 
			{
			return  GetRightJustify();
			break;
			}

		case IDC_NAMELISTGLOBAL_DROP: 
			{
			if (GetAffectSelectedOnly())
				return  FALSE;
			else return  TRUE;
			break;
			}
		case IDC_AFFECTEDBONES_CHECK :
			{
			return GetAffectedBonesOnly();
			break;
			}
		case IDC_UPDATEONMOUSEUP_CHECK2 :
			{
			return GetUpdateOnMouseUp();
			break;
			}
		case IDC_FLIPFLOPUI_CHECK2 :
			{
			return GetFlipFlopUI();
			break;
			}
		case IDC_ATTRIBUTE_CHECK2 :
			{
			return GetShowAttributes();
			break;
			}
		case IDC_GLOBAL_CHECK2 :
			{
			return GetShowGlobals();
			break;
			}
		case IDC_REDUCELABELS_CHECK2 :
			{
			return GetReduceLabels();
			break;
			}
		case IDC_SHOWEXCLUSION_CHECK :
			{
			return GetShowExclusion();
			break;
			}

		case IDC_SHOWLOCK_CHECK :
			{
			return GetShowLock();
			break;
			}

		case IDC_JBUIMETHOD :
			{
			return GetJBMethod();
			break;
			}
		case IDC_SHOWSETUI :
			{
			return GetShowSetUI();
			break;
			}

		case IDC_SHOWOPTIONSUI :
			{
			return GetShowOptionsUI();
			break;
			}
		case IDC_SHOWCOPYPASTEUI :
			{
			return GetShowCopyPasteUI();
			break;
			}

		case IDC_DRAGMODE :
			{
			return GetDragLeftMode();
			break;
			}
		case IDC_DEBUGMODE :
			{
			return GetDebugMode();
			break;
			}
		case IDC_SHOWMARKER :
			{
			return GetShowMarker();
			break;
			}
							


		}
	return FALSE;
	}
BOOL WeightTableWindow::WtExecute(int id)
	{

	BOOL iret = FALSE;
	switch (id)
		{
//edit
		case IDC_COPY :
			{
			SetCopyBuffer();
			iret = TRUE;
			UpdatePasteButton();
			break;
			}
		case IDC_PASTE :
			{
			PasteCopyBuffer();
			InvalidateViews();
			iret = TRUE;
			break;
			}
		case IDC_SELECTALL:
			{
			SetAllSelections();
			InvalidateViews();
			iret = TRUE;
			break;
			}
		case IDC_SELECTNONE:
			{
			ClearAllSelections();
			InvalidateViews();
			iret = TRUE;
			break;
			}
		case IDC_SELECTINVERT:
			{
			InvertSelections();
			InvalidateViews();
			iret = TRUE;
			break;
			}


//sets
		case IDC_CREATE :
			{
			DialogBoxParam  (hInstance, MAKEINTRESOURCE(IDD_WEIGHTTABLE_CUSTOMLISTNAME),hWnd,
						AddCustomListDlgProc, (LPARAM)this);
			iret = TRUE;
			break;
			}
		case IDC_DELETE :
			{
			if (GetActiveSet() >2)
				DeleteCustomList(GetActiveSet());
			iret = TRUE;
//			PasteCopyBuffer();
//			InvalidateViews();

			break;
			}

//options
		case IDC_AFFECTEDBONES_CHECK :
			{
			if (GetAffectedBonesOnly())
				SetAffectedBonesOnly(FALSE);
			else SetAffectedBonesOnly(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_UPDATEONMOUSEUP_CHECK2 :
			{
			if (GetUpdateOnMouseUp())
				SetUpdateOnMouseUp(FALSE);
			else SetUpdateOnMouseUp(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_FLIPFLOPUI_CHECK2 :
			{
			if (GetFlipFlopUI())
				SetFlipFlopUI(FALSE);
			else SetFlipFlopUI(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_ATTRIBUTE_CHECK2 :
			{
			if (GetShowAttributes())
				SetShowAttributes(FALSE);
			else SetShowAttributes(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_GLOBAL_CHECK2 :
			{
			if (GetShowGlobals())
				SetShowGlobals(FALSE);
			else SetShowGlobals(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_REDUCELABELS_CHECK2 :
			{
			if (GetReduceLabels())
				SetReduceLabels(FALSE);
			else SetReduceLabels(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWEXCLUSION_CHECK :
			{
			if (GetShowExclusion())
				SetShowExclusion(FALSE);
			else SetShowExclusion(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWLOCK_CHECK :
			{
			if (GetShowLock())
				SetShowLock(FALSE);
			else SetShowLock(TRUE);
			iret = TRUE;
			break;
			}

		case IDC_NAMELISTGLOBAL_DROP :
			{
			if (GetAffectSelectedOnly())
				SetAffectSelectedOnly(FALSE);
			else SetAffectSelectedOnly(TRUE);
			iret = TRUE;
			break;
			}

		case IDC_JBUIMETHOD :
			{
			if (GetJBMethod())
				SetJBMethod(FALSE);
			else SetJBMethod(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWMENU :
			{
			if (GetShowMenu())
				SetShowMenu(FALSE);
			else SetShowMenu(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWSETUI :
			{
			if (GetShowSetUI())
				SetShowSetUI(FALSE);
			else SetShowSetUI(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWOPTIONSUI :
			{
			if (GetShowOptionsUI())
				SetShowOptionsUI(FALSE);
			else SetShowOptionsUI(TRUE);
			iret = TRUE;
			break;
			}
		case IDC_SHOWCOPYPASTEUI :
			{
			if (GetShowCopyPasteUI())
				SetShowCopyPasteUI(FALSE);
			else SetShowCopyPasteUI(TRUE);
			iret = TRUE;
			break;
			}

		case IDC_DRAGMODE :
			{
			if (GetDragLeftMode())
				SetDragLeftMode(FALSE);
			else SetDragLeftMode(TRUE);
			iret = TRUE;
			break;
			}

		case IDC_DEBUGMODE :
			{
			if (GetDebugMode())
				SetDebugMode(FALSE);
			else SetDebugMode(TRUE);
			iret = TRUE;
			break;
			}


		case IDC_SHOWMARKER :
			{
			if (GetShowMarker())
				SetShowMarker(FALSE);
			else SetShowMarker(TRUE);
			iret = TRUE;
			break;
			}

//5.1.01
		case IDC_RIGHTJUSTIFY: 
			{
			if (GetRightJustify())
				SetRightJustify(FALSE);
			else SetRightJustify(TRUE);
			break;
			}


		}
	
	IMenuBarContext* pContext = (IMenuBarContext*) GetCOREInterface()->GetMenuManager()->GetContext(kWeightTableMenuBar);
	if (pContext)
		pContext->UpdateWindowsMenu();

	return iret;
	}
Exemple #5
0
DWORD ServiceExecutionThread(LPDWORD param)
{
#if _DEBUG
    ::OutputDebugString(L"ServiceExecutionThread\n");
#endif

    if (IntializeSystemInfo() == FALSE)
    {
        return IC_NO_INITIALIZE;
    }

    WORD wVersionRequested = MAKEWORD(1, 1);
    WSADATA wsaData;
    WSAStartup(wVersionRequested, &wsaData);
    SOCKET udpSocket = INVALID_SOCKET;

    int result = IC_NOERROR;
    bool showHelp = false;

    do
    {
        g_killServiceEvent = CreateEvent(0, TRUE, FALSE, 0);
        if (!g_killServiceEvent)
        {
            OutputError(L"CreateEvent fails! (%d)", GetLastError());
            result = IC_EVENT_CREATE_FAIL;
            break;
        }

        wstring apiKey;
        wstring envInfo;
        vector<int> intervalTimes;
        ConnectionInfo connection;

        g_debugMode = GetDebugMode(g_argc, g_argv);

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-h") == true
            || cmdOptionExists(g_argv, g_argv + g_argc, L"/h") == true)
        {
            showHelp = true;
            break;
        }

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-unreg") == true)
        {
            DoUnregistration();
            break;
        }

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-start") == true)
        {
            DoStartService();
            break;
        }

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-stop") == true)
        {
            DoStopService();
            break;
        }

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-update") == true)
        {
            ProcessLatestUpdate();
            break;
        }

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-restart") == true)
        {
            RestartService();
            break;
        }

        apiKey = GetApiKey(g_argc, g_argv);
        envInfo = GetEnvInfo(g_argc, g_argv);
        intervalTimes = GetIntervalTime(g_argc, g_argv);

        if (apiKey.length() == 0)
        {
            OutputError(L"NO ApiKey\n");
            result = IC_NO_APIKEY;
            showHelp = true;
            break;
        }

        if (envInfo.length() == 0)
        {
            OutputError(L"NO AgentID Info\n");
            result = IC_NO_AGENTIDINFO;
            showHelp = true;
            break;
        }

        string address = GetHostAddress(g_argc, g_argv, connection);
        struct hostent *host = gethostbyname(address.c_str());
        if (host == nullptr)
        {
            OutputError(L"Can't resolve host address: %s\n", address.c_str());
            result = IC_NO_RESOLVE_HOSTADDR;
            break;
        }

        SetupHostPort(g_argc, g_argv, connection);

        if (cmdOptionExists(g_argv, g_argv + g_argc, L"-regservice") == true)
        {
            DoRegistration(apiKey, envInfo, address, connection.Getport(), intervalTimes);
            break;
        }

        struct sockaddr_in remoteServAddr;

        remoteServAddr.sin_family = host->h_addrtype;
        memcpy((char *)&remoteServAddr.sin_addr.s_addr, host->h_addr_list[0], host->h_length);
        remoteServAddr.sin_port = htons((u_short)connection.Getport());

        /* socket creation */
        udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if (udpSocket == INVALID_SOCKET) {
            OutputError(L"socket failed with error: %ld\n", WSAGetLastError());
            break;
        }

        wstring appVersion = GetAppVersion(g_moduleFilePath.c_str(), NULL, NULL, NULL, NULL);
        OutputConsole(L"(%s) ServiceExecutionThread - data collect thread - start\n", appVersion.c_str());

        {
            thread processCpuMemThread([apiKey, envInfo, udpSocket, remoteServAddr, intervalTimes]()
            {
                ProcessCpuMemInfo(apiKey, envInfo, udpSocket, remoteServAddr, intervalTimes[0]);
            });

            thread processDiskThread([apiKey, envInfo, udpSocket, remoteServAddr, intervalTimes]()
            {
                ProcessDiskInfo(apiKey, envInfo, udpSocket, remoteServAddr, intervalTimes[1]);
            });

            thread updateThread([]()
            {
                DWORD oneday = 1000 * 60 * 60 * 24;

                while (true)
                {
                    ProcessLatestUpdate();

                    if (::WaitForSingleObject(g_killServiceEvent, oneday) == WAIT_TIMEOUT)
                    {
                        continue;
                    }

                    break;
                }
            });

            if (g_isConsoleApp == TRUE)
            {
                printf("Press any key to exit...\n");
                getchar();
            }
            else
            {
#if _DEBUG
                ::OutputDebugString(L"Service thread - WaitForSingleObject...\n");
#endif
                WaitForSingleObject(g_killServiceEvent, INFINITE);
            }

#if _DEBUG
            ::OutputDebugString(L"Service thread waiting...\n");
            Sleep(1000);
#endif

            if (processCpuMemThread.joinable() == true)
            {
                processCpuMemThread.join();
            }

            if (processDiskThread.joinable() == true)
            {
                processDiskThread.join();
            }

            if (updateThread.joinable() == true)
            {
                updateThread.join();
            }

#if _DEBUG
            ::OutputDebugString(L"All Service-threads exited...\n");
#endif
        }

        ::SetEvent(g_killSafeExitEvent);

#if _DEBUG
        ::OutputDebugString(L"Service thread detached\n");
#endif

    } while (false);

#if _DEBUG
    ::OutputDebugString(L"ServiceExecutionThread - data collect thread - ending\n");
#endif

    if (udpSocket != INVALID_SOCKET)
    {
        closesocket(udpSocket);
    }

    if (showHelp == true)
    {
        ShowHelp();
    }

    WSACleanup();

#if _DEBUG
    ::OutputDebugString(L"ServiceExecutionThread - data collect thread - ended\n");
#endif

    return result;
}