Save data memory: fix overriding icon

This commit is contained in:
Vinicius Rangel 2024-09-24 00:07:13 -03:00
commit b7ec7e4957
No known key found for this signature in database
GPG key ID: A5B154D904B761D9

View file

@ -190,14 +190,19 @@ void SetIcon(void* buf, size_t buf_size) {
if (buf == nullptr) { if (buf == nullptr) {
const auto& src_icon = g_mnt->GetHostPath("/app0/sce_sys/save_data.png"); const auto& src_icon = g_mnt->GetHostPath("/app0/sce_sys/save_data.png");
if (fs::exists(src_icon)) { if (fs::exists(src_icon)) {
if (fs::exists(g_icon_path)) {
fs::remove(g_icon_path);
}
fs::copy_file(src_icon, g_icon_path); fs::copy_file(src_icon, g_icon_path);
} }
IOFile file(g_icon_path, Common::FS::FileAccessMode::Read); if (fs::exists(g_icon_path)) {
size_t size = file.GetSize(); IOFile file(g_icon_path, Common::FS::FileAccessMode::Read);
file.Seek(0); size_t size = file.GetSize();
g_icon_memory.resize(size); file.Seek(0);
file.ReadRaw<u8>(g_icon_memory.data(), size); g_icon_memory.resize(size);
file.Close(); file.ReadRaw<u8>(g_icon_memory.data(), size);
file.Close();
}
} else { } else {
g_icon_memory.resize(buf_size); g_icon_memory.resize(buf_size);
std::memcpy(g_icon_memory.data(), buf, buf_size); std::memcpy(g_icon_memory.data(), buf, buf_size);