From 6cbdc73f536287c5d27612ee7208caa98b440198 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Wed, 10 Jan 2024 13:00:03 -0800 Subject: [PATCH] boss: Fix debug assert when session is not initialized. (#7337) --- src/core/hle/service/boss/boss.cpp | 29 ++++++++++++++--------------- src/core/hle/service/boss/boss.h | 7 ++++++- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp index d3b8bce3e..7643494bc 100644 --- a/src/core/hle/service/boss/boss.cpp +++ b/src/core/hle/service/boss/boss.cpp @@ -34,14 +34,13 @@ void Module::SessionData::serialize(Archive& ar, const unsigned int) { } SERIALIZE_IMPL(Module::SessionData) -std::shared_ptr Module::Interface::GetSessionService( - Kernel::HLERequestContext& ctx) { +std::shared_ptr Module::Interface::GetSessionService(Kernel::HLERequestContext& ctx, + IPC::RequestParser& rp) { const auto session_data = GetSessionData(ctx.Session()); if (session_data == nullptr || session_data->online_service == nullptr) { LOG_WARNING(Service_BOSS, "Client attempted to use uninitialized BOSS session."); // TODO: Error code for uninitialized session. - IPC::RequestParser rp(ctx); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(ResultUnknown); return nullptr; @@ -181,7 +180,7 @@ void Module::Interface::RegisterTask(Kernel::HLERequestContext& ctx) { const u8 unk_param3 = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -201,7 +200,7 @@ void Module::Interface::UnregisterTask(Kernel::HLERequestContext& ctx) { const u8 unk_param2 = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -230,7 +229,7 @@ void Module::Interface::ReconfigureTask(Kernel::HLERequestContext& ctx) { void Module::Interface::GetTaskIdList(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -262,7 +261,7 @@ void Module::Interface::GetNsDataIdList(Kernel::HLERequestContext& ctx) { const u32 start_ns_data_id = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -288,7 +287,7 @@ void Module::Interface::GetNsDataIdList1(Kernel::HLERequestContext& ctx) { const u32 start_ns_data_id = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -314,7 +313,7 @@ void Module::Interface::GetNsDataIdList2(Kernel::HLERequestContext& ctx) { const u32 start_ns_data_id = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -340,7 +339,7 @@ void Module::Interface::GetNsDataIdList3(Kernel::HLERequestContext& ctx) { const u32 start_ns_data_id = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -364,7 +363,7 @@ void Module::Interface::SendProperty(Kernel::HLERequestContext& ctx) { const u32 size = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -394,7 +393,7 @@ void Module::Interface::ReceiveProperty(Kernel::HLERequestContext& ctx) { const u32 size = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -636,7 +635,7 @@ void Module::Interface::GetNsDataHeaderInfo(Kernel::HLERequestContext& ctx) { const auto size = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -657,7 +656,7 @@ void Module::Interface::ReadNsData(Kernel::HLERequestContext& ctx) { const auto size = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } @@ -729,7 +728,7 @@ void Module::Interface::GetNsDataLastUpdate(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx); const u32 ns_data_id = rp.Pop(); - const auto online_service = GetSessionService(ctx); + const auto online_service = GetSessionService(ctx, rp); if (online_service == nullptr) { return; } diff --git a/src/core/hle/service/boss/boss.h b/src/core/hle/service/boss/boss.h index 583f84aba..ce1df770a 100644 --- a/src/core/hle/service/boss/boss.h +++ b/src/core/hle/service/boss/boss.h @@ -16,6 +16,10 @@ namespace Core { class System; } +namespace IPC { +class RequestParser; +} + namespace Service::BOSS { class Module final { @@ -968,7 +972,8 @@ public: protected: std::shared_ptr boss; - std::shared_ptr GetSessionService(Kernel::HLERequestContext& ctx); + std::shared_ptr GetSessionService(Kernel::HLERequestContext& ctx, + IPC::RequestParser& rp); }; private: