Added logic to only auto save a CDL file is the code data logger was actually started at least once. This will prevent empty cdl files from being created on ever ROM close when auto saving of cdl files is enabled.

This commit is contained in:
mjbudd77 2021-05-29 13:46:14 -04:00
parent 2b9058ea13
commit a2aa5ba90f
1 changed files with 10 additions and 1 deletions

View File

@ -47,6 +47,7 @@
static int autoSaveCDL = true; static int autoSaveCDL = true;
static int autoLoadCDL = true; static int autoLoadCDL = true;
static int autoResumeCDL = false; static int autoResumeCDL = false;
static bool autoSaveArmedCDL = false;
static char loadedcdfile[512] = {0}; static char loadedcdfile[512] = {0};
static int getDefaultCDLFile(char *filepath); static int getDefaultCDLFile(char *filepath);
@ -856,6 +857,7 @@ void StartCDLogging(void)
FCEUI_SetLoggingCD(1); FCEUI_SetLoggingCD(1);
//EnableTracerMenuItems(); //EnableTracerMenuItems();
//SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause"); //SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause");
autoSaveArmedCDL = true;
fceuWrapperUnLock(); fceuWrapperUnLock();
} }
//---------------------------------------------------- //----------------------------------------------------
@ -877,9 +879,14 @@ bool PauseCDLogging(void)
//---------------------------------------------------- //----------------------------------------------------
void CDLoggerROMClosed(void) void CDLoggerROMClosed(void)
{ {
g_config->getOption("SDL.AutoSaveCDL", &autoSaveCDL);
PauseCDLogging(); PauseCDLogging();
if (autoSaveCDL)
// Only auto save CDL file if the logger has actually been started at least once.
if (autoSaveCDL && autoSaveArmedCDL)
{ {
//printf("Auto Saving CDL\n");
SaveCDLogFile(); SaveCDLogFile();
} }
} }
@ -924,6 +931,8 @@ void RenameCDLog(const char *newName)
//---------------------------------------------------- //----------------------------------------------------
void SaveCDLogFile(void) void SaveCDLogFile(void)
{ {
autoSaveArmedCDL = false;
if (loadedcdfile[0] == 0) if (loadedcdfile[0] == 0)
{ {
char nameo[1024]; char nameo[1024];