Bug fix for saving of CDL and debug files when the ROM was loaded from an archive.

This commit is contained in:
Matthew Budd 2020-10-25 10:25:11 -04:00
parent 0ce058b35b
commit b0c460fd1d
3 changed files with 21 additions and 4 deletions

View File

@ -623,7 +623,14 @@ static int getDefaultCDLFile( char *filepath )
parseFilepath( romFile, dir, baseFile ); parseFilepath( romFile, dir, baseFile );
sprintf( filepath, "%s/%s.cdl", dir, baseFile ); if ( dir[0] == 0 )
{
sprintf( filepath, "%s.cdl", baseFile );
}
else
{
sprintf( filepath, "%s/%s.cdl", dir, baseFile );
}
//printf("%s\n", filepath ); //printf("%s\n", filepath );
@ -827,7 +834,7 @@ void SaveCDLogFile(void)
FP = fopen(loadedcdfile, "wb"); FP = fopen(loadedcdfile, "wb");
if (FP == NULL) if (FP == NULL)
{ {
FCEUD_PrintError("Error Saving File"); FCEUD_PrintError("Error Saving CDL File");
return; return;
} }
fwrite(cdloggerdata, cdloggerdataSize, 1, FP); fwrite(cdloggerdata, cdloggerdataSize, 1, FP);

View File

@ -2443,7 +2443,7 @@ void saveGameDebugBreakpoints(void)
debuggerBookmark_t *bm; debuggerBookmark_t *bm;
// If no breakpoints are loaded, skip saving // If no breakpoints are loaded, skip saving
if ( numWPs == 0 ) if ( (numWPs == 0) && (dbgBmMgr.size() == 0) )
{ {
return; return;
} }

View File

@ -40,7 +40,17 @@ const char *getRomFile( void )
{ {
if ( GameInfo ) if ( GameInfo )
{ {
return GameInfo->filename; //printf("filename: '%s' \n", GameInfo->filename );
//printf("archiveFilename: '%s' \n", GameInfo->archiveFilename );
if ( GameInfo->archiveFilename != NULL )
{
return GameInfo->archiveFilename;
}
else
{
return GameInfo->filename;
}
} }
return NULL; return NULL;
} }