From 0429c207e6b3042cd1e69b888d66958b8bf99ed2 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 11 May 2020 16:42:58 +0930 Subject: [PATCH] Show timeout in support window --- Source/Project64/UserInterface/SupportWindow.cpp | 16 ++++++++++++---- Source/Project64/UserInterface/SupportWindow.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/Project64/UserInterface/SupportWindow.cpp b/Source/Project64/UserInterface/SupportWindow.cpp index fe5b226a4..98b53c3bd 100644 --- a/Source/Project64/UserInterface/SupportWindow.cpp +++ b/Source/Project64/UserInterface/SupportWindow.cpp @@ -5,6 +5,7 @@ HWND CSupportWindow::m_hParent = NULL; CSupportWindow * CSupportWindow::m_this = NULL; uint32_t CSupportWindow::m_RunCount = 0; +uint32_t CSupportWindow::m_TimeOutTime = 30; CSupportWindow::CSupportWindow(void) { @@ -91,7 +92,7 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* ::EnableWindow(GetDlgItem(IDCANCEL), false); srand ((uint32_t)time(NULL)); - SetTimer(0, ((rand() % 35) + 5) * 1000, NULL); + SetTimer(0, 1000, NULL); } return TRUE; } @@ -120,8 +121,14 @@ LRESULT CSupportWindow::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM / LRESULT CSupportWindow::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - KillTimer(wParam); - EnableContinue(); + m_TimeOutTime -= 1; + if (m_TimeOutTime == 0) + { + KillTimer(wParam); + EnableContinue(); + } + stdstr_f continue_txt(m_TimeOutTime > 0 ? "%s (%d)" : "%s", GS(MSG_SUPPORT_CONTINUE), m_TimeOutTime); + SetWindowTextW(GetDlgItem(IDCANCEL), continue_txt.ToUTF16().c_str()); return true; } @@ -133,7 +140,8 @@ LRESULT CSupportWindow::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt LRESULT CSupportWindow::OnSupportProject64(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { - ShellExecute(NULL, "open", "http://www.pj64-emu.com/support-project64.html", NULL, NULL, SW_SHOWMAXIMIZED); + std::string SupportURL = stdstr_f("http://www.pj64-emu.com/support-project64.html?ver=%s", VER_FILE_VERSION_STR); + ShellExecute(NULL, "open", SupportURL.c_str(), NULL, NULL, SW_SHOWMAXIMIZED); return TRUE; } diff --git a/Source/Project64/UserInterface/SupportWindow.h b/Source/Project64/UserInterface/SupportWindow.h index 63532e8e7..0065ec8ad 100644 --- a/Source/Project64/UserInterface/SupportWindow.h +++ b/Source/Project64/UserInterface/SupportWindow.h @@ -40,4 +40,5 @@ private: static HWND m_hParent; static CSupportWindow * m_this; static uint32_t m_RunCount; + static uint32_t m_TimeOutTime; }; \ No newline at end of file