More cleanup

This commit is contained in:
Henrik Rydgård 2024-04-07 12:36:32 +02:00
parent 79bdc8a9ff
commit b7f0a9029e
2 changed files with 8 additions and 9 deletions

View file

@ -581,16 +581,14 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD
// copy back save name in request
strncpy(param->saveName, saveDirName.c_str(), 20);
if (fileName.empty()) {
delete[] cryptedData;
} else {
if (!fileName.empty()) {
if (!WritePSPFile(filePath, data_, saveSize)) {
ERROR_LOG(SCEUTILITY, "Error writing file %s", filePath.c_str());
delete[] cryptedData;
return SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE;
}
delete[] cryptedData;
}
delete[] cryptedData;
}
@ -1059,13 +1057,12 @@ int SavedataParam::UpdateHash(u8* sfoData, int sfoSize, int sfoDataParamsOffset,
}
// Requires sfoData to be padded with zeroes to the next 16-byte boundary.
int SavedataParam::BuildHash(unsigned char *output,
const unsigned char *data,
int SavedataParam::BuildHash(uint8_t *output,
const uint8_t *data,
unsigned int len,
unsigned int alignedLen,
int mode,
unsigned char *cryptkey)
{
const uint8_t *cryptkey) {
pspChnnlsvContext1 ctx1;
/* Set up buffers */

View file

@ -21,6 +21,8 @@
#include <mutex>
#include <set>
#include <unordered_map>
#include <cstdint>
#include "Common/CommonTypes.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/MemMap.h"
@ -377,7 +379,7 @@ private:
int UpdateHash(u8* sfoData, int sfoSize, int sfoDataParamsOffset, int encryptmode);
// data must be zero-padded from len to alignedLen!
int BuildHash(unsigned char *output, const unsigned char *data, unsigned int len, unsigned int alignedLen, int mode, unsigned char *cryptkey);
int BuildHash(uint8_t *output, const uint8_t *data, unsigned int len, unsigned int alignedLen, int mode, const uint8_t *cryptkey);
int DetermineCryptMode(const SceUtilitySavedataParam *param) const;
std::vector<SaveSFOFileListEntry> GetSFOEntries(const std::string &dirPath);