From bd91a571a6d52aa27e5a05316e322307a42be6a1 Mon Sep 17 00:00:00 2001 From: sonicfind <52436993+sonicfind@users.noreply.github.com> Date: Mon, 31 Aug 2020 16:26:20 -0500 Subject: [PATCH] GSdx-Capture: Append a missing .avi extension Filenames of zero length do not allow OK to be pressed. --- plugins/GSdx/GSCapture.cpp | 15 ++++++++++++++- plugins/GSdx/Window/GSCaptureDlg.cpp | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 5aeede9b09..6a612e4919 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -417,11 +417,24 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float GSCaptureDlg dlg; - if(IDOK != dlg.DoModal()) return false; + if (IDOK != dlg.DoModal()) + return false; m_size.x = (dlg.m_width + 7) & ~7; m_size.y = (dlg.m_height + 7) & ~7; + { + int start = dlg.m_filename.length() - 4; + if (start > 0) + { + std::string test = dlg.m_filename.substr(start); + std::transform(test.begin(), test.end(), test.begin(), tolower); + if (test.compare(".avi") != 0) + dlg.m_filename += ".avi"; + } + else + dlg.m_filename += ".avi"; + } std::wstring fn{dlg.m_filename.begin(), dlg.m_filename.end()}; // diff --git a/plugins/GSdx/Window/GSCaptureDlg.cpp b/plugins/GSdx/Window/GSCaptureDlg.cpp index b48393e58f..964b7c1cf9 100644 --- a/plugins/GSdx/Window/GSCaptureDlg.cpp +++ b/plugins/GSdx/Window/GSCaptureDlg.cpp @@ -155,6 +155,11 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code) { switch (id) { + case IDC_FILENAME: + { + EnableWindow(GetDlgItem(m_hWnd, IDOK), GetText(IDC_FILENAME).length() != 0); + return false; + } case IDC_BROWSE: { if (code == BN_CLICKED)