GSdx-Capture: Abort capture if an invalid directory is given

This commit is contained in:
sonicfind 2020-09-20 00:13:09 -05:00 committed by refractionpcsx2
parent 7662e22665
commit 0ce4f7624f
3 changed files with 20 additions and 3 deletions

View File

@ -420,9 +420,6 @@ std::wstring* GSCapture::BeginCapture(float fps, GSVector2i recommendedResolutio
if (IDOK != dlg.DoModal())
return nullptr;
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)
@ -434,9 +431,21 @@ std::wstring* GSCapture::BeginCapture(float fps, GSVector2i recommendedResolutio
}
else
dlg.m_filename += ".avi";
FILE* test = fopen(dlg.m_filename.c_str(), "w");
if (test)
fclose(test);
else
{
dlg.InvalidFile();
return nullptr;
}
}
std::wstring fn{dlg.m_filename.begin(), dlg.m_filename.end()};
m_size.x = (dlg.m_width + 7) & ~7;
m_size.y = (dlg.m_height + 7) & ~7;
//
HRESULT hr;

View File

@ -35,6 +35,13 @@
#define EndEnumSysDev }}}
void GSCaptureDlg::InvalidFile()
{
char tmp[512];
sprintf_s(tmp, "GSdx couldn't open file for capturing: %s.\nCapture aborted.", m_filename.c_str());
MessageBox(GetActiveWindow(), tmp, "GSdx System Message", MB_OK | MB_SETFOREGROUND);
}
GSCaptureDlg::GSCaptureDlg()
: GSDialog(IDD_CAPTURE)
{

View File

@ -46,6 +46,7 @@ protected:
public:
GSCaptureDlg();
void InvalidFile();
int m_width;
int m_height;