Merge pull request #360 from michaelrgb/master

Add offset to Android network ports, to differentiate from localhost.
This commit is contained in:
Baldur Karlsson
2016-09-15 17:09:32 +02:00
committed by GitHub
3 changed files with 20 additions and 11 deletions
+1
View File
@@ -39,6 +39,7 @@ enum
RenderDoc_FirstTargetControlPort = 38920,
RenderDoc_LastTargetControlPort = RenderDoc_FirstTargetControlPort + 7,
RenderDoc_RemoteServerPort = 39920,
RenderDoc_AndroidPortOffset = 50,
};
/////////////////////////////////////////////////
+6 -3
View File
@@ -1187,16 +1187,19 @@ RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, RemoteSe
if(host != NULL && host[0] != '\0')
s = host;
if(port == 0)
port = RENDERDOC_GetDefaultRemoteServerPort();
if(host != NULL && !strncmp(host, "adb:", 4))
{
s = "127.0.0.1";
if(port == RENDERDOC_GetDefaultRemoteServerPort())
port += RenderDoc_AndroidPortOffset;
// could parse out an (optional) device name from host+4 here.
}
if(port == 0)
port = RENDERDOC_GetDefaultRemoteServerPort();
Network::Socket *sock = NULL;
if(s != "-")
+13 -8
View File
@@ -477,13 +477,6 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
if(host != NULL && host[0] != '\0')
s = host;
if(host != NULL && !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.
@@ -492,7 +485,19 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
else
nextIdent++;
for(; nextIdent <= RenderDoc_LastTargetControlPort; nextIdent++)
uint32_t lastIdent = RenderDoc_LastTargetControlPort;
if(host != NULL && !strncmp(host, "adb:", 4))
{
if(nextIdent == RenderDoc_FirstTargetControlPort)
nextIdent += RenderDoc_AndroidPortOffset;
lastIdent += RenderDoc_AndroidPortOffset;
s = "127.0.0.1";
// could parse out an (optional) device name from host+4 here.
}
for(; nextIdent <= lastIdent; nextIdent++)
{
Network::Socket *sock = Network::CreateClientSocket(s.c_str(), (uint16_t)nextIdent, 250);