Exemplo n.º 1
0
/*
================
rvRegistryOptions::Load

Read the options from the registry
================
*/
bool rvRegistryOptions::Load ( void )
{
	HKEY	hKey;
	char	temp[MAX_PATH];
	TCHAR	keyname[MAX_PATH];
	DWORD	dwType;
	DWORD	dwSize;
	int		i;

	mValues.Clear ( );
	mRecentFiles.Clear ( );

	if ( ERROR_SUCCESS != RegOpenKeyEx ( HKEY_LOCAL_MACHINE, mBaseKey, 0, KEY_READ, &hKey ) )
	{
		return false;
	}

	// Read in the values and recent files
	keyname[0] = 0;
	dwSize = MAX_PATH;
	for ( i = 0; RegEnumValue ( hKey, i, keyname, &dwSize, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS; i ++ )
	{
		temp[0] = '\0';	
		dwSize = MAX_PATH;
		
		if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, keyname, NULL, &dwType, (LPBYTE)temp, &dwSize ) )
		{
			continue;
		}

		dwSize = MAX_PATH;

		// Skip the mru values
		if( !idStr(keyname).IcmpPrefix ( "mru" ) )
		{
			continue;
		}
		
		mValues.Set ( keyname, temp );
	}			

	// Read Recent Files
	for ( i = 0; i < MAX_MRU_SIZE; i ++ )
	{
		dwSize = MAX_PATH;
		if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, va("mru%d", i ), NULL, &dwType, (LPBYTE)temp, &dwSize ) )
		{	
			continue;
		}
		
		AddRecentFile ( temp );
	}

	return true;
}
Exemplo n.º 2
0
void UpdateCurFileName(HWND hwndMain, HWND hwndHV, LPCTSTR szFileName, BOOL fChanged)
{
	TCHAR  szFullPath[MAX_PATH];
	TCHAR *pszFileTitle;

	if(GetFullPathName(szFileName, MAX_PATH, szFullPath, &pszFileTitle))
	{
		lstrcpy(g_szFileName, szFullPath);
		lstrcpy(g_szFileTitle, pszFileTitle);

		SetWindowFileName(hwndMain, pszFileTitle, fChanged, HexView_IsReadOnly(hwndHV));
	}

	AddRecentFile(szFileName);
	UpdateRecentMenu(GetSubMenu(GetMenu(hwndMain), 0));
}
Exemplo n.º 3
0
void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QString &origFilename,
                                         bool temporary, bool local)
{
  m_CaptureFile = origFilename;

  m_CaptureLocal = local;

  Config().Save();

  m_LoadProgress = 0.0f;
  m_PostloadProgress = 0.0f;

  // this function call will block until the capture is either loaded, or there's some failure
  m_Renderer.OpenCapture(captureFile, [this](float p) { m_LoadProgress = p; });

  // if the renderer isn't running, we hit a failure case so display an error message
  if(!m_Renderer.IsRunning())
  {
    QString errmsg = ToQStr(m_Renderer.GetCreateStatus());

    QString messageText = tr("%1\nFailed to open capture for replay: %2.\n\n"
                             "Check diagnostic log in Help menu for more details.")
                              .arg(captureFile)
                              .arg(errmsg);

    RDDialog::critical(NULL, tr("Error opening capture"), messageText);

    m_LoadInProgress = false;
    return;
  }

  if(!temporary)
  {
    AddRecentFile(Config().RecentCaptureFiles, origFilename, 10);

    Config().Save();
  }

  m_EventID = 0;

  m_FirstDrawcall = m_LastDrawcall = NULL;

  // fetch initial data like drawcalls, textures and buffers
  m_Renderer.BlockInvoke([this](IReplayController *r) {
    m_FrameInfo = r->GetFrameInfo();

    m_APIProps = r->GetAPIProperties();

    m_PostloadProgress = 0.2f;

    m_Drawcalls = r->GetDrawcalls();

    AddFakeProfileMarkers();

    m_FirstDrawcall = &m_Drawcalls[0];
    while(!m_FirstDrawcall->children.empty())
      m_FirstDrawcall = &m_FirstDrawcall->children[0];

    m_LastDrawcall = &m_Drawcalls.back();
    while(!m_LastDrawcall->children.empty())
      m_LastDrawcall = &m_LastDrawcall->children.back();

    m_PostloadProgress = 0.4f;

    m_WinSystems = r->GetSupportedWindowSystems();

#if defined(RENDERDOC_PLATFORM_WIN32)
    m_CurWinSystem = WindowingSystem::Win32;
#elif defined(RENDERDOC_PLATFORM_LINUX)
    m_CurWinSystem = WindowingSystem::Xlib;

    // prefer XCB, if supported
    for(WindowingSystem sys : m_WinSystems)
    {
      if(sys == WindowingSystem::XCB)
      {
        m_CurWinSystem = WindowingSystem::XCB;
        break;
      }
    }

    if(m_CurWinSystem == WindowingSystem::XCB)
      m_XCBConnection = QX11Info::connection();
    else
      m_X11Display = QX11Info::display();
#endif

    m_StructuredFile = &r->GetStructuredFile();

    m_ResourceList = r->GetResources();
    for(ResourceDescription &res : m_ResourceList)
      m_Resources[res.resourceId] = &res;

    m_BufferList = r->GetBuffers();
    for(BufferDescription &b : m_BufferList)
      m_Buffers[b.resourceId] = &b;

    m_PostloadProgress = 0.8f;

    m_TextureList = r->GetTextures();
    for(TextureDescription &t : m_TextureList)
      m_Textures[t.resourceId] = &t;

    m_PostloadProgress = 0.9f;

    m_CurD3D11PipelineState = &r->GetD3D11PipelineState();
    m_CurD3D12PipelineState = &r->GetD3D12PipelineState();
    m_CurGLPipelineState = &r->GetGLPipelineState();
    m_CurVulkanPipelineState = &r->GetVulkanPipelineState();
    m_CurPipelineState.SetStates(m_APIProps, m_CurD3D11PipelineState, m_CurD3D12PipelineState,
                                 m_CurGLPipelineState, m_CurVulkanPipelineState);

    m_UnreadMessageCount = 0;
    AddMessages(m_FrameInfo.debugMessages);

    m_PostloadProgress = 1.0f;
  });

  QThread::msleep(20);

  QDateTime today = QDateTime::currentDateTimeUtc();
  QDateTime compare = today.addDays(-21);

  if(compare > Config().DegradedCapture_LastUpdate && m_APIProps.degraded)
  {
    Config().DegradedCapture_LastUpdate = today;

    RDDialog::critical(
        NULL, tr("Degraded support of capture"),
        tr("%1\nThis capture opened with degraded support - "
           "this could mean missing hardware support caused a fallback to software rendering.\n\n"
           "This warning will not appear every time this happens, "
           "check debug errors/warnings window for more details.")
            .arg(origFilename));
  }

  ICaptureAccess *access = Replay().GetCaptureAccess();

  if(access)
  {
    int idx = access->FindSectionByType(SectionType::ResourceRenames);
    if(idx >= 0)
    {
      bytebuf buf = access->GetSectionContents(idx);
      LoadRenames(QString::fromUtf8((const char *)buf.data(), buf.count()));
    }

    idx = access->FindSectionByType(SectionType::Bookmarks);
    if(idx >= 0)
    {
      bytebuf buf = access->GetSectionContents(idx);
      LoadBookmarks(QString::fromUtf8((const char *)buf.data(), buf.count()));
    }

    idx = access->FindSectionByType(SectionType::Notes);
    if(idx >= 0)
    {
      bytebuf buf = access->GetSectionContents(idx);
      LoadNotes(QString::fromUtf8((const char *)buf.data(), buf.count()));
    }
  }

  m_LoadInProgress = false;
  m_CaptureLoaded = true;
}