mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-25 16:06:31 +00:00
Allow specifying environment variable modifications
* This works for local and remote invocations of programs, but is mostly useful on unix systems (Windows programs use env vars less often)
This commit is contained in:
@@ -53,8 +53,11 @@ namespace renderdocui.Windows.Dialogs
|
||||
public string Executable = "";
|
||||
public string WorkingDir = "";
|
||||
public string CmdLine = "";
|
||||
public EnvironmentModification[] Environment = new EnvironmentModification[0];
|
||||
}
|
||||
|
||||
private EnvironmentModification[] m_EnvModifications = new EnvironmentModification[0];
|
||||
|
||||
private bool workDirHint = true;
|
||||
|
||||
private Core m_Core;
|
||||
@@ -69,6 +72,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
workDirPath.Text = settings.WorkingDir;
|
||||
cmdline.Text = settings.CmdLine;
|
||||
|
||||
SetEnvironmentModifications(settings.Environment);
|
||||
|
||||
workDirPath_Leave(null, null);
|
||||
|
||||
AllowFullscreen.Checked = settings.Options.AllowFullscreen;
|
||||
@@ -109,6 +114,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
ret.WorkingDir = RealWorkDir;
|
||||
ret.CmdLine = cmdline.Text;
|
||||
|
||||
ret.Environment = m_EnvModifications;
|
||||
|
||||
ret.Options.AllowFullscreen = AllowFullscreen.Checked;
|
||||
ret.Options.AllowVSync = AllowVSync.Checked;
|
||||
ret.Options.HookIntoChildren = HookIntoChildren.Checked;
|
||||
@@ -195,7 +202,7 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
#region Callbacks
|
||||
|
||||
public delegate LiveCapture OnCaptureMethod(string exe, string workingDir, string cmdLine, CaptureOptions opts);
|
||||
public delegate LiveCapture OnCaptureMethod(string exe, string workingDir, string cmdLine, EnvironmentModification[] env, CaptureOptions opts);
|
||||
public delegate LiveCapture OnInjectMethod(UInt32 PID, string name, CaptureOptions opts);
|
||||
|
||||
private OnCaptureMethod m_CaptureCallback = null;
|
||||
@@ -285,7 +292,7 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
string cmdLine = cmdline.Text;
|
||||
|
||||
var live = m_CaptureCallback(exe, workingDir, cmdLine, GetSettings().Options);
|
||||
var live = m_CaptureCallback(exe, workingDir, cmdLine, GetSettings().Environment, GetSettings().Options);
|
||||
|
||||
if (queueFrameCap.Checked && live != null)
|
||||
live.QueueCapture((int)queuedCapFrame.Value);
|
||||
@@ -452,6 +459,36 @@ namespace renderdocui.Windows.Dialogs
|
||||
workDirPath.ForeColor = SystemColors.WindowText;
|
||||
}
|
||||
|
||||
private void setEnv_Click(object sender, EventArgs e)
|
||||
{
|
||||
EnvironmentEditor envEditor = new EnvironmentEditor();
|
||||
|
||||
foreach (var mod in m_EnvModifications)
|
||||
envEditor.AddModification(mod, true);
|
||||
|
||||
DialogResult res = envEditor.ShowDialog(this);
|
||||
|
||||
if (res == DialogResult.OK)
|
||||
SetEnvironmentModifications(envEditor.Modifications);
|
||||
}
|
||||
|
||||
private void SetEnvironmentModifications(EnvironmentModification[] modifications)
|
||||
{
|
||||
m_EnvModifications = modifications;
|
||||
|
||||
string envModText = "";
|
||||
|
||||
foreach (var mod in modifications)
|
||||
{
|
||||
if (envModText != "")
|
||||
envModText += ", ";
|
||||
|
||||
envModText += mod.GetDescription();
|
||||
}
|
||||
|
||||
environmentDisplay.Text = envModText;
|
||||
}
|
||||
|
||||
private void workDirPath_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(Directory.Exists(workDirPath.Text))
|
||||
|
||||
Reference in New Issue
Block a user