fix fds loading

This commit is contained in:
zeromus 2008-08-01 03:31:06 +00:00
parent 81d4767443
commit c6b90a037e
3 changed files with 11 additions and 1 deletions

View File

@ -188,9 +188,13 @@ int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare
void FCEUI_CheatSearchShowExcluded(void);
void FCEUI_CheatSearchSetCurrentAsOriginal(void);
//.rom
#define FCEUIOD_ROMS 0
//NV = nonvolatile. save data.
#define FCEUIOD_NV 1
//savestates
#define FCEUIOD_STATES 2
//.fds ?
#define FCEUIOD_FDSROM 3
#define FCEUIOD_SNAPS 4
#define FCEUIOD_CHEATS 5

View File

@ -401,6 +401,8 @@ ArchiveScanRecord FCEUD_ScanArchive(std::string fname)
//check the file against the signatures
std::fstream* inf = FCEUD_UTF8_fstream(fname,"rb");
if(!inf) return ArchiveScanRecord();
int matchingFormat = -1;
for(uint32 i=0;i<(int)formatRecords.size();i++)
{

View File

@ -1188,7 +1188,11 @@ std::fstream* FCEUD_UTF8_fstream(const char *n, const char *m)
else if(!strcmp(m,"a+") || !strcmp(m,"a+b"))
mode |= std::ios_base::in | std::ios_base::out | std::ios_base::app;
return new std::fstream(n,mode);
std::fstream *fs = new std::fstream(n,mode);
if(!fs->is_open()) {
delete fs;
return 0;
} else return fs;
}
FILE *FCEUD_UTF8fopen(const char *n, const char *m)