diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 8be54103f..465fbd03b 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -2057,6 +2057,7 @@ DOCUMENT(R"(Launch an application and inject into it to allow capturing. :param str cmdLine: The command line to use when running the application, it will be processed in a platform specific way to generate arguments. :param list env: Any :class:`EnvironmentModification` that should be made when running the program. +:param str capturefile: The capture file path template, or blank to use a default location. :param CaptureOptions opts: The capture options to use when injecting into the program. :param bool waitForExit: If ``True`` this function will block until the process exits. :return: The :class:`ExecuteResult` indicating both the status of the operation (success or failure) @@ -2066,13 +2067,14 @@ DOCUMENT(R"(Launch an application and inject into it to allow capturing. )"); extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, - const rdcarray &env, const char *logfile, + const rdcarray &env, const char *capturefile, const CaptureOptions &opts, bool waitForExit); DOCUMENT(R"(Where supported by operating system and permissions, inject into a running process. :param int pid: The Process ID (PID) to inject into. :param list env: Any :class:`EnvironmentModification` that should be made when running the program. +:param str capturefile: The capture file path template, or blank to use a default location. :param CaptureOptions opts: The capture options to use when injecting into the program. :param bool waitForExit: If ``True`` this function will block until the process exits. :return: The :class:`ExecuteResult` indicating both the status of the operation (success or failure) @@ -2082,7 +2084,7 @@ DOCUMENT(R"(Where supported by operating system and permissions, inject into a r )"); extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC RENDERDOC_InjectIntoProcess(uint32_t pid, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, bool waitForExit); + const char *capturefile, const CaptureOptions &opts, bool waitForExit); DOCUMENT(R"(When debugging RenderDoc it can be useful to capture itself by doing a side-build with a temporary name. This function wraps up the use of the in-application API to start a capture. diff --git a/renderdoc/os/os_specific.h b/renderdoc/os/os_specific.h index 8df373743..3115babc2 100644 --- a/renderdoc/os/os_specific.h +++ b/renderdoc/os/os_specific.h @@ -56,12 +56,13 @@ void ApplyEnvironmentModification(); const char *GetEnvVariable(const char *name); bool CanGlobalHook(); -bool StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts); +bool StartGlobalHook(const char *pathmatch, const char *capturefile, const CaptureOptions &opts); bool IsGlobalHookActive(); void StopGlobalHook(); ExecuteResult InjectIntoProcess(uint32_t pid, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, bool waitForExit); + const char *capturefile, const CaptureOptions &opts, + bool waitForExit); struct ProcessResult { string strStdout, strStderror; @@ -73,7 +74,7 @@ uint32_t LaunchScript(const char *script, const char *workingDir, const char *ar ProcessResult *result = NULL); ExecuteResult LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, + const char *capturefile, const CaptureOptions &opts, bool waitForExit); void *LoadModule(const char *module); void *GetFunctionAddress(void *module, const char *function); diff --git a/renderdoc/os/posix/posix_libentry.cpp b/renderdoc/os/posix/posix_libentry.cpp index d32ae7a4f..771b1192c 100644 --- a/renderdoc/os/posix/posix_libentry.cpp +++ b/renderdoc/os/posix/posix_libentry.cpp @@ -48,7 +48,7 @@ void library_loaded() { RenderDoc::Inst().Initialise(); - const char *logfile = Process::GetEnvVariable("RENDERDOC_LOGFILE"); + const char *capturefile = Process::GetEnvVariable("RENDERDOC_CAPFILE"); const char *opts = Process::GetEnvVariable("RENDERDOC_CAPTUREOPTS"); if(opts) @@ -61,9 +61,9 @@ void library_loaded() RenderDoc::Inst().SetCaptureOptions(optstruct); } - if(logfile) + if(capturefile) { - RenderDoc::Inst().SetCaptureFileTemplate(logfile); + RenderDoc::Inst().SetCaptureFileTemplate(capturefile); } RDCLOG("Loading into %s", curfile.c_str()); diff --git a/renderdoc/os/posix/posix_process.cpp b/renderdoc/os/posix/posix_process.cpp index 06ee88f7d..fb440a668 100644 --- a/renderdoc/os/posix/posix_process.cpp +++ b/renderdoc/os/posix/posix_process.cpp @@ -691,8 +691,8 @@ uint32_t Process::LaunchScript(const char *script, const char *workingDir, const ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine, const rdcarray &envList, - const char *logfile, const CaptureOptions &opts, - bool waitForExit) + const char *capturefile, + const CaptureOptions &opts, bool waitForExit) { if(app == NULL || app[0] == 0) { @@ -708,8 +708,8 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w for(const EnvironmentModification &e : envList) modifications.push_back(e); - if(logfile == NULL) - logfile = ""; + if(capturefile == NULL) + capturefile = ""; string binpath, libpath; { @@ -743,7 +743,7 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w modifications.push_back( EnvironmentModification(EnvMod::Append, EnvSep::Platform, PRELOAD_ENV_VAR, libfile.c_str())); modifications.push_back( - EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_LOGFILE", logfile)); + EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_CAPFILE", capturefile)); modifications.push_back( EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_CAPTUREOPTS", optstr.c_str())); modifications.push_back(EnvironmentModification(EnvMod::Set, EnvSep::NoSep, diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index e6f4c6f7f..f498b76a9 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -196,10 +196,10 @@ extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetCaptureOptions(Capture RenderDoc::Inst().SetCaptureOptions(*opts); } -extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetLogFile(const char *log) +extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetCaptureFile(const char *capfile) { - if(log) - RenderDoc::Inst().SetCaptureFileTemplate(log); + if(capfile) + RenderDoc::Inst().SetCaptureFileTemplate(capfile); } static EnvironmentModification tempEnvMod; @@ -540,10 +540,10 @@ static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, c } ExecuteResult Process::InjectIntoProcess(uint32_t pid, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, + const char *capturefile, const CaptureOptions &opts, bool waitForExit) { - wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(logfile); + wstring wcapturefile = capturefile == NULL ? L"" : StringFormat::UTF82Wide(capturefile); HANDLE hProcess = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | @@ -792,9 +792,10 @@ ExecuteResult Process::InjectIntoProcess(uint32_t pid, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, - bool waitForExit) + const char *capturefile, + const CaptureOptions &opts, bool waitForExit) { void *func = - GetProcAddress(GetModuleHandleA(STRINGIZE(RDOC_DLL_FILE) ".dll"), "INTERNAL_SetLogFile"); + GetProcAddress(GetModuleHandleA(STRINGIZE(RDOC_DLL_FILE) ".dll"), "INTERNAL_SetCaptureFile"); if(func == NULL) { @@ -1051,7 +1053,7 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w if(pi.dwProcessId == 0) return {ReplayStatus::InjectionFailed, 0}; - ExecuteResult ret = InjectIntoProcess(pi.dwProcessId, {}, logfile, opts, false); + ExecuteResult ret = InjectIntoProcess(pi.dwProcessId, {}, capturefile, opts, false); CloseHandle(pi.hProcess); ResumeThread(pi.hThread); @@ -1337,7 +1339,8 @@ static void GlobalHookThread() } } -bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts) +bool Process::StartGlobalHook(const char *pathmatch, const char *capturefile, + const CaptureOptions &opts) { if(pathmatch == NULL) return false; @@ -1443,17 +1446,17 @@ bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const // serialise to string with two chars per byte string optstr = opts.EncodeAsString(); - wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(string(logfile)); + wstring wcapturefile = capturefile == NULL ? L"" : StringFormat::UTF82Wide(string(capturefile)); wstring wpathmatch = StringFormat::UTF82Wide(string(pathmatch)); std::string debugLogfile = RDCGETLOGFILE(); wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile); _snwprintf_s(¶msAlloc[0], 2047, 2047, - L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" " + L"\"%ls\" globalhook --match \"%ls\" --capfile \"%ls\" --debuglog \"%ls\" " L"--capopts \"%hs\"", - cmdpathNative.c_str(), wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(), - optstr.c_str()); + cmdpathNative.c_str(), wpathmatch.c_str(), wcapturefile.c_str(), + wdebugLogfile.c_str(), optstr.c_str()); paramsAlloc[2047] = 0; @@ -1515,10 +1518,10 @@ bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const // repeat the process for the Wow32 renderdoccmd #if ENABLED(RDOC_X64) _snwprintf_s(¶msAlloc[0], 2047, 2047, - L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" " + L"\"%ls\" globalhook --match \"%ls\" --capfile \"%ls\" --debuglog \"%ls\" " L"--capopts \"%hs\"", - cmdpathWow32.c_str(), wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(), - optstr.c_str()); + cmdpathWow32.c_str(), wpathmatch.c_str(), wcapturefile.c_str(), + wdebugLogfile.c_str(), optstr.c_str()); paramsAlloc[2047] = 0; diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 27635d043..66feb0ee6 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -303,10 +303,10 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UnregisterMemoryRegion(void extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, - const rdcarray &env, const char *logfile, + const rdcarray &env, const char *capturefile, const CaptureOptions &opts, bool waitForExit) { - return Process::LaunchAndInjectIntoProcess(app, workingDir, cmdLine, env, logfile, opts, + return Process::LaunchAndInjectIntoProcess(app, workingDir, cmdLine, env, capturefile, opts, waitForExit != 0); } @@ -316,10 +316,10 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_GetDefaultCaptureOptions(Ca } extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_StartGlobalHook(const char *pathmatch, - const char *logfile, + const char *capturefile, const CaptureOptions &opts) { - return Process::StartGlobalHook(pathmatch, logfile, opts); + return Process::StartGlobalHook(pathmatch, capturefile, opts); } extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StopGlobalHook() @@ -339,9 +339,9 @@ extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_CanGlobalHook() extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC RENDERDOC_InjectIntoProcess(uint32_t pid, const rdcarray &env, - const char *logfile, const CaptureOptions &opts, bool waitForExit) + const char *capturefile, const CaptureOptions &opts, bool waitForExit) { - return Process::InjectIntoProcess(pid, env, logfile, opts, waitForExit != 0); + return Process::InjectIntoProcess(pid, env, capturefile, opts, waitForExit != 0); } extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeArrayMem(const void *mem) diff --git a/renderdoccmd/renderdoccmd.cpp b/renderdoccmd/renderdoccmd.cpp index c2c52fd12..252140b4a 100644 --- a/renderdoccmd/renderdoccmd.cpp +++ b/renderdoccmd/renderdoccmd.cpp @@ -821,7 +821,7 @@ struct CapAltBitCommand : public Command virtual void AddOptions(cmdline::parser &parser) { parser.add("pid", 0, ""); - parser.add("log", 0, ""); + parser.add("capfile", 0, ""); parser.add("debuglog", 0, ""); parser.add("capopts", 0, ""); parser.stop_at_rest(true); @@ -916,7 +916,7 @@ struct CapAltBitCommand : public Command RENDERDOC_SetDebugLogFile(debuglog.c_str()); ExecuteResult result = RENDERDOC_InjectIntoProcess( - parser.get("pid"), env, parser.get("log").c_str(), cmdopts, false); + parser.get("pid"), env, parser.get("capfile").c_str(), cmdopts, false); if(result.status == ReplayStatus::Succeeded) return result.ident; diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index 77f3dbde0..c07fbc456 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -596,7 +596,7 @@ struct GlobalHookCommand : public Command virtual void AddOptions(cmdline::parser &parser) { parser.add("match", 0, ""); - parser.add("logfile", 0, ""); + parser.add("capfile", 0, ""); parser.add("debuglog", 0, ""); parser.add("capopts", 0, ""); } @@ -606,7 +606,7 @@ struct GlobalHookCommand : public Command virtual int Execute(cmdline::parser &parser, const CaptureOptions &) { wstring wpathmatch = conv(parser.get("match")); - string logfile = parser.get("logfile"); + string capfile = parser.get("capfile"); string debuglog = parser.get("debuglog"); CaptureOptions cmdopts; @@ -670,7 +670,7 @@ struct GlobalHookCommand : public Command wcsncpy_s(shimdata->pathmatchstring, wpathmatch.c_str(), _TRUNCATE); wcsncpy_s(shimdata->rdocpath, rdocpath, _TRUNCATE); - strncpy_s(shimdata->logfile, logfile.c_str(), _TRUNCATE); + strncpy_s(shimdata->capfile, capfile.c_str(), _TRUNCATE); strncpy_s(shimdata->debuglog, debuglog.c_str(), _TRUNCATE); memcpy(shimdata->opts, &cmdopts, sizeof(CaptureOptions)); diff --git a/renderdocshim/renderdocshim.cpp b/renderdocshim/renderdocshim.cpp index 25cfd02a7..86fc6191b 100644 --- a/renderdocshim/renderdocshim.cpp +++ b/renderdocshim/renderdocshim.cpp @@ -124,8 +124,8 @@ void CheckHook() if(setopts) setopts((const CaptureOptions *)data->opts); - if(setlogfile && data->logfile[0]) - setlogfile(data->logfile); + if(setlogfile && data->capfile[0]) + setlogfile(data->capfile); if(setdebuglog && data->debuglog[0]) setdebuglog(data->debuglog); diff --git a/renderdocshim/renderdocshim.h b/renderdocshim/renderdocshim.h index 0c1307059..d2c13c8f0 100644 --- a/renderdocshim/renderdocshim.h +++ b/renderdocshim/renderdocshim.h @@ -27,7 +27,7 @@ struct ShimData wchar_t pathmatchstring[2048]; wchar_t rdocpath[2048]; char debuglog[2048]; - char logfile[2048]; + char capfile[2048]; unsigned char opts[512]; };