| 1949 | } |
| 1950 | |
| 1951 | static void PresetImport(int preset) |
| 1952 | { |
| 1953 | const char filter[]="Input Preset File (*.pre)\0*.pre\0\0"; |
| 1954 | char nameo[2048]; |
| 1955 | OPENFILENAME ofn; |
| 1956 | memset(&ofn,0,sizeof(ofn)); |
| 1957 | ofn.lStructSize=sizeof(ofn); |
| 1958 | ofn.hInstance=fceu_hInstance; |
| 1959 | ofn.lpstrTitle="Import Input Preset......"; |
| 1960 | ofn.lpstrFilter=filter; |
| 1961 | nameo[0]=0; |
| 1962 | ofn.lpstrFile=nameo; |
| 1963 | ofn.nMaxFile=256; |
| 1964 | ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; |
| 1965 | std::string initdir = FCEU_GetPath(FCEUMKF_INPUT); |
| 1966 | ofn.lpstrInitialDir=initdir.c_str(); |
| 1967 | |
| 1968 | if(GetOpenFileName(&ofn)) |
| 1969 | { |
| 1970 | //Save the directory |
| 1971 | if(ofn.nFileOffset < 1024) |
| 1972 | { |
| 1973 | free(InputPresetDir); |
| 1974 | InputPresetDir=(char*)malloc(strlen(ofn.lpstrFile)+1); |
| 1975 | strcpy(InputPresetDir,ofn.lpstrFile); |
| 1976 | InputPresetDir[ofn.nFileOffset]=0; |
| 1977 | } |
| 1978 | |
| 1979 | FILE *fp=FCEUD_UTF8fopen(nameo,"r"); |
| 1980 | switch(preset) |
| 1981 | { |
| 1982 | case 1: fread(GamePadPreset1,1,sizeof(GamePadPreset1),fp); break; |
| 1983 | case 2: fread(GamePadPreset2,1,sizeof(GamePadPreset2),fp); break; |
| 1984 | case 3: fread(GamePadPreset3,1,sizeof(GamePadPreset3),fp); break; |
| 1985 | } |
| 1986 | fclose(fp); |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | |
| 1991 | //commandline input config. not being used right now |
no test coverage detected