From 7253fe7775d6cc732f5979d8ba867c51c11706fe Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 26 May 2009 15:13:51 +0000 Subject: [PATCH] win32 - record movie dialog - if user doesn't not specify a file extension add .dsm for them --- desmume/src/windows/replay.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index bbc56d178..dd8d02614 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -90,6 +90,8 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP { static struct CreateMovieParameters* p = NULL; std::wstring author = L""; + std::string filename; //temp variable + int x; //temp vairable switch(uMsg) { case WM_INITDIALOG: @@ -114,7 +116,6 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP { OPENFILENAME ofn; char szChoice[MAX_PATH]={0}; - char recordfilename[MAX_PATH]; // browse button ZeroMemory(&ofn, sizeof(ofn)); @@ -127,8 +128,14 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; GetSaveFileName(&ofn); - strcpy(recordfilename, szChoice); - SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, recordfilename); + + //If user did not specify an extension, add .dsm for them + filename = szChoice; + x = filename.find_last_of("."); + if (x < 0) + filename.append(".dsm"); + + SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, filename.c_str()); //if(GetSaveFileName(&ofn)) // UpdateRecordDialogPath(hwndDlg,szChoice);