diff options
| author | 2024-02-17 14:05:41 -0500 | |
|---|---|---|
| committer | 2024-02-18 10:32:21 -0500 | |
| commit | ae83ee28a3a1d31d74b991123a150d3cd202f554 (patch) | |
| tree | 06137c63e8b2aeac11b6765298e91ee90146aaf6 /src | |
| parent | ns: move ISystemUpdateControl (diff) | |
| download | yuzu-ae83ee28a3a1d31d74b991123a150d3cd202f554.tar.gz yuzu-ae83ee28a3a1d31d74b991123a150d3cd202f554.tar.xz yuzu-ae83ee28a3a1d31d74b991123a150d3cd202f554.zip | |
ns: rewrite ISystemUpdateInterface
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 41 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns_types.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/ns/system_update_interface.cpp | 61 | ||||
| -rw-r--r-- | src/core/hle/service/ns/system_update_interface.h | 38 |
5 files changed, 109 insertions, 39 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index fdd1c54ac..2fb3dafd6 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -771,6 +771,8 @@ add_library(core STATIC | |||
| 771 | hle/service/ns/read_only_application_record_interface.h | 771 | hle/service/ns/read_only_application_record_interface.h |
| 772 | hle/service/ns/system_update_control.cpp | 772 | hle/service/ns/system_update_control.cpp |
| 773 | hle/service/ns/system_update_control.h | 773 | hle/service/ns/system_update_control.h |
| 774 | hle/service/ns/system_update_interface.cpp | ||
| 775 | hle/service/ns/system_update_interface.h | ||
| 774 | hle/service/ns/vulnerability_manager_interface.cpp | 776 | hle/service/ns/vulnerability_manager_interface.cpp |
| 775 | hle/service/ns/vulnerability_manager_interface.h | 777 | hle/service/ns/vulnerability_manager_interface.h |
| 776 | hle/service/nvdrv/core/container.cpp | 778 | hle/service/nvdrv/core/container.cpp |
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 89700ae01..c4940db26 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include "core/hle/service/ns/read_only_application_control_data_interface.h" | 27 | #include "core/hle/service/ns/read_only_application_control_data_interface.h" |
| 28 | #include "core/hle/service/ns/read_only_application_record_interface.h" | 28 | #include "core/hle/service/ns/read_only_application_record_interface.h" |
| 29 | #include "core/hle/service/ns/system_update_control.h" | 29 | #include "core/hle/service/ns/system_update_control.h" |
| 30 | #include "core/hle/service/ns/system_update_interface.h" | ||
| 30 | #include "core/hle/service/ns/vulnerability_manager_interface.h" | 31 | #include "core/hle/service/ns/vulnerability_manager_interface.h" |
| 31 | #include "core/hle/service/server_manager.h" | 32 | #include "core/hle/service/server_manager.h" |
| 32 | #include "core/hle/service/set/settings_server.h" | 33 | #include "core/hle/service/set/settings_server.h" |
| @@ -529,44 +530,6 @@ public: | |||
| 529 | } | 530 | } |
| 530 | }; | 531 | }; |
| 531 | 532 | ||
| 532 | class NS_SU final : public ServiceFramework<NS_SU> { | ||
| 533 | public: | ||
| 534 | explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} { | ||
| 535 | // clang-format off | ||
| 536 | static const FunctionInfo functions[] = { | ||
| 537 | {0, nullptr, "GetBackgroundNetworkUpdateState"}, | ||
| 538 | {1, &NS_SU::OpenSystemUpdateControl, "OpenSystemUpdateControl"}, | ||
| 539 | {2, nullptr, "NotifyExFatDriverRequired"}, | ||
| 540 | {3, nullptr, "ClearExFatDriverStatusForDebug"}, | ||
| 541 | {4, nullptr, "RequestBackgroundNetworkUpdate"}, | ||
| 542 | {5, nullptr, "NotifyBackgroundNetworkUpdate"}, | ||
| 543 | {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, | ||
| 544 | {9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"}, | ||
| 545 | {10, nullptr, "NotifySystemUpdateForContentDelivery"}, | ||
| 546 | {11, nullptr, "PrepareShutdown"}, | ||
| 547 | {12, nullptr, "Unknown12"}, | ||
| 548 | {13, nullptr, "Unknown13"}, | ||
| 549 | {14, nullptr, "Unknown14"}, | ||
| 550 | {15, nullptr, "Unknown15"}, | ||
| 551 | {16, nullptr, "DestroySystemUpdateTask"}, | ||
| 552 | {17, nullptr, "RequestSendSystemUpdate"}, | ||
| 553 | {18, nullptr, "GetSendSystemUpdateProgress"}, | ||
| 554 | }; | ||
| 555 | // clang-format on | ||
| 556 | |||
| 557 | RegisterHandlers(functions); | ||
| 558 | } | ||
| 559 | |||
| 560 | private: | ||
| 561 | void OpenSystemUpdateControl(HLERequestContext& ctx) { | ||
| 562 | LOG_DEBUG(Service_NS, "called"); | ||
| 563 | |||
| 564 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 565 | rb.Push(ResultSuccess); | ||
| 566 | rb.PushIpcInterface<ISystemUpdateControl>(system); | ||
| 567 | } | ||
| 568 | }; | ||
| 569 | |||
| 570 | void LoopProcess(Core::System& system) { | 533 | void LoopProcess(Core::System& system) { |
| 571 | auto server_manager = std::make_unique<ServerManager>(system); | 534 | auto server_manager = std::make_unique<ServerManager>(system); |
| 572 | 535 | ||
| @@ -578,7 +541,7 @@ void LoopProcess(Core::System& system) { | |||
| 578 | server_manager->RegisterNamedService("ns:ro", std::make_shared<NS>("ns:ro", system)); | 541 | server_manager->RegisterNamedService("ns:ro", std::make_shared<NS>("ns:ro", system)); |
| 579 | 542 | ||
| 580 | server_manager->RegisterNamedService("ns:dev", std::make_shared<NS_DEV>(system)); | 543 | server_manager->RegisterNamedService("ns:dev", std::make_shared<NS_DEV>(system)); |
| 581 | server_manager->RegisterNamedService("ns:su", std::make_shared<NS_SU>(system)); | 544 | server_manager->RegisterNamedService("ns:su", std::make_shared<ISystemUpdateInterface>(system)); |
| 582 | server_manager->RegisterNamedService("ns:vm", | 545 | server_manager->RegisterNamedService("ns:vm", |
| 583 | std::make_shared<IVulnerabilityManagerInterface>(system)); | 546 | std::make_shared<IVulnerabilityManagerInterface>(system)); |
| 584 | server_manager->RegisterNamedService("pdm:qry", std::make_shared<PDM_QRY>(system)); | 547 | server_manager->RegisterNamedService("pdm:qry", std::make_shared<PDM_QRY>(system)); |
diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h index fa2aad3d9..9b6b3aa2d 100644 --- a/src/core/hle/service/ns/ns_types.h +++ b/src/core/hle/service/ns/ns_types.h | |||
| @@ -22,6 +22,12 @@ enum class ApplicationControlSource : u8 { | |||
| 22 | StorageOnly = 2, | 22 | StorageOnly = 2, |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | enum class BackgroundNetworkUpdateState : u8 { | ||
| 26 | None, | ||
| 27 | InProgress, | ||
| 28 | Ready, | ||
| 29 | }; | ||
| 30 | |||
| 25 | struct ApplicationRecord { | 31 | struct ApplicationRecord { |
| 26 | u64 application_id; | 32 | u64 application_id; |
| 27 | ApplicationRecordType type; | 33 | ApplicationRecordType type; |
diff --git a/src/core/hle/service/ns/system_update_interface.cpp b/src/core/hle/service/ns/system_update_interface.cpp new file mode 100644 index 000000000..7e22ca3db --- /dev/null +++ b/src/core/hle/service/ns/system_update_interface.cpp | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/cmif_serialization.h" | ||
| 5 | #include "core/hle/service/ns/system_update_control.h" | ||
| 6 | #include "core/hle/service/ns/system_update_interface.h" | ||
| 7 | |||
| 8 | namespace Service::NS { | ||
| 9 | |||
| 10 | ISystemUpdateInterface::ISystemUpdateInterface(Core::System& system_) | ||
| 11 | : ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"}, | ||
| 12 | update_notification_event{service_context} { | ||
| 13 | // clang-format off | ||
| 14 | static const FunctionInfo functions[] = { | ||
| 15 | {0, D<&ISystemUpdateInterface::GetBackgroundNetworkUpdateState>, "GetBackgroundNetworkUpdateState"}, | ||
| 16 | {1, D<&ISystemUpdateInterface::OpenSystemUpdateControl>, "OpenSystemUpdateControl"}, | ||
| 17 | {2, nullptr, "NotifyExFatDriverRequired"}, | ||
| 18 | {3, nullptr, "ClearExFatDriverStatusForDebug"}, | ||
| 19 | {4, nullptr, "RequestBackgroundNetworkUpdate"}, | ||
| 20 | {5, nullptr, "NotifyBackgroundNetworkUpdate"}, | ||
| 21 | {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, | ||
| 22 | {9, D<&ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery>, "GetSystemUpdateNotificationEventForContentDelivery"}, | ||
| 23 | {10, nullptr, "NotifySystemUpdateForContentDelivery"}, | ||
| 24 | {11, nullptr, "PrepareShutdown"}, | ||
| 25 | {12, nullptr, "Unknown12"}, | ||
| 26 | {13, nullptr, "Unknown13"}, | ||
| 27 | {14, nullptr, "Unknown14"}, | ||
| 28 | {15, nullptr, "Unknown15"}, | ||
| 29 | {16, nullptr, "DestroySystemUpdateTask"}, | ||
| 30 | {17, nullptr, "RequestSendSystemUpdate"}, | ||
| 31 | {18, nullptr, "GetSendSystemUpdateProgress"}, | ||
| 32 | }; | ||
| 33 | // clang-format on | ||
| 34 | |||
| 35 | RegisterHandlers(functions); | ||
| 36 | } | ||
| 37 | |||
| 38 | ISystemUpdateInterface::~ISystemUpdateInterface() = default; | ||
| 39 | |||
| 40 | Result ISystemUpdateInterface::GetBackgroundNetworkUpdateState( | ||
| 41 | Out<BackgroundNetworkUpdateState> out_background_network_update_state) { | ||
| 42 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 43 | *out_background_network_update_state = BackgroundNetworkUpdateState::None; | ||
| 44 | R_SUCCEED(); | ||
| 45 | } | ||
| 46 | |||
| 47 | Result ISystemUpdateInterface::OpenSystemUpdateControl( | ||
| 48 | Out<SharedPointer<ISystemUpdateControl>> out_system_update_control) { | ||
| 49 | LOG_WARNING(Service_NS, "(STUBBED) called"); | ||
| 50 | *out_system_update_control = std::make_shared<ISystemUpdateControl>(system); | ||
| 51 | R_SUCCEED(); | ||
| 52 | } | ||
| 53 | |||
| 54 | Result ISystemUpdateInterface::GetSystemUpdateNotificationEventForContentDelivery( | ||
| 55 | OutCopyHandle<Kernel::KReadableEvent> out_event) { | ||
| 56 | LOG_WARNING(Service_NS, "(STUBBED) called"); | ||
| 57 | *out_event = update_notification_event.GetHandle(); | ||
| 58 | R_SUCCEED(); | ||
| 59 | } | ||
| 60 | |||
| 61 | } // namespace Service::NS | ||
diff --git a/src/core/hle/service/ns/system_update_interface.h b/src/core/hle/service/ns/system_update_interface.h new file mode 100644 index 000000000..36a2880ec --- /dev/null +++ b/src/core/hle/service/ns/system_update_interface.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/kernel_helpers.h" | ||
| 8 | #include "core/hle/service/ns/ns_types.h" | ||
| 9 | #include "core/hle/service/os/event.h" | ||
| 10 | #include "core/hle/service/service.h" | ||
| 11 | |||
| 12 | namespace Kernel { | ||
| 13 | class KReadableEvent; | ||
| 14 | } | ||
| 15 | |||
| 16 | namespace Service::NS { | ||
| 17 | |||
| 18 | class ISystemUpdateControl; | ||
| 19 | |||
| 20 | class ISystemUpdateInterface final : public ServiceFramework<ISystemUpdateInterface> { | ||
| 21 | public: | ||
| 22 | explicit ISystemUpdateInterface(Core::System& system_); | ||
| 23 | ~ISystemUpdateInterface() override; | ||
| 24 | |||
| 25 | private: | ||
| 26 | Result GetBackgroundNetworkUpdateState( | ||
| 27 | Out<BackgroundNetworkUpdateState> out_background_network_update_state); | ||
| 28 | Result OpenSystemUpdateControl( | ||
| 29 | Out<SharedPointer<ISystemUpdateControl>> out_system_update_control); | ||
| 30 | Result GetSystemUpdateNotificationEventForContentDelivery( | ||
| 31 | OutCopyHandle<Kernel::KReadableEvent> out_event); | ||
| 32 | |||
| 33 | private: | ||
| 34 | KernelHelpers::ServiceContext service_context; | ||
| 35 | Event update_notification_event; | ||
| 36 | }; | ||
| 37 | |||
| 38 | } // namespace Service::NS | ||