From e69574be120cef76f778cb3cb369a50c394b4986 Mon Sep 17 00:00:00 2001 From: Hielke Morsink <123mannetje@gmail.com> Date: Mon, 2 May 2016 23:20:36 +0200 Subject: [PATCH 1/3] Including short commit hash in dump filename --- src/platform/crash.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/platform/crash.cpp b/src/platform/crash.cpp index 41ae935751..2161c5e391 100644 --- a/src/platform/crash.cpp +++ b/src/platform/crash.cpp @@ -50,7 +50,7 @@ static bool OnCrash(const wchar_t * dumpPath, { if (!succeeded) { - constexpr const char * DumpFailedMessage = "Failed to create the dump. Nothing left to do. Please file an issue with OpenRCT2 on Github and provide latest save."; + constexpr const char * DumpFailedMessage = "Failed to create the dump. Please file an issue with OpenRCT2 on GitHub and provide latest save, and provide information about what you did before the crash occured."; printf("%s\n", DumpFailedMessage); if (!gOpenRCT2SilentBreakpad) { @@ -59,11 +59,21 @@ static bool OnCrash(const wchar_t * dumpPath, return succeeded; } + // Get filenames wchar_t dumpFilePath[MAX_PATH]; wchar_t saveFilePath[MAX_PATH]; wsprintfW(dumpFilePath, L"%s%s.dmp", dumpPath, miniDumpId); wsprintfW(saveFilePath, L"%s%s.sv6", dumpPath, miniDumpId); + // Try to rename the files + wchar_t dumpFilePathNew[MAX_PATH]; + wsprintfW(dumpFilePathNew, L"%s%s (%s).dmp", dumpPath, miniDumpId, WSZ(OPENRCT2_COMMIT_SHA1_SHORT)); + if (_wrename(dumpFilePath, dumpFilePathNew) == 0) + { + std::wcscpy(dumpFilePath, dumpFilePathNew); + } + + // Log information to output wprintf(L"Dump Path: %s\n", dumpFilePath); wprintf(L"Dump Id: %s\n", miniDumpId); wprintf(L"Version: %s\n", WSZ(OPENRCT2_VERSION)); @@ -84,7 +94,7 @@ static bool OnCrash(const wchar_t * dumpPath, { return succeeded; } - constexpr const wchar_t * MessageFormat = L"A crash has occurred and dump was created at\n%s.\n\nPlease create an issue with OpenRCT2 on Github and provide the dump and save.\n\nVersion: %s\nCommit: %s"; + constexpr const wchar_t * MessageFormat = L"A crash has occurred and a dump was created at\n%s.\n\nPlease file an issue with OpenRCT2 on GitHub, and provide the dump and saved game there.\n\nVersion: %s\nCommit: %s"; wchar_t message[MAX_PATH * 2]; swprintf_s(message, MessageFormat, From c7a8e0cab72b0fd1d4a02d6e2cdf3988c292c849 Mon Sep 17 00:00:00 2001 From: Hielke Morsink <123mannetje@gmail.com> Date: Mon, 2 May 2016 23:50:43 +0200 Subject: [PATCH 2/3] Removed space from dump filename, and clearer output. --- src/platform/crash.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/crash.cpp b/src/platform/crash.cpp index 2161c5e391..81cb4ac515 100644 --- a/src/platform/crash.cpp +++ b/src/platform/crash.cpp @@ -67,14 +67,15 @@ 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, WSZ(OPENRCT2_COMMIT_SHA1_SHORT)); if (_wrename(dumpFilePath, dumpFilePathNew) == 0) { std::wcscpy(dumpFilePath, dumpFilePathNew); } // Log information to output - wprintf(L"Dump Path: %s\n", dumpFilePath); + wprintf(L"Dump Path: %s\n", 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)); From d7aacfcde6cb96a49149118fdf341e0083d2920c Mon Sep 17 00:00:00 2001 From: Hielke Morsink <123mannetje@gmail.com> Date: Sun, 15 May 2016 01:10:37 +0200 Subject: [PATCH 3/3] Fixed warning in sawyerencoding.c --- src/util/sawyercoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/sawyercoding.c b/src/util/sawyercoding.c index 12d1aaddc3..865b10d669 100644 --- a/src/util/sawyercoding.c +++ b/src/util/sawyercoding.c @@ -298,7 +298,7 @@ static size_t decode_chunk_rle(const uint8* src_buffer, uint8* dst_buffer, size_ dst = dst_buffer; - for (int i = 0; i < length; i++) { + for (size_t i = 0; i < length; i++) { rleCodeByte = src_buffer[i]; if (rleCodeByte & 128) { i++;