From 5c52c6e64ace3df4990363dd959835ef56a450fd Mon Sep 17 00:00:00 2001 From: NarcolepticK <narcoleptickrias@gmail.com> Date: Fri, 27 Jul 2018 09:07:23 -0400 Subject: [PATCH] service/boss: Migrate to ServiceFramework (#3998) * service/boss: Migrate to ServiceFramework * service/boss: Addressed comments * service/boss: Added TODO: verify ResetType --- src/core/hle/service/boss/boss.cpp | 1705 ++++++++++++-------------- src/core/hle/service/boss/boss.h | 1627 +++++++++++++----------- src/core/hle/service/boss/boss_p.cpp | 146 +-- src/core/hle/service/boss/boss_p.h | 10 +- src/core/hle/service/boss/boss_u.cpp | 122 +- src/core/hle/service/boss/boss_u.h | 10 +- src/core/hle/service/service.cpp | 3 +- 7 files changed, 1836 insertions(+), 1787 deletions(-) diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp index 0c2b3141e..9af733d0b 100644 --- a/src/core/hle/service/boss/boss.cpp +++ b/src/core/hle/service/boss/boss.cpp @@ -2,1029 +2,918 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <cinttypes> #include "common/logging/log.h" -#include "core/hle/ipc.h" +#include "core/hle/ipc_helpers.h" #include "core/hle/result.h" #include "core/hle/service/boss/boss.h" #include "core/hle/service/boss/boss_p.h" #include "core/hle/service/boss/boss_u.h" -#include "core/hle/service/service.h" namespace Service { namespace BOSS { -static u32 new_arrival_flag; -static u32 ns_data_new_flag; -static u32 output_flag; +void Module::Interface::InitializeSession(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x01, 2, 2); + const u64 programID = rp.Pop<u64>(); + rp.PopPID(); -void InitializeSession(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u64 unk_param = ((u64)cmd_buff[1] | ((u64)cmd_buff[2] << 32)); - u32 translation = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); - if (translation != IPC::CallingPidDesc()) { - cmd_buff[0] = IPC::MakeHeader(0, 0x1, 0); // 0x40 - cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw; - LOG_ERROR(Service_BOSS, "The translation was invalid, translation={:#010X}", translation); - return; - } - - cmd_buff[0] = IPC::MakeHeader(0x1, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param={:#018X}, translation={:#010X}, unk_param4={:#010X}", - unk_param, translation, unk_param4); + LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018X}", programID); } -void RegisterStorage(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_flag = cmd_buff[4] & 0xFF; +void Module::Interface::SetStorageInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x02, 4, 0); + const u64 extdata_id = rp.Pop<u64>(); + const u32 boss_size = rp.Pop<u32>(); + const u8 extdata_type = rp.Pop<u8>(); /// 0 = NAND, 1 = SD - cmd_buff[0] = IPC::MakeHeader(0x2, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_flag={:#010X}", - unk_param1, unk_param2, unk_param3, unk_flag); + "(STUBBED) extdata_id={:#018X}, boss_size={:#010X}, extdata_type={:#04X}", + extdata_id, boss_size, extdata_type); } -void UnregisterStorage(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::UnregisterStorage(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x03, 0, 0); - cmd_buff[0] = IPC::MakeHeader(0x3, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_BOSS, "(STUBBED) called"); } -void GetStorageInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetStorageInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x04, 0, 0); - cmd_buff[0] = IPC::MakeHeader(0x4, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); LOG_WARNING(Service_BOSS, "(STUBBED) called"); } -void RegisterPrivateRootCa(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x05, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); - cmd_buff[0] = IPC::MakeHeader(0x5, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) translation={:#010X}, buff_addr{:#010X}, buff_size={:#010X}", - translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED)"); } -void RegisterPrivateClientCert(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 translation1 = cmd_buff[3]; - u32 buff1_addr = cmd_buff[4]; - u32 buff1_size = (translation1 >> 4); - u32 translation2 = cmd_buff[5]; - u32 buff2_addr = cmd_buff[6]; - u32 buff2_size = (translation2 >> 4); +void Module::Interface::RegisterPrivateClientCert(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x06, 2, 4); + const u32 buffer1_size = rp.Pop<u32>(); + const u32 buffer2_size = rp.Pop<u32>(); + auto& buffer1 = rp.PopMappedBuffer(); + auto& buffer2 = rp.PopMappedBuffer(); - cmd_buff[0] = IPC::MakeHeader(0x6, 0x1, 0x4); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff1_size << 4 | 0xA); - cmd_buff[3] = buff1_addr; - cmd_buff[2] = (buff2_size << 4 | 0xA); - cmd_buff[3] = buff2_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer1); + rb.PushMappedBuffer(buffer2); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, " - "translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, " - "translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}", - unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2, - buff2_addr, buff2_size); + LOG_WARNING(Service_BOSS, "(STUBBED) buffer1_size={:#010X}, buffer2_size={:#010X}, ", + buffer1_size, buffer2_size); } -void GetNewArrivalFlag(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetNewArrivalFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x07, 0, 0); - cmd_buff[0] = IPC::MakeHeader(0x7, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = new_arrival_flag; + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(new_arrival_flag); LOG_WARNING(Service_BOSS, "(STUBBED) new_arrival_flag={}", new_arrival_flag); } -void RegisterNewArrivalEvent(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; +void Module::Interface::RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x08, 0, 2); + const auto event = rp.PopObject<Kernel::Event>(); - cmd_buff[0] = IPC::MakeHeader(0x8, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED)"); +} + +void Module::Interface::SetOptoutFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x09, 1, 0); + output_flag = rp.Pop<u8>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "output_flag={}", output_flag); +} + +void Module::Interface::GetOptoutFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0A, 0, 0); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(output_flag); + + LOG_WARNING(Service_BOSS, "output_flag={}", output_flag); +} + +void Module::Interface::RegisterTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0B, 3, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + const u8 unk_param3 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}, unk_param3={:#04X}", + size, unk_param2, unk_param3); +} + +void Module::Interface::UnregisterTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0C, 2, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}", size, unk_param2); +} + +void Module::Interface::ReconfigureTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0D, 2, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}", size, unk_param2); +} + +void Module::Interface::GetTaskIdList(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0E, 0, 0); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED) called"); +} + +void Module::Interface::GetStepIdList(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0F, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetNsDataIdList(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x10, 4, 2); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::GetNsDataIdList1(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x11, 4, 2); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::GetNsDataIdList2(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x12, 4, 2); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::GetNsDataIdList3(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x13, 4, 2); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::SendProperty(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x14, 2, 2); + const u16 property_id = rp.Pop<u16>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06X}, size={:#010X}", property_id, size); +} + +void Module::Interface::SendPropertyHandle(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x15, 1, 2); + const u16 property_id = rp.Pop<u16>(); + const Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06X}", property_id); +} + +void Module::Interface::ReceiveProperty(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x16, 2, 2); + const u16 property_id = rp.Pop<u16>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(size); /// Should be actual read size + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06X}, size={:#010X}", property_id, size); +} + +void Module::Interface::UpdateTaskInterval(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x17, 2, 2); + const u32 size = rp.Pop<u32>(); + const u16 unk_param2 = rp.Pop<u16>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#06X}", size, unk_param2); +} + +void Module::Interface::UpdateTaskCount(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x18, 2, 2); + const u32 size = rp.Pop<u32>(); + const u32 unk_param2 = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#010X}", size, unk_param2); +} + +void Module::Interface::GetTaskInterval(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x19, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 ( 32bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetTaskCount(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1A, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 ( 32bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetTaskServiceStatus(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1B, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); // stub 0 ( 8bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::StartTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1C, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::StartTaskImmediate(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1D, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::CancelTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1E, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetTaskFinishHandle(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x1F, 0, 0); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushCopyObjects<Kernel::Event>(boss->task_finish_event); + + LOG_WARNING(Service_BOSS, "(STUBBED) called"); +} + +void Module::Interface::GetTaskState(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x20, 2, 2); + const u32 size = rp.Pop<u32>(); + const u8 state = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); /// TaskStatus + rb.Push<u32>(0); /// Current state value for task PropertyID 0x4 + rb.Push<u8>(0); /// unknown, usually 0 + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, state={:#06X}", size, state); +} + +void Module::Interface::GetTaskResult(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x21, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); // stub 0 (8 bit value) + rb.Push<u32>(0); // stub 0 (32 bit value) + rb.Push<u8>(0); // stub 0 (8 bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetTaskCommErrorCode(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x22, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(4, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 (32 bit value) + rb.Push<u32>(0); // stub 0 (32 bit value) + rb.Push<u8>(0); // stub 0 (8 bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); +} + +void Module::Interface::GetTaskStatus(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x23, 3, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + const u8 unk_param3 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); // stub 0 (8 bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}, unk_param3={:#04X}", + size, unk_param2, unk_param3); +} + +void Module::Interface::GetTaskError(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x24, 2, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); // stub 0 (8 bit value) + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}", size, unk_param2); +} + +void Module::Interface::GetTaskInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x25, 2, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}", size, unk_param2); +} + +void Module::Interface::DeleteNsData(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x26, 1, 0); + const u32 ns_data_id = rp.Pop<u32>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED) ns_data_id={:#010X}", ns_data_id); +} + +void Module::Interface::GetNsDataHeaderInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x27, 3, 2); + const u32 ns_data_id = rp.Pop<u32>(); + const u8 type = rp.Pop<u8>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) ns_data_id={:#010X}, type={:#04X}, size={:#010X}", + ns_data_id, type, size); +} + +void Module::Interface::ReadNsData(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x28, 4, 2); + const u32 ns_data_id = rp.Pop<u32>(); + const u64 offset = rp.Pop<u64>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(size); /// Should be actual read size + rb.Push<u32>(0); /// unknown + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) ns_data_id={:#010X}, offset={:#018X}, size={:#010X}", + ns_data_id, offset, size); +} + +void Module::Interface::SetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x29, 2, 0); + const u32 unk_param1 = rp.Pop<u32>(); + const u32 unk_param2 = rp.Pop<u32>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1, unk_param2); } -void SetOptoutFlag(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2A, 1, 0); + const u32 unk_param1 = rp.Pop<u32>(); - output_flag = cmd_buff[1] & 0xFF; - - cmd_buff[0] = IPC::MakeHeader(0x9, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - - LOG_WARNING(Service_BOSS, "output_flag={}", output_flag); -} - -void GetOptoutFlag(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - cmd_buff[0] = IPC::MakeHeader(0xA, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = output_flag; - - LOG_WARNING(Service_BOSS, "output_flag={}", output_flag); -} - -void RegisterTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 unk_param3 = cmd_buff[3] & 0xFF; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0xB, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size); -} - -void UnregisterTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0xC, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void ReconfigureTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0xD, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void GetTaskIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - cmd_buff[0] = IPC::MakeHeader(0xE, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - - LOG_WARNING(Service_BOSS, "(STUBBED) called"); -} - -void GetStepIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0xF, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - translation, buff_addr, buff_size); -} - -void GetNsDataIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 translation = cmd_buff[5]; - u32 buff_addr = cmd_buff[6]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x10, 0x3, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (16 bit value) - cmd_buff[3] = 0; // stub 0 (16 bit value) - cmd_buff[4] = (buff_size << 4 | 0xC); - cmd_buff[5] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size); -} - -void GetOwnNsDataIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 translation = cmd_buff[5]; - u32 buff_addr = cmd_buff[6]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x11, 0x3, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (16 bit value) - cmd_buff[3] = 0; // stub 0 (16 bit value) - cmd_buff[4] = (buff_size << 4 | 0xC); - cmd_buff[5] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size); -} - -void GetNewDataNsDataIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 translation = cmd_buff[5]; - u32 buff_addr = cmd_buff[6]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x12, 0x3, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (16 bit value) - cmd_buff[3] = 0; // stub 0 (16 bit value) - cmd_buff[4] = (buff_size << 4 | 0xC); - cmd_buff[5] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size); -} - -void GetOwnNewDataNsDataIdList(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 translation = cmd_buff[5]; - u32 buff_addr = cmd_buff[6]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x13, 0x3, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (16 bit value) - cmd_buff[3] = 0; // stub 0 (16 bit value) - cmd_buff[4] = (buff_size << 4 | 0xC); - cmd_buff[5] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size); -} - -void SendProperty(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x14, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void SendPropertyHandle(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x15, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void ReceiveProperty(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 buff_size = cmd_buff[2]; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - - cmd_buff[0] = IPC::MakeHeader(0x16, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = buff_size; // Should be actual number of read bytes. - cmd_buff[3] = (buff_size << 4 | 0xC); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, buff_size={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}", - unk_param1, buff_size, translation, buff_addr); -} - -void UpdateTaskInterval(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x17, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void UpdateTaskCount(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 buff_size = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - - cmd_buff[0] = IPC::MakeHeader(0x18, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}", - buff_size, unk_param2, translation, buff_addr); -} - -void GetTaskInterval(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x19, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 ( 32bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void GetTaskCount(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x1A, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 ( 32bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void GetTaskServiceStatus(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x1B, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 ( 8bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void StartTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x1C, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void StartTaskImmediate(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x1D, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void CancelTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x1E, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void GetTaskFinishHandle(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - cmd_buff[0] = IPC::MakeHeader(0x1F, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; - cmd_buff[3] = 0; // stub 0(This should be a handle of task_finish ?) - - LOG_WARNING(Service_BOSS, "(STUBBED) called"); -} - -void GetTaskState(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 buff_size = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[3]; - u32 buff_addr = cmd_buff[4]; - - cmd_buff[0] = IPC::MakeHeader(0x20, 0x4, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (8 bit value) - cmd_buff[3] = 0; // stub 0 (32 bit value) - cmd_buff[4] = 0; // stub 0 (8 bit value) - cmd_buff[5] = (buff_size << 4 | 0xA); - cmd_buff[6] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}", - buff_size, unk_param2, translation, buff_addr); -} - -void GetTaskResult(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x21, 0x4, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (8 bit value) - cmd_buff[3] = 0; // stub 0 (32 bit value) - cmd_buff[4] = 0; // stub 0 (8 bit value) - cmd_buff[5] = (buff_size << 4 | 0xA); - cmd_buff[6] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void GetTaskCommErrorCode(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x22, 0x4, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32 bit value) - cmd_buff[3] = 0; // stub 0 (32 bit value) - cmd_buff[4] = 0; // stub 0 (8 bit value) - cmd_buff[5] = (buff_size << 4 | 0xA); - cmd_buff[6] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, translation, buff_addr, buff_size); -} - -void GetTaskStatus(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 unk_param3 = cmd_buff[3] & 0xFF; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x23, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (8 bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size); -} - -void GetTaskError(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x24, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (8 bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void GetTaskInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); - - cmd_buff[0] = IPC::MakeHeader(0x25, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, translation, buff_addr, buff_size); -} - -void DeleteNsData(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - - cmd_buff[0] = IPC::MakeHeader(0x26, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 (32bit value) LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1); } -void GetNsDataHeaderInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 unk_param3 = cmd_buff[3]; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); +void Module::Interface::SetNsDataNewFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2B, 2, 0); + const u32 unk_param1 = rp.Pop<u32>(); + ns_data_new_flag = rp.Pop<u8>(); - cmd_buff[0] = IPC::MakeHeader(0x27, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xC); - cmd_buff[3] = buff_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#04X}", unk_param1, + ns_data_new_flag); } -void ReadNsData(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 translation = cmd_buff[5]; - u32 buff_addr = cmd_buff[6]; - u32 buff_size = (translation >> 4); +void Module::Interface::GetNsDataNewFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2C, 1, 0); + const u32 unk_param1 = rp.Pop<u32>(); - cmd_buff[0] = IPC::MakeHeader(0x28, 0x3, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) - cmd_buff[3] = 0; // stub 0 (32bit value) - cmd_buff[4] = (buff_size << 4 | 0xC); - cmd_buff[5] = buff_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(ns_data_new_flag); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, translation={:#010X}, " - "buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, unk_param4, translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#04X}", unk_param1, + ns_data_new_flag); } -void SetNsDataAdditionalInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; +void Module::Interface::GetNsDataLastUpdate(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2D, 1, 0); + const u32 unk_param1 = rp.Pop<u32>(); - cmd_buff[0] = IPC::MakeHeader(0x29, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}", unk_param1, - unk_param2); -} - -void GetNsDataAdditionalInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - - cmd_buff[0] = IPC::MakeHeader(0x2A, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) + IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 (32bit value) + rb.Push<u32>(0); // stub 0 (32bit value) LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1); } -void SetNsDataNewFlag(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - ns_data_new_flag = cmd_buff[2] & 0xFF; +void Module::Interface::GetErrorCode(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2E, 1, 0); + const u8 input = rp.Pop<u8>(); - cmd_buff[0] = IPC::MakeHeader(0x2B, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); /// output value - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}", - unk_param1, ns_data_new_flag); + LOG_WARNING(Service_BOSS, "(STUBBED) input={:#010X}", input); } -void GetNsDataNewFlag(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; +void Module::Interface::RegisterStorageEntry(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x2F, 5, 0); + const u32 unk_param1 = rp.Pop<u32>(); + const u32 unk_param2 = rp.Pop<u32>(); + const u32 unk_param3 = rp.Pop<u32>(); + const u32 unk_param4 = rp.Pop<u32>(); + const u8 unk_param5 = rp.Pop<u8>(); - cmd_buff[0] = IPC::MakeHeader(0x2C, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = ns_data_new_flag; - - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, ns_data_new_flag={:#010X}", - unk_param1, ns_data_new_flag); -} - -void GetNsDataLastUpdate(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - - cmd_buff[0] = IPC::MakeHeader(0x2D, 0x3, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) - cmd_buff[3] = 0; // stub 0 (32bit value) - - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1); -} - -void GetErrorCode(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - - cmd_buff[0] = IPC::MakeHeader(0x2E, 0x2, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) - - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}", unk_param1); -} - -void RegisterStorageEntry(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; - u32 unk_param5 = cmd_buff[5] & 0xFF; - - cmd_buff[0] = IPC::MakeHeader(0x2F, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_BOSS, "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "unk_param4={:#010X}, unk_param5={:#010X}", + "unk_param4={:#010X}, unk_param5={:#04X}", unk_param1, unk_param2, unk_param3, unk_param4, unk_param5); } -void GetStorageEntryInfo(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetStorageEntryInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x30, 0, 0); - cmd_buff[0] = IPC::MakeHeader(0x30, 0x3, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) - cmd_buff[3] = 0; // stub 0 (16bit value) + IPC::RequestBuilder rb = rp.MakeBuilder(3, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 (32bit value) + rb.Push<u16>(0); // stub 0 (16bit value) LOG_WARNING(Service_BOSS, "(STUBBED) called"); } -void SetStorageOption(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1] & 0xFF; - u32 unk_param2 = cmd_buff[2]; - u32 unk_param3 = cmd_buff[3]; - u32 unk_param4 = cmd_buff[4]; +void Module::Interface::SetStorageOption(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x31, 4, 0); + const u8 unk_param1 = rp.Pop<u8>(); + const u32 unk_param2 = rp.Pop<u32>(); + const u16 unk_param3 = rp.Pop<u16>(); + const u16 unk_param4 = rp.Pop<u16>(); - cmd_buff[0] = IPC::MakeHeader(0x31, 0x1, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, " - "unk_param3={:#010X}, unk_param4={:#010X}", + "(STUBBED) unk_param1={:#04X}, unk_param2={:#010X}, " + "unk_param3={:#08X}, unk_param4={:#08X}", unk_param1, unk_param2, unk_param3, unk_param4); } -void GetStorageOption(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetStorageOption(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x32, 0, 0); - cmd_buff[0] = IPC::MakeHeader(0x32, 0x5, 0); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (32bit value) - cmd_buff[3] = 0; // stub 0 (8bit value) - cmd_buff[4] = 0; // stub 0 (16bit value) - cmd_buff[5] = 0; // stub 0 (16bit value) + IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); // stub 0 (32bit value) + rb.Push<u8>(0); // stub 0 (8bit value) + rb.Push<u16>(0); // stub 0 (16bit value) + rb.Push<u16>(0); // stub 0 (16bit value) LOG_WARNING(Service_BOSS, "(STUBBED) called"); } -void StartBgImmediate(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::StartBgImmediate(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x33, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); - cmd_buff[0] = IPC::MakeHeader(0x33, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff_size << 4 | 0xA); - cmd_buff[3] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}", - unk_param1, translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); } -void GetTaskActivePriority(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); +void Module::Interface::GetTaskProperty0(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x34, 1, 2); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); - u32 unk_param1 = cmd_buff[1]; // TODO(JamePeng): Figure out the meaning of these parameters - u32 translation = cmd_buff[2]; - u32 buff_addr = cmd_buff[3]; - u32 buff_size = (translation >> 4); + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); /// current state of PropertyID 0x0 stub 0 (8bit value) + rb.PushMappedBuffer(buffer); - cmd_buff[0] = IPC::MakeHeader(0x34, 0x2, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = 0; // stub 0 (8bit value) - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; - - LOG_WARNING(Service_BOSS, - "(STUBBED) buff_size={:#010X}, unk_param2={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}", - unk_param1, translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}", size); } -void RegisterImmediateTask(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2] & 0xFF; - u32 unk_param3 = cmd_buff[3] & 0xFF; - u32 translation = cmd_buff[4]; - u32 buff_addr = cmd_buff[5]; - u32 buff_size = (translation >> 4); +void Module::Interface::RegisterImmediateTask(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x35, 3, 2); + const u32 size = rp.Pop<u32>(); + const u8 unk_param2 = rp.Pop<u8>(); + const u8 unk_param3 = rp.Pop<u8>(); + auto& buffer = rp.PopMappedBuffer(); - cmd_buff[0] = IPC::MakeHeader(0x35, 0x1, 0x2); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[3] = (buff_size << 4 | 0xA); - cmd_buff[4] = buff_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, unk_param3={:#010X}, " - "translation={:#010X}, buff_addr={:#010X}, buff_size={:#010X}", - unk_param1, unk_param2, unk_param3, translation, buff_addr, buff_size); + LOG_WARNING(Service_BOSS, "(STUBBED) size={:#010X}, unk_param2={:#04X}, unk_param3={:#04X}", + size, unk_param2, unk_param3); } -void SetTaskQuery(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 translation1 = cmd_buff[3]; - u32 buff1_addr = cmd_buff[4]; - u32 buff1_size = (translation1 >> 4); - u32 translation2 = cmd_buff[5]; - u32 buff2_addr = cmd_buff[6]; - u32 buff2_size = (translation2 >> 4); +void Module::Interface::SetTaskQuery(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x36, 2, 4); + const u32 buffer1_size = rp.Pop<u32>(); + const u32 buffer2_size = rp.Pop<u32>(); + auto& buffer1 = rp.PopMappedBuffer(); + auto& buffer2 = rp.PopMappedBuffer(); - cmd_buff[0] = IPC::MakeHeader(0x36, 0x1, 0x4); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff1_size << 4 | 0xA); - cmd_buff[3] = buff1_addr; - cmd_buff[2] = (buff2_size << 4 | 0xA); - cmd_buff[3] = buff2_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer1); + rb.PushMappedBuffer(buffer2); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, " - "translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, " - "translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}", - unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2, - buff2_addr, buff2_size); + LOG_WARNING(Service_BOSS, "(STUBBED) buffer1_size={:#010X}, buffer2_size={:#010X}", + buffer1_size, buffer2_size); } -void GetTaskQuery(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - // TODO(JamePeng): Figure out the meaning of these parameters - u32 unk_param1 = cmd_buff[1]; - u32 unk_param2 = cmd_buff[2]; - u32 translation1 = cmd_buff[3]; - u32 buff1_addr = cmd_buff[4]; - u32 buff1_size = (translation1 >> 4); - u32 translation2 = cmd_buff[5]; - u32 buff2_addr = cmd_buff[6]; - u32 buff2_size = (translation2 >> 4); +void Module::Interface::GetTaskQuery(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x37, 2, 4); + const u32 buffer1_size = rp.Pop<u32>(); + const u32 buffer2_size = rp.Pop<u32>(); + auto& buffer1 = rp.PopMappedBuffer(); + auto& buffer2 = rp.PopMappedBuffer(); - cmd_buff[0] = IPC::MakeHeader(0x37, 0x1, 0x4); - cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[2] = (buff1_size << 4 | 0xA); - cmd_buff[3] = buff1_addr; - cmd_buff[2] = (buff2_size << 4 | 0xC); - cmd_buff[3] = buff2_addr; + IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer1); + rb.PushMappedBuffer(buffer2); - LOG_WARNING(Service_BOSS, - "(STUBBED) unk_param1={:#010X}, unk_param2={:#010X}, " - "translation1={:#010X}, buff1_addr={:#010X}, buff1_size={:#010X}, " - "translation2={:#010X}, buff2_addr={:#010X}, buff2_size={:#010X}", - unk_param1, unk_param2, translation1, buff1_addr, buff1_size, translation2, - buff2_addr, buff2_size); + LOG_WARNING(Service_BOSS, "(STUBBED) buffer1_size={:#010X}, buffer2_size={:#010X}", + buffer1_size, buffer2_size); } -void Init() { +void Module::Interface::InitializeSessionPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x401, 2, 2); + const u64 programID = rp.Pop<u64>(); + rp.PopPID(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018X}", programID); +} + +void Module::Interface::GetAppNewFlag(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x404, 2, 0); + const u64 programID = rp.Pop<u64>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(0); // 0 = nothing new, 1 = new content + + LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018X}", programID); +} + +void Module::Interface::GetNsDataIdListPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x40D, 6, 2); + const u64 programID = rp.Pop<u64>(); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) programID={:#018X}, filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + programID, filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::GetNsDataIdListPrivileged1(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x40E, 6, 2); + const u64 programID = rp.Pop<u64>(); + const u32 filter = rp.Pop<u32>(); + const u32 max_entries = rp.Pop<u32>(); /// buffer size in words + const u16 word_index_start = rp.Pop<u16>(); + const u32 start_ns_data_id = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u16>(0); /// Actual number of output entries + rb.Push<u16>(0); /// Last word-index copied to output in the internal NsDataId list. + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) programID={:#018X}, filter={:#010X}, max_entries={:#010X}, " + "word_index_start={:#06X}, start_ns_data_id={:#010X}", + programID, filter, max_entries, word_index_start, start_ns_data_id); +} + +void Module::Interface::SendPropertyPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x413, 2, 2); + const u16 property_id = rp.Pop<u16>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, "(STUBBED) property_id={:#06X}, size={:#010X}", property_id, size); +} + +void Module::Interface::DeleteNsDataPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x415, 3, 0); + const u64 programID = rp.Pop<u64>(); + const u32 ns_data_id = rp.Pop<u32>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING(Service_BOSS, "(STUBBED) programID={:#018X}, ns_data_id={:#010X}", programID, + ns_data_id); +} + +void Module::Interface::GetNsDataHeaderInfoPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x416, 5, 2); + const u64 programID = rp.Pop<u64>(); + const u32 ns_data_id = rp.Pop<u32>(); + const u8 type = rp.Pop<u8>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) programID={:#018X} ns_data_id={:#010X}, type={:#04X}, size={:#010X}", + programID, ns_data_id, type, size); +} + +void Module::Interface::ReadNsDataPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x417, 6, 2); + const u64 programID = rp.Pop<u64>(); + const u32 ns_data_id = rp.Pop<u32>(); + const u64 offset = rp.Pop<u64>(); + const u32 size = rp.Pop<u32>(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(3, 2); + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(size); /// Should be actual read size + rb.Push<u32>(0); /// unknown + rb.PushMappedBuffer(buffer); + + LOG_WARNING(Service_BOSS, + "(STUBBED) programID={:#018X}, ns_data_id={:#010X}, offset={:#018X}, size={:#010X}", + programID, ns_data_id, offset, size); +} + +void Module::Interface::SetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x41A, 4, 0); + const u64 programID = rp.Pop<u64>(); + const u32 unk_param1 = rp.Pop<u32>(); + ns_data_new_flag_privileged = rp.Pop<u8>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); + rb.Push(RESULT_SUCCESS); + + LOG_WARNING( + Service_BOSS, + "(STUBBED) programID={:#018X}, unk_param1={:#010X}, ns_data_new_flag_privileged={:#04X}", + programID, unk_param1, ns_data_new_flag_privileged); +} + +void Module::Interface::GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x41B, 3, 0); + const u64 programID = rp.Pop<u64>(); + const u32 unk_param1 = rp.Pop<u32>(); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + rb.Push(RESULT_SUCCESS); + rb.Push<u8>(ns_data_new_flag_privileged); + + LOG_WARNING( + Service_BOSS, + "(STUBBED) programID={:#018X}, unk_param1={:#010X}, ns_data_new_flag_privileged={:#04X}", + programID, unk_param1, ns_data_new_flag_privileged); +} + +Module::Interface::Interface(std::shared_ptr<Module> boss, const char* name, u32 max_session) + : ServiceFramework(name, max_session), boss(std::move(boss)) {} + +Module::Module() { using namespace Kernel; - - AddService(new BOSS_P_Interface); - AddService(new BOSS_U_Interface); - - new_arrival_flag = 0; - ns_data_new_flag = 0; - output_flag = 0; + // TODO: verify ResetType + task_finish_event = Event::Create(Kernel::ResetType::OneShot, "BOSS::task_finish_event"); } -void Shutdown() {} +void InstallInterfaces(SM::ServiceManager& service_manager) { + auto boss = std::make_shared<Module>(); + std::make_shared<BOSS_P>(boss)->InstallAsService(service_manager); + std::make_shared<BOSS_U>(boss)->InstallAsService(service_manager); +} } // namespace BOSS - } // namespace Service diff --git a/src/core/hle/service/boss/boss.h b/src/core/hle/service/boss/boss.h index 8cdc663c8..d005c8b61 100644 --- a/src/core/hle/service/boss/boss.h +++ b/src/core/hle/service/boss/boss.h @@ -4,799 +4,964 @@ #pragma once +#include "core/hle/kernel/event.h" #include "core/hle/service/service.h" namespace Service { namespace BOSS { -/** - * BOSS::InitializeSession service function - * Inputs: - * 0 : Header Code[0x00010082] - * 1 : u32 lower 64bit value - * 2 : u32 higher 64bit value - * 3 : 0x20 - * 4 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void InitializeSession(Service::Interface* self); +class Module final { +public: + Module(); + ~Module() = default; -/** - * BOSS::RegisterStorage service function - * Inputs: - * 0 : Header Code[0x00020010] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * 3 : u32 unknown3 - * 4 : u8 unknown_flag - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void RegisterStorage(Service::Interface* self); + class Interface : public ServiceFramework<Interface> { + public: + Interface(std::shared_ptr<Module> boss, const char* name, u32 max_session); + ~Interface() = default; -/** - * BOSS::UnregisterStorage service function - * Inputs: - * 0 : Header Code[0x00030000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void UnregisterStorage(Service::Interface* self); + protected: + /** + * BOSS::InitializeSession service function + * Inputs: + * 0 : Header Code[0x00010082] + * 1-2 : programID, normally zero for using the programID determined from the input PID + * 3 : 0x20, ARM11-kernel processID translate-header. + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void InitializeSession(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetStorageInfo service function - * Inputs: - * 0 : Header Code[0x00040000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - */ -void GetStorageInfo(Service::Interface* self); + /** + * BOSS::RegisterStorage service function + * Inputs: + * 0 : Header Code[0x00020100] + * 1-2 : u64 extdataID + * 3 : u32 boss_size + * 4 : u8 extdata_type: 0 = NAND, 1 = SD + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetStorageInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterPrivateRootCa service function - * Inputs: - * 0 : Header Code[0x00050042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void RegisterPrivateRootCa(Service::Interface* self); + /** + * BOSS::UnregisterStorage service function + * Inputs: + * 0 : Header Code[0x00030000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void UnregisterStorage(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterPrivateClientCert service function - * Inputs: - * 0 : Header Code[0x00060084] - * 1 : u32 unknown value - * 2 : u32 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : u32 buff_addr1 - * 5 : MappedBufferDesc2(permission = R) - * 6 : u32 buff_addr2 - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff1_size << 4 | 0xA - * 3 : u32 buff_addr1 - * 4 : buff2_size << 4 | 0xA - * 5 : u32 buff_addr2 - */ -void RegisterPrivateClientCert(Service::Interface* self); + /** + * BOSS::GetStorageInfo service function + * Inputs: + * 0 : Header Code[0x00040000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + */ + void GetStorageInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNewArrivalFlag service function - * Inputs: - * 0 : Header Code[0x00070000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 flag - */ -void GetNewArrivalFlag(Service::Interface* self); + /** + * BOSS::RegisterPrivateRootCa service function + * Inputs: + * 0 : Header Code[0x00050042] + * 1 : u32 Size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void RegisterPrivateRootCa(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterNewArrivalEvent service function - * Inputs: - * 0 : Header Code[0x00080002] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void RegisterNewArrivalEvent(Service::Interface* self); + /** + * BOSS::RegisterPrivateClientCert service function + * Inputs: + * 0 : Header Code[0x00060084] + * 1 : u32 buffer 1 size + * 2 : u32 buffer 2 size + * 3 : MappedBufferDesc1(permission = R) + * 4 : u32 buff_addr1 + * 5 : MappedBufferDesc2(permission = R) + * 6 : u32 buff_addr2 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff1_size << 4 | 0xA + * 3 : u32 buff_addr1 + * 4 : buff2_size << 4 | 0xA + * 5 : u32 buff_addr2 + */ + void RegisterPrivateClientCert(Kernel::HLERequestContext& ctx); -/** - * BOSS::SetOptoutFlag service function - * Inputs: - * 0 : Header Code[0x00090040] - * 1 : u8 output_flag - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void SetOptoutFlag(Service::Interface* self); + /** + * BOSS::GetNewArrivalFlag service function + * Inputs: + * 0 : Header Code[0x00070000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 flag + */ + void GetNewArrivalFlag(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetOptoutFlag service function - * Inputs: - * 0 : Header Code[0x000A0000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 output_flag - */ -void GetOptoutFlag(Service::Interface* self); + /** + * BOSS::RegisterNewArrivalEvent service function + * Inputs: + * 0 : Header Code[0x00080002] + * 1 : u32 unknown1 + * 2 : u32 unknown2 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterTask service function - * Inputs: - * 0 : Header Code[0x000B00C2] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : u8 unknown value - * 4 : MappedBufferDesc1(permission = R) - * 5 : buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void RegisterTask(Service::Interface* self); + /** + * BOSS::SetOptoutFlag service function + * Inputs: + * 0 : Header Code[0x00090040] + * 1 : u8 output_flag + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetOptoutFlag(Kernel::HLERequestContext& ctx); -/** - * BOSS::UnregisterTask service function - * Inputs: - * 0 : Header Code[0x000C0082] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void UnregisterTask(Service::Interface* self); + /** + * BOSS::GetOptoutFlag service function + * Inputs: + * 0 : Header Code[0x000A0000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 output_flag + */ + void GetOptoutFlag(Kernel::HLERequestContext& ctx); -/** - * BOSS::ReconfigureTask service function - * Inputs: - * 0 : Header Code[0x000D0082] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void ReconfigureTask(Service::Interface* self); + /** + * BOSS::RegisterTask service function + * Inputs: + * 0 : Header Code[0x000B00C2] + * 1 : TaskID buffer size + * 2 : u8 unknown value, Usually zero, regardless of HTTP GET/POST. + * 3 : u8 unknown value, Usually zero, regardless of HTTP GET/POST. + * 4 : MappedBufferDesc1(permission = R) + * 5 : buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void RegisterTask(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskIdList service function - * Inputs: - * 0 : Header Code[0x000E0000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void GetTaskIdList(Service::Interface* self); + /** + * BOSS::UnregisterTask service function + * Inputs: + * 0 : Header Code[0x000C0082] + * 1 : TaskID buffer size + * 2 : u8 unknown value + * 3 : MappedBufferDesc1(permission = R) + * 4 : buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void UnregisterTask(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetStepIdList service function - * Inputs: - * 0 : Header Code[0x000F0042] - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void GetStepIdList(Service::Interface* self); + /** + * BOSS::ReconfigureTask service function + * Inputs: + * 0 : Header Code[0x000D0082] + * 1 : TaskID buffer size + * 2 : u8 unknown value + * 3 : MappedBufferDesc1(permission = R) + * 4 : buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void ReconfigureTask(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNsDataIdList service function - * Inputs: - * 0 : Header Code[0x00100102] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * 3 : u32 unknown3 - * 4 : u32 unknown4 - * 5 : MappedBufferDesc(permission = W) - * 6 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u16 unknown value - * 3 : u16 unknown value - * 4 : buff_size << 4 | 0xC - * 5 : u32 buff_addr - */ -void GetNsDataIdList(Service::Interface* self); + /** + * BOSS::GetTaskIdList service function + * Inputs: + * 0 : Header Code[0x000E0000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void GetTaskIdList(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetOwnNsDataIdList service function - * Inputs: - * 0 : Header Code[0x00110102] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * 3 : u32 unknown3 - * 4 : u32 unknown4 - * 5 : MappedBufferDesc(permission = W) - * 6 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u16 unknown value - * 3 : u16 unknown value - * 4 : buff_size << 4 | 0xC - * 5 : u32 buff_addr - */ -void GetOwnNsDataIdList(Service::Interface* self); + /** + * BOSS::GetStepIdList service function + * Inputs: + * 0 : Header Code[0x000F0042] + * 1 : u32 buffer size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void GetStepIdList(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNewDataNsDataIdList service function - * Inputs: - * 0 : Header Code[0x00120102] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * 3 : u32 unknown3 - * 4 : u32 unknown4 - * 5 : MappedBufferDesc(permission = W) - * 6 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u16 unknown value - * 3 : u16 unknown value - * 4 : buff_size << 4 | 0xC - * 5 : u32 buff_addr - */ -void GetNewDataNsDataIdList(Service::Interface* self); + /** + * BOSS::GetNsDataIdList service function + * Inputs: + * 0 : Header Code[0x00100102] + * 1 : u32 filter + * 2 : u32 Buffer size in words(max entries) + * 3 : u16, starting word-index in the internal NsDataId list + * 4 : u32, start_NsDataId + * 5 : MappedBufferDesc(permission = W) + * 6 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void GetNsDataIdList(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetOwnNewDataNsDataIdList service function - * Inputs: - * 0 : Header Code[0x00130102] - * 1 : u32 unknown1 - * 2 : u32 unknown2 - * 3 : u32 unknown3 - * 4 : u32 unknown4 - * 5 : MappedBufferDesc(permission = W) - * 6 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u16 unknown value - * 3 : u16 unknown value + /** + * BOSS::GetNsDataIdList1 service function + * Inputs: + * 0 : Header Code[0x00110102] + * 1 : u32 filter + * 2 : u32 Buffer size in words(max entries) + * 3 : u16, starting word-index in the internal NsDataId list + * 4 : u32, start_NsDataId + * 5 : MappedBufferDesc(permission = W) + * 6 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void GetNsDataIdList1(Kernel::HLERequestContext& ctx); - */ -void GetOwnNewDataNsDataIdList(Service::Interface* self); + /** + * BOSS::GetNsDataIdList2 service function + * Inputs: + * 0 : Header Code[0x00120102] + * 1 : u32 filter + * 2 : u32 Buffer size in words(max entries) + * 3 : u16, starting word-index in the internal NsDataId list + * 4 : u32, start_NsDataId + * 5 : MappedBufferDesc(permission = W) + * 6 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void GetNsDataIdList2(Kernel::HLERequestContext& ctx); -/** - * BOSS::SendProperty service function - * Inputs: - * 0 : Header Code[0x00140082] - * 1 : u16 unknown value - * 2 : u32 unknown value - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void SendProperty(Service::Interface* self); + /** + * BOSS::GetNsDataIdList3 service function + * Inputs: + * 0 : Header Code[0x00130102] + * 1 : u32 filter + * 2 : u32 Buffer size in words(max entries) + * 3 : u16, starting word-index in the internal NsDataId list + * 4 : u32, start_NsDataId + * 5 : MappedBufferDesc(permission = W) + * 6 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr -/** - * BOSS::SendPropertyHandle service function - * Inputs: - * 0 : Header Code[0x00150042] - * 2 : u8 unknown value - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void SendPropertyHandle(Service::Interface* self); + */ + void GetNsDataIdList3(Kernel::HLERequestContext& ctx); -/** - * BOSS::ReceiveProperty service function - * Inputs: - * 0 : Header Code[0x00160082] - * 1 : u16 unknown1 - * 2 : u32 buff_size - * 3 : MappedBufferDesc(permission = W) - * 4 : u32 buff addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : u16 unknown value - * 4 : buff_size << 4 | 0xC - * 5 : u32 buff_addr - */ -void ReceiveProperty(Service::Interface* self); + /** + * BOSS::SendProperty service function + * Inputs: + * 0 : Header Code[0x00140082] + * 1 : u16 PropertyID + * 2 : u32 size + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void SendProperty(Kernel::HLERequestContext& ctx); -/** - * BOSS::UpdateTaskInterval service function - * Inputs: - * 0 : Header Code[0x00170082] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void UpdateTaskInterval(Service::Interface* self); + /** + * BOSS::SendPropertyHandle service function + * Inputs: + * 0 : Header Code[0x00150042] + * 2 : u16 PropertyID + * 3 : 0x0 + * 4 : Handle + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SendPropertyHandle(Kernel::HLERequestContext& ctx); -/** - * BOSS::UpdateTaskCount service function - * Inputs: - * 0 : Header Code[0x00180082] - * 1 : u32 buff_size - * 2 : u32 unknown2 - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void UpdateTaskCount(Service::Interface* self); + /** + * BOSS::ReceiveProperty service function + * Inputs: + * 0 : Header Code[0x00160082] + * 1 : u16 PropertyID + * 2 : u32 Size + * 3 : MappedBufferDesc(permission = W) + * 4 : u32 buff addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Actual read size + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void ReceiveProperty(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskInterval service function - * Inputs: - * 0 : Header Code[0x00190042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskInterval(Service::Interface* self); + /** + * BOSS::UpdateTaskInterval service function + * Inputs: + * 0 : Header Code[0x00170082] + * 1 : u32 unknown value + * 2 : u8 unknown value + * 3 : MappedBufferDesc1(permission = R) + * 4 : buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void UpdateTaskInterval(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskCount service function - * Inputs: - * 0 : Header Code[0x001A0042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskCount(Service::Interface* self); + /** + * BOSS::UpdateTaskCount service function + * Inputs: + * 0 : Header Code[0x00180082] + * 1 : u32 buff_size + * 2 : u32 unknown2 + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void UpdateTaskCount(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskServiceStatus service function - * Inputs: - * 0 : Header Code[0x001B0042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskServiceStatus(Service::Interface* self); + /** + * BOSS::GetTaskInterval service function + * Inputs: + * 0 : Header Code[0x00190042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskInterval(Kernel::HLERequestContext& ctx); -/** - * BOSS::StartTask service function - * Inputs: - * 0 : Header Code[0x001C0042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void StartTask(Service::Interface* self); + /** + * BOSS::GetTaskCount service function + * Inputs: + * 0 : Header Code[0x001A0042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskCount(Kernel::HLERequestContext& ctx); -/** - * BOSS::StartTaskImmediate service function - * Inputs: - * 0 : Header Code[0x001D0042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void StartTaskImmediate(Service::Interface* self); + /** + * BOSS::GetTaskServiceStatus service function + * Inputs: + * 0 : Header Code[0x001B0042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 unknown value + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskServiceStatus(Kernel::HLERequestContext& ctx); -/** - * BOSS::CancelTask service function - * Inputs: - * 0 : Header Code[0x001E0042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void CancelTask(Service::Interface* self); + /** + * BOSS::StartTask service function + * Inputs: + * 0 : Header Code[0x001C0042] + * 1 : TaskID buffer size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void StartTask(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskFinishHandle service function - * Inputs: - * 0 : Header Code[0x001F0000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : 0 - * 3 : Task Finish Handle - */ -void GetTaskFinishHandle(Service::Interface* self); + /** + * BOSS::StartTaskImmediate service function + * Inputs: + * 0 : Header Code[0x001D0042] + * 1 : TaskID buffer size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void StartTaskImmediate(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskState service function - * Inputs: - * 0 : Header Code[0x00200082] - * 1 : u32 buff_size - * 2 : u8 unknown value - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : u32 unknown value - * 4 : u8 unknown value - * 5 : buff_size << 4 | 0xA - * 6 : u32 buff_addr - */ -void GetTaskState(Service::Interface* self); + /** + * BOSS::CancelTask service function + * Inputs: + * 0 : Header Code[0x001E0042] + * 1 : TaskID buffer size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void CancelTask(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskResult service function - * Inputs: - * 0 : Header Code[0x00210042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : u32 unknown value - * 4 : u8 unknown value - * 5 : buff_size << 4 | 0xA - * 6 : u32 buff_addr - */ -void GetTaskResult(Service::Interface* self); + /** + * BOSS::GetTaskFinishHandle service function + * Inputs: + * 0 : Header Code[0x001F0000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : 0x0 + * 3 : Task Finish Handle + */ + void GetTaskFinishHandle(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskCommErrorCode service function - * Inputs: - * 0 : Header Code[0x00220042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : u32 unknown value - * 4 : u8 unknown value - * 5 : buff_size << 4 | 0xA - * 6 : u32 buff_addr - */ -void GetTaskCommErrorCode(Service::Interface* self); + /** + * BOSS::GetTaskState service function + * Inputs: + * 0 : Header Code[0x00200082] + * 1 : TaskID buffer size + * 2 : u8 state + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 TaskStatus + * 3 : u32 Current state value for task PropertyID 0x4 + * 4 : u8 unknown value + * 5 : buff_size << 4 | 0xA + * 6 : u32 buff_addr + */ + void GetTaskState(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskStatus service function - * Inputs: - * 0 : Header Code[0x002300C2] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : u8 unknown value - * 4 : MappedBufferDesc(permission = R) - * 5 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskStatus(Service::Interface* self); + /** + * BOSS::GetTaskResult service function + * Inputs: + * 0 : Header Code[0x00210042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 unknown value + * 3 : u32 unknown value + * 4 : u8 unknown value + * 5 : buff_size << 4 | 0xA + * 6 : u32 buff_addr + */ + void GetTaskResult(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskError service function - * Inputs: - * 0 : Header Code[0x00240082] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskError(Service::Interface* self); + /** + * BOSS::GetTaskCommErrorCode service function + * Inputs: + * 0 : Header Code[0x00220042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + * 3 : u32 unknown value + * 4 : u8 unknown value + * 5 : buff_size << 4 | 0xA + * 6 : u32 buff_addr + */ + void GetTaskCommErrorCode(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskInfo service function - * Inputs: - * 0 : Header Code[0x00250082] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : MappedBufferDesc(permission = R) - * 4 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void GetTaskInfo(Service::Interface* self); + /** + * BOSS::GetTaskStatus service function + * Inputs: + * 0 : Header Code[0x002300C2] + * 1 : u32 size + * 2 : u8 unknown value + * 3 : u8 unknown value + * 4 : MappedBufferDesc(permission = R) + * 5 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 unknown value + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskStatus(Kernel::HLERequestContext& ctx); -/** - * BOSS::DeleteNsData service function - * Inputs: - * 0 : Header Code[0x00260040] - * 1 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void DeleteNsData(Service::Interface* self); + /** + * BOSS::GetTaskError service function + * Inputs: + * 0 : Header Code[0x00240082] + * 1 : u32 size + * 2 : u8 unknown value + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 unknown value + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskError(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNsDataHeaderInfo service function - * Inputs: - * 0 : Header Code[0x002700C2] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : u32 unknown value - * 4 : MappedBufferDesc(permission = W) - * 5 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xC - * 3 : u32 buff_addr - */ -void GetNsDataHeaderInfo(Service::Interface* self); + /** + * BOSS::GetTaskInfo service function + * Inputs: + * 0 : Header Code[0x00250082] + * 1 : u32 size + * 2 : u8 unknown value + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void GetTaskInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::ReadNsData service function - * Inputs: - * 0 : Header Code[0x00280102] - * 1 : u32 unknown value - * 2 : u32 unknown value - * 3 : u32 unknown value - * 4 : u32 unknown value - * 5 : MappedBufferDesc(permission = W) - * 6 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : u32 unknown value - * 4 : buff_size << 4 | 0xC - * 5 : u32 buff_addr - */ -void ReadNsData(Service::Interface* self); + /** + * BOSS::DeleteNsData service function + * Inputs: + * 0 : Header Code[0x00260040] + * 1 : u32 NsDataID + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void DeleteNsData(Kernel::HLERequestContext& ctx); -/** - * BOSS::SetNsDataAdditionalInfo service function - * Inputs: - * 0 : Header Code[0x00290080] - * 1 : u32 unknown value - * 2 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void SetNsDataAdditionalInfo(Service::Interface* self); + /** + * BOSS::GetNsDataHeaderInfo service function + * Inputs: + * 0 : Header Code[0x002700C2] + * 1 : u32, NsDataID + * 2 : u8, type + * 3 : u32, Size + * 4 : MappedBufferDesc(permission = W) + * 5 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xC + * 3 : u32, buff_addr + */ + void GetNsDataHeaderInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNsDataAdditionalInfo service function - * Inputs: - * 0 : Header Code[0x002A0040] - * 1 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - */ -void GetNsDataAdditionalInfo(Service::Interface* self); + /** + * BOSS::ReadNsData service function + * Inputs: + * 0 : Header Code[0x00280102] + * 1 : u32, NsDataID + * 2-3 : u64, offset + * 4 : u32, Size + * 5 : MappedBufferDesc(permission = W) + * 6 : u32, buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 Actual read size + * 3 : u32, unknown value + * 4 : buff_size << 4 | 0xC + * 5 : u32, buff_addr + */ + void ReadNsData(Kernel::HLERequestContext& ctx); -/** - * BOSS::SetNsDataNewFlag service function - * Inputs: - * 0 : Header Code[0x002B0080] - * 1 : u32 unknown value - * 2 : u8 flag - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void SetNsDataNewFlag(Service::Interface* self); + /** + * BOSS::SetNsDataAdditionalInfo service function + * Inputs: + * 0 : Header Code[0x00290080] + * 1 : u32 unknown value + * 2 : u32 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNsDataNewFlag service function - * Inputs: - * 0 : Header Code[0x002C0040] - * 1 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 flag - */ -void GetNsDataNewFlag(Service::Interface* self); + /** + * BOSS::GetNsDataAdditionalInfo service function + * Inputs: + * 0 : Header Code[0x002A0040] + * 1 : u32 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + */ + void GetNsDataAdditionalInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetNsDataLastUpdate service function - * Inputs: - * 0 : Header Code[0x002D0040] - * 1 : u32 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : u32 unknown value - */ -void GetNsDataLastUpdate(Service::Interface* self); + /** + * BOSS::SetNsDataNewFlag service function + * Inputs: + * 0 : Header Code[0x002B0080] + * 1 : u32 unknown value + * 2 : u8 flag + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetNsDataNewFlag(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetErrorCode service function - * Inputs: - * 0 : Header Code[0x002E0040] - * 1 : u8 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - */ -void GetErrorCode(Service::Interface* self); + /** + * BOSS::GetNsDataNewFlag service function + * Inputs: + * 0 : Header Code[0x002C0040] + * 1 : u32 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 flag + */ + void GetNsDataNewFlag(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterStorageEntry service function - * Inputs: - * 0 : Header Code[0x002F0140] - * 1 : u32 unknown value - * 2 : u32 unknown value - * 3 : u32 unknown value - * 4 : u16 unknown value - * 5 : u8 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void RegisterStorageEntry(Service::Interface* self); + /** + * BOSS::GetNsDataLastUpdate service function + * Inputs: + * 0 : Header Code[0x002D0040] + * 1 : u32 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + * 3 : u32 unknown value + */ + void GetNsDataLastUpdate(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetStorageEntryInfo service function - * Inputs: - * 0 : Header Code[0x00300000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u32 unknown value - * 3 : u16 unknown value - */ -void GetStorageEntryInfo(Service::Interface* self); + /** + * BOSS::GetErrorCode service function + * Inputs: + * 0 : Header Code[0x002E0040] + * 1 : u8 input + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + */ + void GetErrorCode(Kernel::HLERequestContext& ctx); -/** - * BOSS::SetStorageOption service function - * Inputs: - * 0 : Header Code[0x00310100] - * 1 : u8 unknown value - * 2 : u32 unknown value - * 3 : u16 unknown value - * 4 : u16 unknown value - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void SetStorageOption(Service::Interface* self); + /** + * BOSS::RegisterStorageEntry service function + * Inputs: + * 0 : Header Code[0x002F0140] + * 1 : u32 unknown value + * 2 : u32 unknown value + * 3 : u32 unknown value + * 4 : u16 unknown value + * 5 : u8 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void RegisterStorageEntry(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetStorageOption service function - * Inputs: - * 0 : Header Code[0x00320000] - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : u32 unknown value - * 4 : u16 unknown value - * 5 : u16 unknown value - */ -void GetStorageOption(Service::Interface* self); + /** + * BOSS::GetStorageEntryInfo service function + * Inputs: + * 0 : Header Code[0x00300000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 unknown value + * 3 : u16 unknown value + */ + void GetStorageEntryInfo(Kernel::HLERequestContext& ctx); -/** - * BOSS::StartBgImmediate service function - * Inputs: - * 0 : Header Code[0x00330042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void StartBgImmediate(Service::Interface* self); + /** + * BOSS::SetStorageOption service function + * Inputs: + * 0 : Header Code[0x00310100] + * 1 : u8 unknown value + * 2 : u32 unknown value + * 3 : u16 unknown value + * 4 : u16 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetStorageOption(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskActivePriority service function - * Inputs: - * 0 : Header Code[0x00340042] - * 1 : u32 unknown value - * 2 : MappedBufferDesc(permission = R) - * 3 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : u8 unknown value - * 3 : buff_size << 4 | 0xA - * 4 : u32 buff_addr - */ -void GetTaskActivePriority(Service::Interface* self); + /** + * BOSS::GetStorageOption service function + * Inputs: + * 0 : Header Code[0x00320000] + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 unknown value + * 3 : u32 unknown value + * 4 : u16 unknown value + * 5 : u16 unknown value + */ + void GetStorageOption(Kernel::HLERequestContext& ctx); -/** - * BOSS::RegisterImmediateTask service function - * Inputs: - * 0 : Header Code[0x003500C2] - * 1 : u32 unknown value - * 2 : u8 unknown value - * 3 : u8 unknown value - * 4 : MappedBufferDesc(permission = R) - * 5 : u32 buff_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff_size << 4 | 0xA - * 3 : u32 buff_addr - */ -void RegisterImmediateTask(Service::Interface* self); + /** + * BOSS::StartBgImmediate service function + * Inputs: + * 0 : Header Code[0x00330042] + * 1 : TaskID buffer size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32, buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32, buff_addr + */ + void StartBgImmediate(Kernel::HLERequestContext& ctx); -/** - * BOSS::SetTaskQuery service function - * Inputs: - * 0 : Header Code[0x00360084] - * 1 : u32 unknown value - * 2 : u32 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : u32 buff1_addr - * 5 : MappedBufferDesc2(permission = R) - * 6 : u32 buff2_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff1_size << 4 | 0xA - * 3 : u32 buff1_addr - * 4 : buff2_size << 4 | 0xA - * 5 : u32 buff2_addr - */ -void SetTaskQuery(Service::Interface* self); + /** + * BOSS::GetTaskProperty0 service function + * Inputs: + * 0 : Header Code[0x00340042] + * 1 : u32 size + * 2 : MappedBufferDesc(permission = R) + * 3 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 current state + * 3 : buff_size << 4 | 0xA + * 4 : u32 buff_addr + */ + void GetTaskProperty0(Kernel::HLERequestContext& ctx); -/** - * BOSS::GetTaskQuery service function - * Inputs: - * 0 : Header Code[0x00370084] - * 1 : u32 unknown value - * 2 : u32 unknown value - * 3 : MappedBufferDesc1(permission = R) - * 4 : u32 buff1_addr - * 5 : MappedBufferDesc2(permission = W) - * 6 : u32 buff2_addr - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : buff1_size << 4 | 0xA - * 3 : u32 buff1_addr - * 4 : buff2_size << 4 | 0xC - * 5 : u32 buff2_addr - */ -void GetTaskQuery(Service::Interface* self); + /** + * BOSS::RegisterImmediateTask service function + * Inputs: + * 0 : Header Code[0x003500C2] + * 1 : u32 size + * 2 : u8 unknown value + * 3 : u8 unknown value + * 4 : MappedBufferDesc(permission = R) + * 5 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void RegisterImmediateTask(Kernel::HLERequestContext& ctx); -/// Initialize BOSS service(s) -void Init(); + /** + * BOSS::SetTaskQuery service function + * Inputs: + * 0 : Header Code[0x00360084] + * 1 : u32 buffer1 size + * 2 : u32 buffer2 size + * 3 : MappedBufferDesc1(permission = R) + * 4 : u32 buff1_addr + * 5 : MappedBufferDesc2(permission = R) + * 6 : u32 buff2_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff1_size << 4 | 0xA + * 3 : u32 buff1_addr + * 4 : buff2_size << 4 | 0xA + * 5 : u32 buff2_addr + */ + void SetTaskQuery(Kernel::HLERequestContext& ctx); -/// Shutdown BOSS service(s) -void Shutdown(); + /** + * BOSS::GetTaskQuery service function + * Inputs: + * 0 : Header Code[0x00370084] + * 1 : u32 buffer1 size + * 2 : u32 buffer2 size + * 3 : MappedBufferDesc1(permission = R) + * 4 : u32 buff1_addr + * 5 : MappedBufferDesc2(permission = W) + * 6 : u32 buff2_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff1_size << 4 | 0xA + * 3 : u32 buff1_addr + * 4 : buff2_size << 4 | 0xC + * 5 : u32 buff2_addr + */ + void GetTaskQuery(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::InitializeSessionPrivileged service function + * Inputs: + * 0 : Header Code[0x04010082] + * 1-2 : programID, normally zero for using the programID determined from the input PID + * 3 : 0x20, ARM11-kernel processID translate-header. + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void InitializeSessionPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::GetAppNewFlag service function + * Inputs: + * 0 : Header Code[0x04040080] + * 1-2 : u64 ProgramID + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 flag, 0 = nothing new, 1 = new content + */ + void GetAppNewFlag(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::GetNsDataIdListPrivileged service function + * Inputs: + * 0 : Header Code[0x040D0182] + * 1-2 : u64 ProgramID + * 3 : u32 filter + * 4 : u32 Buffer size in words(max entries) + * 5 : u16, starting word-index in the internal NsDataId list + * 6 : u32, start_NsDataId + * 7 : MappedBufferDesc(permission = W) + * 8 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void GetNsDataIdListPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::GetNsDataIdListPrivileged1 service function + * Inputs: + * 0 : Header Code[0x040E0182] + * 1-2 : u64 ProgramID + * 3 : u32 filter + * 4 : u32 Buffer size in words(max entries) + * 5 : u16, starting word-index in the internal NsDataId list + * 6 : u32, start_NsDataId + * 7 : MappedBufferDesc(permission = W) + * 8 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u16 Actual number of output entries + * 3 : u16 Last word-index copied to output in the internal NsDataId list + * 4 : buff_size << 4 | 0xC + * 5 : u32 buff_addr + */ + void GetNsDataIdListPrivileged1(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::SendPropertyPrivileged service function + * Inputs: + * 0 : Header Code[0x04130082] + * 1 : u16 PropertyID + * 2 : u32 size + * 3 : MappedBufferDesc(permission = R) + * 4 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xA + * 3 : u32 buff_addr + */ + void SendPropertyPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::DeleteNsDataPrivileged service function + * Inputs: + * 0 : Header Code[0x041500C0] + * 1-2 : u64 ProgramID + * 3 : u32 NsDataID + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void DeleteNsDataPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::GetNsDataHeaderInfoPrivileged service function + * Inputs: + * 0 : Header Code[0x04160142] + * 1-2 : u64 ProgramID + * 3 : u32, NsDataID + * 4 : u8, type + * 5 : u32, Size + * 6 : MappedBufferDesc(permission = W) + * 7 : u32 buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : buff_size << 4 | 0xC + * 3 : u32, buff_addr + */ + void GetNsDataHeaderInfoPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::ReadNsDataPrivileged service function + * Inputs: + * 0 : Header Code[0x04170182] + * 1-2 : u64 ProgramID + * 3 : u32, NsDataID + * 4-5 : u64, offset + * 6 : u32, Size + * 7 : MappedBufferDesc(permission = W) + * 8 : u32, buff_addr + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u32 Actual read size + * 3 : u32, unknown value + * 4 : buff_size << 4 | 0xC + * 5 : u32, buff_addr + */ + void ReadNsDataPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::SetNsDataNewFlagPrivileged service function + * Inputs: + * 0 : Header Code[0x041A0100] + * 1-2 : u64 ProgramID + * 3 : u32 unknown value + * 4 : u8 flag + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ + void SetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx); + + /** + * BOSS_P::GetNsDataNewFlagPrivileged service function + * Inputs: + * 0 : Header Code[0x041B00C0] + * 1-2 : u64 ProgramID + * 3 : u32 unknown value + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : u8 flag + */ + void GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx); + + private: + std::shared_ptr<Module> boss; + + u8 new_arrival_flag; + u8 ns_data_new_flag; + u8 ns_data_new_flag_privileged; + u8 output_flag; + }; + +private: + Kernel::SharedPtr<Kernel::Event> task_finish_event; +}; + +void InstallInterfaces(SM::ServiceManager& service_manager); } // namespace BOSS } // namespace Service diff --git a/src/core/hle/service/boss/boss_p.cpp b/src/core/hle/service/boss/boss_p.cpp index 3990d0d6e..ceb0aa5a6 100644 --- a/src/core/hle/service/boss/boss_p.cpp +++ b/src/core/hle/service/boss/boss_p.cpp @@ -2,84 +2,86 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/boss/boss.h" #include "core/hle/service/boss/boss_p.h" namespace Service { namespace BOSS { -const Interface::FunctionInfo FunctionTable[] = { - // boss:u shared commands - {0x00010082, InitializeSession, "InitializeSession"}, - {0x00020100, RegisterStorage, "RegisterStorage"}, - {0x00030000, UnregisterStorage, "UnregisterStorage"}, - {0x00040000, GetStorageInfo, "GetStorageInfo"}, - {0x00050042, RegisterPrivateRootCa, "RegisterPrivateRootCa"}, - {0x00060084, RegisterPrivateClientCert, "RegisterPrivateClientCert"}, - {0x00070000, GetNewArrivalFlag, "GetNewArrivalFlag"}, - {0x00080002, RegisterNewArrivalEvent, "RegisterNewArrivalEvent"}, - {0x00090040, SetOptoutFlag, "SetOptoutFlag"}, - {0x000A0000, GetOptoutFlag, "GetOptoutFlag"}, - {0x000B00C2, RegisterTask, "RegisterTask"}, - {0x000C0082, UnregisterTask, "UnregisterTask"}, - {0x000D0082, ReconfigureTask, "ReconfigureTask"}, - {0x000E0000, GetTaskIdList, "GetTaskIdList"}, - {0x000F0042, GetStepIdList, "GetStepIdList"}, - {0x00100102, GetNsDataIdList, "GetNsDataIdList"}, - {0x00110102, GetOwnNsDataIdList, "GetOwnNsDataIdList"}, - {0x00120102, GetNewDataNsDataIdList, "GetNewDataNsDataIdList"}, - {0x00130102, GetOwnNewDataNsDataIdList, "GetOwnNewDataNsDataIdList"}, - {0x00140082, SendProperty, "SendProperty"}, - {0x00150042, SendPropertyHandle, "SendPropertyHandle"}, - {0x00160082, ReceiveProperty, "ReceiveProperty"}, - {0x00170082, UpdateTaskInterval, "UpdateTaskInterval"}, - {0x00180082, UpdateTaskCount, "UpdateTaskCount"}, - {0x00190042, GetTaskInterval, "GetTaskInterval"}, - {0x001A0042, GetTaskCount, "GetTaskCount"}, - {0x001B0042, GetTaskServiceStatus, "GetTaskServiceStatus"}, - {0x001C0042, StartTask, "StartTask"}, - {0x001D0042, StartTaskImmediate, "StartTaskImmediate"}, - {0x001E0042, CancelTask, "CancelTask"}, - {0x001F0000, GetTaskFinishHandle, "GetTaskFinishHandle"}, - {0x00200082, GetTaskState, "GetTaskState"}, - {0x00210042, GetTaskResult, "GetTaskResult"}, - {0x00220042, GetTaskCommErrorCode, "GetTaskCommErrorCode"}, - {0x002300C2, GetTaskStatus, "GetTaskStatus"}, - {0x00240082, GetTaskError, "GetTaskError"}, - {0x00250082, GetTaskInfo, "GetTaskInfo"}, - {0x00260040, DeleteNsData, "DeleteNsData"}, - {0x002700C2, GetNsDataHeaderInfo, "GetNsDataHeaderInfo"}, - {0x00280102, ReadNsData, "ReadNsData"}, - {0x00290080, SetNsDataAdditionalInfo, "SetNsDataAdditionalInfo"}, - {0x002A0040, GetNsDataAdditionalInfo, "GetNsDataAdditionalInfo"}, - {0x002B0080, SetNsDataNewFlag, "SetNsDataNewFlag"}, - {0x002C0040, GetNsDataNewFlag, "GetNsDataNewFlag"}, - {0x002D0040, GetNsDataLastUpdate, "GetNsDataLastUpdate"}, - {0x002E0040, GetErrorCode, "GetErrorCode"}, - {0x002F0140, RegisterStorageEntry, "RegisterStorageEntry"}, - {0x00300000, GetStorageEntryInfo, "GetStorageEntryInfo"}, - {0x00310100, SetStorageOption, "SetStorageOption"}, - {0x00320000, GetStorageOption, "GetStorageOption"}, - {0x00330042, StartBgImmediate, "StartBgImmediate"}, - {0x00340042, GetTaskActivePriority, "GetTaskActivePriority"}, - {0x003500C2, RegisterImmediateTask, "RegisterImmediateTask"}, - {0x00360084, SetTaskQuery, "SetTaskQuery"}, - {0x00370084, GetTaskQuery, "GetTaskQuery"}, - // boss:p - {0x04010082, nullptr, "InitializeSessionPrivileged"}, - {0x04040080, nullptr, "GetAppNewFlag"}, - {0x040D0182, nullptr, "GetNsDataIdListPrivileged"}, - {0x040E0182, nullptr, "GetNsDataIdListPrivileged1"}, - {0x04130082, nullptr, "SendPropertyPrivileged"}, - {0x041500C0, nullptr, "DeleteNsDataPrivileged"}, - {0x04160142, nullptr, "GetNsDataHeaderInfoPrivileged"}, - {0x04170182, nullptr, "ReadNsDataPrivileged"}, - {0x041A0100, nullptr, "SetNsDataNewFlagPrivileged"}, - {0x041B00C0, nullptr, "GetNsDataNewFlagPrivileged"}, -}; +BOSS_P::BOSS_P(std::shared_ptr<Module> boss) + : Module::Interface(std::move(boss), "boss:P", DefaultMaxSessions) { + static const FunctionInfo functions[] = { + // boss:u shared commands + // clang-format off + {0x00010082, &BOSS_P::InitializeSession, "InitializeSession"}, + {0x00020100, &BOSS_P::SetStorageInfo, "RegisterStorage"}, + {0x00030000, &BOSS_P::UnregisterStorage, "UnregisterStorage"}, + {0x00040000, &BOSS_P::GetStorageInfo, "GetStorageInfo"}, + {0x00050042, &BOSS_P::RegisterPrivateRootCa, "RegisterPrivateRootCa"}, + {0x00060084, &BOSS_P::RegisterPrivateClientCert, "RegisterPrivateClientCert"}, + {0x00070000, &BOSS_P::GetNewArrivalFlag, "GetNewArrivalFlag"}, + {0x00080002, &BOSS_P::RegisterNewArrivalEvent, "RegisterNewArrivalEvent"}, + {0x00090040, &BOSS_P::SetOptoutFlag, "SetOptoutFlag"}, + {0x000A0000, &BOSS_P::GetOptoutFlag, "GetOptoutFlag"}, + {0x000B00C2, &BOSS_P::RegisterTask, "RegisterTask"}, + {0x000C0082, &BOSS_P::UnregisterTask, "UnregisterTask"}, + {0x000D0082, &BOSS_P::ReconfigureTask, "ReconfigureTask"}, + {0x000E0000, &BOSS_P::GetTaskIdList, "GetTaskIdList"}, + {0x000F0042, &BOSS_P::GetStepIdList, "GetStepIdList"}, + {0x00100102, &BOSS_P::GetNsDataIdList, "GetNsDataIdList"}, + {0x00110102, &BOSS_P::GetNsDataIdList1, "GetNsDataIdList1"}, + {0x00120102, &BOSS_P::GetNsDataIdList2, "GetNsDataIdList2"}, + {0x00130102, &BOSS_P::GetNsDataIdList3, "GetNsDataIdList3"}, + {0x00140082, &BOSS_P::SendProperty, "SendProperty"}, + {0x00150042, &BOSS_P::SendPropertyHandle, "SendPropertyHandle"}, + {0x00160082, &BOSS_P::ReceiveProperty, "ReceiveProperty"}, + {0x00170082, &BOSS_P::UpdateTaskInterval, "UpdateTaskInterval"}, + {0x00180082, &BOSS_P::UpdateTaskCount, "UpdateTaskCount"}, + {0x00190042, &BOSS_P::GetTaskInterval, "GetTaskInterval"}, + {0x001A0042, &BOSS_P::GetTaskCount, "GetTaskCount"}, + {0x001B0042, &BOSS_P::GetTaskServiceStatus, "GetTaskServiceStatus"}, + {0x001C0042, &BOSS_P::StartTask, "StartTask"}, + {0x001D0042, &BOSS_P::StartTaskImmediate, "StartTaskImmediate"}, + {0x001E0042, &BOSS_P::CancelTask, "CancelTask"}, + {0x001F0000, &BOSS_P::GetTaskFinishHandle, "GetTaskFinishHandle"}, + {0x00200082, &BOSS_P::GetTaskState, "GetTaskState"}, + {0x00210042, &BOSS_P::GetTaskResult, "GetTaskResult"}, + {0x00220042, &BOSS_P::GetTaskCommErrorCode, "GetTaskCommErrorCode"}, + {0x002300C2, &BOSS_P::GetTaskStatus, "GetTaskStatus"}, + {0x00240082, &BOSS_P::GetTaskError, "GetTaskError"}, + {0x00250082, &BOSS_P::GetTaskInfo, "GetTaskInfo"}, + {0x00260040, &BOSS_P::DeleteNsData, "DeleteNsData"}, + {0x002700C2, &BOSS_P::GetNsDataHeaderInfo, "GetNsDataHeaderInfo"}, + {0x00280102, &BOSS_P::ReadNsData, "ReadNsData"}, + {0x00290080, &BOSS_P::SetNsDataAdditionalInfo, "SetNsDataAdditionalInfo"}, + {0x002A0040, &BOSS_P::GetNsDataAdditionalInfo, "GetNsDataAdditionalInfo"}, + {0x002B0080, &BOSS_P::SetNsDataNewFlag, "SetNsDataNewFlag"}, + {0x002C0040, &BOSS_P::GetNsDataNewFlag, "GetNsDataNewFlag"}, + {0x002D0040, &BOSS_P::GetNsDataLastUpdate, "GetNsDataLastUpdate"}, + {0x002E0040, &BOSS_P::GetErrorCode, "GetErrorCode"}, + {0x002F0140, &BOSS_P::RegisterStorageEntry, "RegisterStorageEntry"}, + {0x00300000, &BOSS_P::GetStorageEntryInfo, "GetStorageEntryInfo"}, + {0x00310100, &BOSS_P::SetStorageOption, "SetStorageOption"}, + {0x00320000, &BOSS_P::GetStorageOption, "GetStorageOption"}, + {0x00330042, &BOSS_P::StartBgImmediate, "StartBgImmediate"}, + {0x00340042, &BOSS_P::GetTaskProperty0, "GetTaskProperty0"}, + {0x003500C2, &BOSS_P::RegisterImmediateTask, "RegisterImmediateTask"}, + {0x00360084, &BOSS_P::SetTaskQuery, "SetTaskQuery"}, + {0x00370084, &BOSS_P::GetTaskQuery, "GetTaskQuery"}, + // boss:p + {0x04010082, &BOSS_P::InitializeSessionPrivileged, "InitializeSessionPrivileged"}, + {0x04040080, &BOSS_P::GetAppNewFlag, "GetAppNewFlag"}, + {0x040D0182, &BOSS_P::GetNsDataIdListPrivileged, "GetNsDataIdListPrivileged"}, + {0x040E0182, &BOSS_P::GetNsDataIdListPrivileged1, "GetNsDataIdListPrivileged1"}, + {0x04130082, &BOSS_P::SendPropertyPrivileged, "SendPropertyPrivileged"}, + {0x041500C0, &BOSS_P::DeleteNsDataPrivileged, "DeleteNsDataPrivileged"}, + {0x04160142, &BOSS_P::GetNsDataHeaderInfoPrivileged, "GetNsDataHeaderInfoPrivileged"}, + {0x04170182, &BOSS_P::ReadNsDataPrivileged, "ReadNsDataPrivileged"}, + {0x041A0100, &BOSS_P::SetNsDataNewFlagPrivileged, "SetNsDataNewFlagPrivileged"}, + {0x041B00C0, &BOSS_P::GetNsDataNewFlagPrivileged, "GetNsDataNewFlagPrivileged"}, + // clang-format on + }; -BOSS_P_Interface::BOSS_P_Interface() { - Register(FunctionTable); + RegisterHandlers(functions); } } // namespace BOSS diff --git a/src/core/hle/service/boss/boss_p.h b/src/core/hle/service/boss/boss_p.h index 32112c251..09632d58b 100644 --- a/src/core/hle/service/boss/boss_p.h +++ b/src/core/hle/service/boss/boss_p.h @@ -4,18 +4,14 @@ #pragma once -#include "core/hle/service/service.h" +#include "core/hle/service/boss/boss.h" namespace Service { namespace BOSS { -class BOSS_P_Interface : public Service::Interface { +class BOSS_P final : public Module::Interface { public: - BOSS_P_Interface(); - - std::string GetPortName() const override { - return "boss:P"; - } + explicit BOSS_P(std::shared_ptr<Module> boss); }; } // namespace BOSS diff --git a/src/core/hle/service/boss/boss_u.cpp b/src/core/hle/service/boss/boss_u.cpp index 371d702e0..fb7eacc81 100644 --- a/src/core/hle/service/boss/boss_u.cpp +++ b/src/core/hle/service/boss/boss_u.cpp @@ -2,72 +2,74 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/boss/boss.h" #include "core/hle/service/boss/boss_u.h" namespace Service { namespace BOSS { -const Interface::FunctionInfo FunctionTable[] = { - {0x00010082, InitializeSession, "InitializeSession"}, - {0x00020100, RegisterStorage, "RegisterStorage"}, - {0x00030000, UnregisterStorage, "UnregisterStorage"}, - {0x00040000, GetStorageInfo, "GetStorageInfo"}, - {0x00050042, RegisterPrivateRootCa, "RegisterPrivateRootCa"}, - {0x00060084, RegisterPrivateClientCert, "RegisterPrivateClientCert"}, - {0x00070000, GetNewArrivalFlag, "GetNewArrivalFlag"}, - {0x00080002, RegisterNewArrivalEvent, "RegisterNewArrivalEvent"}, - {0x00090040, SetOptoutFlag, "SetOptoutFlag"}, - {0x000A0000, GetOptoutFlag, "GetOptoutFlag"}, - {0x000B00C2, RegisterTask, "RegisterTask"}, - {0x000C0082, UnregisterTask, "UnregisterTask"}, - {0x000D0082, ReconfigureTask, "ReconfigureTask"}, - {0x000E0000, GetTaskIdList, "GetTaskIdList"}, - {0x000F0042, GetStepIdList, "GetStepIdList"}, - {0x00100102, GetNsDataIdList, "GetNsDataIdList"}, - {0x00110102, GetOwnNsDataIdList, "GetOwnNsDataIdList"}, - {0x00120102, GetNewDataNsDataIdList, "GetNewDataNsDataIdList"}, - {0x00130102, GetOwnNewDataNsDataIdList, "GetOwnNewDataNsDataIdList"}, - {0x00140082, SendProperty, "SendProperty"}, - {0x00150042, SendPropertyHandle, "SendPropertyHandle"}, - {0x00160082, ReceiveProperty, "ReceiveProperty"}, - {0x00170082, UpdateTaskInterval, "UpdateTaskInterval"}, - {0x00180082, UpdateTaskCount, "UpdateTaskCount"}, - {0x00190042, GetTaskInterval, "GetTaskInterval"}, - {0x001A0042, GetTaskCount, "GetTaskCount"}, - {0x001B0042, GetTaskServiceStatus, "GetTaskServiceStatus"}, - {0x001C0042, StartTask, "StartTask"}, - {0x001D0042, StartTaskImmediate, "StartTaskImmediate"}, - {0x001E0042, CancelTask, "CancelTask"}, - {0x001F0000, GetTaskFinishHandle, "GetTaskFinishHandle"}, - {0x00200082, GetTaskState, "GetTaskState"}, - {0x00210042, GetTaskResult, "GetTaskResult"}, - {0x00220042, GetTaskCommErrorCode, "GetTaskCommErrorCode"}, - {0x002300C2, GetTaskStatus, "GetTaskStatus"}, - {0x00240082, GetTaskError, "GetTaskError"}, - {0x00250082, GetTaskInfo, "GetTaskInfo"}, - {0x00260040, DeleteNsData, "DeleteNsData"}, - {0x002700C2, GetNsDataHeaderInfo, "GetNsDataHeaderInfo"}, - {0x00280102, ReadNsData, "ReadNsData"}, - {0x00290080, SetNsDataAdditionalInfo, "SetNsDataAdditionalInfo"}, - {0x002A0040, GetNsDataAdditionalInfo, "GetNsDataAdditionalInfo"}, - {0x002B0080, SetNsDataNewFlag, "SetNsDataNewFlag"}, - {0x002C0040, GetNsDataNewFlag, "GetNsDataNewFlag"}, - {0x002D0040, GetNsDataLastUpdate, "GetNsDataLastUpdate"}, - {0x002E0040, GetErrorCode, "GetErrorCode"}, - {0x002F0140, RegisterStorageEntry, "RegisterStorageEntry"}, - {0x00300000, GetStorageEntryInfo, "GetStorageEntryInfo"}, - {0x00310100, SetStorageOption, "SetStorageOption"}, - {0x00320000, GetStorageOption, "GetStorageOption"}, - {0x00330042, StartBgImmediate, "StartBgImmediate"}, - {0x00340042, GetTaskActivePriority, "GetTaskActivePriority"}, - {0x003500C2, RegisterImmediateTask, "RegisterImmediateTask"}, - {0x00360084, SetTaskQuery, "SetTaskQuery"}, - {0x00370084, GetTaskQuery, "GetTaskQuery"}, -}; +BOSS_U::BOSS_U(std::shared_ptr<Module> boss) + : Module::Interface(std::move(boss), "boss:U", DefaultMaxSessions) { + static const FunctionInfo functions[] = { + // clang-format off + {0x00010082, &BOSS_U::InitializeSession, "InitializeSession"}, + {0x00020100, &BOSS_U::SetStorageInfo, "SetStorageInfo"}, + {0x00030000, &BOSS_U::UnregisterStorage, "UnregisterStorage"}, + {0x00040000, &BOSS_U::GetStorageInfo, "GetStorageInfo"}, + {0x00050042, &BOSS_U::RegisterPrivateRootCa, "RegisterPrivateRootCa"}, + {0x00060084, &BOSS_U::RegisterPrivateClientCert, "RegisterPrivateClientCert"}, + {0x00070000, &BOSS_U::GetNewArrivalFlag, "GetNewArrivalFlag"}, + {0x00080002, &BOSS_U::RegisterNewArrivalEvent, "RegisterNewArrivalEvent"}, + {0x00090040, &BOSS_U::SetOptoutFlag, "SetOptoutFlag"}, + {0x000A0000, &BOSS_U::GetOptoutFlag, "GetOptoutFlag"}, + {0x000B00C2, &BOSS_U::RegisterTask, "RegisterTask"}, + {0x000C0082, &BOSS_U::UnregisterTask, "UnregisterTask"}, + {0x000D0082, &BOSS_U::ReconfigureTask, "ReconfigureTask"}, + {0x000E0000, &BOSS_U::GetTaskIdList, "GetTaskIdList"}, + {0x000F0042, &BOSS_U::GetStepIdList, "GetStepIdList"}, + {0x00100102, &BOSS_U::GetNsDataIdList, "GetNsDataIdList"}, + {0x00110102, &BOSS_U::GetNsDataIdList1, "GetNsDataIdList1"}, + {0x00120102, &BOSS_U::GetNsDataIdList2, "GetNsDataIdList2"}, + {0x00130102, &BOSS_U::GetNsDataIdList3, "GetNsDataIdList3"}, + {0x00140082, &BOSS_U::SendProperty, "SendProperty"}, + {0x00150042, &BOSS_U::SendPropertyHandle, "SendPropertyHandle"}, + {0x00160082, &BOSS_U::ReceiveProperty, "ReceiveProperty"}, + {0x00170082, &BOSS_U::UpdateTaskInterval, "UpdateTaskInterval"}, + {0x00180082, &BOSS_U::UpdateTaskCount, "UpdateTaskCount"}, + {0x00190042, &BOSS_U::GetTaskInterval, "GetTaskInterval"}, + {0x001A0042, &BOSS_U::GetTaskCount, "GetTaskCount"}, + {0x001B0042, &BOSS_U::GetTaskServiceStatus, "GetTaskServiceStatus"}, + {0x001C0042, &BOSS_U::StartTask, "StartTask"}, + {0x001D0042, &BOSS_U::StartTaskImmediate, "StartTaskImmediate"}, + {0x001E0042, &BOSS_U::CancelTask, "CancelTask"}, + {0x001F0000, &BOSS_U::GetTaskFinishHandle, "GetTaskFinishHandle"}, + {0x00200082, &BOSS_U::GetTaskState, "GetTaskState"}, + {0x00210042, &BOSS_U::GetTaskResult, "GetTaskResult"}, + {0x00220042, &BOSS_U::GetTaskCommErrorCode, "GetTaskCommErrorCode"}, + {0x002300C2, &BOSS_U::GetTaskStatus, "GetTaskStatus"}, + {0x00240082, &BOSS_U::GetTaskError, "GetTaskError"}, + {0x00250082, &BOSS_U::GetTaskInfo, "GetTaskInfo"}, + {0x00260040, &BOSS_U::DeleteNsData, "DeleteNsData"}, + {0x002700C2, &BOSS_U::GetNsDataHeaderInfo, "GetNsDataHeaderInfo"}, + {0x00280102, &BOSS_U::ReadNsData, "ReadNsData"}, + {0x00290080, &BOSS_U::SetNsDataAdditionalInfo, "SetNsDataAdditionalInfo"}, + {0x002A0040, &BOSS_U::GetNsDataAdditionalInfo, "GetNsDataAdditionalInfo"}, + {0x002B0080, &BOSS_U::SetNsDataNewFlag, "SetNsDataNewFlag"}, + {0x002C0040, &BOSS_U::GetNsDataNewFlag, "GetNsDataNewFlag"}, + {0x002D0040, &BOSS_U::GetNsDataLastUpdate, "GetNsDataLastUpdate"}, + {0x002E0040, &BOSS_U::GetErrorCode, "GetErrorCode"}, + {0x002F0140, &BOSS_U::RegisterStorageEntry, "RegisterStorageEntry"}, + {0x00300000, &BOSS_U::GetStorageEntryInfo, "GetStorageEntryInfo"}, + {0x00310100, &BOSS_U::SetStorageOption, "SetStorageOption"}, + {0x00320000, &BOSS_U::GetStorageOption, "GetStorageOption"}, + {0x00330042, &BOSS_U::StartBgImmediate, "StartBgImmediate"}, + {0x00340042, &BOSS_U::GetTaskProperty0, "GetTaskProperty0"}, + {0x003500C2, &BOSS_U::RegisterImmediateTask, "RegisterImmediateTask"}, + {0x00360084, &BOSS_U::SetTaskQuery, "SetTaskQuery"}, + {0x00370084, &BOSS_U::GetTaskQuery, "GetTaskQuery"}, + // clang-format on + }; -BOSS_U_Interface::BOSS_U_Interface() { - Register(FunctionTable); + RegisterHandlers(functions); } } // namespace BOSS diff --git a/src/core/hle/service/boss/boss_u.h b/src/core/hle/service/boss/boss_u.h index d047d8cf2..9f8065606 100644 --- a/src/core/hle/service/boss/boss_u.h +++ b/src/core/hle/service/boss/boss_u.h @@ -4,18 +4,14 @@ #pragma once -#include "core/hle/service/service.h" +#include "core/hle/service/boss/boss.h" namespace Service { namespace BOSS { -class BOSS_U_Interface : public Service::Interface { +class BOSS_U final : public Module::Interface { public: - BOSS_U_Interface(); - - std::string GetPortName() const override { - return "boss:U"; - } + explicit BOSS_U(std::shared_ptr<Module> boss); }; } // namespace BOSS diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index efa258e08..faaeeefd0 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -239,7 +239,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { ACT::InstallInterfaces(*sm); AM::InstallInterfaces(*sm); APT::InstallInterfaces(*sm); - BOSS::Init(); + BOSS::InstallInterfaces(*sm); CAM::InstallInterfaces(*sm); CECD::InstallInterfaces(*sm); CFG::InstallInterfaces(*sm); @@ -269,7 +269,6 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) { /// Shutdown ServiceManager void Shutdown() { - BOSS::Shutdown(); FS::ArchiveShutdown(); g_kernel_named_ports.clear();