mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 17:36:36 +00:00
Change renderdoccmd to be a console program on windows.
* This means it outputs natively/properly to stdout/stderr and its output can be redirected with pipes. * It does mean we need to be very careful whenever it's run internally to not pop up a command window, which happens by default.
This commit is contained in:
@@ -752,21 +752,12 @@ std::string getParentExe()
|
||||
return "";
|
||||
}
|
||||
|
||||
int WINAPI wWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine,
|
||||
_In_ int nShowCmd)
|
||||
// ignore the argc/argv we get here, convert from wide to be sure we're unicode safe.
|
||||
int main(int, char *)
|
||||
{
|
||||
LPWSTR *wargv;
|
||||
int argc;
|
||||
|
||||
if(AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
|
||||
std::cout.sync_with_stdio();
|
||||
std::cerr.sync_with_stdio();
|
||||
}
|
||||
|
||||
wargv = CommandLineToArgvW(GetCommandLine(), &argc);
|
||||
|
||||
std::vector<std::string> argv;
|
||||
@@ -789,13 +780,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_
|
||||
parent[i] = '/';
|
||||
}
|
||||
|
||||
if(strstr(parent.c_str(), "/cmd.exe") && AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
|
||||
hInstance = hInst;
|
||||
hInstance = GetModuleHandleA(NULL);
|
||||
|
||||
WNDCLASSEX wc;
|
||||
wc.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
Reference in New Issue
Block a user