From 860926d7313ebbe3d3745a8b17335803f6b2ca02 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 21 Jun 2016 12:05:45 +0300 Subject: [PATCH] File op buffer --- rpcs3/Emu/Cell/lv2/sys_fs.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index ff18d94620..3dbab511eb 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -140,7 +140,8 @@ s32 sys_fs_read(u32 fd, vm::ptr buf, u64 nbytes, vm::ptr nread) std::lock_guard lock(file->mutex); - *nread = file->file.read(buf.get_ptr(), nbytes); + std::unique_ptr local_buf(new u8[nbytes]); + std::memcpy(buf.get_ptr(), local_buf.get(), *nread = file->file.read(local_buf.get(), nbytes)); return CELL_OK; } @@ -160,7 +161,9 @@ s32 sys_fs_write(u32 fd, vm::cptr buf, u64 nbytes, vm::ptr nwrite) std::lock_guard lock(file->mutex); - *nwrite = file->file.write(buf.get_ptr(), nbytes); + std::unique_ptr local_buf(new u8[nbytes]); + std::memcpy(local_buf.get(), buf.get_ptr(), nbytes); + *nwrite = file->file.write(local_buf.get(), nbytes); return CELL_OK; }