mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 11:34:55 +00:00
Improved "hack"
This commit is contained in:
parent
77c11dabbe
commit
bfbe1d4908
@ -293,13 +293,17 @@ s64 PS4_SYSV_ABI write(s32 fd, const void* buf, size_t nbytes) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto file_size_before = file->f.GetSize();
|
|
||||||
auto written_bytes = file->f.WriteRaw<u8>(buf, nbytes);
|
// Due to a quirk with std::fwrite
|
||||||
auto file_size = file->f.GetSize();
|
// we need to validate the returned bytes, and make sure the file size is correct.
|
||||||
if (file_size != file_size_before + written_bytes) {
|
auto expected_file_size = file->f.GetSize();
|
||||||
file->f.SetSize(written_bytes);
|
auto bytes_written = file->f.WriteRaw<u8>(buf, nbytes);
|
||||||
|
expected_file_size += bytes_written;
|
||||||
|
auto actual_file_size = file->f.GetSize();
|
||||||
|
if (expected_file_size != actual_file_size) {
|
||||||
|
file->f.SetSize(expected_file_size);
|
||||||
}
|
}
|
||||||
return written_bytes;
|
return bytes_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
s64 PS4_SYSV_ABI posix_write(s32 fd, const void* buf, size_t nbytes) {
|
s64 PS4_SYSV_ABI posix_write(s32 fd, const void* buf, size_t nbytes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user