fix ram watch recent

This commit is contained in:
zeromus 2009-11-01 23:44:44 +00:00
parent 61a9f31785
commit fd82450e42
2 changed files with 14 additions and 3 deletions

View File

@ -300,10 +300,12 @@ static CFGSTRUCT fceuconfig[] = {
void SaveConfig(const char *filename)
{
std::string rwtemp[5];
//adelikat: Hacky fix for Ram Watch recent menu
for (int x = 0; x < 5; x++)
{
strcpy(ramWatchRecent[x],rw_recent_files[x]);
rwtemp[x] = rw_recent_files[x];
ramWatchRecent[x] = (char*)rwtemp[x].c_str();
}
//-----------------------------------
@ -321,7 +323,16 @@ void LoadConfig(const char *filename)
//adelikat:Hacky fix for Ram Watch recent menu
for (int x = 0; x < 5; x++)
{
strncpy(rw_recent_files[x], ramWatchRecent[x]);
if(ramWatchRecent[x])
{
strncpy(rw_recent_files[x], ramWatchRecent[x], 1024);
free(ramWatchRecent[x]);
ramWatchRecent[x] = 0;
}
else
{
rw_recent_files[x][0] = 0;
}
}
//-----------------------------------
}

View File

@ -24,7 +24,7 @@ using namespace std;
static HMENU ramwatchmenu;
static HMENU rwrecentmenu;
/*static*/ HACCEL RamWatchAccels = NULL;
char rw_recent_files[MAX_RECENT_WATCHES][1024];
char rw_recent_files[MAX_RECENT_WATCHES][1024] = {"","","","",""};
//char Watch_Dir[1024]="";
bool RWfileChanged = false; //Keeps track of whether the current watch file has been changed, if so, ramwatch will prompt to save changes
bool AutoRWLoad = false; //Keeps track of whether Auto-load is checked