If the app name doesn't have a directory separator search PATH directories to find path of application to launch.
Resolve the app name fully then change the working directory
* A 64-bit install has an x86 subfolder to capture 32-bit programs. If
a 32-bit program then launches a 64-bit program we need to 'promote'
back to run the original bitness to capture it.
* It's still not supported to capture 64-bit in general from just a
32-bit install as the support files aren't included.
* In particular, we don't want to hold this lock while potentially
calling FreeLibrary as that could try to acquire the loader lock that
another thread might be holding while waiting on our lock.
* Using OS-specific append writing functions instead of simple fopen/
fwrite/fclose we can guarantee that multiple processes writing to the
same log file won't trash or interleave their log output.
* To make the logs readable the PID is now included along with the
project/timestamp.
* After that, we make sure that when we launch a program we set the
output log to the same file as the parent UI. This keeps all the logs
together and removes user confusion over which logfile is needed.
* We also move all of RenderDoc's temporary files under a RenderDoc
folder in the temp folder, instead of scattering the files in the root
* By renaming the renderdoc and renderdoccmd projects to something else
(say 'selfhost' and 'selfhostcmd') then they can be used to capture
renderdocui and the replaying that's happening.
* Only supported on development builds and might break down, but it's
handy to have as an easy to enable option.
* There's also a couple of handy python functions exposed -
renderdoc.StaticExports.StartSelfHostCapture(string dllname)
renderdoc.StaticExports.EndSelfHostCapture(string dllname)
which can be used to start and stop the capture around e.g. a shader
debug operation or a pixel history operation or something similar.
* If the application incorrectly calls WSACleanup() before WSAStartup()
then instead of just an error for invalid use, it will instead kill
all of the sockets we created from our early WSAStartup().
* To fix this, we hook those functions and track the process wide ref-
count, to prevent it from every going to 0 until we shut down our own.
* This was found on GTA 5 in particular but possibly some other
application will do this too.
* When relevant we do SetLastError(S_OK) before calling the 'real'
function, and likewise do GetLastError() to preserve the result if
we're doing work after the real function.
* This also fixes the problem of capturing 32-bit programs with 64-bit
RenderDoc failing to properly insert environment variables and
error'ing when it tries to do it directly.
* This was copy-pasted from windows where unfortunately the nfds
argument is ignored and we could get away with just passing 0 (which
I suspect is where the broken code came from originally - a windows
example code that passed 0)
* Also allow disabling GL a little better by removing the dependency in
renderdoccmd.
* Disabling them now completely removes all xcb and xlib build
dependencies. The resulting library/executable is only useful in
limited situations - e.g. replaying vulkan remotely which doesn't need
any window system interaction. Or capturing vulkan as well with the
KHR_display WSI extension which doesn't need any built-time includes
or libs.
* If the machine idents differ in significant ways that we'd consider
it to be a different platform (currently just OS), and if so mark it
as supported but suggested to be replayed remotely.
* This can be used to determine what kind of machine a capture came from
and potentially decide to alert the user and suggest replaying on that
kind of machine if it's very different.