From 516a95721c5ec7ae2f09cb1e7c9757903523d09e Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 13 Feb 2018 23:16:19 -0500 Subject: [PATCH] service: Remove remaining uses of BufferDescriptor*. --- src/core/hle/service/acc/acc_u0.cpp | 3 +-- src/core/hle/service/am/am.cpp | 6 +++--- src/core/hle/service/filesystem/fsp_srv.cpp | 4 +--- src/core/hle/service/nvdrv/interface.cpp | 5 ++--- src/core/hle/service/set/set.cpp | 4 +--- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index ee7d07aa7..7955f726b 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp @@ -66,8 +66,7 @@ void ACC_U0::GetUserExistence(Kernel::HLERequestContext& ctx) { void ACC_U0::ListAllUsers(Kernel::HLERequestContext& ctx) { constexpr std::array user_ids{DEFAULT_USER_ID}; - const auto& output_buffer = ctx.BufferDescriptorC()[0]; - Memory::WriteBlock(output_buffer.Address(), user_ids.data(), user_ids.size()); + ctx.WriteBuffer(user_ids.data(), user_ids.size()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); LOG_DEBUG(Service_ACC, "called"); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 07cea8717..402105ea0 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -306,11 +306,11 @@ private: u64 offset = rp.Pop(); - const auto& output_buffer = ctx.BufferDescriptorC()[0]; + const size_t size{ctx.GetWriteBufferSize()}; - ASSERT(offset + output_buffer.Size() <= buffer.size()); + ASSERT(offset + size <= buffer.size()); - Memory::WriteBlock(output_buffer.Address(), buffer.data() + offset, output_buffer.Size()); + ctx.WriteBuffer(buffer.data() + offset, size); IPC::ResponseBuilder rb{ctx, 2}; diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 34d4fd035..87a07e457 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -33,12 +33,10 @@ private: IPC::RequestParser rp{ctx}; const s64 offset = rp.Pop(); const s64 length = rp.Pop(); - const auto& descriptor = ctx.BufferDescriptorB()[0]; LOG_DEBUG(Service_FS, "called, offset=0x%llx, length=0x%llx", offset, length); // Error checking - ASSERT_MSG(length == descriptor.Size(), "unexpected size difference"); if (length < 0) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); @@ -60,7 +58,7 @@ private: } // Write the data to memory - Memory::WriteBlock(descriptor.Address(), output.data(), descriptor.Size()); + ctx.WriteBuffer(output); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 13d23291e..1e50d218a 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -14,9 +14,8 @@ namespace Nvidia { void NVDRV::Open(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NVDRV, "called"); - auto buffer = ctx.BufferDescriptorA()[0]; - - std::string device_name = Memory::ReadCString(buffer.Address(), buffer.Size()); + const auto& buffer = ctx.ReadBuffer(); + std::string device_name(buffer.begin(), buffer.end()); u32 fd = nvdrv->Open(device_name); IPC::ResponseBuilder rb{ctx, 4}; diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 1062ba8b3..3001ee411 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -17,9 +17,7 @@ void SET::GetAvailableLanguageCodes(Kernel::HLERequestContext& ctx) { u32 id = rp.Pop(); constexpr std::array lang_codes{}; - const auto& output_buffer = ctx.BufferDescriptorC()[0]; - - Memory::WriteBlock(output_buffer.Address(), lang_codes.data(), lang_codes.size()); + ctx.WriteBuffer(lang_codes.data(), lang_codes.size()); IPC::ResponseBuilder rb{ctx, 2};