From b7f0a9029eb8216f38a084c8013468654d471bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 7 Apr 2024 12:36:32 +0200 Subject: [PATCH] More cleanup --- Core/Dialog/SavedataParam.cpp | 13 +++++-------- Core/Dialog/SavedataParam.h | 4 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index ad78b52fec..fd0477f572 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -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 */ diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index d580aabb29..15e7015d57 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -21,6 +21,8 @@ #include #include #include +#include + #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 GetSFOEntries(const std::string &dirPath);