Remove old code

This commit is contained in:
baldurk
2016-07-12 17:05:30 +02:00
parent e66794018c
commit 90f6a9da20
-276
View File
@@ -650,282 +650,6 @@ int renderdoccmd(std::vector<std::string> &argv)
return ret;
}
#if 0
if(argv.size() >= 2)
{
// fall through and print usage
if(argequal(argv[1], "--help") || argequal(argv[1], "-h"))
{
}
// if we were given a logfile, load it and continually replay it.
else if(strstr(argv[1].c_str(), ".rdc") != NULL)
{
float progress = 0.0f;
ReplayRenderer *renderer = NULL;
auto status = RENDERDOC_CreateReplayRenderer(argv[1].c_str(), &progress, &renderer);
if(renderer)
{
if(status == eReplayCreate_Success)
DisplayRendererPreview(renderer);
ReplayRenderer_Shutdown(renderer);
}
return 0;
}
// dump the image from a logfile
if(argequal(argv[1], "--thumb") || argequal(argv[1], "-t"))
{
if(argv.size() >= 3)
{
string jpgname = argv[2];
if(jpgname[jpgname.length() - 4] == '.' && jpgname[jpgname.length() - 3] == 'r' &&
jpgname[jpgname.length() - 2] == 'd' && jpgname[jpgname.length() - 1] == 'c')
{
jpgname.pop_back();
jpgname.pop_back();
jpgname.pop_back();
jpgname += "jpg";
}
else
{
jpgname += ".jpg";
}
uint32_t len = 0;
bool32 ret = RENDERDOC_GetThumbnail(argv[2].c_str(), NULL, len);
if(!ret)
{
fprintf(stderr, "No thumbnail in '%s' or error retrieving it", argv[2].c_str());
}
else
{
byte *jpgbuf = new byte[len];
RENDERDOC_GetThumbnail(argv[2].c_str(), jpgbuf, len);
FILE *f = fopen(jpgname.c_str(), "wb");
if(!f)
{
fprintf(stderr, "Couldn't open destination file '%s'.", jpgname.c_str());
}
else
{
fwrite(jpgbuf, 1, len, f);
fclose(f);
}
delete[] jpgbuf;
}
}
else
{
fprintf(stderr, "Not enough parameters to --thumb");
}
return 0;
}
// replay a logfile
else if(argequal(argv[1], "--replay") || argequal(argv[1], "-r"))
{
if(argv.size() >= 3)
{
float progress = 0.0f;
ReplayRenderer *renderer = NULL;
auto status = RENDERDOC_CreateReplayRenderer(argv[2].c_str(), &progress, &renderer);
if(renderer)
{
if(status == eReplayCreate_Success)
DisplayRendererPreview(renderer);
ReplayRenderer_Shutdown(renderer);
}
return 0;
}
else
{
fprintf(stderr, "Not enough parameters to --replay");
}
}
#if defined(RENDERDOC_PLATFORM_WIN32)
// if we were given an executable on windows, inject into it
// can't do this on other platforms as there's no nice extension
// and we don't want to just launch any single parameter in case it's
// -h or -help or some other guess/typo
else if(strstr(argv[1].c_str(), ".exe") != NULL)
{
uint32_t ident = RENDERDOC_ExecuteAndInject(argv[1].c_str(), NULL, NULL, NULL, &opts, false);
if(ident == 0)
fprintf(stderr, "Failed to create & inject\n");
else
fprintf(stderr, "Created & injected as %d\n", ident);
return ident;
}
#endif
// capture a program with default capture options
else if(argequal(argv[1], "--capture") || argequal(argv[1], "-c"))
{
if(argv.size() >= 4)
{
uint32_t ident =
RENDERDOC_ExecuteAndInject(argv[2].c_str(), NULL, argv[3].c_str(), NULL, &opts, false);
if(ident == 0)
fprintf(stderr, "Failed to create & inject to '%s' with params \"%s\"\n", argv[2].c_str(),
argv[3].c_str());
else
fprintf(stderr, "Created & injected '%s' with params \"%s\" as %d\n", argv[2].c_str(),
argv[3].c_str(), ident);
return ident;
}
else if(argv.size() >= 3)
{
uint32_t ident = RENDERDOC_ExecuteAndInject(argv[2].c_str(), NULL, NULL, NULL, &opts, false);
if(ident == 0)
fprintf(stderr, "Failed to create & inject to '%s'\n", argv[2].c_str());
else
fprintf(stderr, "Created & injected '%s' as %d\n", argv[2].c_str(), ident);
return ident;
}
else
{
fprintf(stderr, "Not enough parameters to --capture");
}
}
// inject into a running process with default capture options
else if(argequal(argv[1], "--inject") || argequal(argv[1], "-i"))
{
if(argv.size() >= 3)
{
const char *pid = argv[2].c_str();
while(*pid == '"' || isspace(*pid))
pid++;
uint32_t pidNum = (uint32_t)atoi(pid);
uint32_t ident = RENDERDOC_InjectIntoProcess(pidNum, NULL, &opts, false);
if(ident == 0)
printf("Failed to inject to %u\n", pidNum);
else
printf("Injected to %u as %u\n", pidNum, ident);
return ident;
}
else
{
fprintf(stderr, "Not enough parameters to --inject");
}
}
// spawn remote replay host
else if(argequal(argv[1], "--replayhost") || argequal(argv[1], "-rh"))
{
RENDERDOC_SpawnReplayHost(NULL);
return 1;
}
// replay a logfile over the network on a remote host
else if(argequal(argv[1], "--remotereplay") || argequal(argv[1], "-rr"))
{
if(argv.size() >= 4)
{
RemoteRenderer *remote = NULL;
auto status = RENDERDOC_CreateRemoteReplayConnection(argv[2].c_str(), &remote);
if(remote == NULL || status != eReplayCreate_Success)
return 1;
float progress = 0.0f;
ReplayRenderer *renderer = NULL;
status = RemoteRenderer_CreateProxyRenderer(remote, 0, argv[3].c_str(), &progress, &renderer);
if(renderer)
{
if(status == eReplayCreate_Success)
DisplayRendererPreview(renderer);
ReplayRenderer_Shutdown(renderer);
}
return 0;
}
else
{
fprintf(stderr, "Not enough parameters to --remotereplay");
}
}
// not documented/useful for manual use on the cmd line, used internally
else if(argequal(argv[1], "--cap32for64"))
{
if(argv.size() >= 5)
{
const char *pid = argv[2].c_str();
while(*pid == '"' || isspace(*pid))
pid++;
uint32_t pidNum = (uint32_t)atoi(pid);
const char *log = argv[3].c_str();
if(log[0] == 0)
log = NULL;
CaptureOptions cmdopts;
readCapOpts(argv[4].c_str(), &cmdopts);
return RENDERDOC_InjectIntoProcess(pidNum, log, &cmdopts, false);
}
else
{
fprintf(stderr, "Not enough parameters to --cap32for64");
}
}
}
fprintf(stderr, "renderdoccmd usage:\n\n");
fprintf(stderr,
" <file.rdc> Launch a preview window that replays this logfile "
"and\n");
fprintf(stderr, " displays the backbuffer.\n");
#if defined(RENDERDOC_PLATFORM_WIN32)
fprintf(stderr,
" <program.exe> Launch a capture of this program with default "
"options.\n");
#endif
fprintf(stderr, "\n");
fprintf(stderr, " -h, --help Displays this help message.\n");
fprintf(stderr,
" -t, --thumb LOGFILE.rdc Dumps the embedded thumbnail to LOGFILE.jpg if it "
"exists.\n");
fprintf(stderr,
" -c, --capture PROGRAM Launches capture of the program with default "
"options.\n");
fprintf(stderr,
" -i, --inject PID Injects into the specified PID to capture.\n");
fprintf(stderr,
" -r, --replay LOGFILE Launch a preview window that replays this logfile "
"and\n");
fprintf(stderr, " displays the backbuffer.\n");
fprintf(stderr,
" -rh, --replayhost Starts a replay host server that can be used to "
"remotely\n");
fprintf(stderr, " replay logfiles from another machine.\n");
fprintf(
stderr,
" -rr, --remotereplay HOST LOGFILE Launch a replay of the logfile and display a preview\n");
fprintf(
stderr,
" window. Use the remote host to replay all commands.\n");
return 1;
#endif
int renderdoccmd(int argc, char **c_argv)
{
std::vector<std::string> argv;