Make gamedata installation atomic as real PS3

This commit is contained in:
Eladash 2021-03-12 16:25:03 +02:00 committed by Ivan
parent a9b0d25c01
commit d7b4753007
6 changed files with 123 additions and 11 deletions

View file

@ -907,19 +907,16 @@ struct fs_aio_thread : ppu_thread
const auto func = cmd2.arg2<fs_aio_cb_t>();
cmd_pop(1);
s32 error = CELL_OK;
s32 error = CELL_EBADF;
u64 result = 0;
const auto file = idm::get<lv2_fs_object, lv2_file>(aio->fd);
if (!file || (type == 1 && file->flags & CELL_FS_O_WRONLY) || (type == 2 && !(file->flags & CELL_FS_O_ACCMODE)))
{
error = CELL_EBADF;
}
else
else if (std::lock_guard lock(file->mp->mutex); file->file)
{
std::lock_guard lock(file->mp->mutex);
const auto old_pos = file->file.pos(); file->file.seek(aio->offset);
result = type == 2
@ -927,6 +924,7 @@ struct fs_aio_thread : ppu_thread
: file->op_read(aio->buf, aio->size);
file->file.seek(old_pos);
error = CELL_OK;
}
func(*this, aio, error, xid, result);