Only draw visible savedata icons, fix leak.

Fixes #4870.
This commit is contained in:
Unknown W. Brackets 2013-12-17 08:07:30 -08:00
parent 6c8ba5eda6
commit b2795b31c0
2 changed files with 7 additions and 4 deletions

View File

@ -268,14 +268,13 @@ void PSPSaveDialog::DisplayBanner(int which)
void PSPSaveDialog::DisplaySaveList(bool canMove)
{
int displayCount = 0;
static int upFramesHeld = 0;
static int downFramesHeld = 0;
for (int i = 0; i < param.GetFilenameCount(); i++)
for (int displayCount = 0; displayCount < param.GetFilenameCount(); displayCount++)
{
int textureColor = 0xFFFFFFFF;
auto fileInfo = param.GetFileInfo(i);
auto fileInfo = param.GetFileInfo(displayCount);
if (fileInfo.size == 0 && fileInfo.texture != NULL)
textureColor = 0xFF777777;
@ -302,6 +301,10 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
else if (displayCount > currentSelectedSave)
y += 48 + 45 * (displayCount - currentSelectedSave);
// Skip if it's well outside the screen.
if (y > 472.0f || y < -200.0f)
continue;
int tw = 256;
int th = 256;
if (fileInfo.texture != NULL) {
@ -311,7 +314,6 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor);
}
PPGeSetDefaultTexture();
displayCount++;
}
if (canMove) {

View File

@ -846,6 +846,7 @@ bool PPGeImage::Load() {
u32 texSize = width_ * height_ * 4;
texture_ = __PPGeDoAlloc(texSize, true, "Savedata Icon");
if (texture_ == 0) {
free(textureData);
WARN_LOG(SCEGE, "Bad PPGeImage - unable to allocate space for texture");
return false;
}