MCPcopy Create free account
hub / github.com/dborth/fceugx / MakeFilePath

Function MakeFilePath

source/filebrowser.cpp:304–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304bool MakeFilePath(char filepath[], int type, char * filename, int filenum)
305{
306 char file[512];
307 char folder[1024];
308 char ext[4];
309 char temppath[MAXPATHLEN];
310
311 if(type == FILE_ROM)
312 {
313 // Check path length
314 if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) >= MAXPATHLEN)
315 {
316 ErrorPrompt("Maximum filepath length reached!");
317 filepath[0] = 0;
318 return false;
319 }
320 else
321 {
322 sprintf(temppath, "%s%s",browser.dir,browserList[browser.selIndex].filename);
323 }
324 }
325 else
326 {
327 if(GCSettings.SaveMethod == DEVICE_AUTO)
328 return false;
329
330 switch(type)
331 {
332 case FILE_RAM:
333 case FILE_STATE:
334 sprintf(folder, GCSettings.SaveFolder);
335
336 if(type == FILE_RAM) sprintf(ext, "sav");
337 else sprintf(ext, "fcs");
338
339 if(filenum >= -1)
340 {
341 if(filenum == -1)
342 sprintf(file, "%s.%s", filename, ext);
343 else if(filenum == 0)
344 if (!GCSettings.AppendAuto)
345 sprintf(file, "%s.%s", filename, ext);
346 else
347 sprintf(file, "%s Auto.%s", filename, ext);
348 else
349 sprintf(file, "%s %i.%s", filename, filenum, ext);
350 }
351 else
352 {
353 sprintf(file, "%s", filename);
354 }
355 break;
356
357 case FILE_CHEAT:
358 sprintf(folder, GCSettings.CheatFolder);
359 sprintf(file, "%s.cht", romFilename);
360 break;
361 }

Callers 8

GetFirstZipFilenameFunction · 0.85
SaveStateAutoFunction · 0.85
LoadStateAutoFunction · 0.85
SaveRAMAutoFunction · 0.85
LoadRAMAutoFunction · 0.85
SetupCheatsFunction · 0.85
MenuGameSavesFunction · 0.85
BrowserLoadFileFunction · 0.85

Calls 2

ErrorPromptFunction · 0.85
CleanupPathFunction · 0.85

Tested by

no test coverage detected