void CDataCeneter::GetRegTbl(BYTE bOperation, LPVOID VarData) { if (bOperation == GET_DDNS_INFO) { GetDDNSInfo(bOperation, VarData); } else if (bOperation >= GET_INTER_EVENT && bOperation <= GET_ALL_EVENT_BLACK) { GetEventType(bOperation, VarData); } else if (bOperation >= GET_MAIL_SERVER && bOperation <= GET_MAIL_SERVER) { GetMailServer(bOperation, VarData); } else if (bOperation >= GET_RECORD_PATH && bOperation <= GET_RECORD_PATH) { GetRecordPath(bOperation, VarData); } }
static void UpdateRecordDialog(HWND hwndDlg) { int enable=0; std::string fn=GetRecordPath(hwndDlg); if(fn!="") { if(access(fn.c_str(), F_OK) || !access(fn.c_str(), W_OK)) { LONG lCount = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCOUNT, 0, 0); LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0); if(lIndex != lCount-1) { enable=1; } } } EnableWindow(GetDlgItem(hwndDlg,IDOK),enable ? TRUE : FALSE); }
static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static struct CreateMovieParameters* p = NULL; switch(uMsg) { case WM_INITDIALOG: p = (struct CreateMovieParameters*)lParam; UpdateRecordDialogPath(hwndDlg, p->szFilename); p->szFilename = ""; if (strlen(taseditorConfig.lastAuthorName)) { // convert UTF8 char* string to Unicode wstring wchar_t savedAuthorName[AUTHOR_NAME_MAX_LEN] = {0}; MultiByteToWideChar(CP_UTF8, 0, taseditorConfig.lastAuthorName, -1, savedAuthorName, AUTHOR_NAME_MAX_LEN); p->authorName = savedAuthorName; } else { p->authorName = L""; } SendMessage(GetDlgItem(hwndDlg, IDC_EDIT_AUTHOR), CCM_SETUNICODEFORMAT, TRUE, 0); SetDlgItemTextW(hwndDlg, IDC_EDIT_AUTHOR, (LPCWSTR)(p->authorName.c_str())); // Populate the "record from..." dialog { char* findGlob=strdup(FCEU_MakeFName(FCEUMKF_STATEGLOB, 0, 0).c_str()); WIN32_FIND_DATA wfd; HANDLE hFind; int i=0; SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_INSERTSTRING, i++, (LPARAM)"Start"); SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_INSERTSTRING, i++, (LPARAM)"Now"); memset(&wfd, 0, sizeof(wfd)); hFind = FindFirstFile(findGlob, &wfd); if(hFind != INVALID_HANDLE_VALUE) { do { if ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) continue; if (strlen(wfd.cFileName) < 4 || !strcmp(wfd.cFileName + (strlen(wfd.cFileName) - 4), ".fm2")) continue; SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_INSERTSTRING, i++, (LPARAM)wfd.cFileName); } while(FindNextFile(hFind, &wfd)); FindClose(hFind); } free(findGlob); SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_INSERTSTRING, i++, (LPARAM)"Browse..."); SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_SETCURSEL, p->recordFrom, 0); } UpdateRecordDialog(hwndDlg); return TRUE; case WM_COMMAND: if(HIWORD(wParam) == CBN_SELCHANGE) { LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0); if(lIndex == CB_ERR) { // fix listbox selection SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_SETCURSEL, (WPARAM)0, 0); } UpdateRecordDialog(hwndDlg); return TRUE; } else if(HIWORD(wParam) == CBN_CLOSEUP) { LONG lCount = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCOUNT, 0, 0); LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0); if (lIndex != CB_ERR && lIndex == lCount-1) { OPENFILENAME ofn; char szChoice[MAX_PATH]={0}; // pop open a file browser to choose the savestate memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; ofn.lpstrFilter = "FCEU Save State (*.fc?)\0*.fc?\0\0"; ofn.lpstrFile = szChoice; ofn.lpstrDefExt = "fcs"; ofn.nMaxFile = MAX_PATH; if(GetOpenFileName(&ofn)) { SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_INSERTSTRING, lIndex, (LPARAM)szChoice); SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_SETCURSEL, (WPARAM)lIndex, 0); } else UpdateRecordDialog(hwndDlg); } return TRUE; } else if(HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_EDIT_FILENAME) { UpdateRecordDialog(hwndDlg); } else { switch(LOWORD(wParam)) { case IDOK: { LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0); p->szFilename = GetRecordPath(hwndDlg); p->recordFrom = (int)lIndex; // save author name in params and in config (converted to multibyte char*) wchar_t authorName[AUTHOR_NAME_MAX_LEN] = {0}; GetDlgItemTextW(hwndDlg, IDC_EDIT_AUTHOR, (LPWSTR)authorName, AUTHOR_NAME_MAX_LEN); p->authorName = authorName; if (p->authorName == L"") taseditorConfig.lastAuthorName[0] = 0; else // convert Unicode wstring to UTF8 char* string WideCharToMultiByte(CP_UTF8, 0, (p->authorName).c_str(), -1, taseditorConfig.lastAuthorName, AUTHOR_NAME_MAX_LEN, 0, 0); if (lIndex >= 2) p->szSavestateFilename = GetSavePath(hwndDlg); EndDialog(hwndDlg, 1); } return TRUE; case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; case IDC_BUTTON_BROWSEFILE: { OPENFILENAME ofn; char szChoice[MAX_PATH]={0}; // browse button memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; ofn.lpstrFilter = "FCEUX Movie File (*.fm2)\0*.fm2\0All Files (*.*)\0*.*\0\0"; ofn.lpstrFile = szChoice; ofn.lpstrDefExt = "fm2"; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; if(GetSaveFileName(&ofn)) { UpdateRecordDialogPath(hwndDlg,szChoice); } } return TRUE; } } } return FALSE; }