Dynamically manage PPGe images so 50+ are okay.

Otherwise, we try to allocate all at once and could run out of ram.

Should fix #2242.
This commit is contained in:
Unknown W. Brackets 2013-12-08 11:06:18 -08:00
parent 18bcf63ee9
commit 2d3f0758c1
5 changed files with 220 additions and 71 deletions

View file

@ -272,8 +272,9 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
for (int i = 0; i < param.GetFilenameCount(); i++)
{
int textureColor = 0xFFFFFFFF;
auto fileInfo = param.GetFileInfo(i);
if (param.GetFileInfo(i).size == 0 && param.GetFileInfo(i).textureData == 0)
if (fileInfo.size == 0 && fileInfo.texture != NULL)
textureColor = 0xFF777777;
// Calc save image position on screen
@ -300,13 +301,12 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
int tw = 256;
int th = 256;
if (param.GetFileInfo(i).textureData != 0) {
tw = param.GetFileInfo(i).textureWidth;
th = param.GetFileInfo(i).textureHeight;
PPGeSetTexture(param.GetFileInfo(i).textureData, param.GetFileInfo(i).textureWidth, param.GetFileInfo(i).textureHeight);
if (fileInfo.texture != NULL) {
fileInfo.texture->SetTexture();
tw = fileInfo.texture->Width();
th = fileInfo.texture->Height();
PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor);
} else
PPGeDisableTexture();
}
PPGeSetDefaultTexture();
displayCount++;
}
@ -322,8 +322,9 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
void PSPSaveDialog::DisplaySaveIcon()
{
int textureColor = CalcFadedColor(0xFFFFFFFF);
auto curSave = param.GetFileInfo(currentSelectedSave);
if (param.GetFileInfo(currentSelectedSave).size == 0)
if (curSave.size == 0)
textureColor = CalcFadedColor(0xFF777777);
// Calc save image position on screen
@ -334,14 +335,15 @@ void PSPSaveDialog::DisplaySaveIcon()
int tw = 256;
int th = 256;
if (param.GetFileInfo(currentSelectedSave).textureData != 0) {
tw = param.GetFileInfo(currentSelectedSave).textureWidth;
th = param.GetFileInfo(currentSelectedSave).textureHeight;
PPGeSetTexture(param.GetFileInfo(currentSelectedSave).textureData, param.GetFileInfo(currentSelectedSave).textureWidth, param.GetFileInfo(currentSelectedSave).textureHeight);
} else
if (curSave.texture != NULL) {
curSave.texture->SetTexture();
tw = curSave.texture->Width();
th = curSave.texture->Height();
} else {
PPGeDisableTexture();
PPGeDrawImage(x, y, w, h, 0, 0 ,1 ,1 ,tw, th, textureColor);
if (param.GetFileInfo(currentSelectedSave).textureData != 0)
}
PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor);
if (curSave.texture != NULL)
PPGeSetDefaultTexture();
}