From 0400eba274dd0a6b38220a0b3665b582b83c17af Mon Sep 17 00:00:00 2001 From: emoose Date: Mon, 28 Dec 2020 07:30:29 +0000 Subject: [PATCH] [Kernel] XFile::Read: add notify_completion param to allow disabling XIOCompletion --- src/xenia/kernel/xfile.cc | 21 ++++++++++++--------- src/xenia/kernel/xfile.h | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/xenia/kernel/xfile.cc b/src/xenia/kernel/xfile.cc index dc4553505..24ded0619 100644 --- a/src/xenia/kernel/xfile.cc +++ b/src/xenia/kernel/xfile.cc @@ -93,7 +93,7 @@ X_STATUS XFile::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length, uint64_t byte_offset, uint32_t* out_bytes_read, - uint32_t apc_context) { + uint32_t apc_context, bool notify_completion) { if (byte_offset == uint64_t(-1)) { // Read from current position. byte_offset = position_; @@ -160,18 +160,21 @@ X_STATUS XFile::Read(uint32_t buffer_guest_address, uint32_t buffer_length, } } - XIOCompletion::IONotification notify; - notify.apc_context = apc_context; - notify.num_bytes = uint32_t(bytes_read); - notify.status = result; - - NotifyIOCompletionPorts(notify); - if (out_bytes_read) { *out_bytes_read = uint32_t(bytes_read); } - async_event_->Set(); + if (notify_completion) { + XIOCompletion::IONotification notify; + notify.apc_context = apc_context; + notify.num_bytes = uint32_t(bytes_read); + notify.status = result; + + NotifyIOCompletionPorts(notify); + + async_event_->Set(); + } + return result; } diff --git a/src/xenia/kernel/xfile.h b/src/xenia/kernel/xfile.h index b432b69d5..a63a4e6cf 100644 --- a/src/xenia/kernel/xfile.h +++ b/src/xenia/kernel/xfile.h @@ -99,7 +99,7 @@ class XFile : public XObject { // critical region). X_STATUS Read(uint32_t buffer_guess_address, uint32_t buffer_length, uint64_t byte_offset, uint32_t* out_bytes_read, - uint32_t apc_context); + uint32_t apc_context, bool notify_completion = true); X_STATUS Write(uint32_t buffer_guess_address, uint32_t buffer_length, uint64_t byte_offset, uint32_t* out_bytes_written,