Don't duplicate no save texture for each save since it's the same.

And some games have 99 slots.
This commit is contained in:
Xele02 2013-01-29 22:46:20 +01:00
parent a766ec42d8
commit 36015f9678
2 changed files with 31 additions and 7 deletions

View File

@ -145,6 +145,7 @@ SavedataParam::SavedataParam()
: pspParam(0)
, selectedSave(0)
, saveDataList(0)
, noSaveIcon(0)
, saveDataListCount(0)
, saveNameListDataCount(0)
{
@ -915,7 +916,7 @@ void SavedataParam::Clear()
{
for (int i = 0; i < saveNameListDataCount; i++)
{
if (saveDataList[i].textureData != 0)
if (saveDataList[i].textureData != 0 && saveDataList[i].size != 0)
kernelMemory.Free(saveDataList[i].textureData);
saveDataList[i].textureData = 0;
}
@ -924,6 +925,14 @@ void SavedataParam::Clear()
saveDataList = 0;
saveDataListCount = 0;
}
if(noSaveIcon)
{
if(noSaveIcon->textureData != 0)
kernelMemory.Free(noSaveIcon->textureData);
noSaveIcon->textureData = 0;
delete noSaveIcon;
noSaveIcon = 0;
}
}
int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
@ -989,9 +998,16 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
if(Memory::IsValidAddress(param->newData))
{
// We have a png to show
PspUtilitySavedataFileData newData;
Memory::ReadStruct(param->newData, &newData);
CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[realCount]);
if(!noSaveIcon)
{
noSaveIcon = new SaveFileInfo();
PspUtilitySavedataFileData newData;
Memory::ReadStruct(param->newData, &newData);
CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, *noSaveIcon);
}
saveDataList[realCount].textureData = noSaveIcon->textureData;
saveDataList[realCount].textureWidth = noSaveIcon->textureWidth;
saveDataList[realCount].textureHeight = noSaveIcon->textureHeight;
}
DEBUG_LOG(HLE,"Don't Exist");
realCount++;
@ -1033,9 +1049,16 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
if(Memory::IsValidAddress(param->newData))
{
// We have a png to show
PspUtilitySavedataFileData newData;
Memory::ReadStruct(param->newData, &newData);
CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, saveDataList[0]);
if(!noSaveIcon)
{
noSaveIcon = new SaveFileInfo();
PspUtilitySavedataFileData newData;
Memory::ReadStruct(param->newData, &newData);
CreatePNGIcon(Memory::GetPointer(newData.buf), (int)newData.size, *noSaveIcon);
}
saveDataList[0].textureData = noSaveIcon->textureData;
saveDataList[0].textureWidth = noSaveIcon->textureWidth;
saveDataList[0].textureHeight = noSaveIcon->textureHeight;
}
DEBUG_LOG(HLE,"Don't Exist");
}

View File

@ -191,6 +191,7 @@ private:
SceUtilitySavedataParam* pspParam;
int selectedSave;
SaveFileInfo* saveDataList;
SaveFileInfo* noSaveIcon;
int saveDataListCount;
int saveNameListDataCount;
};