SaveData: fix icon overriding

This commit is contained in:
Vinicius Rangel 2024-09-25 19:47:39 -03:00
parent e68774d449
commit bb32b30a58
No known key found for this signature in database
GPG key ID: A5B154D904B761D9
3 changed files with 7 additions and 2 deletions

View file

@ -157,7 +157,11 @@ void SaveInstance::SetupAndMount(bool read_only, bool copy_icon, bool ignore_cor
if (copy_icon) {
const auto& src_icon = g_mnt->GetHostPath("/app0/sce_sys/save_data.png");
if (fs::exists(src_icon)) {
fs::copy_file(src_icon, GetIconPath());
auto output_icon = GetIconPath();
if (fs::exists(output_icon)) {
fs::remove(output_icon);
}
fs::copy_file(src_icon, output_icon);
}
}
exists = true;

View file

@ -207,7 +207,7 @@ void SetIcon(void* buf, size_t buf_size) {
} else {
g_icon_memory.resize(buf_size);
std::memcpy(g_icon_memory.data(), buf, buf_size);
IOFile file(g_icon_path, Common::FS::FileAccessMode::Append);
IOFile file(g_icon_path, Common::FS::FileAccessMode::Write);
file.Seek(0);
file.WriteRaw<u8>(g_icon_memory.data(), buf_size);
file.Close();

View file

@ -1573,6 +1573,7 @@ Error PS4_SYSV_ABI sceSaveDataSetupSaveDataMemory2(const OrbisSaveDataMemorySetu
SaveMemory::SetIcon(nullptr, 0);
}
}
SaveMemory::TriggerSaveWithoutEvent();
if (g_fw_ver >= ElfInfo::FW_45 && result != nullptr) {
result->existedMemorySize = existed_size;
}