Initially count the dir for save info size.

Should help #6068, verified by the sizes test and JpcspTrace results.
This commit is contained in:
Unknown W. Brackets 2014-10-14 20:22:26 -07:00
parent 12c0272cbc
commit b71b1bbff9
2 changed files with 18 additions and 5 deletions

View File

@ -209,9 +209,9 @@ int PSPSaveDialog::Init(int paramAddr)
StartFade(true);
/*INFO_LOG(SCEUTILITY,"Dump Param :");
INFO_LOG(SCEUTILITY,"size : %d",param.GetPspParam()->size);
INFO_LOG(SCEUTILITY,"language : %d",param.GetPspParam()->language);
INFO_LOG(SCEUTILITY,"buttonSwap : %d",param.GetPspParam()->buttonSwap);
INFO_LOG(SCEUTILITY,"size : %d",param.GetPspParam()->common.size);
INFO_LOG(SCEUTILITY,"language : %d",param.GetPspParam()->common.language);
INFO_LOG(SCEUTILITY,"buttonSwap : %d",param.GetPspParam()->common.buttonSwap);
INFO_LOG(SCEUTILITY,"result : %d",param.GetPspParam()->common.result);
INFO_LOG(SCEUTILITY,"mode : %d",param.GetPspParam()->mode);
INFO_LOG(SCEUTILITY,"bind : %d",param.GetPspParam()->bind);

View File

@ -977,8 +977,21 @@ int SavedataParam::GetSizes(SceUtilitySavedataParam *param)
if (param->utilityData.IsValid())
{
int total_size = 0;
total_size += getSizeNormalized(1); // SFO;
total_size += getSizeNormalized((u32)param->dataSize == 0 ? 1 : (u32)param->dataSize); // Save Data
// The directory record itself.
// TODO: Account for number of files / actual record size?
total_size += getSizeNormalized(1);
// Account for the SFO (is this always 1 sector?)
total_size += getSizeNormalized(1);
// Add the size of the data itself (don't forget encryption overhead.)
// This is only added if a filename is specified.
if (param->fileName[0] != 0) {
if (g_Config.bEncryptSave) {
total_size += getSizeNormalized((u32)param->dataSize + 16);
} else {
total_size += getSizeNormalized((u32)param->dataSize);
}
}
total_size += getSizeNormalized(param->icon0FileData.size);
total_size += getSizeNormalized(param->icon1FileData.size);
total_size += getSizeNormalized(param->pic1FileData.size);