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

Function FindGameSaveNum

source/menu.cpp:1813–1836  ·  view source on GitHub ↗

* FindGameSaveNum * * Determines the save file number of the given file name * Returns -1 if none is found ***************************************************************************/

Source from the content-addressed store, hash-verified

1811 * Returns -1 if none is found
1812 ***************************************************************************/
1813static int FindGameSaveNum(char * savefile, int method)
1814{
1815 int n = -1;
1816 int romlen = strlen(romFilename);
1817 int savelen = strlen(savefile);
1818
1819 int diff = savelen-romlen;
1820
1821 if(strncmp(savefile, romFilename, romlen) != 0)
1822 return -1;
1823
1824 if(savefile[romlen] == ' ')
1825 {
1826 if(diff == 5 && strncmp(&savefile[romlen+1], "Auto", 4) == 0)
1827 n = 0; // found Auto save
1828 else if(diff == 2 || diff == 3)
1829 n = atoi(&savefile[romlen+1]);
1830 }
1831
1832 if(n >= 0 && n < MAX_SAVES)
1833 return n;
1834 else
1835 return -1;
1836}
1837
1838/****************************************************************************
1839 * MenuGameSaves

Callers 1

MenuGameSavesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected