although the last change probably wouldve worked, this fix solves the real problem: save ram didnt close file pointers when roms reset

This commit is contained in:
zeromus 2009-05-03 18:10:30 +00:00
parent 2e4026e86d
commit 5263070da5
3 changed files with 13 additions and 4 deletions

View File

@ -884,6 +884,12 @@ void NDS_Reset(BOOL resetBySavestate)
if (!header) return ;
if (MMU.bupmem.fp)
{
fclose(MMU.bupmem.fp);
MMU.bupmem.fp = NULL;
}
lagframecounter=0;
LagFrameFlag=0;
lastLag=0;

View File

@ -199,9 +199,9 @@ void mc_reset_com(memory_chip_t *mc)
void mc_realloc(memory_chip_t *mc, int type, u32 size)
{
if(mc->data) delete[] mc->data;
mc_init(mc, type);
mc_alloc(mc, size);
if(mc->data) delete[] mc->data;
mc_init(mc, type);
mc_alloc(mc, size);
}
void mc_load_file(memory_chip_t *mc, const char* filename)
@ -213,7 +213,7 @@ void mc_load_file(memory_chip_t *mc, const char* filename)
if(movieMode != MOVIEMODE_INACTIVE) {
mc->filename = strdup(filename);
file = fopen(filename, "wb+");
return;
}
else
file = fopen(filename, "rb+");

View File

@ -17,4 +17,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaProjectFile = D:\svn\desmume\trunk\desmume\src\windows\CodeAnalyst\DeSmuME_2005.caw
EndGlobalSection
EndGlobal