void MainWnd::OnCheatsSavecheatlist() { CString buffer; CString filename; int index = theApp.filename.ReverseFind('\\'); if(index != -1) buffer = theApp.filename.Right(theApp.filename.GetLength()-index-1); else buffer = theApp.filename; CString saveDir = regQueryStringValue(_T("saveDir"), NULL); if(saveDir.IsEmpty()) saveDir = getDirFromFile(theApp.filename); if(isDriveRoot(saveDir)) filename.Format(_T("%s%s.clt"), saveDir, buffer); else filename.Format(_T("%s\\%s.clt"), saveDir, buffer); LPCTSTR exts[] = { _T(".clt") }; CString filter = winLoadFilter(IDS_FILTER_CHEAT_LIST); CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME); FileDlg dlg(this, filename, filter, 0, _T("CLT"), exts, saveDir, title, true); if(dlg.DoModal() == IDOK) { winSaveCheatList(dlg.GetPathName()); } }
void MainWnd::winSaveCheatListDefault() { CString name; CString filename; int index = theApp.filename.ReverseFind('\\'); if(index != -1) name = theApp.filename.Right(theApp.filename.GetLength()-index-1); else name = theApp.filename; CString dir = regQueryStringValue("saveDir", NULL); if( dir[0] == '.' ) { // handle as relative path char baseDir[MAX_PATH+1]; GetModuleFileName( NULL, baseDir, MAX_PATH ); baseDir[MAX_PATH] = '\0'; // for security reasons PathRemoveFileSpec( baseDir ); // removes the trailing file name and backslash strcat( baseDir, "\\" ); strcat( baseDir, dir ); dir = baseDir; } if(!dir.GetLength()) dir = getDirFromFile(filename); if(isDriveRoot(dir)) filename.Format("%s%s.clt", dir, name); else filename.Format("%s\\%s.clt", dir, name); winSaveCheatList(filename); }
void MainWnd::OnCheatsSavecheatlist() { theApp.winCheckFullscreen(); LPCTSTR exts[] = { ".clt", NULL }; CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST); CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME); CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]); CString cheatDir = winGetDestDir(IDS_CHEAT_DIR); FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, true); if (dlg.DoModal() == IDOK) { winSaveCheatList(dlg.GetPathName()); } }
void MainWnd::winSaveCheatListDefault() { CString name; CString filename; int index = theApp.filename.ReverseFind('\\'); if(index != -1) name = theApp.filename.Right(theApp.filename.GetLength()-index-1); else name = theApp.filename; CString dir = regQueryStringValue("saveDir", NULL); if(!dir.GetLength()) dir = getDirFromFile(filename); if(isDriveRoot(dir)) filename.Format("%s%s.clt", dir, name); else filename.Format("%s\\%s.clt", dir, name); winSaveCheatList(filename); }