diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 6aaf339d8..80142afef 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -1038,9 +1038,13 @@ void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(string(logfile)); wstring wpathmatch = StringFormat::UTF82Wide(string(pathmatch)); - _snwprintf_s(paramsAlloc, 2047, 2047, - L"\"%ls\" globalhook --match \"%ls\" --log \"%ls\" --capopts \"%hs\"", renderdocPath, - wpathmatch.c_str(), wlogfile.c_str(), optstr.c_str()); + std::string debugLogfile = RDCGETLOGFILE(); + wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile); + + _snwprintf_s( + paramsAlloc, 2047, 2047, + L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" --capopts \"%hs\"", + renderdocPath, wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(), optstr.c_str()); paramsAlloc[2047] = 0; diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index a8bc510ec..87671c5ba 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -678,7 +678,8 @@ struct GlobalHookCommand : public Command virtual void AddOptions(cmdline::parser &parser) { parser.add("match", 0, ""); - parser.add("log", 0, ""); + parser.add("logfile", 0, ""); + parser.add("debuglog", 0, ""); parser.add("capopts", 0, ""); } virtual const char *Description() { return "Internal use only!"; } @@ -687,7 +688,8 @@ struct GlobalHookCommand : public Command virtual int Execute(cmdline::parser &parser, const CaptureOptions &) { string pathmatch = parser.get("match"); - string log = parser.get("log"); + string logfile = parser.get("logfile"); + string debuglog = parser.get("debuglog"); CaptureOptions cmdopts; readCapOpts(parser.get("capopts").c_str(), &cmdopts); @@ -764,7 +766,8 @@ struct GlobalHookCommand : public Command wcsncpy_s(shimdata->pathmatchstring, wpathmatch.c_str(), _TRUNCATE); wcsncpy_s(shimdata->rdocpath, rdocpath, _TRUNCATE); - strncpy_s(shimdata->log, log.c_str(), _TRUNCATE); + strncpy_s(shimdata->logfile, logfile.c_str(), _TRUNCATE); + strncpy_s(shimdata->debuglog, debuglog.c_str(), _TRUNCATE); memcpy(shimdata->opts, &cmdopts, sizeof(CaptureOptions)); static_assert(sizeof(CaptureOptions) <= sizeof(shimdata->opts), diff --git a/renderdocshim/renderdocshim.cpp b/renderdocshim/renderdocshim.cpp index aa7d57b10..87348dee9 100644 --- a/renderdocshim/renderdocshim.cpp +++ b/renderdocshim/renderdocshim.cpp @@ -35,8 +35,9 @@ #include struct CaptureOptions; -typedef void(__cdecl *pRENDERDOC_SetCaptureOptions)(const CaptureOptions *opts); -typedef void(__cdecl *pRENDERDOC_SetLogFile)(const char *logfile); +typedef void(__cdecl *pINTERNAL_SetCaptureOptions)(const CaptureOptions *opts); +typedef void(__cdecl *pINTERNAL_SetLogFile)(const char *logfile); +typedef void(__cdecl *pRENDERDOC_SetDebugLogFile)(const char *logfile); #if defined(RELEASE) #define LOGPRINT(txt) \ @@ -113,16 +114,21 @@ void CheckHook() if(mod) { - pRENDERDOC_SetCaptureOptions setopts = - (pRENDERDOC_SetCaptureOptions)GetProcAddress(mod, "RENDERDOC_SetCaptureOptions"); - pRENDERDOC_SetLogFile setlog = - (pRENDERDOC_SetLogFile)GetProcAddress(mod, "RENDERDOC_SetLogFile"); + pINTERNAL_SetCaptureOptions setopts = + (pINTERNAL_SetCaptureOptions)GetProcAddress(mod, "INTERNAL_SetCaptureOptions"); + pINTERNAL_SetLogFile setlogfile = + (pINTERNAL_SetLogFile)GetProcAddress(mod, "INTERNAL_SetLogFile"); + pRENDERDOC_SetDebugLogFile setdebuglog = + (pRENDERDOC_SetDebugLogFile)GetProcAddress(mod, "RENDERDOC_SetDebugLogFile"); if(setopts) setopts((const CaptureOptions *)data->opts); - if(setlog && data->log[0]) - setlog(data->log); + if(setlogfile && data->logfile[0]) + setlogfile(data->logfile); + + if(setdebuglog && data->debuglog[0]) + setdebuglog(data->debuglog); } } else diff --git a/renderdocshim/renderdocshim.h b/renderdocshim/renderdocshim.h index e140f0a31..dc6e6b4c9 100644 --- a/renderdocshim/renderdocshim.h +++ b/renderdocshim/renderdocshim.h @@ -26,7 +26,8 @@ struct ShimData { wchar_t pathmatchstring[2048]; wchar_t rdocpath[2048]; - char log[2048]; + char debuglog[2048]; + char logfile[2048]; unsigned char opts[512]; };