From 12ef20ef311c095fe39fca3fe60f60bc5c87fd93 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 28 Aug 2016 17:17:20 +0100 Subject: [PATCH] Re-enable crash dumping --- openrct2.proj | 1 + src/platform/crash.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index b403528c6d..d036d7468f 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -31,6 +31,7 @@ OPENRCT2_BRANCH="$(GIT_BRANCH)";$(OPENRCT2_DEFINES) OPENRCT2_COMMIT_SHA1="$(GIT_COMMIT_SHA1)";$(OPENRCT2_DEFINES) OPENRCT2_COMMIT_SHA1_SHORT="$(GIT_COMMIT_SHA1_SHORT)";$(OPENRCT2_DEFINES) + USE_BREAKPAD;$(OPENRCT2_DEFINES) $(MsBuildThisFileDirectory) $(RootDir)distribution\ diff --git a/src/platform/crash.cpp b/src/platform/crash.cpp index 81cb4ac515..549d0af94b 100644 --- a/src/platform/crash.cpp +++ b/src/platform/crash.cpp @@ -41,6 +41,12 @@ extern "C" { #define WSZ(x) L"" x +#ifdef OPENRCT2_COMMIT_SHA1_SHORT + const wchar_t *_wszCommitSha1Short = WSZ(OPENRCT2_COMMIT_SHA1_SHORT); +#else + const wchar_t *_wszCommitSha1Short = WSZ(""); +#endif + static bool OnCrash(const wchar_t * dumpPath, const wchar_t * miniDumpId, void * context, @@ -67,7 +73,7 @@ static bool OnCrash(const wchar_t * dumpPath, // Try to rename the files wchar_t dumpFilePathNew[MAX_PATH]; - wsprintfW(dumpFilePathNew, L"%s%s(%s).dmp", dumpPath, miniDumpId, WSZ(OPENRCT2_COMMIT_SHA1_SHORT)); + wsprintfW(dumpFilePathNew, L"%s%s(%s).dmp", dumpPath, miniDumpId, _wszCommitSha1Short); if (_wrename(dumpFilePath, dumpFilePathNew) == 0) { std::wcscpy(dumpFilePath, dumpFilePathNew); @@ -78,7 +84,7 @@ static bool OnCrash(const wchar_t * dumpPath, wprintf(L"Dump File Path: %s\n", dumpFilePath); wprintf(L"Dump Id: %s\n", miniDumpId); wprintf(L"Version: %s\n", WSZ(OPENRCT2_VERSION)); - wprintf(L"Commit: %s\n", WSZ(OPENRCT2_COMMIT_SHA1_SHORT)); + wprintf(L"Commit: %s\n", _wszCommitSha1Short); utf8 * saveFilePathUTF8 = widechar_to_utf8(saveFilePath); SDL_RWops * rw = SDL_RWFromFile(saveFilePathUTF8, "wb+"); @@ -101,7 +107,7 @@ static bool OnCrash(const wchar_t * dumpPath, MessageFormat, dumpFilePath, WSZ(OPENRCT2_VERSION), - WSZ(OPENRCT2_COMMIT_SHA1_SHORT)); + _wszCommitSha1Short); // Cannot use platform_show_messagebox here, it tries to set parent window already dead. MessageBoxW(NULL, message, WSZ(OPENRCT2_NAME), MB_OK | MB_ICONERROR);