MCPcopy Create free account
hub / github.com/TASEmulators/fceux / PresetImport

Function PresetImport

src/drivers/win/input.cpp:1951–1988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1949}
1950
1951static 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

Callers 1

InputConCallBFunction · 0.85

Calls 2

FCEU_GetPathFunction · 0.85
FCEUD_UTF8fopenFunction · 0.70

Tested by

no test coverage detected