From 8cedad82419e44b563957ad8d24c91b9209c1c3e Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 11 Apr 2019 17:15:17 +1000 Subject: [PATCH] [c-host] fix NvFBC build after moving headers --- VERSION | 2 +- c-host/include/interface/platform.h | 1 + c-host/platform/Linux/src/platform.c | 8 ++++++++ c-host/platform/Windows/capture/NVFBC/src/nvfbc.c | 2 +- c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp | 3 +-- c-host/platform/Windows/src/platform.c | 8 ++++++++ c-host/src/app.c | 2 +- 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 3c9dc8b7..a12195df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-153-g611216286e+1 \ No newline at end of file +a12-154-g32bd6d96e3+1 \ No newline at end of file diff --git a/c-host/include/interface/platform.h b/c-host/include/interface/platform.h index ec65349c..dbb5d3dd 100644 --- a/c-host/include/interface/platform.h +++ b/c-host/include/interface/platform.h @@ -25,6 +25,7 @@ int app_main(); void app_quit(); // these must be implemented for each OS +const char * os_getExecutable(); unsigned int os_shmemSize(); bool os_shmemMmap(void **ptr); diff --git a/c-host/platform/Linux/src/platform.c b/c-host/platform/Linux/src/platform.c index 3ca5deb7..afb31ede 100644 --- a/c-host/platform/Linux/src/platform.c +++ b/c-host/platform/Linux/src/platform.c @@ -33,6 +33,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA struct app { + const char * executable; unsigned int shmSize; int shmFD; void * shmMap; @@ -67,6 +68,8 @@ void sigHandler(int signo) int main(int argc, char * argv[]) { + app.executable = argv[0]; + static struct option longOptions[] = { {"shmDevice", required_argument, 0, 'f'}, @@ -177,6 +180,11 @@ int main(int argc, char * argv[]) return result; } +const char * os_getExecutable() +{ + return app.executable; +} + unsigned int os_shmemSize() { return app.shmSize; diff --git a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c index f595859c..5b097a36 100644 --- a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "interface/capture.h" #include "interface/platform.h" #include "windows/platform.h" -#include "windows/windebug.h" +#include "windows/debug.h" #include "windows/mousehook.h" #include #include diff --git a/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp b/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp index e0798635..97c3badb 100644 --- a/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp +++ b/c-host/platform/Windows/capture/NVFBC/src/wrapper.cpp @@ -18,8 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA */ #include "wrapper.h" -#include "debug.h" -#include "windows/windebug.h" +#include "windows/debug.h" #include #include diff --git a/c-host/platform/Windows/src/platform.c b/c-host/platform/Windows/src/platform.c index e00c25f2..d31cdf86 100644 --- a/c-host/platform/Windows/src/platform.c +++ b/c-host/platform/Windows/src/platform.c @@ -28,6 +28,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "windows/debug.h" #include "ivshmem/Public.h" +static char executable[MAX_PATH + 1]; static HANDLE shmemHandle = INVALID_HANDLE_VALUE; static bool shmemOwned = false; static IVSHMEM_MMAP shmemMap = {0}; @@ -99,6 +100,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine PSP_DEVICE_INTERFACE_DETAIL_DATA infData = NULL; SP_DEVICE_INTERFACE_DATA deviceInterfaceData; + GetModuleFileName(NULL, executable, sizeof(executable)); + // redirect stderr to a file { char tempPath[MAX_PATH+1]; @@ -224,6 +227,11 @@ finish: return result; } +const char * os_getExecutable() +{ + return executable; +} + unsigned int os_shmemSize() { IVSHMEM_SIZE size; diff --git a/c-host/src/app.c b/c-host/src/app.c index 77ebfd1a..63b39e2e 100644 --- a/c-host/src/app.c +++ b/c-host/src/app.c @@ -258,7 +258,7 @@ static bool captureRestart() int app_main() { - if (!installCrashHandler()) + if (!installCrashHandler(os_getExecutable())) DEBUG_WARN("Failed to install the crash handler"); unsigned int shmemSize = os_shmemSize();