Load another files of save.

This commit is contained in:
shenweip 2013-11-03 23:52:16 +08:00
parent b9d655f602
commit 8a26da6e45
2 changed files with 25 additions and 7 deletions

View File

@ -479,14 +479,24 @@ bool SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &save
return false;
}
}
if(!LoadSaveData(param, saveDirName, dirPath, secureMode))
if(!LoadSaveData(param, saveDirName, dirPath, secureMode)) // Load main savedata
return false;
LoadSFO(param, dirPath);
LoadSFO(param, dirPath); // Load sfo
// Don't know what it is, but PSP always respond this and this unlock some game
param->bind = 1021;
// Load ICON0.PNG
LoadFile(dirPath, ICON0_FILENAME, &param->icon0FileData);
// Load ICON1.PNG
LoadFile(dirPath, ICON1_FILENAME, &param->icon1FileData);
// Load PIC1.PNG
LoadFile(dirPath, PIC1_FILENAME, &param->pic1FileData);
// Load SND0.AT3
LoadFile(dirPath, SND0_FILENAME, &param->snd0FileData);
return true;
}
@ -520,7 +530,7 @@ bool SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::stri
return true;
}
void SavedataParam::LoadDecryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int saveSize, bool &saveDone) {
void SavedataParam::LoadDecryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize, bool &saveDone) {
int align_len = align16(saveSize);
u8* data_base = new u8[align_len];
u8* cryptKey = new u8[0x10];
@ -546,7 +556,7 @@ void SavedataParam::LoadDecryptedSave(SceUtilitySavedataParam *param, u8 *data,
delete[] cryptKey;
}
void SavedataParam::LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int saveSize) {
void SavedataParam::LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize) {
if (param->dataBuf.IsValid())
memcpy(data, saveData, std::min((u32)saveSize, (u32)param->dataBufSize));
}
@ -572,6 +582,14 @@ void SavedataParam::LoadSFO(SceUtilitySavedataParam *param, const std::string di
}
}
void SavedataParam::LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData) {
std::string filePath = dirPath + "/" + filename;
s64 readSize = -1;
u8 *buf = fileData->buf;
if(ReadPSPFile(filePath, &buf, fileData->bufSize, &readSize))
fileData->size = readSize;
}
int SavedataParam::EncryptData(unsigned int mode,
unsigned char *data,
int *dataLen,

View File

@ -341,10 +341,10 @@ private:
void ClearFileInfo(SaveFileInfo &saveInfo, std::string saveName);
bool LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string dirPath, bool secureMode);
void LoadDecryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int saveSize, bool &saveDone);
void LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int saveSize);
void LoadDecryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize, bool &saveDone);
void LoadNotCryptedSave(SceUtilitySavedataParam *param, u8 *data, u8 *saveData, int &saveSize);
void LoadSFO(SceUtilitySavedataParam *param, const std::string dirPath);
void LoadFile();
void LoadFile(const std::string dirPath, const std::string filename, PspUtilitySavedataFileData *fileData);
int DecryptSave(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *cryptkey);
int EncryptData(unsigned int mode, unsigned char *data, int *dataLen, int *alignedLen, unsigned char *hash, unsigned char *cryptkey);