From b3f4052033ab57694ca60bccf24938dd2ea4e64c Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 25 Mar 2026 00:15:45 +0000 Subject: [PATCH] [hle] remove redundant data on Request/Response builders Signed-off-by: lizzie --- src/core/hle/service/acc/acc.cpp | 12 +- src/core/hle/service/acc/async_context.cpp | 2 +- src/core/hle/service/apm/apm_interface.cpp | 4 +- src/core/hle/service/fgm/fgm.cpp | 2 +- src/core/hle/service/friend/friend.cpp | 14 +- src/core/hle/service/glue/arp.cpp | 2 +- src/core/hle/service/glue/bgtc.cpp | 2 +- src/core/hle/service/glue/ectx.cpp | 2 +- .../hle/service/hid/hid_system_server.cpp | 8 +- src/core/hle/service/hle_ipc.h | 4 +- src/core/hle/service/ipc_helpers.h | 257 +++++++----------- src/core/hle/service/lm/lm.cpp | 2 +- src/core/hle/service/nfc/nfc.cpp | 8 +- src/core/hle/service/nfc/nfc_interface.cpp | 6 +- src/core/hle/service/nfp/nfp.cpp | 6 +- src/core/hle/service/nifm/nifm.cpp | 16 +- src/core/hle/service/nim/nim.cpp | 12 +- ...nly_application_control_data_interface.cpp | 4 +- .../hle/service/nvdrv/nvdrv_interface.cpp | 2 +- src/core/hle/service/pcv/pcv.cpp | 2 +- src/core/hle/service/pm/pm.cpp | 2 +- src/core/hle/service/psc/time/alarms.cpp | 6 +- src/core/hle/service/ptm/psm.cpp | 4 +- src/core/hle/service/ptm/ts.cpp | 2 +- src/core/hle/service/sm/sm.cpp | 9 +- src/core/hle/service/sm/sm_controller.cpp | 2 +- src/core/hle/service/ssl/ssl.cpp | 8 +- src/core/hle/service/usb/usb.cpp | 4 +- 28 files changed, 166 insertions(+), 238 deletions(-) diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 43c569851d..e8a97edeb0 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -729,7 +729,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(ensure_token_id); + rb.PushIpcInterface(ctx, ensure_token_id); } void LoadIdTokenCacheDeprecated(HLERequestContext& ctx) { @@ -921,7 +921,7 @@ void Module::Interface::GetProfile(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, user_id, *profile_manager); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); } void Module::Interface::IsUserRegistrationRequestPermitted(HLERequestContext& ctx) { @@ -993,7 +993,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(HLERequestContext& c LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, profile_manager); + rb.PushIpcInterface(ctx, system, profile_manager); } void Module::Interface::IsUserAccountSwitchLocked(HLERequestContext& ctx) { @@ -1089,7 +1089,7 @@ void Module::Interface::GetProfileEditor(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, user_id, *profile_manager); + rb.PushIpcInterface(ctx, system, user_id, *profile_manager); } void Module::Interface::GetBaasAccountAdministrator(HLERequestContext &ctx) { @@ -1100,7 +1100,7 @@ void Module::Interface::GetBaasAccountAdministrator(HLERequestContext &ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, uuid); + rb.PushIpcInterface(ctx, system, uuid); } void Module::Interface::ListQualifiedUsers(HLERequestContext& ctx) { @@ -1143,7 +1143,7 @@ void Module::Interface::GetBaasAccountManagerForSystemService(HLERequestContext& IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, uuid); + rb.PushIpcInterface(ctx, system, uuid); } void Module::Interface::StoreSaveDataThumbnailSystem(HLERequestContext& ctx) { diff --git a/src/core/hle/service/acc/async_context.cpp b/src/core/hle/service/acc/async_context.cpp index c9e0af90ce..5b60dec934 100644 --- a/src/core/hle/service/acc/async_context.cpp +++ b/src/core/hle/service/acc/async_context.cpp @@ -32,7 +32,7 @@ void IAsyncContext::GetSystemEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(completion_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, completion_event->GetReadableEvent()); } void IAsyncContext::Cancel(HLERequestContext& ctx) { diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp index 90241a7093..51c01e2f25 100644 --- a/src/core/hle/service/apm/apm_interface.cpp +++ b/src/core/hle/service/apm/apm_interface.cpp @@ -82,7 +82,7 @@ void APM::OpenSession(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, controller); + rb.PushIpcInterface(ctx, system, controller); } void APM::GetPerformanceMode(HLERequestContext& ctx) { @@ -125,7 +125,7 @@ void APM_Sys::GetPerformanceEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, controller); + rb.PushIpcInterface(ctx, system, controller); } void APM_Sys::SetCpuBoostMode(HLERequestContext& ctx) { diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp index 6b3f77be2b..ad6f7bc3b1 100644 --- a/src/core/hle/service/fgm/fgm.cpp +++ b/src/core/hle/service/fgm/fgm.cpp @@ -45,7 +45,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index b851de8496..3622cec073 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -163,7 +163,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(readable_event.Signal()); - rb.PushCopyObjects(readable_event); + rb.PushCopyObjects(ctx, readable_event); } void Cancel(HLERequestContext& ctx) { @@ -379,7 +379,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(notification_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, notification_event->GetReadableEvent()); } void Clear(HLERequestContext& ctx) { @@ -455,7 +455,7 @@ private: void Module::Interface::CreateFriendService(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); LOG_DEBUG(Service_Friend, "called"); } @@ -467,12 +467,12 @@ void Module::Interface::CreateNotificationService(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, uuid); + rb.PushIpcInterface(ctx, system, uuid); } -Module::Interface::Interface(std::shared_ptr module_, Core::System& system_, - const char* name) - : ServiceFramework{system_, name}, module{std::move(module_)} {} +Module::Interface::Interface(std::shared_ptr module_, Core::System& system_, const char* name) + : ServiceFramework{system_, name}, module{std::move(module_)} +{} Module::Interface::~Interface() = default; diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index a7f54e980c..b5dfbe9c60 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp @@ -279,7 +279,7 @@ void ARP_W::AcquireRegistrar(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(registrar); + rb.PushIpcInterface(ctx, registrar); } void ARP_W::UnregisterApplicationInstance(HLERequestContext& ctx) { diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index 5e51f98319..360f16f0dd 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -28,7 +28,7 @@ void BGTC_T::OpenTaskService(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} { diff --git a/src/core/hle/service/glue/ectx.cpp b/src/core/hle/service/glue/ectx.cpp index 6f71b62f3a..eaedd9bc4a 100644 --- a/src/core/hle/service/glue/ectx.cpp +++ b/src/core/hle/service/glue/ectx.cpp @@ -56,7 +56,7 @@ ECTX_AW::~ECTX_AW() = default; void ECTX_AW::CreateContextRegistrar(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(std::make_shared(system)); + rb.PushIpcInterface(ctx, system); } } // namespace Service::Glue diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index 1de5dd6f28..81c28b6933 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -728,7 +728,7 @@ void IHidSystemServer::AcquireConnectionTriggerTimeoutEvent(HLERequestContext& c IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(acquire_device_registered_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, acquire_device_registered_event->GetReadableEvent()); } void IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx) { @@ -736,7 +736,7 @@ void IHidSystemServer::AcquireDeviceRegisteredEventForControllerSupport(HLEReque IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(acquire_device_registered_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, acquire_device_registered_event->GetReadableEvent()); } void IHidSystemServer::GetRegisteredDevices(HLERequestContext& ctx) { @@ -761,7 +761,7 @@ void IHidSystemServer::AcquireUniquePadConnectionEventHandle(HLERequestContext& LOG_WARNING(Service_HID, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; - rb.PushCopyObjects(unique_pad_connection_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, unique_pad_connection_event->GetReadableEvent()); rb.Push(ResultSuccess); } @@ -778,7 +778,7 @@ void IHidSystemServer::AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestConte IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(joy_detach_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, joy_detach_event->GetReadableEvent()); } void IHidSystemServer::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) { diff --git a/src/core/hle/service/hle_ipc.h b/src/core/hle/service/hle_ipc.h index c2e0e5e8c4..b8c98c7dee 100644 --- a/src/core/hle/service/hle_ipc.h +++ b/src/core/hle/service/hle_ipc.h @@ -27,7 +27,7 @@ class Memory; } namespace IPC { -class ResponseBuilder; +struct ResponseBuilder; } namespace Service { @@ -390,7 +390,7 @@ public: } private: - friend class IPC::ResponseBuilder; + friend struct IPC::ResponseBuilder; void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming); diff --git a/src/core/hle/service/ipc_helpers.h b/src/core/hle/service/ipc_helpers.h index 4b02872fba..b6c27a2481 100644 --- a/src/core/hle/service/ipc_helpers.h +++ b/src/core/hle/service/ipc_helpers.h @@ -21,45 +21,7 @@ namespace IPC { constexpr Result ResultSessionClosed{ErrorModule::HIPC, 301}; -class RequestHelperBase { -protected: - Service::HLERequestContext* context = nullptr; - u32* cmdbuf; - u32 index = 0; - -public: - explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} - - explicit RequestHelperBase(Service::HLERequestContext& ctx) - : context(&ctx), cmdbuf(ctx.CommandBuffer()) {} - - void Skip(u32 size_in_words, bool set_to_null) { - if (set_to_null) { - memset(cmdbuf + index, 0, size_in_words * sizeof(u32)); - } - index += size_in_words; - } - - /** - * Aligns the current position forward to a 16-byte boundary, padding with zeros. - */ - void AlignWithPadding() { - if (index & 3) { - Skip(static_cast(4 - (index & 3)), true); - } - } - - u32 GetCurrentOffset() const { - return index; - } - - void SetCurrentOffset(u32 offset) { - index = offset; - } -}; - -class ResponseBuilder : public RequestHelperBase { -public: +struct ResponseBuilder { /// Flags used for customizing the behavior of ResponseBuilder enum class Flags : u32 { None = 0, @@ -68,25 +30,21 @@ public: AlwaysMoveHandles = 1, }; - explicit ResponseBuilder(Service::HLERequestContext& ctx, u32 normal_params_size_, - u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0, - Flags flags = Flags::None) - : RequestHelperBase(ctx), normal_params_size(normal_params_size_), - num_handles_to_copy(num_handles_to_copy_), - num_objects_to_move(num_objects_to_move_), kernel{ctx.kernel} { - - memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH); + inline explicit ResponseBuilder(Service::HLERequestContext& ctx, u32 normal_params_size_, u32 num_handles_to_copy_ = 0, u32 num_objects_to_move_ = 0, Flags flags = Flags::None) + : cmdbuf(ctx.CommandBuffer()) + , normal_params_size(normal_params_size_) + , num_handles_to_copy(num_handles_to_copy_) + , num_objects_to_move(num_objects_to_move_) + { + std::memset(cmdbuf, 0, sizeof(u32) * IPC::COMMAND_BUFFER_LENGTH); IPC::CommandHeader header{}; - // The entire size of the raw data section in u32 units, including the 16 bytes of mandatory // padding. - u32 raw_data_size = ctx.write_size = - ctx.IsTipc() ? normal_params_size - 1 : normal_params_size; + u32 raw_data_size = ctx.write_size = ctx.IsTipc() ? normal_params_size - 1 : normal_params_size; u32 num_handles_to_move{}; u32 num_domain_objects{}; - const bool always_move_handles{ - (static_cast(flags) & static_cast(Flags::AlwaysMoveHandles)) != 0}; + const bool always_move_handles = (u32(flags) & u32(Flags::AlwaysMoveHandles)) != 0; if (!ctx.GetManager()->IsDomain() || always_move_handles) { num_handles_to_move = num_objects_to_move; } else { @@ -94,16 +52,14 @@ public: } if (ctx.GetManager()->IsDomain()) { - raw_data_size += - static_cast(sizeof(DomainMessageHeader) / sizeof(u32) + num_domain_objects); + raw_data_size += u32(sizeof(DomainMessageHeader) / sizeof(u32) + num_domain_objects); ctx.write_size += num_domain_objects; } if (ctx.IsTipc()) { header.type.Assign(ctx.GetCommandType()); } else { - raw_data_size += static_cast(sizeof(IPC::DataPayloadHeader) / sizeof(u32) + 4 + - normal_params_size); + raw_data_size += u32(sizeof(IPC::DataPayloadHeader) / sizeof(u32) + 4 + normal_params_size); } header.data_size.Assign(raw_data_size); @@ -117,21 +73,17 @@ public: handle_descriptor_header.num_handles_to_copy.Assign(num_handles_to_copy_); handle_descriptor_header.num_handles_to_move.Assign(num_handles_to_move); PushRaw(handle_descriptor_header); - ctx.handles_offset = index; - Skip(num_handles_to_copy + num_handles_to_move, true); } if (!ctx.IsTipc()) { AlignWithPadding(); - if (ctx.GetManager()->IsDomain() && ctx.HasDomainMessageHeader()) { IPC::DomainMessageHeader domain_header{}; domain_header.num_objects = num_domain_objects; PushRaw(domain_header); } - IPC::DataPayloadHeader data_payload_header{}; data_payload_header.magic = Common::MakeMagic('S', 'F', 'C', 'O'); PushRaw(data_payload_header); @@ -141,35 +93,39 @@ public: ctx.data_payload_offset = index; ctx.write_size += index; - ctx.domain_offset = static_cast(index + raw_data_size / sizeof(u32)); + ctx.domain_offset = u32(index + raw_data_size / sizeof(u32)); } - template - void PushIpcInterface(std::shared_ptr iface) { - auto manager{context->GetManager()}; + inline void Skip(u32 size_in_words, bool set_to_null) { + if (set_to_null) std::memset(cmdbuf + index, 0, size_in_words * sizeof(u32)); + index += size_in_words; + } + /// @brief Aligns the current position forward to a 16-byte boundary, padding with zeros. + inline void AlignWithPadding() { if (index & 3) Skip(u32(4 - (index & 3)), true); } + inline u32 GetCurrentOffset() const { return index; } + inline void SetCurrentOffset(u32 offset) { index = offset; } + template inline void PushIpcInterface(Service::HLERequestContext& ctx, std::shared_ptr iface) { + auto manager = ctx.GetManager(); if (manager->IsDomain()) { - context->AddDomainObject(std::move(iface)); + ctx.AddDomainObject(std::move(iface)); } else { - ASSERT(Kernel::GetCurrentProcess(kernel).GetResourceLimit()->Reserve( - Kernel::LimitableResource::SessionCountMax, 1)); + ASSERT(Kernel::GetCurrentProcess(ctx.kernel).GetResourceLimit()->Reserve(Kernel::LimitableResource::SessionCountMax, 1)); - auto* session = Kernel::KSession::Create(kernel); + auto* session = Kernel::KSession::Create(ctx.kernel); session->Initialize(nullptr, 0); - Kernel::KSession::Register(kernel, session); + Kernel::KSession::Register(ctx.kernel, session); - auto next_manager = std::make_shared( - kernel, manager->GetServerManager()); + auto next_manager = std::make_shared(ctx.kernel, manager->GetServerManager()); next_manager->SetSessionHandler(iface); manager->GetServerManager().RegisterSession(&session->GetServerSession(), next_manager); - context->AddMoveObject(&session->GetClientSession()); + ctx.AddMoveObject(&session->GetClientSession()); } } - template - void PushIpcInterface(Args&&... args) { - PushIpcInterface(std::make_shared(std::forward(args)...)); + template inline void PushIpcInterface(Service::HLERequestContext& ctx, Args&&... args) { + PushIpcInterface(ctx, std::make_shared(std::forward(args)...)); } void PushImpl(s8 value); @@ -185,59 +141,38 @@ public: void PushImpl(bool value); void PushImpl(Result value); - template - void Push(T value) { + template inline void Push(T value) { return PushImpl(value); } template void Push(const First& first_value, const Other&... other_values); - /** - * Helper function for pushing strongly-typed enumeration values. - * - * @tparam Enum The enumeration type to be pushed - * - * @param value The value to push. - * - * @note The underlying size of the enumeration type is the size of the - * data that gets pushed. e.g. "enum class SomeEnum : u16" will - * push a u16-sized amount of data. - */ - template - void PushEnum(Enum value) { + /// @brief Helper function for pushing strongly-typed enumeration values. + /// @tparam Enum The enumeration type to be pushed + /// @param value The value to push. + /// @note The underlying size of the enumeration type is the size of the data that gets pushed. + /// e.g. "enum class SomeEnum : u16" will push a u16-sized amount of data. + template inline void PushEnum(Enum value) { static_assert(std::is_enum_v, "T must be an enum type within a PushEnum call."); - static_assert(!std::is_convertible_v, - "enum type in PushEnum must be a strongly typed enum."); + static_assert(!std::is_convertible_v, "enum type in PushEnum must be a strongly typed enum."); Push(static_cast>(value)); } - /** - * @brief Copies the content of the given trivially copyable class to the buffer as a normal - * param - * @note: The input class must be correctly packed/padded to fit hardware layout. - */ - template - void PushRaw(const T& value); - - template - void PushMoveObjects(O*... pointers); - - template - void PushMoveObjects(O&... pointers); + /// @brief Copies the content of the given trivially copyable class to the buffer as a normal param + /// @note: The input class must be correctly packed/padded to fit hardware layout. + template void PushRaw(const T& value); + template void PushMoveObjects(Service::HLERequestContext& ctx, O*... pointers); + template void PushMoveObjects(Service::HLERequestContext& ctx, O&... pointers); + template void PushCopyObjects(Service::HLERequestContext& ctx, O*... pointers); + template void PushCopyObjects(Service::HLERequestContext& ctx, O&... pointers); - template - void PushCopyObjects(O*... pointers); - - template - void PushCopyObjects(O&... pointers); - -private: + u32* cmdbuf; + u32 index = 0; u32 normal_params_size{}; u32 num_handles_to_copy{}; u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent u32 data_payload_index{}; - Kernel::KernelCore& kernel; }; /// Push /// @@ -252,8 +187,7 @@ inline void ResponseBuilder::PushImpl(u32 value) { template void ResponseBuilder::PushRaw(const T& value) { - static_assert(std::is_trivially_copyable_v, - "It's undefined behavior to use memcpy with non-trivially copyable objects"); + static_assert(std::is_trivially_copyable_v, "It's undefined behavior to use memcpy with non-trivially copyable objects"); std::memcpy(cmdbuf + index, &value, sizeof(T)); index += (sizeof(T) + 3) / 4; // round up to word length } @@ -273,8 +207,8 @@ inline void ResponseBuilder::PushImpl(s16 value) { } inline void ResponseBuilder::PushImpl(s64 value) { - PushImpl(static_cast(value)); - PushImpl(static_cast(value >> 32)); + PushImpl(u32(value)); + PushImpl(u32(value >> 32)); } inline void ResponseBuilder::PushImpl(u8 value) { @@ -286,8 +220,8 @@ inline void ResponseBuilder::PushImpl(u16 value) { } inline void ResponseBuilder::PushImpl(u64 value) { - PushImpl(static_cast(value)); - PushImpl(static_cast(value >> 32)); + PushImpl(u32(value)); + PushImpl(u32(value >> 32)); } inline void ResponseBuilder::PushImpl(float value) { @@ -313,90 +247,88 @@ void ResponseBuilder::Push(const First& first_value, const Other&... other_value } template -inline void ResponseBuilder::PushCopyObjects(O*... pointers) { +inline void ResponseBuilder::PushCopyObjects(Service::HLERequestContext& ctx, O*... pointers) { auto objects = {pointers...}; for (auto& object : objects) { - context->AddCopyObject(object); + ctx.AddCopyObject(object); } } template -inline void ResponseBuilder::PushCopyObjects(O&... pointers) { +inline void ResponseBuilder::PushCopyObjects(Service::HLERequestContext& ctx, O&... pointers) { auto objects = {&pointers...}; for (auto& object : objects) { - context->AddCopyObject(object); + ctx.AddCopyObject(object); } } template -inline void ResponseBuilder::PushMoveObjects(O*... pointers) { +inline void ResponseBuilder::PushMoveObjects(Service::HLERequestContext& ctx, O*... pointers) { auto objects = {pointers...}; for (auto& object : objects) { - context->AddMoveObject(object); + ctx.AddMoveObject(object); } } template -inline void ResponseBuilder::PushMoveObjects(O&... pointers) { +inline void ResponseBuilder::PushMoveObjects(Service::HLERequestContext& ctx, O&... pointers) { auto objects = {&pointers...}; for (auto& object : objects) { - context->AddMoveObject(object); + ctx.AddMoveObject(object); } } -class RequestParser : public RequestHelperBase { -public: - explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} - - explicit RequestParser(Service::HLERequestContext& ctx) : RequestHelperBase(ctx) { +struct RequestParser { + inline explicit RequestParser(u32* command_buffer) : cmdbuf(command_buffer) {} + inline explicit RequestParser(Service::HLERequestContext& ctx) + : cmdbuf(ctx.CommandBuffer()) + { // TIPC does not have data payload offset if (!ctx.IsTipc()) { ASSERT_MSG(ctx.GetDataPayloadOffset(), "context is incomplete"); Skip(ctx.GetDataPayloadOffset(), false); } - // Skip the u64 command id, it's already stored in the context static constexpr u32 CommandIdSize = 2; Skip(CommandIdSize, false); } - template - T Pop(); - - template - void Pop(T& value); + inline void Skip(u32 size_in_words, bool set_to_null) { + if (set_to_null) std::memset(cmdbuf + index, 0, size_in_words * sizeof(u32)); + index += size_in_words; + } + /// @brief Aligns the current position forward to a 16-byte boundary, padding with zeros. + inline void AlignWithPadding() { if (index & 3) Skip(u32(4 - (index & 3)), true); } + inline u32 GetCurrentOffset() const { return index; } + inline void SetCurrentOffset(u32 offset) { index = offset; } - template - void Pop(First& first_value, Other&... other_values); + template T Pop(); + template void Pop(T& value); + template void Pop(First& first_value, Other&... other_values); template T PopEnum() { static_assert(std::is_enum_v, "T must be an enum type within a PopEnum call."); - static_assert(!std::is_convertible_v, - "enum type in PopEnum must be a strongly typed enum."); - return static_cast(Pop>()); + static_assert(!std::is_convertible_v, "enum type in PopEnum must be a strongly typed enum."); + return T(Pop>()); } - /** - * @brief Reads the next normal parameters as a struct, by copying it - * @note: The output class must be correctly packed/padded to fit hardware layout. - */ - template - void PopRaw(T& value); + /// @brief Reads the next normal parameters as a struct, by copying it + /// @note: The output class must be correctly packed/padded to fit hardware layout. + template void PopRaw(T& value); - /** - * @brief Reads the next normal parameters as a struct, by copying it into a new value - * @note: The output class must be correctly packed/padded to fit hardware layout. - */ - template - T PopRaw(); + /// @brief Reads the next normal parameters as a struct, by copying it into a new value + /// @note: The output class must be correctly packed/padded to fit hardware layout. + template T PopRaw(); - template - std::weak_ptr PopIpcInterface() { - ASSERT(context->GetManager()->IsDomain()); - ASSERT(context->GetDomainMessageHeader().input_object_count > 0); - return context->GetDomainHandler(Pop() - 1); + template [[nodiscard]] std::weak_ptr PopIpcInterface(Service::HLERequestContext& ctx) { + ASSERT(ctx.GetManager()->IsDomain()); + ASSERT(ctx.GetDomainMessageHeader().input_object_count > 0); + return ctx.GetDomainHandler(Pop() - 1); } + + u32* cmdbuf; + u32 index = 0; }; /// Pop /// @@ -408,7 +340,7 @@ inline u32 RequestParser::Pop() { template <> inline s32 RequestParser::Pop() { - return static_cast(Pop()); + return s32(Pop()); } // Ignore the -Wclass-memaccess warning on memcpy for non-trivially default constructible objects. @@ -418,8 +350,7 @@ inline s32 RequestParser::Pop() { #endif template void RequestParser::PopRaw(T& value) { - static_assert(std::is_trivially_copyable_v, - "It's undefined behavior to use memcpy with non-trivially copyable objects"); + static_assert(std::is_trivially_copyable_v, "It's undefined behavior to use memcpy with non-trivially copyable objects"); std::memcpy(&value, cmdbuf + index, sizeof(T)); index += (sizeof(T) + 3) / 4; // round up to word length } diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 26f7e0fc32..9a45f130df 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -353,7 +353,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp index 6583cd2445..f64445835e 100644 --- a/src/core/hle/service/nfc/nfc.cpp +++ b/src/core/hle/service/nfc/nfc.cpp @@ -151,7 +151,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -173,7 +173,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -195,7 +195,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -217,7 +217,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; diff --git a/src/core/hle/service/nfc/nfc_interface.cpp b/src/core/hle/service/nfc/nfc_interface.cpp index 35849bd6c4..084227fa06 100644 --- a/src/core/hle/service/nfc/nfc_interface.cpp +++ b/src/core/hle/service/nfc/nfc_interface.cpp @@ -143,7 +143,7 @@ void NfcInterface::AttachAvailabilityChangeEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(GetManager()->AttachAvailabilityChangeEvent()); + rb.PushCopyObjects(ctx, GetManager()->AttachAvailabilityChangeEvent()); } void NfcInterface::StartDetection(HLERequestContext& ctx) { @@ -203,7 +203,7 @@ void NfcInterface::AttachActivateEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(result); - rb.PushCopyObjects(out_event); + rb.PushCopyObjects(ctx, out_event); } void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) { @@ -217,7 +217,7 @@ void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(result); - rb.PushCopyObjects(out_event); + rb.PushCopyObjects(ctx, out_event); } void NfcInterface::SetNfcEnabled(HLERequestContext& ctx) { diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index 604daabbe2..b9922ce024 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -157,7 +157,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -179,7 +179,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -201,7 +201,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index a0302a5841..5b1be272fd 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -297,7 +297,7 @@ private: void GetSystemEventReadableHandle(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 2}; rb.Push(ResultSuccess); - rb.PushCopyObjects(evt_scan_complete->GetReadableEvent(), + rb.PushCopyObjects(ctx, evt_scan_complete->GetReadableEvent(), evt_processing->GetReadableEvent()); } @@ -457,7 +457,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 2}; rb.Push(ResultSuccess); - rb.PushCopyObjects(event1->GetReadableEvent(), event2->GetReadableEvent()); + rb.PushCopyObjects(ctx, event1->GetReadableEvent(), event2->GetReadableEvent()); } void Cancel(HLERequestContext& ctx) { @@ -533,7 +533,7 @@ void IGeneralService::CreateScanRequest(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } void IGeneralService::CreateRequest(HLERequestContext& ctx) { @@ -542,7 +542,7 @@ void IGeneralService::CreateRequest(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) { @@ -721,7 +721,7 @@ void IGeneralService::GetNetworkProfile(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } void IGeneralService::SetNetworkProfile(HLERequestContext& ctx) { @@ -874,7 +874,7 @@ void IGeneralService::CreateTemporaryNetworkProfile(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 6, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); rb.PushRaw(uuid); } @@ -1129,7 +1129,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } void CreateGeneralService(HLERequestContext& ctx) { @@ -1137,7 +1137,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 4f465c5da7..1acfd2f865 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -53,7 +53,7 @@ private: LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -75,7 +75,7 @@ private: LOG_WARNING(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -336,7 +336,7 @@ private: LOG_DEBUG(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } void IsLargeResourceAvailable(HLERequestContext& ctx) { @@ -356,7 +356,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -439,7 +439,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(finished_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, finished_event->GetReadableEvent()); } void GetResult(HLERequestContext& ctx) { @@ -500,7 +500,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } // TODO(ogniK): Do we need these? diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp index 03f0a17865..44861ea30a 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp @@ -359,8 +359,8 @@ void IReadOnlyApplicationControlDataInterface::ListApplicationTitle(HLERequestCo IPC::ResponseBuilder rb{ctx, 2, 1, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(async_value->ReadableEvent()); - rb.PushIpcInterface(std::move(async_value)); + rb.PushCopyObjects(ctx, async_value->ReadableEvent()); + rb.PushIpcInterface(ctx, std::move(async_value)); } Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData3( diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp index 15983ba881..2b0f7b5409 100644 --- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp +++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp @@ -199,7 +199,7 @@ void NVDRV::QueryEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3, 1}; rb.Push(ResultSuccess); auto& readable_event = event->GetReadableEvent(); - rb.PushCopyObjects(readable_event); + rb.PushCopyObjects(ctx, readable_event); rb.PushEnum(NvResult::Success); } else { LOG_ERROR(Service_NVDRV, "Invalid event request!"); diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp index 3d0f2aeb7d..93cdbcd699 100644 --- a/src/core/hle/service/pcv/pcv.cpp +++ b/src/core/hle/service/pcv/pcv.cpp @@ -124,7 +124,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, device_code); + rb.PushIpcInterface(ctx, system, device_code); } }; diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index b52468e419..d46be88c6e 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -162,7 +162,7 @@ private: IPC::ResponseBuilder rb{ctx, 10, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(*process); + rb.PushCopyObjects(ctx, *process); rb.PushRaw(program_location); rb.PushRaw(override_status); } diff --git a/src/core/hle/service/psc/time/alarms.cpp b/src/core/hle/service/psc/time/alarms.cpp index 5e52c19f82..53e7059fa3 100644 --- a/src/core/hle/service/psc/time/alarms.cpp +++ b/src/core/hle/service/psc/time/alarms.cpp @@ -142,7 +142,7 @@ void IAlarmService::CreateWakeupAlarm(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, m_alarms, AlarmType::WakeupAlarm); + rb.PushIpcInterface(ctx, system, m_alarms, AlarmType::WakeupAlarm); } void IAlarmService::CreateBackgroundTaskAlarm(HLERequestContext& ctx) { @@ -150,7 +150,7 @@ void IAlarmService::CreateBackgroundTaskAlarm(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, m_alarms, AlarmType::BackgroundTaskAlarm); + rb.PushIpcInterface(ctx, system, m_alarms, AlarmType::BackgroundTaskAlarm); } ISteadyClockAlarm::ISteadyClockAlarm(Core::System& system_, Alarms& alarms, AlarmType type) @@ -174,7 +174,7 @@ void ISteadyClockAlarm::GetAlarmEvent(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(m_alarm.GetEventHandle()); + rb.PushCopyObjects(ctx, m_alarm.GetEventHandle()); } void ISteadyClockAlarm::Enable(HLERequestContext& ctx) { diff --git a/src/core/hle/service/ptm/psm.cpp b/src/core/hle/service/ptm/psm.cpp index f144b8e497..7696fa858c 100644 --- a/src/core/hle/service/ptm/psm.cpp +++ b/src/core/hle/service/ptm/psm.cpp @@ -65,7 +65,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(state_change_event->GetReadableEvent()); + rb.PushCopyObjects(ctx, state_change_event->GetReadableEvent()); } void UnbindStateChangeEvent(HLERequestContext& ctx) { @@ -184,7 +184,7 @@ void PSM::OpenSession(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } } // namespace Service::PTM diff --git a/src/core/hle/service/ptm/ts.cpp b/src/core/hle/service/ptm/ts.cpp index 652f38b97e..04df9a5a86 100644 --- a/src/core/hle/service/ptm/ts.cpp +++ b/src/core/hle/service/ptm/ts.cpp @@ -82,7 +82,7 @@ void TS::OpenSession(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } } // namespace Service::PTM diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 1095dcf6c3..dc4f5cb983 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -136,7 +136,7 @@ void SM::GetServiceCmif(HLERequestContext& ctx) { if (result == ResultSuccess) { IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; rb.Push(result); - rb.PushMoveObjects(client_session); + rb.PushMoveObjects(ctx, client_session); } else { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(result); @@ -153,7 +153,7 @@ void SM::GetServiceTipc(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; rb.Push(result); - rb.PushMoveObjects(result == ResultSuccess ? client_session : nullptr); + rb.PushMoveObjects(ctx, result == ResultSuccess ? client_session : nullptr); } static std::string PopServiceName(IPC::RequestParser& rp) { @@ -226,8 +226,7 @@ void SM::RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_s max_session_count, is_light); Kernel::KServerPort* server_port{}; - if (const auto result = service_manager.RegisterService(std::addressof(server_port), name, - max_session_count, nullptr); + if (const auto result = service_manager.RegisterService(std::addressof(server_port), name, max_session_count, nullptr); result.IsError()) { LOG_ERROR(Service_SM, "failed to register service with error_code={:08X}", result.raw); IPC::ResponseBuilder rb{ctx, 2}; @@ -237,7 +236,7 @@ void SM::RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_s IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; rb.Push(ResultSuccess); - rb.PushMoveObjects(server_port); + rb.PushMoveObjects(ctx, server_port); } void SM::UnregisterService(HLERequestContext& ctx) { diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp index 00c88f6de1..5bb508c5ba 100644 --- a/src/core/hle/service/sm/sm_controller.cpp +++ b/src/core/hle/service/sm/sm_controller.cpp @@ -61,7 +61,7 @@ void Controller::CloneCurrentObject(HLERequestContext& ctx) { // We succeeded. IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles}; rb.Push(ResultSuccess); - rb.PushMoveObjects(session->GetClientSession()); + rb.PushMoveObjects(ctx, session->GetClientSession()); } void Controller::CloneCurrentObjectEx(HLERequestContext& ctx) { diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index b66c686b2a..2d8de4a735 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -546,8 +546,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(res); if (res == ResultSuccess) { - rb.PushIpcInterface(system, ssl_version, shared_data, - std::move(backend)); + rb.PushIpcInterface(ctx, system, ssl_version, shared_data, std::move(backend)); } } @@ -627,12 +626,11 @@ private: IPC::RequestParser rp{ctx}; const auto parameters = rp.PopRaw(); - LOG_WARNING(Service_SSL, "(STUBBED) called, api_version={}, pid_placeholder={}", - parameters.ssl_version.api_version, parameters.pid_placeholder); + LOG_WARNING(Service_SSL, "(STUBBED) called, api_version={}, pid_placeholder={}", parameters.ssl_version.api_version, parameters.pid_placeholder); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system, parameters.ssl_version); + rb.PushIpcInterface(ctx, system, parameters.ssl_version); } void SetInterfaceVersion(HLERequestContext& ctx) { diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index 7f07cfef19..a451d4f783 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp @@ -155,7 +155,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } }; @@ -199,7 +199,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface(system); + rb.PushIpcInterface(ctx, system); } };