Initial commit of existing code.

* All renderdoc code up to this point was written by me, history is available by request
This commit is contained in:
baldurk
2014-05-02 08:33:01 +01:00
parent 04b1549c0f
commit c38affcded
695 changed files with 230316 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
CC=gcc
CPP=g++
MACROS=-DLINUX \
-DRENDERDOC_PLATFORM=linux \
-DRENDERDOC_EXPORTS \
-DGIT_COMMIT_HASH='"'$$(git rev-parse HEAD)'"' \
-DRENDERDOC_VERSION_STRING='"0.20"'
CFLAGS=-c -Wall -Werror -fPIC $(MACROS) -I.
CPPFLAGS=-std=c++11 -g -Wno-unused -Wno-unknown-pragmas -Wno-reorder
LDFLAGS=-L../renderdoc -lrenderdoc
OBJECTS=linux_specific.o
all: bin/renderdoccmd
%.o: %.cpp
$(CPP) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
../renderdoc/librenderdoc.so:
bin/renderdoccmd: $(OBJECTS) $(SOURCES) ../renderdoc/librenderdoc.so
mkdir -p bin/
g++ -o bin/renderdoccmd $(LDFLAGS) $(OBJECTS)
clean:
find -type f -iname \*.o -exec rm '{}' \;
rm -f bin/renderdoccmd
+31
View File
@@ -0,0 +1,31 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2014 Crytek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <stdio.h>
int main()
{
puts("foo");
return 0;
}
+4838
View File
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
// little header to include forward declarations for miniz.c
#pragma once
extern "C" {
typedef unsigned char mz_uint8;
typedef signed short mz_int16;
typedef unsigned short mz_uint16;
typedef unsigned int mz_uint32;
typedef unsigned int mz_uint;
typedef long long mz_int64;
typedef unsigned long long mz_uint64;
typedef int mz_bool;
typedef struct
{
void *m_p;
size_t m_size, m_capacity;
mz_uint m_element_size;
} mz_zip_array;
struct mz_zip_internal_state_tag
{
mz_zip_array m_central_dir;
mz_zip_array m_central_dir_offsets;
mz_zip_array m_sorted_central_dir_offsets;
FILE *m_pFile;
void *m_pMem;
size_t m_mem_size;
size_t m_mem_capacity;
};
typedef struct mz_zip_internal_state_tag mz_zip_internal_state;
// Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL.
enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 };
typedef enum
{
MZ_ZIP_MODE_INVALID = 0,
MZ_ZIP_MODE_READING = 1,
MZ_ZIP_MODE_WRITING = 2,
MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3
} mz_zip_mode;
// Heap allocation callbacks.
// Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long.
typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size);
typedef void (*mz_free_func)(void *opaque, void *address);
typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size);
typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n);
typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n);
typedef struct
{
mz_uint64 m_archive_size;
mz_uint64 m_central_directory_file_ofs;
mz_uint m_total_files;
mz_zip_mode m_zip_mode;
mz_uint m_file_offset_alignment;
mz_alloc_func m_pAlloc;
mz_free_func m_pFree;
mz_realloc_func m_pRealloc;
void *m_pAlloc_opaque;
mz_file_read_func m_pRead;
mz_file_write_func m_pWrite;
void *m_pIO_opaque;
mz_zip_internal_state *m_pState;
} mz_zip_archive;
mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning);
mz_bool mz_zip_writer_init_wfile(mz_zip_archive *pZip, const wchar_t *pFilename, mz_uint64 size_to_reserve_at_beginning);
mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
mz_bool mz_zip_writer_add_wfile(mz_zip_archive *pZip, const char *pArchive_name, const wchar_t *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags);
mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip);
mz_bool mz_zip_writer_end(mz_zip_archive *pZip);
}; // extern "C"
+1
View File
@@ -0,0 +1 @@
// ADD PREDEFINED MACROS HERE!
+679
View File
@@ -0,0 +1,679 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2014 Crytek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <windows.h>
#include <tchar.h>
#include <string>
#include <vector>
#include <renderdoc.h>
#include "resource.h"
// breakpad
#include "common/windows/http_upload.h"
#include "client/windows/crash_generation/client_info.h"
#include "client/windows/crash_generation/crash_generation_server.h"
#include "miniz.h"
using std::string;
using std::wstring;
using std::vector;
using google_breakpad::ClientInfo;
using google_breakpad::CrashGenerationServer;
bool exitServer = false;
static HINSTANCE CrashHandlerInst = 0;
static HWND CrashHandlerWnd = 0;
bool uploadReport = false;
bool uploadDump = false;
bool uploadLog = false;
string reproSteps = "";
wstring dump = L"";
vector<google_breakpad::CustomInfoEntry> customInfo;
wstring logpath = L"";
INT_PTR CALLBACK CrashHandlerProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
HANDLE hIcon = LoadImage(CrashHandlerInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
if(hIcon)
{
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
}
SetDlgItemTextW(hDlg, IDC_WELCOMETEXT,
L"RenderDoc has encountered an unhandled exception or other similar unrecoverable error.\n\n" \
L"If you had captured but not saved a logfile it should still be available in %TEMP% and will not be deleted," \
L"you can try loading it again.\n\n" \
L"A minidump has been created and the RenderDoc diagnostic log (NOT any capture logfile) is available if you would like " \
L"to send them back to be analysed. The path for both is found below if you would like to inspect their contents and censor as appropriate.\n\n" \
L"Neither contains any significant private information, the minidump has some internal states and local memory at the time of the " \
L"crash & thread stacks, etc. The diagnostic log contains diagnostic messages like warnings and errors.\n\n" \
L"The only other information sent is the version of RenderDoc, C# exception callstack, and any notes you include.\n\n" \
L"Any repro steps or notes would be helpful to include with the report. If you'd like to be contacted about the bug " \
L"e.g. for updates about its status just include your email & name. Thank you!\n\n" \
L"Baldur (renderdoc@crytek.com)");
SetDlgItemTextW(hDlg, IDC_DUMPPATH, dump.c_str());
SetDlgItemTextW(hDlg, IDC_LOGPATH, logpath.c_str());
CheckDlgButton(hDlg, IDC_SENDDUMP, BST_CHECKED);
CheckDlgButton(hDlg, IDC_SENDLOG, BST_CHECKED);
}
case WM_SHOWWINDOW:
{
{
RECT r;
GetClientRect(hDlg, &r);
int xPos = (GetSystemMetrics(SM_CXSCREEN) - r.right)/2;
int yPos = (GetSystemMetrics(SM_CYSCREEN) - r.bottom)/2;
SetWindowPos(hDlg, NULL, xPos, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
return (INT_PTR)TRUE;
}
case WM_COMMAND:
{
int ID = LOWORD(wParam);
if(ID == IDC_DONTSEND)
{
EndDialog(hDlg, 0);
return (INT_PTR)TRUE;
}
else if(ID == IDC_SEND)
{
uploadReport = true;
uploadDump = (IsDlgButtonChecked(hDlg, IDC_SENDDUMP) != 0);
uploadLog = (IsDlgButtonChecked(hDlg, IDC_SENDLOG) != 0);
char notes[4097] = {0};
GetDlgItemTextA(hDlg, IDC_NAME, notes, 4096);
notes[4096] = 0;
reproSteps = "Name: ";
reproSteps += notes;
reproSteps += "\n";
memset(notes, 0, 4096);
GetDlgItemTextA(hDlg, IDC_EMAIL, notes, 4096);
notes[4096] = 0;
reproSteps += "Email: ";
reproSteps += notes;
reproSteps += "\n\n";
memset(notes, 0, 4096);
GetDlgItemTextA(hDlg, IDC_REPRO, notes, 4096);
notes[4096] = 0;
reproSteps += notes;
EndDialog(hDlg, 0);
return (INT_PTR)TRUE;
}
}
break;
case WM_QUIT:
case WM_DESTROY:
case WM_CLOSE:
{
EndDialog(hDlg, 0);
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
static void _cdecl OnClientCrashed(void* context, const ClientInfo* client_info, const wstring* dump_path)
{
if(dump_path)
{
dump = *dump_path;
google_breakpad::CustomClientInfo custom = client_info->GetCustomInfo();
for(size_t i=0; i < custom.count; i++)
customInfo.push_back(custom.entries[i]);
}
exitServer = true;
}
static void _cdecl OnClientExited(void* context, const ClientInfo* client_info)
{
exitServer = true;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if(msg == WM_CLOSE) { DestroyWindow(hwnd); return 0; }
if(msg == WM_DESTROY) { PostQuitMessage(0); return 0; }
return DefWindowProc(hwnd, msg, wParam, lParam);
}
void DisplayRendererPreview(ReplayRenderer *renderer, HINSTANCE hInstance)
{
if(renderer == NULL) return;
HWND wnd = 0;
wnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"renderdoccmd", L"renderdoccmd", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 1280, 720,
NULL, NULL, hInstance, NULL);
if(wnd == NULL)
{
return;
}
ShowWindow(wnd, SW_SHOW);
UpdateWindow(wnd);
rdctype::array<FetchTexture> texs;
ReplayRenderer_GetTextures(renderer, &texs);
ReplayOutput *out = ReplayRenderer_CreateOutput(renderer, wnd);
ReplayRenderer_SetFrameEvent(renderer, 0, 10000000);
OutputConfig c;
c.m_Type = eOutputType_TexDisplay;
ReplayOutput_SetOutputConfig(out, c);
for(int32_t i=0; i < texs.count; i++)
{
wstring name(texs[i].name.elems, texs[i].name.elems+texs[i].name.count);
if(name.find(L"Swap") != wstring::npos)
{
TextureDisplay d;
d.texid = texs[i].ID;
d.mip = 0;
d.overlay = eTexOverlay_None;
d.CustomShader = ResourceId();
d.HDRMul = -1.0f;
d.rangemin = 0.0f;
d.rangemax = 1.0f;
d.scale = 1.0f;
d.offx = 0.0f;
d.offy = 0.0f;
d.sliceFace = 0;
d.rawoutput = false;
d.Red = d.Green = d.Blue = true;
d.Alpha = false;
ReplayOutput_SetTextureDisplay(out, d);
break;
}
}
MSG msg;
ZeroMemory(&msg, sizeof(msg));
while(true)
{
// Check to see if any messages are waiting in the queue
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// Translate the message and dispatch it to WindowProc()
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// If the message is WM_QUIT, exit the while loop
if(msg.message == WM_QUIT)
break;
ReplayRenderer_SetFrameEvent(renderer, 0, 10000000+rand()%1000);
ReplayOutput_SetOutputConfig(out, c);
ReplayOutput_Display(out);
Sleep(40);
}
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
{
LPWSTR *argv;
int argc;
argv = CommandLineToArgvW(GetCommandLine(), &argc);
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = L"renderdoccmd";
wc.hIconSm = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON));
if(!RegisterClassEx(&wc))
{
return 1;
}
CrashGenerationServer *crashServer = NULL;
if(argc == 2 && !_wcsicmp(argv[1], L"crashhandle"))
{
wchar_t tempPath[MAX_PATH] = {0};
GetTempPathW(MAX_PATH-1, tempPath);
Sleep(100);
wstring dumpFolder = tempPath;
dumpFolder += L"RenderDocDumps";
CreateDirectoryW(dumpFolder.c_str(), NULL);
crashServer = new CrashGenerationServer(L"\\\\.\\pipe\\RenderDocBreakpadServer",
NULL, NULL, NULL, OnClientCrashed, NULL,
OnClientExited, NULL, NULL, NULL, true,
&dumpFolder);
if (!crashServer->Start()) {
delete crashServer;
crashServer = NULL;
return 1;
}
CrashHandlerInst = hInstance;
CrashHandlerWnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"renderdoccmd", L"renderdoccmd", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 10, 10,
NULL, NULL, hInstance, NULL);
HANDLE hIcon = LoadImage(CrashHandlerInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
if(hIcon)
{
SendMessage(CrashHandlerWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(CrashHandlerWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
}
ShowWindow(CrashHandlerWnd, SW_HIDE);
HANDLE readyEvent = CreateEventA(NULL, TRUE, FALSE, "RENDERDOC_CRASHHANDLE");
if(readyEvent != NULL)
{
SetEvent(readyEvent);
CloseHandle(readyEvent);
}
MSG msg;
ZeroMemory(&msg, sizeof(msg));
while(!exitServer)
{
// Check to see if any messages are waiting in the queue
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// Translate the message and dispatch it to WindowProc()
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// If the message is WM_QUIT, exit the while loop
if(msg.message == WM_QUIT)
break;
Sleep(100);
}
delete crashServer;
crashServer = NULL;
if(!dump.empty())
{
logpath = L"";
string report = "";
for(size_t i=0; i < customInfo.size(); i++)
{
wstring name = customInfo[i].name;
wstring val = customInfo[i].value;
if(name == L"logpath")
{
logpath = val;
}
else if(name == L"ptime")
{
// breakpad uptime, ignore.
}
else
{
report += string(name.begin(), name.end()) + ": " + string(val.begin(), val.end()) + "\n";
}
}
DialogBox(CrashHandlerInst, MAKEINTRESOURCE(IDD_CRASH_HANDLER), CrashHandlerWnd, (DLGPROC)CrashHandlerProc);
report += "\n\nRepro steps/Notes:\n\n" + reproSteps;
{
FILE *f = NULL;
_wfopen_s(&f, logpath.c_str(), L"r");
if(f)
{
fseek(f, 0, SEEK_END);
long filesize = ftell(f);
fseek(f, 0, SEEK_SET);
if(filesize > 10)
{
char *error_log = new char[filesize+1];
memset(error_log, 0, filesize+1);
fread(error_log, 1, filesize, f);
char *managed_callstack = strstr(error_log, "--- Begin C# Exception Data ---");
if(managed_callstack)
{
report += managed_callstack;
report += "\n\n";
}
delete[] error_log;
}
fclose(f);
}
}
if(uploadReport)
{
mz_zip_archive zip;
ZeroMemory(&zip, sizeof(zip));
wstring destzip = dumpFolder + L"\\report.zip";
DeleteFileW(destzip.c_str());
mz_zip_writer_init_wfile(&zip, destzip.c_str(), 0);
mz_zip_writer_add_mem(&zip, "report.txt", report.c_str(), report.length(), MZ_BEST_COMPRESSION);
if(uploadDump && !dump.empty())
mz_zip_writer_add_wfile(&zip, "minidump.dmp", dump.c_str(), NULL, 0, MZ_BEST_COMPRESSION);
if(uploadLog && !logpath.empty())
mz_zip_writer_add_wfile(&zip, "error.log", logpath.c_str(), NULL, 0, MZ_BEST_COMPRESSION);
mz_zip_writer_finalize_archive(&zip);
mz_zip_writer_end(&zip);
int timeout = 10000;
wstring body = L"";
int code = 0;
std::map<wstring, wstring> params;
google_breakpad::HTTPUpload::SendRequest(L"http://renderdoc.org/bugsubmit", params,
dumpFolder + L"\\report.zip", L"report", &timeout, &body, &code);
DeleteFileW(destzip.c_str());
}
}
if(!dump.empty())
DeleteFileW(dump.c_str());
if(!logpath.empty())
DeleteFileW(logpath.c_str());
return 0;
}
HMODULE renderdoc = LoadLibrary(_T("renderdoc.dll"));
if(!renderdoc)
{
OutputDebugString(_T("Couldn't load library!"));
return 1;
}
CaptureOptions opts;
opts.AllowFullscreen = false;
opts.AllowVSync = false;
opts.DelayForDebugger = 5;
opts.HookIntoChildren = true;
if(argc == 2)
{
// if we were given an exe, inject into it
if(wcsstr(argv[1], L".exe") != NULL)
{
uint32_t ident = RENDERDOC_ExecuteAndInject(argv[1], NULL, NULL, NULL, &opts, false);
if(ident == 0)
printf("Failed to create & inject\n");
else
printf("Created & injected as %d\n", ident);
return ident;
}
// if we were given a logfile, load it and continually replay it.
else if(wcsstr(argv[1], L".rdc") != NULL)
{
float progress = 0.0f;
ReplayRenderer *renderer = NULL;
auto status = RENDERDOC_CreateReplayRenderer(argv[1], &progress, &renderer);
if(renderer && status == eReplayCreate_Success)
DisplayRendererPreview(renderer, hInstance);
delete renderer;
return 0;
}
else if(wcsstr(argv[1], L"-replayhost") != NULL)
{
RENDERDOC_SpawnReplayHost(NULL);
return 1;
}
}
else if(argc == 3)
{
if(!_wcsicmp(argv[1], L"-inject"))
{
wchar_t *pid = argv[2];
while(*pid == L'"' || iswspace(*pid)) pid++;
DWORD pidNum = (DWORD)_wtoi(pid);
uint32_t ident = RENDERDOC_InjectIntoProcess(pidNum, NULL, &opts, false);
if(ident == 0)
printf("Failed to inject\n");
else
printf("Injected as %d\n", ident);
return ident;
}
else
{
uint32_t ident = RENDERDOC_ExecuteAndInject(argv[1], NULL, NULL, argv[2], &opts, false);
if(ident == 0)
printf("Failed to create & inject\n");
else
printf("Created & injected as %d\n", ident);
return ident;
}
}
else if(argc == 4)
{
if(argc == 4 && wcsstr(argv[1], L"-replay") != NULL)
{
RemoteRenderer *remote = NULL;
auto status = RENDERDOC_CreateRemoteReplayConnection(argv[2], &remote);
if(remote == NULL || status != eReplayCreate_Success)
return 1;
float progress = 0.0f;
ReplayRenderer *renderer = NULL;
status = RemoteRenderer_CreateProxyRenderer(remote, 0, argv[3], &progress, &renderer);
if(renderer && status == eReplayCreate_Success)
DisplayRendererPreview(renderer, hInstance);
RemoteRenderer_Shutdown(remote);
return 0;
}
}
else if(argc == 5)
{
if(!_wcsicmp(argv[1], L"-cap32for64"))
{
wchar_t *pid = argv[2];
while(*pid == L'"' || iswspace(*pid)) pid++;
DWORD pidNum = (DWORD)_wtoi(pid);
wchar_t *log = argv[3];
CaptureOptions cmdopts;
string optstring(&argv[4][0], &argv[4][0] + wcslen(argv[4]));
cmdopts.FromString(optstring);
return RENDERDOC_InjectIntoProcess(pidNum, log, &cmdopts, false);
}
else if(!_wcsicmp(argv[1], L"-remotecontrol"))
{
wchar_t *host = argv[2];
wchar_t *ident = argv[3];
while(*ident == L'"' || iswspace(*ident)) ident++;
bool force = argv[4][0] != '0';
DWORD identNum = (DWORD)_wtoi(ident);
wchar_t username[256] = {0};
DWORD usersize = 255;
GetEnvironmentVariableW(L"renderdoc_username", username, usersize);
RemoteAccess *access = RENDERDOC_CreateRemoteAccessConnection(host, identNum, username, force);
if(access == NULL)
{
printf("Failed to connect\n");
}
else
{
printf("Target: %ls, API: %ls, Busy: %ls\n", RemoteAccess_GetTarget(access), RemoteAccess_GetAPI(access), RemoteAccess_GetBusyClient(access));
fflush(stdout);
volatile bool run = true;
while(run)
{
RemoteMessage msg;
RemoteAccess_ReceiveMessage(access, &msg);
if(msg.Type == eRemoteMsg_Disconnected)
{
printf("Disconnected\n");
RemoteAccess_Shutdown(access);
access = NULL;
break;
}
else if(msg.Type == eRemoteMsg_Busy)
{
printf("Busy: %ls\n", msg.Busy.ClientName.elems);
RemoteAccess_Shutdown(access);
access = NULL;
break;
}
else if(msg.Type == eRemoteMsg_Noop)
{
}
else if(msg.Type == eRemoteMsg_RegisterAPI)
{
printf("Updated - Target: %ls, API: %ls\n", RemoteAccess_GetTarget(access), RemoteAccess_GetAPI(access));
}
else if(msg.Type == eRemoteMsg_NewCapture)
{
printf("Got capture - %d @ %llu, %d bytes of thumbnail\n", msg.NewCapture.ID, msg.NewCapture.timestamp, msg.NewCapture.thumbnail.count);
}
fflush(stdout);
}
if(access)
{
RemoteAccess_Shutdown(access);
access = NULL;
}
}
fflush(stdout);
return 0;
}
}
MessageBoxW(NULL, L"renderdoccmd Usage:\n\n" \
L"renderdoccmd.exe \"full path to exe\" [\"path to capture logfile to save to\"]\n" \
L"renderdoccmd.exe \"full path to logfile to replay\"\n" \
L"renderdoccmd.exe -inject \"Process ID\"\n",
L"renderdoccmd", MB_OK);
return 1;
}
+1
View File
@@ -0,0 +1 @@
[General]
+3
View File
@@ -0,0 +1,3 @@
miniz.c
miniz.h
linux_specific.cpp
+1
View File
@@ -0,0 +1 @@
/home/baldurk/renderdoc/renderdoccmd
Binary file not shown.
+177
View File
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Profile|Win32">
<Configuration>Profile</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|x64">
<Configuration>Profile</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D03DF2F9-513C-4084-BBDD-1DEE8D9250D7}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>renderdoccmd</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)\breakpad\lib32;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)\breakpad\lib64;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)\breakpad\lib32;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)\breakpad\lib64;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;RENDERDOC_PLATFORM=win32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\renderdoc\replay\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(OutDir)\renderdoc.lib;breakpad_common.lib;crash_generation_server.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;RENDERDOC_PLATFORM=win32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\renderdoc\replay\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>$(OutDir)\renderdoc.lib;breakpad_common.lib;crash_generation_server.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;RENDERDOC_PLATFORM=win32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\renderdoc\replay\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>$(OutDir)\renderdoc.lib;breakpad_common.lib;crash_generation_server.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;RENDERDOC_PLATFORM=win32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\renderdoc\replay\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>$(OutDir)\renderdoc.lib;breakpad_common.lib;crash_generation_server.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="miniz.c" />
<ClCompile Include="renderdoccmd.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="renderdoccmd.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="miniz.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\renderdocui\Resources\icon.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="renderdoccmd.cpp" />
<ClCompile Include="miniz.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Resources</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Resources</Filter>
</ClInclude>
<ClInclude Include="miniz.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="Resources">
<UniqueIdentifier>{3979a11e-8029-4886-a51e-a2a9bb91d69f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\renderdocui\Resources\icon.ico">
<Filter>Resources</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="renderdoccmd.rc">
<Filter>Resources</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>