mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 06:05:45 +00:00
detect adb: (invalid in normal hostname) as android remote target
* For now, just redirect to 127.0.0.1 and assume the user has proper port forwarding set up, but in future we'd do this ourselves and maybe parse out a device name after the adb:
This commit is contained in:
@@ -1187,6 +1187,13 @@ RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, RemoteSe
|
||||
if(host != NULL && host[0] != '\0')
|
||||
s = host;
|
||||
|
||||
if(!strncmp(host, "adb:", 4))
|
||||
{
|
||||
s = "127.0.0.1";
|
||||
|
||||
// could parse out an (optional) device name from host+4 here.
|
||||
}
|
||||
|
||||
if(port == 0)
|
||||
port = RENDERDOC_GetDefaultRemoteServerPort();
|
||||
|
||||
|
||||
@@ -705,12 +705,22 @@ extern "C" RENDERDOC_API TargetControl *RENDERDOC_CC RENDERDOC_CreateTargetContr
|
||||
if(host != NULL && host[0] != '\0')
|
||||
s = host;
|
||||
|
||||
bool android = false;
|
||||
|
||||
if(!strncmp(host, "adb:", 4))
|
||||
{
|
||||
android = true;
|
||||
s = "127.0.0.1";
|
||||
|
||||
// could parse out an (optional) device name from host+4 here.
|
||||
}
|
||||
|
||||
Network::Socket *sock = Network::CreateClientSocket(s.c_str(), ident & 0xffff, 750);
|
||||
|
||||
if(sock == NULL)
|
||||
return NULL;
|
||||
|
||||
bool localhost = Network::GetIPOctet(sock->GetRemoteIP(), 0) == 127;
|
||||
bool localhost = !android && (Network::GetIPOctet(sock->GetRemoteIP(), 0) == 127);
|
||||
|
||||
TargetControl *remote = new TargetControl(sock, clientName, forceConnection != 0, localhost);
|
||||
|
||||
|
||||
@@ -477,6 +477,13 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
|
||||
if(host != NULL && host[0] != '\0')
|
||||
s = host;
|
||||
|
||||
if(!strncmp(host, "adb:", 4))
|
||||
{
|
||||
s = "127.0.0.1";
|
||||
|
||||
// could parse out an (optional) device name from host+4 here.
|
||||
}
|
||||
|
||||
// initial case is we're called with 0, start with the first port.
|
||||
// otherwise we're called with the last successful ident, so increment
|
||||
// before continuing to enumerate.
|
||||
|
||||
Reference in New Issue
Block a user