From 458e7876d39e5151fc39b762743ae3dc725fd010 Mon Sep 17 00:00:00 2001 From: glx Date: Tue, 8 Sep 2009 14:58:15 +0000 Subject: [PATCH] (svn r17475) -Codechange: show path to crash.log and crash.dmp in crash window. Also tells the user where crash.sav is when saving succeeded. --- src/os/windows/crashlog_win.cpp | 19 +++++++++++++++---- src/os/windows/ottdres.rc.in | 12 ++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 68eaf3419f..a54665cb9f 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -429,10 +429,11 @@ static const TCHAR _crash_desc[] = _T("Please send the crash information and the crash.dmp file (if any) to the developers.\n") _T("This will greatly help debugging. The correct place to do this is http://bugs.openttd.org. ") _T("The information contained in the report is displayed below.\n") - _T("Press \"Emergency save\" to attempt saving the game."); + _T("Press \"Emergency save\" to attempt saving the game. Generated file(s):\n") + _T("'%s%s%s'"); static const TCHAR _save_succeeded[] = - _T("Emergency save succeeded.\n") + _T("Emergency save succeeded. Its location is '%s'.\n") _T("Be aware that critical parts of the internal game state may have become ") _T("corrupted. The saved game is not guaranteed to work."); @@ -479,7 +480,14 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA } *p = '\0'; - SetDlgItemText(wnd, 10, _crash_desc); + /* Add path to crash.log and crash.dmp (if any) to the crash window text */ + int len = _tcslen(_crash_desc) + _tcslen(OTTD2FS(CrashLogWindows::current->crashlog_filename)) + _tcslen(OTTD2FS(CrashLogWindows::current->crashdump_filename)) + 4; + TCHAR *text = AllocaM(TCHAR, len); + TCHAR *dump = _tcsdup(OTTD2FS(CrashLogWindows::current->crashdump_filename)); + _sntprintf(text, len, _crash_desc, OTTD2FS(CrashLogWindows::current->crashlog_filename), dump[0] != _T('\0') ? _T("'\n'") : _T(""), dump); + free(dump); + + SetDlgItemText(wnd, 10, text); SetDlgItemText(wnd, 11, MB_TO_WIDE_BUFFER(dos_nl, crash_msgW, lengthof(crash_msgW))); SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE); SetWndSize(wnd, -1); @@ -492,7 +500,10 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA case 13: // Emergency save char filename[MAX_PATH]; if (CrashLogWindows::current->WriteSavegame(filename, lastof(filename))) { - MessageBox(wnd, _save_succeeded, _T("Save successful"), MB_ICONINFORMATION); + int len = _tcslen(_save_succeeded) + _tcslen(OTTD2FS(filename)) + 1; + TCHAR *text = AllocaM(TCHAR, len); + _sntprintf(text, len, _save_succeeded, OTTD2FS(filename)); + MessageBox(wnd, text, _T("Save successful"), MB_ICONINFORMATION); } else { MessageBox(wnd, _T("Save failed"), _T("Save failed"), MB_ICONINFORMATION); } diff --git a/src/os/windows/ottdres.rc.in b/src/os/windows/ottdres.rc.in index 971f7c55ab..451547bd1e 100644 --- a/src/os/windows/ottdres.rc.in +++ b/src/os/windows/ottdres.rc.in @@ -46,17 +46,17 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // Dialog // -100 DIALOG DISCARDABLE 0, 0, 305, 77 +100 DIALOG DISCARDABLE 0, 0, 305, 91 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Fatal Application Failure" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "&Close",12,7,58,50,14 - PUSHBUTTON "&Emergency save",13,155,58,68,14 - PUSHBUTTON "",15,243,58,55,14 - EDITTEXT 11,7,79,291,118,ES_MULTILINE | ES_READONLY | WS_VSCROLL | + PUSHBUTTON "&Close",12,7,72,50,14 + PUSHBUTTON "&Emergency save",13,155,72,68,14 + PUSHBUTTON "",15,243,72,55,14 + EDITTEXT 11,7,93,291,118,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP - LTEXT "",10,36,7,262,43 + LTEXT "",10,36,7,262,57 ICON 100,IDC_STATIC,9,9,20,20 END