mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
Only try to load cheats file if we got a valid string back from
MDFN_MakeFName
This commit is contained in:
parent
7c59861979
commit
3a74c5c848
@ -37,12 +37,7 @@
|
||||
|
||||
FileStream::FileStream(const char *path, const int mode): OpenedMode(mode)
|
||||
{
|
||||
if(mode == FileStream::MODE_WRITE)
|
||||
fp = fopen(path, "wb");
|
||||
else
|
||||
fp = fopen(path, "rb");
|
||||
|
||||
if(!fp)
|
||||
if(!(fp = fopen(path, (mode == FileStream::MODE_WRITE) ? "wb" : "rb")))
|
||||
{
|
||||
ErrnoHolder ene(errno);
|
||||
|
||||
@ -92,8 +87,7 @@ int64 FileStream::tell(void)
|
||||
return ftello(fp);
|
||||
}
|
||||
|
||||
int64 FileStream::size(void)
|
||||
{
|
||||
int64 FileStream::size(void) {
|
||||
struct stat buf;
|
||||
|
||||
fstat(fileno(fp), &buf);
|
||||
|
@ -40,12 +40,7 @@
|
||||
|
||||
FileWrapper::FileWrapper(const char *path, const int mode, const char *purpose) : OpenedMode(mode)
|
||||
{
|
||||
if(mode == MODE_WRITE)
|
||||
fp = fopen(path, "wb");
|
||||
else
|
||||
fp = fopen(path, "rb");
|
||||
|
||||
if(!fp)
|
||||
if(!(fp = fopen(path, (mode == MODE_WRITE) ? "wb" : "rb")))
|
||||
{
|
||||
ErrnoHolder ene(errno);
|
||||
|
||||
|
@ -238,15 +238,19 @@ void MDFN_LoadGameCheats(void *override_ptr)
|
||||
{
|
||||
const char *fn = MDFN_MakeFName(MDFNMKF_CHEAT,0,0).c_str();
|
||||
|
||||
if (log_cb && fn)
|
||||
if (log_cb && fn[0] != '\0')
|
||||
{
|
||||
log_cb(RETRO_LOG_INFO, "Loading cheats from %s...\n", fn);
|
||||
|
||||
if(!(fp = fopen(fn,"rb")))
|
||||
{
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_ERROR, "Error opening file.\n");
|
||||
return;
|
||||
if(!(fp = fopen(fn,"rb")))
|
||||
{
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_ERROR, "Error opening file.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if(SeekToOurSection(fp))
|
||||
|
Loading…
Reference in New Issue
Block a user