GSdx-Capture: Append a missing .avi extension

Filenames of zero length do not allow OK to be pressed.
This commit is contained in:
sonicfind 2020-08-31 16:26:20 -05:00 committed by refractionpcsx2
parent e8b16bb145
commit bd91a571a6
2 changed files with 19 additions and 1 deletions

View File

@ -417,11 +417,24 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float
GSCaptureDlg dlg; GSCaptureDlg dlg;
if(IDOK != dlg.DoModal()) return false; if (IDOK != dlg.DoModal())
return false;
m_size.x = (dlg.m_width + 7) & ~7; m_size.x = (dlg.m_width + 7) & ~7;
m_size.y = (dlg.m_height + 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()}; std::wstring fn{dlg.m_filename.begin(), dlg.m_filename.end()};
// //

View File

@ -155,6 +155,11 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{ {
switch (id) switch (id)
{ {
case IDC_FILENAME:
{
EnableWindow(GetDlgItem(m_hWnd, IDOK), GetText(IDC_FILENAME).length() != 0);
return false;
}
case IDC_BROWSE: case IDC_BROWSE:
{ {
if (code == BN_CLICKED) if (code == BN_CLICKED)