From defddec47ff997824b6f8adb3bece790f6723c24 Mon Sep 17 00:00:00 2001 From: PavelBARABANOV Date: Tue, 15 Sep 2026 08:01:17 +0200 Subject: [PATCH] [ns] add stubs for cmd936 and cmd4042 (#4429) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- This is necessary to close Absolum and Hades 2 in qlaunch. Cmd4042 is necessary that there are no freezes when opening virtual cartridges. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4429 Reviewed-by: lizzie Reviewed-by: Maufeat --- src/core/CMakeLists.txt | 2 ++ .../ns/application_manager_interface.cpp | 23 +++++++++--- .../ns/application_manager_interface.h | 5 +++ src/core/hle/service/ns/i_async_result.cpp | 35 +++++++++++++++++++ src/core/hle/service/ns/i_async_result.h | 19 ++++++++++ 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/core/hle/service/ns/i_async_result.cpp create mode 100644 src/core/hle/service/ns/i_async_result.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5c31ebb70e..74391b5e65 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -810,6 +810,8 @@ add_library(core STATIC hle/service/ns/ecommerce_interface.h hle/service/ns/factory_reset_interface.cpp hle/service/ns/factory_reset_interface.h + hle/service/ns/i_async_result.cpp + hle/service/ns/i_async_result.h hle/service/ns/language.cpp hle/service/ns/language.h hle/service/ns/ns.cpp diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 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 out_ R_SUCCEED(); } +Result IApplicationManagerInterface::Unknown936(Out out_result) { + LOG_WARNING(Service_NS, "(STUBBED) called."); + *out_result = 0; + R_SUCCEED(); +} + Result IApplicationManagerInterface::IsAnyApplicationEntityInstalled( Out out_is_any_application_entity_installed) { LOG_WARNING(Service_NS, "(STUBBED) called"); @@ -862,6 +868,15 @@ Result IApplicationManagerInterface::Unknown4023(Out out_result) { R_SUCCEED(); } +Result IApplicationManagerInterface::Unknown4042(OutInterface out_interface, + OutCopyHandle 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(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.h index 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 out_event); Result GetGameCardWakenReadyEvent(OutCopyHandle out_event); Result IsGameCardApplicationRunning(Out out_is_running); + Result Unknown936(Out out_result); Result IsAnyApplicationEntityInstalled(Out out_is_any_application_entity_installed); Result GetApplicationViewDeprecated( OutArray out_application_views, @@ -71,6 +73,9 @@ public: InBuffer logo_path_buffer); Result Unknown4022(OutCopyHandle out_event); Result Unknown4023(Out out_result); + Result Unknown4042(OutInterface out_interface, + OutCopyHandle 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.cpp new file mode 100644 index 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 + +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 file diff --git a/src/core/hle/service/ns/i_async_result.h b/src/core/hle/service/ns/i_async_result.h new file mode 100644 index 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 { +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