1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Savestates: Fixup file write

This commit is contained in:
Elad Ashkenazi 2024-05-05 04:37:49 +03:00
parent 0fcb0b7d8e
commit 91a54c11eb
3 changed files with 11 additions and 8 deletions

View File

@ -2479,10 +2479,13 @@ bool fs::pending_file::commit(bool overwrite)
#endif
#ifdef _WIN32
if (file)
{
// Disable auto-delete
FILE_DISPOSITION_INFO disp;
disp.DeleteFileW = false;
SetFileInformationByHandle(file.get_handle(), FileDispositionInfo, &disp, sizeof(disp));
ensure(SetFileInformationByHandle(file.get_handle(), FileDispositionInfo, &disp, sizeof(disp)));
}
#endif
file.close();

View File

@ -3345,13 +3345,13 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s
set_progress_message("Commiting File");
fs::file to_close_file;
{
auto& ar = *to_ar->load();
auto reset = init_mtx->reset();
to_close_file = std::move(file.file);
ar = {};
ar.set_reading_state(); // Guard against using it
reset.set_init();
}
to_close_file.close();
if (!file.commit() || !fs::get_stat(path, file_stat))
{

View File

@ -740,7 +740,7 @@ void gui_application::InitializeCallbacks()
verbose_message = "\n" + *str_ptr;
}
bytes_written = std::max<usz>(ar_ptr->get_size(), old_written);
bytes_written = ar_ptr->is_writing() ? std::max<usz>(ar_ptr->get_size(), old_written) : old_written;
break;
}