mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 21:40:41 +00:00
Test Android target connection for up to MaxConnectTimeout seconds.
Added new setting to SettingsDialog, and passed it to native code via
RenderDoc::Inst().GetConfigSetting("MaxConnectTimeout")
This commit is contained in:
committed by
Baldur Karlsson
parent
31104c817a
commit
d249faacd3
@@ -1170,8 +1170,9 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC
|
||||
RemoteServer_ExecuteAndInject(RemoteServer *remote, const char *app, const char *workingDir,
|
||||
const char *cmdLine, void *env, const CaptureOptions *opts)
|
||||
{
|
||||
if(Android::IsHostADB(remote->hostname().c_str()))
|
||||
return Android::StartAndroidPackageForCapture(app);
|
||||
const char *host = remote->hostname().c_str();
|
||||
if(Android::IsHostADB(host))
|
||||
return Android::StartAndroidPackageForCapture(host, app);
|
||||
|
||||
return remote->ExecuteAndInject(app, workingDir, cmdLine, env, opts);
|
||||
}
|
||||
|
||||
@@ -453,6 +453,6 @@ inline uint64_t CountLeadingZeroes(uint64_t value);
|
||||
namespace Android
|
||||
{
|
||||
bool IsHostADB(const char *hostname);
|
||||
uint32_t StartAndroidPackageForCapture(const char *package);
|
||||
uint32_t StartAndroidPackageForCapture(const char *host, const char *package);
|
||||
string adbExecCommand(const string &args);
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ void adbForwardPorts()
|
||||
RenderDoc_FirstTargetControlPort + RenderDoc_AndroidPortOffset,
|
||||
RenderDoc_FirstTargetControlPort));
|
||||
}
|
||||
uint32_t StartAndroidPackageForCapture(const char *package)
|
||||
uint32_t StartAndroidPackageForCapture(const char *host, const char *package)
|
||||
{
|
||||
string packageName = basename(string(package)); // Remove leading '/' if any
|
||||
|
||||
@@ -728,11 +728,29 @@ uint32_t StartAndroidPackageForCapture(const char *package)
|
||||
adbExecCommand("shell pm grant " + packageName +
|
||||
" android.permission.READ_EXTERNAL_STORAGE"); // Reading the capture thumbnail
|
||||
adbExecCommand("shell monkey -p " + packageName + " -c android.intent.category.LAUNCHER 1");
|
||||
Threading::Sleep(
|
||||
5000); // Let the app pickup the setprop before we turn it back off for replaying.
|
||||
|
||||
uint32_t ret = RenderDoc_FirstTargetControlPort + RenderDoc_AndroidPortOffset;
|
||||
uint32_t elapsed = 0,
|
||||
timeout = 1000 *
|
||||
RDCMAX(5, atoi(RenderDoc::Inst().GetConfigSetting("MaxConnectTimeout").c_str()));
|
||||
while(elapsed < timeout)
|
||||
{
|
||||
// Check if the target app has started yet and we can connect to it.
|
||||
TargetControl *control = RENDERDOC_CreateTargetControl(host, ret, "testConnection", false);
|
||||
if(control)
|
||||
{
|
||||
TargetControl_Shutdown(control);
|
||||
break;
|
||||
}
|
||||
|
||||
Threading::Sleep(1000);
|
||||
elapsed += 1000;
|
||||
}
|
||||
|
||||
// Let the app pickup the setprop before we turn it back off for replaying.
|
||||
adbExecCommand("shell setprop debug.vulkan.layers \\\"\\\"");
|
||||
|
||||
return RenderDoc_FirstTargetControlPort + RenderDoc_AndroidPortOffset;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ namespace renderdocui.Code
|
||||
public string LastCaptureExe = "";
|
||||
public List<string> RecentCaptureSettings = new List<string>();
|
||||
public string AdbExecutablePath = "";
|
||||
public uint MaxConnectTimeout = 30;
|
||||
|
||||
// for historical reasons, this was named CaptureSavePath
|
||||
[XmlElement("CaptureSavePath")]
|
||||
|
||||
+84
-40
@@ -59,6 +59,7 @@
|
||||
System.Windows.Forms.GroupBox groupBox7;
|
||||
System.Windows.Forms.TableLayoutPanel tableLayoutPanel8;
|
||||
System.Windows.Forms.Label label36;
|
||||
System.Windows.Forms.Label label25;
|
||||
TreelistView.TreeListColumn treeListColumn3 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Section", "Section")));
|
||||
this.settingsTabs = new renderdocui.Controls.TablessControl();
|
||||
this.generalTab = new System.Windows.Forms.TabPage();
|
||||
@@ -104,6 +105,7 @@
|
||||
this.EventBrowser_ApplyColours = new System.Windows.Forms.CheckBox();
|
||||
this.EventBrowser_ColourEventRow = new System.Windows.Forms.CheckBox();
|
||||
this.androidTab = new System.Windows.Forms.TabPage();
|
||||
this.maxConnectTimeout = new System.Windows.Forms.NumericUpDown();
|
||||
this.browseAdbPath = new System.Windows.Forms.Button();
|
||||
this.adbPath = new System.Windows.Forms.TextBox();
|
||||
this.pagesTree = new TreelistView.TreeListView();
|
||||
@@ -140,6 +142,7 @@
|
||||
groupBox7 = new System.Windows.Forms.GroupBox();
|
||||
tableLayoutPanel8 = new System.Windows.Forms.TableLayoutPanel();
|
||||
label36 = new System.Windows.Forms.Label();
|
||||
label25 = new System.Windows.Forms.Label();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
this.settingsTabs.SuspendLayout();
|
||||
this.generalTab.SuspendLayout();
|
||||
@@ -163,6 +166,10 @@
|
||||
this.eventTab.SuspendLayout();
|
||||
groupBox4.SuspendLayout();
|
||||
this.tableLayoutPanel5.SuspendLayout();
|
||||
this.androidTab.SuspendLayout();
|
||||
groupBox7.SuspendLayout();
|
||||
tableLayoutPanel8.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxConnectTimeout)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pagesTree)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -1192,68 +1199,99 @@
|
||||
groupBox7.Text = "Android";
|
||||
//
|
||||
// tableLayoutPanel8
|
||||
//
|
||||
//
|
||||
tableLayoutPanel8.ColumnCount = 2;
|
||||
tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel8.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
tableLayoutPanel8.Controls.Add(this.browseAdbPath, 1, 1);
|
||||
tableLayoutPanel8.Controls.Add(label25, 0, 2);
|
||||
tableLayoutPanel8.Controls.Add(this.maxConnectTimeout, 1, 2);
|
||||
tableLayoutPanel8.Controls.Add(label36, 0, 0);
|
||||
tableLayoutPanel8.Controls.Add(this.adbPath, 0, 1);
|
||||
tableLayoutPanel8.Controls.Add(this.browseAdbPath, 1, 1);
|
||||
tableLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
tableLayoutPanel8.Location = new System.Drawing.Point(4, 19);
|
||||
tableLayoutPanel8.Location = new System.Drawing.Point(5, 20);
|
||||
tableLayoutPanel8.Margin = new System.Windows.Forms.Padding(4);
|
||||
tableLayoutPanel8.Name = "tableLayoutPanel8";
|
||||
tableLayoutPanel8.RowCount = 3;
|
||||
tableLayoutPanel8.RowCount = 4;
|
||||
tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel8.Size = new System.Drawing.Size(451, 474);
|
||||
tableLayoutPanel8.Size = new System.Drawing.Size(447, 470);
|
||||
tableLayoutPanel8.TabIndex = 0;
|
||||
//
|
||||
// browseAdbPath
|
||||
//
|
||||
this.browseAdbPath.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
this.browseAdbPath.Location = new System.Drawing.Point(327, 29);
|
||||
this.browseAdbPath.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.browseAdbPath.Name = "browseAdbPath";
|
||||
this.browseAdbPath.Size = new System.Drawing.Size(120, 28);
|
||||
this.browseAdbPath.TabIndex = 7;
|
||||
this.browseAdbPath.Text = "Browse";
|
||||
this.toolTip.SetToolTip(this.browseAdbPath, "Changes the directory where capture files are saved after being created, until sa" +
|
||||
"ved manually or deleted.\r\n\r\nDefaults to %TEMP%.");
|
||||
this.browseAdbPath.UseVisualStyleBackColor = true;
|
||||
this.browseAdbPath.Click += new System.EventHandler(this.browseAdbPath_Click);
|
||||
//
|
||||
//
|
||||
// label25
|
||||
//
|
||||
label25.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
label25.AutoSize = true;
|
||||
label25.Location = new System.Drawing.Point(4, 73);
|
||||
label25.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
label25.Name = "label25";
|
||||
label25.Size = new System.Drawing.Size(309, 22);
|
||||
label25.TabIndex = 26;
|
||||
label25.Text = "Max Connection Timeout (s)";
|
||||
label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.toolTip.SetToolTip(label25, "Maximum time to try connecting to the target app.");
|
||||
//
|
||||
// maxConnectTimeout
|
||||
//
|
||||
this.maxConnectTimeout.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.maxConnectTimeout.AutoSize = true;
|
||||
this.maxConnectTimeout.Location = new System.Drawing.Point(321, 73);
|
||||
this.maxConnectTimeout.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.maxConnectTimeout.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxConnectTimeout.Name = "maxConnectTimeout";
|
||||
this.maxConnectTimeout.Size = new System.Drawing.Size(122, 22);
|
||||
this.maxConnectTimeout.TabIndex = 25;
|
||||
this.toolTip.SetToolTip(this.maxConnectTimeout, "Maximum time to try connecting to the target app.");
|
||||
this.maxConnectTimeout.ValueChanged += new System.EventHandler(this.maxConnectTimeout_ValueChanged);
|
||||
//
|
||||
// label36
|
||||
//
|
||||
label36.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
//
|
||||
label36.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
label36.AutoSize = true;
|
||||
label36.Location = new System.Drawing.Point(4, 0);
|
||||
label36.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
label36.MinimumSize = new System.Drawing.Size(0, 25);
|
||||
label36.Location = new System.Drawing.Point(5, 0);
|
||||
label36.Margin = new System.Windows.Forms.Padding(3);
|
||||
label36.MinimumSize = new System.Drawing.Size(0, 31);
|
||||
label36.Name = "label36";
|
||||
label36.Size = new System.Drawing.Size(315, 25);
|
||||
label36.Size = new System.Drawing.Size(307, 31);
|
||||
label36.TabIndex = 14;
|
||||
label36.Text = "Android ADB executable path";
|
||||
label36.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.toolTip.SetToolTip(label36, "Changes the directory where capture files are saved after being created, until sa" +
|
||||
"ved manually or deleted.\r\n\r\nDefaults to %TEMP%.");
|
||||
//
|
||||
this.toolTip.SetToolTip(label36, "The location of adb.exe, used to control Android devices.");
|
||||
//
|
||||
// adbPath
|
||||
//
|
||||
this.adbPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.adbPath.Location = new System.Drawing.Point(4, 29);
|
||||
this.adbPath.Margin = new System.Windows.Forms.Padding(4);
|
||||
//
|
||||
this.adbPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.adbPath.Location = new System.Drawing.Point(5, 39);
|
||||
this.adbPath.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.adbPath.Name = "adbPath";
|
||||
this.adbPath.Size = new System.Drawing.Size(315, 22);
|
||||
this.adbPath.Size = new System.Drawing.Size(307, 22);
|
||||
this.adbPath.TabIndex = 24;
|
||||
this.toolTip.SetToolTip(this.adbPath, "Changes the directory where capture files are saved after being created, until sa" +
|
||||
"ved manually or deleted.\r\n\r\nDefaults to %TEMP%.");
|
||||
this.toolTip.SetToolTip(this.adbPath, "The location of adb.exe, used to control Android devices.");
|
||||
this.adbPath.TextChanged += new System.EventHandler(this.adbPath_TextChanged);
|
||||
//
|
||||
//
|
||||
// browseAdbPath
|
||||
//
|
||||
this.browseAdbPath.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.browseAdbPath.Location = new System.Drawing.Point(322, 36);
|
||||
this.browseAdbPath.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.browseAdbPath.Name = "browseAdbPath";
|
||||
this.browseAdbPath.Size = new System.Drawing.Size(90, 23);
|
||||
this.browseAdbPath.TabIndex = 7;
|
||||
this.browseAdbPath.Text = "Browse";
|
||||
this.toolTip.SetToolTip(this.browseAdbPath, "The location of adb.exe, used to control Android devices.");
|
||||
this.browseAdbPath.UseVisualStyleBackColor = true;
|
||||
this.browseAdbPath.Click += new System.EventHandler(this.browseAdbPath_Click);
|
||||
//
|
||||
// pagesTree
|
||||
//
|
||||
treeListColumn3.AutoSize = true;
|
||||
@@ -1329,6 +1367,11 @@
|
||||
groupBox4.ResumeLayout(false);
|
||||
this.tableLayoutPanel5.ResumeLayout(false);
|
||||
this.tableLayoutPanel5.PerformLayout();
|
||||
this.androidTab.ResumeLayout(false);
|
||||
groupBox7.ResumeLayout(false);
|
||||
tableLayoutPanel8.ResumeLayout(false);
|
||||
tableLayoutPanel8.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxConnectTimeout)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pagesTree)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -1387,5 +1430,6 @@
|
||||
private System.Windows.Forms.TabPage androidTab;
|
||||
private System.Windows.Forms.Button browseAdbPath;
|
||||
private System.Windows.Forms.TextBox adbPath;
|
||||
private System.Windows.Forms.NumericUpDown maxConnectTimeout;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ namespace renderdocui.Windows.Dialogs
|
||||
externalDisassemblerArgs.Text = m_Core.Config.GetDefaultExternalDisassembler().args;
|
||||
externalDisassemblePath.Text = m_Core.Config.GetDefaultExternalDisassembler().executable;
|
||||
adbPath.Text = m_Core.Config.AdbExecutablePath;
|
||||
maxConnectTimeout.Value = m_Core.Config.MaxConnectTimeout;
|
||||
|
||||
TextureViewer_ResetRange.Checked = m_Core.Config.TextureViewer_ResetRange;
|
||||
TextureViewer_PerTexSettings.Checked = m_Core.Config.TextureViewer_PerTexSettings;
|
||||
@@ -414,5 +415,16 @@ namespace renderdocui.Windows.Dialogs
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void maxConnectTimeout_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_Core.Config.MaxConnectTimeout = (uint)maxConnectTimeout.Value;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,6 +1009,8 @@ namespace renderdocui.Windows
|
||||
|
||||
string logfile = m_Core.TempLogFilename(Path.GetFileNameWithoutExtension(exe));
|
||||
|
||||
StaticExports.SetConfigSetting("MaxConnectTimeout", m_Core.Config.MaxConnectTimeout.ToString());
|
||||
|
||||
UInt32 ret = m_Core.Renderer.ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts);
|
||||
|
||||
if (ret == 0)
|
||||
|
||||
Reference in New Issue
Block a user