mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 09:26:52 +00:00
Add ability to replace sections in RDCFile
This commit is contained in:
@@ -538,12 +538,29 @@ bool CaptureContext::SaveCaptureTo(const QString &captureFile)
|
||||
{
|
||||
if(QFileInfo(GetCaptureFilename()).exists())
|
||||
{
|
||||
// QFile::copy won't overwrite, so remove the destination first (the save dialog already
|
||||
// prompted for overwrite)
|
||||
QFile::remove(captureFile);
|
||||
success = QFile::copy(GetCaptureFilename(), captureFile);
|
||||
if(GetCaptureFilename() == captureFile)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ICaptureFile *capFile = Replay().GetCaptureFile();
|
||||
|
||||
error = tr("Couldn't save to %1").arg(captureFile);
|
||||
if(capFile)
|
||||
{
|
||||
// this will overwrite
|
||||
success = capFile->CopyFileTo(captureFile.toUtf8().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
// QFile::copy won't overwrite, so remove the destination first (the save dialog already
|
||||
// prompted for overwrite)
|
||||
QFile::remove(captureFile);
|
||||
success = QFile::copy(GetCaptureFilename(), captureFile);
|
||||
}
|
||||
|
||||
error = tr("Couldn't save to %1").arg(captureFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -568,9 +585,17 @@ bool CaptureContext::SaveCaptureTo(const QString &captureFile)
|
||||
return false;
|
||||
}
|
||||
|
||||
// if it was a temporary capture, remove the old instnace
|
||||
if(m_CaptureTemporary)
|
||||
QFile::remove(m_CaptureFile);
|
||||
|
||||
// Update the filename, and mark that it's local and not temporary now.
|
||||
m_CaptureFile = captureFile;
|
||||
m_CaptureLocal = true;
|
||||
m_CaptureTemporary = false;
|
||||
|
||||
Replay().ReopenCaptureFile(captureFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,6 +355,13 @@ void ReplayManager::PingRemote()
|
||||
}
|
||||
}
|
||||
|
||||
void ReplayManager::ReopenCaptureFile(const QString &path)
|
||||
{
|
||||
if(!m_CaptureFile)
|
||||
m_CaptureFile = RENDERDOC_OpenCaptureFile();
|
||||
m_CaptureFile->OpenFile(path.toUtf8().data(), "rdc");
|
||||
}
|
||||
|
||||
uint32_t ReplayManager::ExecuteAndInject(const QString &exe, const QString &workingDir,
|
||||
const QString &cmdLine,
|
||||
const QList<EnvironmentModification> &env,
|
||||
|
||||
@@ -83,6 +83,11 @@ public:
|
||||
return m_Remote;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// may return NULL if the capture file is not open locally. Consider using ICaptureAccess above to
|
||||
// work whether local or remote.
|
||||
ICaptureFile *GetCaptureFile() { return m_CaptureFile; }
|
||||
void ReopenCaptureFile(const QString &path);
|
||||
const RemoteHost *CurrentRemote() { return m_RemoteHost; }
|
||||
uint32_t ExecuteAndInject(const QString &exe, const QString &workingDir, const QString &cmdLine,
|
||||
const QList<EnvironmentModification> &env, const QString &capturefile,
|
||||
|
||||
Reference in New Issue
Block a user