VERY experimental Nintendo Switch 2 emulator
C++
[ns] add stubs for cmd936 and cmd4042 (#4429)
PavelBARABANOVdefddec47ff9
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 5c31ebb70e..74391b5e65 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -810,6 +810,8 @@ add_library(core STATIChle/service/ns/ecommerce_interface.hhle/service/ns/factory_reset_interface.cpphle/service/ns/factory_reset_interface.h+ hle/service/ns/i_async_result.cpp+ hle/service/ns/i_async_result.hhle/service/ns/language.cpphle/service/ns/language.hhle/service/ns/ns.cppdiff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cppindex 8f21244439..348649917e 100644--- a/src/core/hle/service/ns/application_manager_interface.cpp+++ b/src/core/hle/service/ns/application_manager_interface.cpp@@ -228,9 +228,9 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_{930, nullptr, "Unknown930"}, //20.0.0+{931, nullptr, "Unknown931"}, //20.0.0+{933, nullptr, "Unknown933"}, //20.0.0+- {934, nullptr, "Unknown934"}, //20.0.0+- {935, nullptr, "Unknown935"}, //20.0.0+- {936, nullptr, "Unknown936"}, //20.0.0++ {934, nullptr, "Unknown934"}, //21.0.0++ {935, nullptr, "Unknown935"}, //21.0.0++ {936, D<&IApplicationManagerInterface::Unknown936>, "Unknown936"}, //21.0.0+{1000, nullptr, "RequestVerifyApplicationDeprecated"},{1001, nullptr, "CorruptApplicationForDebug"},{1002, nullptr, "RequestVerifyAddOnContentsRights"},@@ -422,7 +422,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_{4039, nullptr, "Unknown4039"}, //20.0.0+{4040, nullptr, "Unknown4040"}, //20.0.0+{4041, nullptr, "Unknown4041"}, //20.0.0+- {4042, nullptr, "Unknown4042"}, //20.0.0++ {4042, D<&IApplicationManagerInterface::Unknown4042>, "Unknown4042"}, //20.0.0+{4043, nullptr, "Unknown4043"}, //20.0.0+{4044, nullptr, "Unknown4044"}, //20.0.0+{4045, nullptr, "Unknown4045"}, //20.0.0+@@ -639,6 +639,12 @@ Result IApplicationManagerInterface::IsGameCardApplicationRunning(Out<bool> out_R_SUCCEED();}+Result IApplicationManagerInterface::Unknown936(Out<u64> out_result) {+ LOG_WARNING(Service_NS, "(STUBBED) called.");+ *out_result = 0;+ R_SUCCEED();+}+Result IApplicationManagerInterface::IsAnyApplicationEntityInstalled(Out<bool> out_is_any_application_entity_installed) {LOG_WARNING(Service_NS, "(STUBBED) called");@@ -862,6 +868,15 @@ Result IApplicationManagerInterface::Unknown4023(Out<u64> out_result) {R_SUCCEED();}+Result IApplicationManagerInterface::Unknown4042(OutInterface<IAsyncResult> out_interface,+ OutCopyHandle<Kernel::KReadableEvent> out_event,+ u64 arg1, u64 arg2) {+ LOG_WARNING(Service_NS, "(STUBBED) called, arg1={:016X}, arg2={:016X}", arg1, arg2);+ *out_event = unknown_event.GetHandle();+ *out_interface = std::make_shared<IAsyncResult>(system, &unknown_event);+ R_SUCCEED();+}+Result IApplicationManagerInterface::Unknown4053() {LOG_WARNING(Service_NS, "(STUBBED) called.");R_SUCCEED();diff --git a/src/core/hle/service/ns/application_manager_interface.h b/src/core/hle/service/ns/application_manager_interface.hindex 52858f03f8..af5ec780af 100644--- a/src/core/hle/service/ns/application_manager_interface.h+++ b/src/core/hle/service/ns/application_manager_interface.h@@ -7,6 +7,7 @@#pragma once#include "core/hle/service/cmif_types.h"+#include "core/hle/service/ns/i_async_result.h"#include "core/hle/service/ns/language.h"#include "core/hle/service/ns/ns_types.h"#include "core/hle/service/os/event.h"@@ -34,6 +35,7 @@ public:Result GetGameCardMountFailureEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);Result GetGameCardWakenReadyEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);Result IsGameCardApplicationRunning(Out<bool> out_is_running);+ Result Unknown936(Out<u64> out_result);Result IsAnyApplicationEntityInstalled(Out<bool> out_is_any_application_entity_installed);Result GetApplicationViewDeprecated(OutArray<ApplicationViewV19, BufferAttr_HipcMapAlias> out_application_views,@@ -71,6 +73,9 @@ public:InBuffer<BufferAttr_HipcMapAlias> logo_path_buffer);Result Unknown4022(OutCopyHandle<Kernel::KReadableEvent> out_event);Result Unknown4023(Out<u64> out_result);+ Result Unknown4042(OutInterface<IAsyncResult> out_interface,+ OutCopyHandle<Kernel::KReadableEvent> out_event,+ u64 arg1, u64 arg2);Result Unknown4053();Result Unknown4105();diff --git a/src/core/hle/service/ns/i_async_result.cpp b/src/core/hle/service/ns/i_async_result.cppnew file mode 100644index 0000000000..be04c162d3--- /dev/null+++ b/src/core/hle/service/ns/i_async_result.cpp@@ -0,0 +1,35 @@+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later++#include "core/hle/service/cmif_serialization.h"+#include "core/hle/service/ns/i_async_result.h"++#include <cstring>++namespace Service::NS {++IAsyncResult::IAsyncResult(Core::System& system_, Service::Event* event_)+ : ServiceFramework{system_, "nn::ns::detail::IAsyncResult"}, event{event_} {+ // clang-format off+ static const FunctionInfo functions[] = {+ {0, nullptr, "Get"},+ {1, D<&IAsyncResult::Cancel>, "Cancel"},+ {2, nullptr, "GetErrorContext"}, // 4.0.0++ };+ // clang-format on++ RegisterHandlers(functions);+}++IAsyncResult::~IAsyncResult() = default;++Result IAsyncResult::Cancel() {+ LOG_DEBUG(Service_NS, "called");+ if (event != nullptr) {+ event->Signal(system.Kernel());+ }++ R_SUCCEED();+}++} // namespace Service::NS\ No newline at end of filediff --git a/src/core/hle/service/ns/i_async_result.h b/src/core/hle/service/ns/i_async_result.hnew file mode 100644index 0000000000..914ea5a42c--- /dev/null+++ b/src/core/hle/service/ns/i_async_result.h@@ -0,0 +1,19 @@+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later++#include "core/hle/service/service.h"++namespace Service::NS {++class IAsyncResult final : public ServiceFramework<IAsyncResult> {+public:+ explicit IAsyncResult(Core::System& system_, Service::Event* event_);+ ~IAsyncResult() override;++private:+ Result Cancel();++ Service::Event* event{};+};++} // namespace Service::NS\ No newline at end of file