summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-02-12 02:34:27 +0100
committerLiam <byteslice@airmail.cc>2024-02-12 15:17:25 +0100
commit203d2135293ccc6addd8f93c885e1ea54f3239b6 (patch)
treeeed7c8416f994e2c768b2c0d10c1f481aada68be /src/core
parentam: rewrite IStorageAccessor, ITransferStorageAccessor (diff)
downloadyuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar.gz
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar.bz2
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar.lz
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar.xz
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.tar.zst
yuzu-203d2135293ccc6addd8f93c885e1ea54f3239b6.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/am/applet.h2
-rw-r--r--src/core/hle/service/am/applet_manager.cpp1
-rw-r--r--src/core/hle/service/am/frontend/applet_cabinet.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_controller.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_error.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_general.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_mii_edit.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_profile_select.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_software_keyboard.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applet_web_browser.cpp2
-rw-r--r--src/core/hle/service/am/frontend/applets.cpp2
-rw-r--r--src/core/hle/service/am/service/application_functions.cpp2
-rw-r--r--src/core/hle/service/am/service/library_applet_accessor.cpp2
-rw-r--r--src/core/hle/service/am/service/library_applet_creator.cpp2
-rw-r--r--src/core/hle/service/am/service/library_applet_self_accessor.cpp2
-rw-r--r--src/core/hle/service/am/service/storage.cpp48
-rw-r--r--src/core/hle/service/am/service/storage.h (renamed from src/core/hle/service/am/storage.h)14
-rw-r--r--src/core/hle/service/am/storage.cpp59
19 files changed, 73 insertions, 81 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index c2c08c2e9..bd483816b 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -477,14 +477,14 @@ add_library(core STATIC
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/storage.cpp
+ hle/service/am/service/storage.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.cpp
- hle/service/am/storage.h
hle/service/am/window_controller.cpp
hle/service/am/window_controller.h
hle/service/aoc/aoc_u.cpp
diff --git a/src/core/hle/service/am/applet.h b/src/core/hle/service/am/applet.h
index 6c593ab1a..4f34d4811 100644
--- a/src/core/hle/service/am/applet.h
+++ b/src/core/hle/service/am/applet.h
@@ -3,7 +3,6 @@
#pragma once
-#include <list>
#include <mutex>
#include "common/math_util.h"
@@ -18,7 +17,6 @@
#include "core/hle/service/am/hid_registration.h"
#include "core/hle/service/am/managed_layer_holder.h"
#include "core/hle/service/am/process.h"
-#include "core/hle/service/am/storage.h"
#include "core/hle/service/am/system_buffer_manager.h"
namespace Service::AM {
diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp
index b35d97bc7..4c7266f89 100644
--- a/src/core/hle/service/am/applet_manager.cpp
+++ b/src/core/hle/service/am/applet_manager.cpp
@@ -12,6 +12,7 @@
#include "core/hle/service/am/frontend/applet_controller.h"
#include "core/hle/service/am/frontend/applet_mii_edit_types.h"
#include "core/hle/service/am/frontend/applet_software_keyboard_types.h"
+#include "core/hle/service/am/service/storage.h"
#include "hid_core/hid_types.h"
namespace Service::AM {
diff --git a/src/core/hle/service/am/frontend/applet_cabinet.cpp b/src/core/hle/service/am/frontend/applet_cabinet.cpp
index 0862c81b6..4cbc80d63 100644
--- a/src/core/hle/service/am/frontend/applet_cabinet.cpp
+++ b/src/core/hle/service/am/frontend/applet_cabinet.cpp
@@ -9,7 +9,7 @@
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_cabinet.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/mii/mii_manager.h"
#include "core/hle/service/nfc/common/device.h"
#include "hid_core/hid_core.h"
diff --git a/src/core/hle/service/am/frontend/applet_controller.cpp b/src/core/hle/service/am/frontend/applet_controller.cpp
index bd3e49fc4..66f52686d 100644
--- a/src/core/hle/service/am/frontend/applet_controller.cpp
+++ b/src/core/hle/service/am/frontend/applet_controller.cpp
@@ -12,7 +12,7 @@
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_controller.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "hid_core/frontend/emulated_controller.h"
#include "hid_core/hid_core.h"
#include "hid_core/hid_types.h"
diff --git a/src/core/hle/service/am/frontend/applet_error.cpp b/src/core/hle/service/am/frontend/applet_error.cpp
index b97a5f3ea..34ec7013b 100644
--- a/src/core/hle/service/am/frontend/applet_error.cpp
+++ b/src/core/hle/service/am/frontend/applet_error.cpp
@@ -10,7 +10,7 @@
#include "core/frontend/applets/error.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_error.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/reporter.h"
namespace Service::AM::Frontend {
diff --git a/src/core/hle/service/am/frontend/applet_general.cpp b/src/core/hle/service/am/frontend/applet_general.cpp
index 3c091a602..d2cabb7b5 100644
--- a/src/core/hle/service/am/frontend/applet_general.cpp
+++ b/src/core/hle/service/am/frontend/applet_general.cpp
@@ -10,7 +10,7 @@
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_data_broker.h"
#include "core/hle/service/am/frontend/applet_general.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/reporter.h"
namespace Service::AM::Frontend {
diff --git a/src/core/hle/service/am/frontend/applet_mii_edit.cpp b/src/core/hle/service/am/frontend/applet_mii_edit.cpp
index e3d19fb3d..0180ab761 100644
--- a/src/core/hle/service/am/frontend/applet_mii_edit.cpp
+++ b/src/core/hle/service/am/frontend/applet_mii_edit.cpp
@@ -7,7 +7,7 @@
#include "core/frontend/applets/mii_edit.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_mii_edit.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/mii/mii.h"
#include "core/hle/service/mii/mii_manager.h"
#include "core/hle/service/sm/sm.h"
diff --git a/src/core/hle/service/am/frontend/applet_profile_select.cpp b/src/core/hle/service/am/frontend/applet_profile_select.cpp
index efb4053b8..89b5a1eab 100644
--- a/src/core/hle/service/am/frontend/applet_profile_select.cpp
+++ b/src/core/hle/service/am/frontend/applet_profile_select.cpp
@@ -10,7 +10,7 @@
#include "core/hle/service/acc/errors.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_profile_select.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
namespace Service::AM::Frontend {
diff --git a/src/core/hle/service/am/frontend/applet_software_keyboard.cpp b/src/core/hle/service/am/frontend/applet_software_keyboard.cpp
index 034c62f32..d1bc03018 100644
--- a/src/core/hle/service/am/frontend/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/frontend/applet_software_keyboard.cpp
@@ -6,7 +6,7 @@
#include "core/frontend/applets/software_keyboard.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_software_keyboard.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
namespace Service::AM::Frontend {
diff --git a/src/core/hle/service/am/frontend/applet_web_browser.cpp b/src/core/hle/service/am/frontend/applet_web_browser.cpp
index 6ee4caf34..bb60260b4 100644
--- a/src/core/hle/service/am/frontend/applet_web_browser.cpp
+++ b/src/core/hle/service/am/frontend/applet_web_browser.cpp
@@ -20,7 +20,7 @@
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/frontend/applet_web_browser.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/iplatform_service_manager.h"
#include "core/loader/loader.h"
diff --git a/src/core/hle/service/am/frontend/applets.cpp b/src/core/hle/service/am/frontend/applets.cpp
index 944d8b105..e662c6cd6 100644
--- a/src/core/hle/service/am/frontend/applets.cpp
+++ b/src/core/hle/service/am/frontend/applets.cpp
@@ -26,7 +26,7 @@
#include "core/hle/service/am/frontend/applet_software_keyboard.h"
#include "core/hle/service/am/frontend/applet_web_browser.h"
#include "core/hle/service/am/frontend/applets.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/sm/sm.h"
namespace Service::AM::Frontend {
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp
index 346ab42ab..b788fddd4 100644
--- a/src/core/hle/service/am/service/application_functions.cpp
+++ b/src/core/hle/service/am/service/application_functions.cpp
@@ -11,7 +11,7 @@
#include "core/hle/service/am/am_results.h"
#include "core/hle/service/am/applet.h"
#include "core/hle/service/am/service/application_functions.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/filesystem/save_data_controller.h"
diff --git a/src/core/hle/service/am/service/library_applet_accessor.cpp b/src/core/hle/service/am/service/library_applet_accessor.cpp
index aac875ef4..0c2426d4b 100644
--- a/src/core/hle/service/am/service/library_applet_accessor.cpp
+++ b/src/core/hle/service/am/service/library_applet_accessor.cpp
@@ -5,7 +5,7 @@
#include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/frontend/applets.h"
#include "core/hle/service/am/service/library_applet_accessor.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/cmif_serialization.h"
namespace Service::AM {
diff --git a/src/core/hle/service/am/service/library_applet_creator.cpp b/src/core/hle/service/am/service/library_applet_creator.cpp
index 4d905549c..166637d60 100644
--- a/src/core/hle/service/am/service/library_applet_creator.cpp
+++ b/src/core/hle/service/am/service/library_applet_creator.cpp
@@ -9,7 +9,7 @@
#include "core/hle/service/am/library_applet_storage.h"
#include "core/hle/service/am/service/library_applet_accessor.h"
#include "core/hle/service/am/service/library_applet_creator.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/sm/sm.h"
diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp
index a432a79ba..7a3a86e88 100644
--- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp
+++ b/src/core/hle/service/am/service/library_applet_self_accessor.cpp
@@ -10,7 +10,7 @@
#include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/frontend/applets.h"
#include "core/hle/service/am/service/library_applet_self_accessor.h"
-#include "core/hle/service/am/storage.h"
+#include "core/hle/service/am/service/storage.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/glue/glue_manager.h"
diff --git a/src/core/hle/service/am/service/storage.cpp b/src/core/hle/service/am/service/storage.cpp
new file mode 100644
index 000000000..25ee0afbd
--- /dev/null
+++ b/src/core/hle/service/am/service/storage.cpp
@@ -0,0 +1,48 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/hle/service/am/am_results.h"
+#include "core/hle/service/am/library_applet_storage.h"
+#include "core/hle/service/am/service/storage.h"
+#include "core/hle/service/am/service/storage_accessor.h"
+#include "core/hle/service/cmif_serialization.h"
+
+namespace Service::AM {
+
+IStorage::IStorage(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl)
+ : ServiceFramework{system_, "IStorage"}, m_impl{std::move(impl)} {
+ static const FunctionInfo functions[] = {
+ {0, D<&IStorage::Open>, "Open"},
+ {1, D<&IStorage::OpenTransferStorage>, "OpenTransferStorage"},
+ };
+
+ RegisterHandlers(functions);
+}
+
+IStorage::IStorage(Core::System& system_, std::vector<u8>&& data)
+ : IStorage(system_, CreateStorage(std::move(data))) {}
+
+IStorage::~IStorage() = default;
+
+Result IStorage::Open(Out<SharedPointer<IStorageAccessor>> out_storage_accessor) {
+ LOG_DEBUG(Service_AM, "called");
+
+ R_UNLESS(m_impl->GetHandle() == nullptr, AM::ResultInvalidStorageType);
+
+ *out_storage_accessor = std::make_shared<IStorageAccessor>(system, m_impl);
+ R_SUCCEED();
+}
+
+Result IStorage::OpenTransferStorage(
+ Out<SharedPointer<ITransferStorageAccessor>> out_transfer_storage_accessor) {
+ R_UNLESS(m_impl->GetHandle() != nullptr, AM::ResultInvalidStorageType);
+
+ *out_transfer_storage_accessor = std::make_shared<ITransferStorageAccessor>(system, m_impl);
+ R_SUCCEED();
+}
+
+std::vector<u8> IStorage::GetData() const {
+ return m_impl->GetData();
+}
+
+} // namespace Service::AM
diff --git a/src/core/hle/service/am/storage.h b/src/core/hle/service/am/service/storage.h
index 10d00b141..cde2ed0ea 100644
--- a/src/core/hle/service/am/storage.h
+++ b/src/core/hle/service/am/service/storage.h
@@ -3,29 +3,33 @@
#pragma once
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Service::AM {
class LibraryAppletStorage;
+class IStorageAccessor;
+class ITransferStorageAccessor;
class IStorage final : public ServiceFramework<IStorage> {
public:
- explicit IStorage(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl_);
+ explicit IStorage(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl);
explicit IStorage(Core::System& system_, std::vector<u8>&& buffer);
~IStorage() override;
std::shared_ptr<LibraryAppletStorage> GetImpl() const {
- return impl;
+ return m_impl;
}
std::vector<u8> GetData() const;
private:
- void Open(HLERequestContext& ctx);
- void OpenTransferStorage(HLERequestContext& ctx);
+ Result Open(Out<SharedPointer<IStorageAccessor>> out_storage_accessor);
+ Result OpenTransferStorage(
+ Out<SharedPointer<ITransferStorageAccessor>> out_transfer_storage_accessor);
- 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
deleted file mode 100644
index 12d95eebd..000000000
--- a/src/core/hle/service/am/storage.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#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/ipc_helpers.h"
-
-namespace Service::AM {
-
-IStorage::IStorage(Core::System& system_, std::shared_ptr<LibraryAppletStorage> impl_)
- : ServiceFramework{system_, "IStorage"}, impl{std::move(impl_)} {
- static const FunctionInfo functions[] = {
- {0, &IStorage::Open, "Open"},
- {1, &IStorage::OpenTransferStorage, "OpenTransferStorage"},
- };
-
- RegisterHandlers(functions);
-}
-
-IStorage::IStorage(Core::System& system_, std::vector<u8>&& data)
- : IStorage(system_, CreateStorage(std::move(data))) {}
-
-IStorage::~IStorage() = default;
-
-void IStorage::Open(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- if (impl->GetHandle() != nullptr) {
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(AM::ResultInvalidStorageType);
- return;
- }
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<IStorageAccessor>(system, impl);
-}
-
-void IStorage::OpenTransferStorage(HLERequestContext& ctx) {
- LOG_DEBUG(Service_AM, "called");
-
- if (impl->GetHandle() == nullptr) {
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(AM::ResultInvalidStorageType);
- return;
- }
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<ITransferStorageAccessor>(system, impl);
-}
-
-std::vector<u8> IStorage::GetData() const {
- return impl->GetData();
-}
-
-} // namespace Service::AM