summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/am/service/storage_accessor.cpp68
-rw-r--r--src/core/hle/service/am/service/storage_accessor.h (renamed from src/core/hle/service/am/storage_accessor.h)21
-rw-r--r--src/core/hle/service/am/storage.cpp2
-rw-r--r--src/core/hle/service/am/storage_accessor.cpp90
5 files changed, 82 insertions, 103 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 956207fcf..c2c08c2e9 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -475,14 +475,14 @@ add_library(core STATIC
hle/service/am/service/process_winding_controller.h
hle/service/am/service/self_controller.cpp
hle/service/am/service/self_controller.h
+ hle/service/am/service/storage_accessor.cpp
+ hle/service/am/service/storage_accessor.h
hle/service/am/service/system_applet_proxy.cpp
hle/service/am/service/system_applet_proxy.h
hle/service/am/system_buffer_manager.cpp
hle/service/am/system_buffer_manager.h
hle/service/am/spsm.cpp
hle/service/am/spsm.h
- hle/service/am/storage_accessor.cpp
- hle/service/am/storage_accessor.h
hle/service/am/storage.cpp
hle/service/am/storage.h
hle/service/am/window_controller.cpp
diff --git a/src/core/hle/service/am/service/storage_accessor.cpp b/src/core/hle/service/am/service/storage_accessor.cpp
new file mode 100644
index 000000000..84577fee4
--- /dev/null
+++ b/src/core/hle/service/am/service/storage_accessor.cpp
@@ -0,0 +1,68 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/hle/kernel/k_transfer_memory.h"
+#include "core/hle/service/am/library_applet_storage.h"
+#include "core/hle/service/am/service/storage_accessor.h"
+#include "core/hle/service/cmif_serialization.h"
+
+namespace Service::AM {
+
+IStorageAccessor::IStorageAccessor(Core::System& system_,
+ std::shared_ptr<LibraryAppletStorage> impl)
+ : ServiceFramework{system_, "IStorageAccessor"}, m_impl{std::move(impl)} {
+ static const FunctionInfo functions[] = {
+ {0, D<&IStorageAccessor::GetSize>, "GetSize"},
+ {10, D<&IStorageAccessor::Write>, "Write"},
+ {11, D<&IStorageAccessor::Read>, "Read"},
+ };
+
+ RegisterHandlers(functions);
+}
+
+IStorageAccessor::~IStorageAccessor() = default;
+
+Result IStorageAccessor::GetSize(Out<s64> out_size) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_size = m_impl->GetSize();
+ R_SUCCEED();
+}
+
+Result IStorageAccessor::Write(InBuffer<BufferAttr_HipcAutoSelect> buffer, s64 offset) {
+ LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, buffer.size());
+ R_RETURN(m_impl->Write(offset, buffer.data(), buffer.size()));
+}
+
+Result IStorageAccessor::Read(OutBuffer<BufferAttr_HipcAutoSelect> out_buffer, s64 offset) {
+ LOG_DEBUG(Service_AM, "called, offset={} size={}", offset, out_buffer.size());
+ R_RETURN(m_impl->Read(offset, out_buffer.data(), out_buffer.size()));
+}
+
+ITransferStorageAccessor::ITransferStorageAccessor(Core::System& system_,
+ std::shared_ptr<LibraryAppletStorage> impl)
+ : ServiceFramework{system_, "ITransferStorageAccessor"}, m_impl{std::move(impl)} {
+ static const FunctionInfo functions[] = {
+ {0, D<&ITransferStorageAccessor::GetSize>, "GetSize"},
+ {1, D<&ITransferStorageAccessor::GetHandle>, "GetHandle"},
+ };
+
+ RegisterHandlers(functions);
+}
+
+ITransferStorageAccessor::~ITransferStorageAccessor() = default;
+
+Result ITransferStorageAccessor::GetSize(Out<s64> out_size) {
+ LOG_DEBUG(Service_AM, "called");
+ *out_size = m_impl->GetSize();
+ R_SUCCEED();
+}
+
+Result ITransferStorageAccessor::GetHandle(Out<s64> out_size,
+ OutCopyHandle<Kernel::KTransferMemory> out_handle) {
+ LOG_INFO(Service_AM, "called");
+ *out_size = m_impl->GetSize();
+ *out_handle = m_impl->GetHandle();
+ R_SUCCEED();
+}
+
+} // namespace Service::AM
diff --git a/src/core/hle/service/am/storage_accessor.h b/src/core/hle/service/am/service/storage_accessor.h
index b9aa85a66..1a01730e0 100644
--- a/src/core/hle/service/am/storage_accessor.h
+++ b/src/core/hle/service/am/service/storage_accessor.h
@@ -3,35 +3,36 @@
#pragma once
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/library_applet_storage.h"
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Service::AM {
class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
public:
- explicit IStorageAccessor(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl_);
+ explicit IStorageAccessor(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl);
~IStorageAccessor() override;
private:
- void GetSize(HLERequestContext& ctx);
- void Write(HLERequestContext& ctx);
- void Read(HLERequestContext& ctx);
+ Result GetSize(Out<s64> out_size);
+ Result Write(InBuffer<BufferAttr_HipcAutoSelect> buffer, s64 offset);
+ Result Read(OutBuffer<BufferAttr_HipcAutoSelect> out_buffer, s64 offset);
- const std::shared_ptr<LibraryAppletStorage> impl;
+ const std::shared_ptr<LibraryAppletStorage> m_impl;
};
class ITransferStorageAccessor final : public ServiceFramework<ITransferStorageAccessor> {
public:
explicit ITransferStorageAccessor(Core::System& system_,
- std::shared_ptr<LibraryAppletStorage> impl_);
+ std::shared_ptr<LibraryAppletStorage> impl);
~ITransferStorageAccessor() override;
private:
- void GetSize(HLERequestContext& ctx);
- void GetHandle(HLERequestContext& ctx);
+ Result GetSize(Out<s64> out_size);
+ Result GetHandle(Out<s64> out_size, OutCopyHandle<Kernel::KTransferMemory> out_handle);
- const std::shared_ptr<LibraryAppletStorage> impl;
+ const std::shared_ptr<LibraryAppletStorage> m_impl;
};
} // namespace Service::AM
diff --git a/src/core/hle/service/am/storage.cpp b/src/core/hle/service/am/storage.cpp
index 4e82afd1c..12d95eebd 100644
--- a/src/core/hle/service/am/storage.cpp
+++ b/src/core/hle/service/am/storage.cpp
@@ -3,8 +3,8 @@
#include "core/hle/service/am/am_results.h"
#include "core/hle/service/am/library_applet_storage.h"
+#include "core/hle/service/am/service/storage_accessor.h"
#include "core/hle/service/am/storage.h"
-#include "core/hle/service/am/storage_accessor.h"
#include "core/hle/service/ipc_helpers.h"
namespace Service::AM {
diff --git a/src/core/hle/service/am/storage_accessor.cpp b/src/core/hle/service/am/storage_accessor.cpp
deleted file mode 100644
index a1184b065..000000000
--- a/src/core/hle/service/am/storage_accessor.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/kernel/k_transfer_memory.h"
-#include "core/hle/service/am/am_results.h"
-#include "core/hle/service/am/library_applet_storage.h"
-#include "core/hle/service/am/storage_accessor.h"
-#include "core/hle/service/ipc_helpers.h"
-
-namespace Service::AM {
-
-IStorageAccessor::IStorageAccessor(Core::System& system_,
- std::shared_ptr<LibraryAppletStorage> impl_)
- : ServiceFramework{system_, "IStorageAccessor"}, impl{std::move(impl_)} {
- static const FunctionInfo functions[] = {
- {0, &IStorageAccessor::GetSize, "GetSize"},
- {10, &IStorageAccessor::Write, "Write"},
- {11, &IStorageAccessor::Read, "Read"},
- };
-
- RegisterHandlers(functions);
-}
-
-IStorageAccessor::~IStorageAccessor() = default;
-
-void IStorageAccessor::GetSize(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- IPC::ResponseBuilder rb{ctx, 4};
-
- rb.Push(ResultSuccess);
- rb.Push(impl->GetSize());
-}
-
-void IStorageAccessor::Write(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- const s64 offset{rp.Pop<s64>()};
- const auto data{ctx.ReadBuffer()};
- LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, data.size());
-
- const auto res{impl->Write(offset, data.data(), data.size())};
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(res);
-}
-
-void IStorageAccessor::Read(HLERequestContext& ctx) {
- IPC::RequestParser rp{ctx};
-
- const s64 offset{rp.Pop<s64>()};
- std::vector<u8> data(ctx.GetWriteBufferSize());
-
- LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, data.size());
-
- const auto res{impl->Read(offset, data.data(), data.size())};
-
- ctx.WriteBuffer(data);
-
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(res);
-}
-
-ITransferStorageAccessor::ITransferStorageAccessor(Core::System& system_,
- std::shared_ptr<LibraryAppletStorage> impl_)
- : ServiceFramework{system_, "ITransferStorageAccessor"}, impl{std::move(impl_)} {
- static const FunctionInfo functions[] = {
- {0, &ITransferStorageAccessor::GetSize, "GetSize"},
- {1, &ITransferStorageAccessor::GetHandle, "GetHandle"},
- };
-
- RegisterHandlers(functions);
-}
-
-ITransferStorageAccessor::~ITransferStorageAccessor() = default;
-
-void ITransferStorageAccessor::GetSize(HLERequestContext& ctx) {
- IPC::ResponseBuilder rb{ctx, 4};
- rb.Push(ResultSuccess);
- rb.Push(impl->GetSize());
-}
-
-void ITransferStorageAccessor::GetHandle(HLERequestContext& ctx) {
- IPC::ResponseBuilder rb{ctx, 4, 1};
- rb.Push(ResultSuccess);
- rb.Push(impl->GetSize());
- rb.PushCopyObjects(impl->GetHandle());
-}
-
-} // namespace Service::AM