Add a command line parameter --remoteaccess to connect to instance

* This is useful in e.g. a renderdoc-aware application that has voluntarily
  injected renderdoc, and then wants to boot the UI to automatically open
  up the management connection
This commit is contained in:
baldurk
2014-09-01 21:15:23 +01:00
parent d8daa093c5
commit 960387d485
3 changed files with 41 additions and 4 deletions
+28 -1
View File
@@ -29,6 +29,7 @@ using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using renderdoc;
namespace renderdocui.Code
@@ -74,6 +75,32 @@ namespace renderdocui.Code
temp = true;
}
string remoteHost = "";
uint remoteIdent = 0;
for (int i = 0; i < args.Length; i++)
{
if (args[i].ToLowerInvariant() == "--remoteaccess" && i + 1 < args.Length)
{
var regexp = @"^([a-zA-Z0-9_-]+:)?([0-9]+)$";
var match = Regex.Match(args[i+1], regexp);
if (match.Success)
{
var host = match.Groups[1].Value;
if (host != "" && host[host.Length - 1] == ':')
host = host.Substring(0, host.Length - 1);
uint ident = 0;
if (uint.TryParse(match.Groups[2].Value, out ident))
{
remoteHost = host;
remoteIdent = ident;
}
}
}
}
if (args.Length > 0 && File.Exists(args[args.Length - 1]))
{
filename = args[args.Length - 1];
@@ -107,7 +134,7 @@ namespace renderdocui.Code
Application.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
var core = new Core(filename, temp, cfg);
var core = new Core(filename, remoteHost, remoteIdent, temp, cfg);
try
{
+2 -2
View File
@@ -146,13 +146,13 @@ namespace renderdocui.Code
#region Init and Shutdown
public Core(string paramFilename, bool temp, PersistantConfig config)
public Core(string paramFilename, string remoteHost, uint remoteIdent, bool temp, PersistantConfig config)
{
if (!Directory.Exists(ConfigDirectory))
Directory.CreateDirectory(ConfigDirectory);
m_Config = config;
m_MainWindow = new MainWindow(this, paramFilename, temp);
m_MainWindow = new MainWindow(this, paramFilename, remoteHost, remoteIdent, temp);
}
public void Shutdown()
+11 -1
View File
@@ -66,6 +66,8 @@ namespace renderdocui.Windows
private Core m_Core;
private string m_InitFilename;
private string m_InitRemoteHost;
private uint m_InitRemoteIdent;
private List<LiveCapture> m_LiveCaptures = new List<LiveCapture>();
@@ -123,7 +125,7 @@ namespace renderdocui.Windows
}
}
public MainWindow(Core core, string initFilename, bool temp)
public MainWindow(Core core, string initFilename, string remoteHost, uint remoteIdent, bool temp)
{
InitializeComponent();
@@ -141,6 +143,8 @@ namespace renderdocui.Windows
m_Core = core;
m_InitFilename = initFilename;
m_InitRemoteHost = remoteHost;
m_InitRemoteIdent = remoteIdent;
OwnTemporaryLog = temp;
logStatisticsToolStripMenuItem.Enabled = false;
@@ -190,6 +194,12 @@ namespace renderdocui.Windows
PopulateRecentFiles();
PopulateRecentCaptures();
if (m_InitRemoteIdent != 0)
{
var live = new LiveCapture(m_Core, m_InitRemoteHost, m_InitRemoteIdent, this);
ShowLiveCapture(live);
}
if (m_InitFilename != "")
{
if(Path.GetExtension(m_InitFilename) == ".rdc")