mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
reduce memory fragmentation. fixes out of memory crashes (eg: after many save state loads)
This commit is contained in:
parent
62c005ed34
commit
ad8d0e3472
@ -972,7 +972,7 @@ static int MenuGameSelection()
|
|||||||
|
|
||||||
// populate initial directory listing
|
// populate initial directory listing
|
||||||
OpenGameList();
|
OpenGameList();
|
||||||
|
|
||||||
gameBrowser.ResetState();
|
gameBrowser.ResetState();
|
||||||
gameBrowser.fileList[0]->SetState(STATE_SELECTED);
|
gameBrowser.fileList[0]->SetState(STATE_SELECTED);
|
||||||
gameBrowser.TriggerUpdate();
|
gameBrowser.TriggerUpdate();
|
||||||
@ -1030,6 +1030,7 @@ static int MenuGameSelection()
|
|||||||
|
|
||||||
HaltParseThread(); // halt parsing
|
HaltParseThread(); // halt parsing
|
||||||
HaltGui();
|
HaltGui();
|
||||||
|
ResetBrowser();
|
||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
mainWindow->Remove(&buttonWindow);
|
mainWindow->Remove(&buttonWindow);
|
||||||
mainWindow->Remove(&gameBrowser);
|
mainWindow->Remove(&gameBrowser);
|
||||||
@ -1623,6 +1624,8 @@ static int MenuGameSaves(int action)
|
|||||||
len = strlen(romFilename);
|
len = strlen(romFilename);
|
||||||
|
|
||||||
// find matching files
|
// find matching files
|
||||||
|
AllocSaveBuffer();
|
||||||
|
|
||||||
for(i=0; i < browser.numEntries; i++)
|
for(i=0; i < browser.numEntries; i++)
|
||||||
{
|
{
|
||||||
len2 = strlen(browserList[i].filename);
|
len2 = strlen(browserList[i].filename);
|
||||||
@ -1653,7 +1656,7 @@ static int MenuGameSaves(int action)
|
|||||||
{
|
{
|
||||||
sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp);
|
sprintf(scrfile, "%s%s/%s.png", pathPrefix[GCSettings.SaveMethod], GCSettings.SaveFolder, tmp);
|
||||||
|
|
||||||
AllocSaveBuffer();
|
memset(savebuffer, 0, SAVEBUFFERSIZE);
|
||||||
if(LoadFile(scrfile, SILENT))
|
if(LoadFile(scrfile, SILENT))
|
||||||
saves.previewImg[j] = new GuiImageData(savebuffer);
|
saves.previewImg[j] = new GuiImageData(savebuffer);
|
||||||
FreeSaveBuffer();
|
FreeSaveBuffer();
|
||||||
@ -1670,6 +1673,7 @@ static int MenuGameSaves(int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FreeSaveBuffer();
|
||||||
saves.length = j;
|
saves.length = j;
|
||||||
|
|
||||||
if(saves.length == 0 && action == 0)
|
if(saves.length == 0 && action == 0)
|
||||||
@ -1789,10 +1793,10 @@ static int MenuGameSaves(int action)
|
|||||||
mainWindow->Remove(&saveBrowser);
|
mainWindow->Remove(&saveBrowser);
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
|
ResetBrowser();
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuGameSettings
|
* MenuGameSettings
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user