diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 2d2dacbace..144336e507 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -1112,7 +1112,8 @@ void PSPSaveDialog::ExecuteNotVisibleIOAction() { param.ClearSFOCache(); auto &result = param.GetPspParam()->common.result; - switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode) { + SceUtilitySavedataType utilityMode = (SceUtilitySavedataType)(u32)param.GetPspParam()->mode; + switch (utilityMode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: // Only load and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: result = param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave); diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index cd77e58e4d..a0cbad3996 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -503,11 +503,13 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD std::string sfopath = dirPath + "/" + SFO_FILENAME; std::shared_ptr sfoFile = LoadCachedSFO(sfopath, true); + // This was added in #18430, see below. bool subWrite = param->mode == SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE || param->mode == SCE_UTILITY_SAVEDATA_TYPE_WRITEDATA; bool wasCrypted = GetSaveCryptMode(param, saveDirName) != 0; - // Update values - if(!subWrite){ + // Update values. NOTE! #18430 made this conditional on !subWrite, but this is not correct, as it causes #18687. + // So now we do a hacky trick and just check for a valid title before we proceed with updating the sfoFile. + if (strnlen(param->sfoParam.title, sizeof(param->sfoParam.title)) > 0) { sfoFile->SetValue("TITLE", param->sfoParam.title, 128); sfoFile->SetValue("SAVEDATA_TITLE", param->sfoParam.savedataTitle, 128); sfoFile->SetValue("SAVEDATA_DETAIL", param->sfoParam.detail, 1024); @@ -554,7 +556,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD // Calc SFO hash for PSP. if (cryptedData != 0 || (subWrite && wasCrypted)) { int offset = sfoFile->GetDataOffset(sfoData, "SAVEDATA_PARAMS"); - if(offset >= 0) + if (offset >= 0) UpdateHash(sfoData, (int)sfoSize, offset, DetermineCryptMode(param)); } @@ -598,7 +600,6 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD delete[] cryptedData; } - // SAVE ICON0 if (param->icon0FileData.buf.IsValid()) { diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 433e280135..7c2045236c 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -238,6 +238,10 @@ bool CanExtractWithoutOverwrite(struct zip *z, const Path &destination, int maxO } for (int i = 0; i < numFiles; i++) { const char *fn = zip_get_name(z, i, 0); + if (endsWith(fn, "/")) { + // we don't care about directory overwrites, that's fine. + continue; + } Path p = destination / fn; if (File::Exists(p)) { INFO_LOG(Log::HLE, "Extract zip check: %s exists, can't extract without overwrite", p.ToVisualString().c_str()); diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 2278a88002..30d4605619 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -125,7 +125,9 @@ void InstallZipScreen::CreateViews() { destFolders_.push_back(savedataDir); - leftColumn->Add(new NoticeView(NoticeLevel::WARN, di->T("Confirm Overwrite"), "")); + if (overwrite) { + leftColumn->Add(new NoticeView(NoticeLevel::WARN, di->T("Confirm Overwrite"), "")); + } int columnWidth = 300;