Make more savedata struct parts PSPPointers.

This commit is contained in:
Unknown W. Brackets 2013-06-22 22:49:39 -07:00
parent 12232dcad4
commit dae4156654
2 changed files with 12 additions and 11 deletions

View File

@ -264,7 +264,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &save
cryptedSize = param->dataSize;
if(cryptedSize == 0 || (SceSize)cryptedSize > param->dataBufSize)
cryptedSize = param->dataBufSize; // fallback, should never use this
u8* data_ = (u8*)Memory::GetPointer(param->dataBuf);
u8 *data_ = param->dataBuf;
int aligned_len = align16(cryptedSize);
cryptedData = new u8[aligned_len + 0x10];
@ -369,7 +369,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &save
if(param->dataBuf != 0) // Can launch save without save data in mode 13
{
std::string filePath = dirPath+"/"+GetFileName(param);
u8* data_ = 0;
u8 *data_ = 0;
SceSize saveSize = 0;
if(cryptedData == 0) // Save decrypted data
{
@ -377,7 +377,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &save
if(saveSize == 0 || saveSize > param->dataBufSize)
saveSize = param->dataBufSize; // fallback, should never use this
data_ = (u8*)Memory::GetPointer(param->dataBuf);
data_ = param->dataBuf;
}
else
{
@ -438,7 +438,7 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save
return false;
}
u8 *data_ = (u8*)Memory::GetPointer(param->dataBuf);
u8 *data_ = param->dataBuf;
std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName));
if (saveId >= 0 && saveNameListDataCount > 0) // if user selection, use it
@ -1036,14 +1036,13 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param)
listEmptyFile = false;
}
typedef char (*SaveNameListData_t)[20];
SaveNameListData_t saveNameListData;
SceUtilitySavedataSaveName *saveNameListData;
bool hasMultipleFileName = false;
if (param->saveNameList != 0)
if (param->saveNameList.Valid())
{
Clear();
saveNameListData = (SaveNameListData_t)Memory::GetPointer(param->saveNameList);
saveNameListData = param->saveNameList;
// Get number of fileName in array
saveDataListCount = 0;

View File

@ -128,6 +128,8 @@ struct SceUtilitySavedataFileListInfo
PSPPointer<SceUtilitySavedataFileListEntry> systemEntries;
};
typedef char SceUtilitySavedataSaveName[20];
// Structure to hold the parameters for the sceUtilitySavedataInitStart function.
struct SceUtilitySavedataParam
{
@ -142,14 +144,14 @@ struct SceUtilitySavedataParam
char gameName[13];
char unused[3];
/** saveName: name of the particular save, normally a number */
char saveName[20];
u32 saveNameList;
SceUtilitySavedataSaveName saveName;
PSPPointer<SceUtilitySavedataSaveName> saveNameList;
/** fileName: name of the data file of the game for example DATA.BIN */
char fileName[13];
char unused2[3];
/** pointer to a buffer that will contain data file unencrypted data */
u32 dataBuf; // Initially void*, but void* in 64bit system take 8 bytes.
PSPPointer<u8> dataBuf;
/** size of allocated space to dataBuf */
SceSize dataBufSize;
SceSize dataSize; // Size of the actual save data