VERY experimental Nintendo Switch 2 emulator
C++
olsc: rewrite IOlscServiceForSystemService
Liam41d6ea28bf88
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 36bc9103e9..d486966544 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -870,6 +870,8 @@ add_library(core STATIChle/service/olsc/olsc_service_for_system_service.hhle/service/olsc/olsc.cpphle/service/olsc/olsc.h+ hle/service/olsc/remote_storage_controller.cpp+ hle/service/olsc/remote_storage_controller.hhle/service/olsc/transfer_task_list_controller.cpphle/service/olsc/transfer_task_list_controller.hhle/service/omm/omm.cppdiff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp b/src/core/hle/service/olsc/olsc_service_for_system_service.cppindex 1873f1245d..f027933c92 100644--- a/src/core/hle/service/olsc/olsc_service_for_system_service.cpp+++ b/src/core/hle/service/olsc/olsc_service_for_system_service.cpp@@ -1,8 +1,10 @@// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later-#include "core/hle/service/ipc_helpers.h"+#include "core/hle/service/cmif_serialization.h"+#include "core/hle/service/olsc/daemon_controller.h"#include "core/hle/service/olsc/olsc_service_for_system_service.h"+#include "core/hle/service/olsc/remote_storage_controller.h"#include "core/hle/service/olsc/transfer_task_list_controller.h"namespace Service::OLSC {@@ -11,9 +13,9 @@ IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_: ServiceFramework{system_, "olsc:s"} {// clang-format offstatic const FunctionInfo functions[] = {- {0, &IOlscServiceForSystemService::OpenTransferTaskListController, "OpenTransferTaskListController"},- {1, nullptr, "OpenRemoteStorageController"},- {2, nullptr, "OpenDaemonController"},+ {0, D<&IOlscServiceForSystemService::OpenTransferTaskListController>, "OpenTransferTaskListController"},+ {1, D<&IOlscServiceForSystemService::OpenRemoteStorageController>, "OpenRemoteStorageController"},+ {2, D<&IOlscServiceForSystemService::OpenDaemonController>, "OpenDaemonController"},{10, nullptr, "Unknown10"},{11, nullptr, "Unknown11"},{12, nullptr, "Unknown12"},@@ -24,7 +26,7 @@ IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_{103, nullptr, "GetLastErrorInfo"},{104, nullptr, "GetLastErrorEventHolder"},{105, nullptr, "GetLastTransferTaskErrorInfo"},- {200, nullptr, "GetDataTransferPolicyInfo"},+ {200, D<&IOlscServiceForSystemService::GetDataTransferPolicyInfo>, "GetDataTransferPolicyInfo"},{201, nullptr, "RemoveDataTransferPolicyInfo"},{202, nullptr, "UpdateDataTransferPolicyOld"},{203, nullptr, "UpdateDataTransferPolicy"},@@ -68,6 +70,7 @@ IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_{1122, nullptr, "RepairIssue2"},{1123, nullptr, "RepairIssue3"},{1124, nullptr, "Unknown1124"},+ {10000, D<&IOlscServiceForSystemService::CloneService>, "CloneService"},};// clang-format on@@ -76,12 +79,39 @@ IOlscServiceForSystemService::IOlscServiceForSystemService(Core::System& system_IOlscServiceForSystemService::~IOlscServiceForSystemService() = default;-void IOlscServiceForSystemService::OpenTransferTaskListController(HLERequestContext& ctx) {+Result IOlscServiceForSystemService::OpenTransferTaskListController(+ Out<SharedPointer<ITransferTaskListController>> out_interface) {LOG_INFO(Service_OLSC, "called");+ *out_interface = std::make_shared<ITransferTaskListController>(system);+ R_SUCCEED();+}++Result IOlscServiceForSystemService::OpenRemoteStorageController(+ Out<SharedPointer<IRemoteStorageController>> out_interface) {+ LOG_INFO(Service_OLSC, "called");+ *out_interface = std::make_shared<IRemoteStorageController>(system);+ R_SUCCEED();+}++Result IOlscServiceForSystemService::OpenDaemonController(+ Out<SharedPointer<IDaemonController>> out_interface) {+ LOG_INFO(Service_OLSC, "called");+ *out_interface = std::make_shared<IDaemonController>(system);+ R_SUCCEED();+}- IPC::ResponseBuilder rb{ctx, 2, 0, 1};- rb.Push(ResultSuccess);- rb.PushIpcInterface<ITransferTaskListController>(system);+Result IOlscServiceForSystemService::GetDataTransferPolicyInfo(Out<u16> out_policy_info,+ u64 application_id) {+ LOG_WARNING(Service_OLSC, "(STUBBED) called");+ *out_policy_info = 0;+ R_SUCCEED();+}++Result IOlscServiceForSystemService::CloneService(+ Out<SharedPointer<IOlscServiceForSystemService>> out_interface) {+ LOG_INFO(Service_OLSC, "called");+ *out_interface = std::static_pointer_cast<IOlscServiceForSystemService>(shared_from_this());+ R_SUCCEED();}} // namespace Service::OLSCdiff --git a/src/core/hle/service/olsc/olsc_service_for_system_service.h b/src/core/hle/service/olsc/olsc_service_for_system_service.hindex a81fba0dca..13026272ac 100644--- a/src/core/hle/service/olsc/olsc_service_for_system_service.h+++ b/src/core/hle/service/olsc/olsc_service_for_system_service.h@@ -1,17 +1,27 @@// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later+#include "core/hle/service/cmif_types.h"#include "core/hle/service/service.h"namespace Service::OLSC {+class IDaemonController;+class IRemoteStorageController;+class ITransferTaskListController;+class IOlscServiceForSystemService final : public ServiceFramework<IOlscServiceForSystemService> {public:explicit IOlscServiceForSystemService(Core::System& system_);~IOlscServiceForSystemService() override;private:- void OpenTransferTaskListController(HLERequestContext& ctx);+ Result OpenTransferTaskListController(+ Out<SharedPointer<ITransferTaskListController>> out_interface);+ Result OpenRemoteStorageController(Out<SharedPointer<IRemoteStorageController>> out_interface);+ Result OpenDaemonController(Out<SharedPointer<IDaemonController>> out_interface);+ Result GetDataTransferPolicyInfo(Out<u16> out_policy_info, u64 application_id);+ Result CloneService(Out<SharedPointer<IOlscServiceForSystemService>> out_interface);};} // namespace Service::OLSC