From 25e7209d5cf33473dec828aef8f1e3da70bc65a3 Mon Sep 17 00:00:00 2001 From: NarcolepticK Date: Sat, 25 Aug 2018 02:31:01 -0400 Subject: [PATCH] service/cecd: Updated function names --- src/core/hle/service/cecd/cecd.cpp | 38 ++++++++++++------ src/core/hle/service/cecd/cecd.h | 59 ++++++++++++++-------------- src/core/hle/service/cecd/cecd_s.cpp | 17 ++++---- src/core/hle/service/cecd/cecd_u.cpp | 16 ++++---- 4 files changed, 73 insertions(+), 57 deletions(-) diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index ede743bea..6a88e16dd 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -74,7 +74,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) { std::vector entries(max_entries); const u32 entry_count = directory->backend->Read(max_entries, entries.data()); - LOG_DEBUG(Service_CECD, "Number of entries found in = {}", entry_count); + LOG_DEBUG(Service_CECD, "Number of entries found: {}", entry_count); rb.Push(RESULT_SUCCESS); rb.Push(entry_count); /// Entry count @@ -114,7 +114,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) { open_mode.check); } -void Module::Interface::ReadFile(Kernel::HLERequestContext& ctx) { +void Module::Interface::Read(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x02, 1, 2); const u32 write_buffer_size = rp.Pop(); auto& write_buffer = rp.PopMappedBuffer(); @@ -267,7 +267,7 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) { ncch_program_id, is_outbox, message_id_size, buffer_size); } -void Module::Interface::WriteFile(Kernel::HLERequestContext& ctx) { +void Module::Interface::Write(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x05, 1, 2); const u32 read_buffer_size = rp.Pop(); auto& read_buffer = rp.PopMappedBuffer(); @@ -476,7 +476,7 @@ void Module::Interface::Delete(Kernel::HLERequestContext& ctx) { /// DeleteMessa message_id_size); } -void Module::Interface::Cecd_0x000900C2(Kernel::HLERequestContext& ctx) { /// Update Index/List? +void Module::Interface::SetData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x09, 3, 2); const u32 ncch_program_id = rp.Pop(); const u32 buffer_size = rp.Pop(); @@ -484,7 +484,7 @@ void Module::Interface::Cecd_0x000900C2(Kernel::HLERequestContext& ctx) { /// Up auto& message_id_buffer = rp.PopMappedBuffer(); if (buffer_size > 0) { - FileSys::Path path("/Cecd_0x000900C2.out"); + FileSys::Path path("/SetData.out"); FileSys::Mode mode; mode.write_flag.Assign(1); mode.create_flag.Assign(1); @@ -503,7 +503,7 @@ void Module::Interface::Cecd_0x000900C2(Kernel::HLERequestContext& ctx) { /// Up SessionData* session_data = GetSessionData(ctx.Session()); if (session_data->file) - LOG_DEBUG( + LOG_TRACE( Service_CECD, "SessionData: ncch_program_id={:#010x}, data_path_type={:#04x}, " "path={}, open_mode: raw={:#x}, unknown={}, read={}, write={}, create={}, check={}", @@ -524,7 +524,7 @@ void Module::Interface::Cecd_0x000900C2(Kernel::HLERequestContext& ctx) { /// Up ncch_program_id, buffer_size, option); } -void Module::Interface::GetSystemInfo(Kernel::HLERequestContext& ctx) { +void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0A, 3, 4); const u32 dest_buffer_size = rp.Pop(); const CecSystemInfoType info_type = rp.PopEnum(); @@ -561,7 +561,7 @@ void Module::Interface::GetSystemInfo(Kernel::HLERequestContext& ctx) { dest_buffer_size, static_cast(info_type), param_buffer_size); } -void Module::Interface::RunCommand(Kernel::HLERequestContext& ctx) { +void Module::Interface::Start(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0B, 1, 0); const CecCommand command = rp.PopEnum(); @@ -571,7 +571,7 @@ void Module::Interface::RunCommand(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command)); } -void Module::Interface::RunCommandAlt(Kernel::HLERequestContext& ctx) { +void Module::Interface::Stop(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0C, 1, 0); const CecCommand command = rp.PopEnum(); @@ -581,12 +581,26 @@ void Module::Interface::RunCommandAlt(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_CECD, "(STUBBED) called, command={}", cecd->GetCecCommandAsString(command)); } -void Module::Interface::GetCecStateAbbreviated(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetCecInfoBuffer(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x0D, 2, 2); + const u32 buffer_size = rp.Pop(); + const u32 possible_info_type = rp.Pop(); + auto& buffer = rp.PopMappedBuffer(); + + IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); + rb.Push(RESULT_SUCCESS); + rb.PushMappedBuffer(buffer); + + LOG_DEBUG(Service_CECD, "called, buffer_size={}, possible_info_type={}", buffer_size, + possible_info_type); +} + +void Module::Interface::GetCecdState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0E, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); - rb.PushEnum(CecStateAbbreviated::CEC_STATE_ABBREV_IDLE); + rb.PushEnum(CecdState::NDM_STATUS_IDLE); LOG_WARNING(Service_CECD, "(STUBBED) called"); } @@ -916,7 +930,7 @@ void Module::CheckAndUpdateFile(const CecDataPathType path_type, const u32 ncch_ const u32 entry_count = root_dir->backend->Read(max_num_boxes + 1, entries.data()); root_dir->backend->Close(); - LOG_DEBUG(Service_CECD, "Number of entries found in /CEC = {}", entry_count); + LOG_DEBUG(Service_CECD, "Number of entries found in /CEC: {}", entry_count); std::string mbox_list_name("MBoxList____"); std::string file_name; diff --git a/src/core/hle/service/cecd/cecd.h b/src/core/hle/service/cecd/cecd.h index 0fbda5da2..6e9dbe05d 100644 --- a/src/core/hle/service/cecd/cecd.h +++ b/src/core/hle/service/cecd/cecd.h @@ -97,15 +97,6 @@ public: CEC_STATE_IDLE = 26 }; - /// Need to confirm if CecStateAbbreviated is up-to-date and valid - enum class CecStateAbbreviated : u32 { - CEC_STATE_ABBREV_IDLE = 1, /// Relates to CEC_STATE_IDLE - CEC_STATE_ABBREV_NOT_LOCAL = 2, /// Relates to CEC_STATEs *FINISH*, *POST, and OVER_BOSS - CEC_STATE_ABBREV_SCANNING = 3, /// Relates to CEC_STATE_SCANNING - CEC_STATE_ABBREV_WLREADY = 4, /// Relates to CEC_STATE_WIRELESS_READY when a bool is true - CEC_STATE_ABBREV_OTHER = 5, /// Relates to CEC_STATEs besides *FINISH*, *POST, and - }; /// OVER_BOSS and those listed here - enum class CecSystemInfoType : u32 { EulaVersion = 1, Eula = 2, ParentControl = 3 }; struct CecInOutBoxInfoHeader { @@ -202,7 +193,7 @@ public: }; static_assert(sizeof(CecOBIndexHeader) == 0x08, "CecOBIndexHeader struct has incorrect size."); - enum class CecNdmStatus : u32 { + enum class CecdState : u32 { NDM_STATUS_WORKING = 0, NDM_STATUS_IDLE = 1, NDM_STATUS_SUSPENDING = 2, @@ -265,7 +256,7 @@ public: void Open(Kernel::HLERequestContext& ctx); /** - * CECD::ReadFile service function + * CECD::Read service function * Inputs: * 0 : Header Code[0x00020042] * 1 : Buffer size (unused) @@ -277,7 +268,7 @@ public: * 3 : Descriptor for mapping a write-only buffer in the target process * 4 : Buffer address */ - void ReadFile(Kernel::HLERequestContext& ctx); + void Read(Kernel::HLERequestContext& ctx); /** * CECD::ReadMessage service function @@ -328,7 +319,7 @@ public: void ReadMessageWithHMAC(Kernel::HLERequestContext& ctx); /** - * CECD::WriteFile service function + * CECD::Write service function * Inputs: * 0 : Header Code[0x00050042] * 1 : Buffer size(unused) @@ -339,7 +330,7 @@ public: * 2 : Descriptor for mapping a read-only buffer in the target process * 3 : Buffer address */ - void WriteFile(Kernel::HLERequestContext& ctx); + void Write(Kernel::HLERequestContext& ctx); /** * CECD::WriteMessage service function @@ -405,7 +396,7 @@ public: void Delete(Kernel::HLERequestContext& ctx); /** - * CECD::Cecd_0x000900C2 service function + * CECD::SetData service function * Inputs: * 0 : Header Code[0x000900C2] * 1 : NCCH Program ID @@ -418,10 +409,10 @@ public: * 2 : Descriptor for mapping a read-only buffer in the target process * 3 : Message ID address */ - void Cecd_0x000900C2(Kernel::HLERequestContext& ctx); + void SetData(Kernel::HLERequestContext& ctx); /** - * CECD::GetSystemInfo service function + * CECD::ReadData service function * Inputs: * 0 : Header Code[0x000A00C4] * 1 : Destination buffer size (unused) @@ -438,51 +429,51 @@ public: * 4 : Descriptor for mapping a write-only buffer in the target process * 5 : Destination buffer address */ - void GetSystemInfo(Kernel::HLERequestContext& ctx); + void ReadData(Kernel::HLERequestContext& ctx); /** - * CECD::RunCommand service function + * CECD::Start service function * Inputs: * 0 : Header Code[0x000B0040] * 1 : Command * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ - void RunCommand(Kernel::HLERequestContext& ctx); + void Start(Kernel::HLERequestContext& ctx); /** - * CECD::RunCommandAlt service function + * CECD::Stop service function * Inputs: * 0 : Header Code[0x000C0040] * 1 : Command * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ - void RunCommandAlt(Kernel::HLERequestContext& ctx); + void Stop(Kernel::HLERequestContext& ctx); /** * CECD::GetCecInfoBuffer service function * Inputs: * 0 : Header Code[0x000D0082] * 1 : unknown - * 2 : unknown - * 3 : buffer descriptor - * 4 : buffer address + * 2 : unknown, buffer size? + * 3 : Descriptor for mapping a write-only buffer in the target process + * 4 : Destination buffer address * Outputs: * 1 : Result of function, 0 on success, otherwise error code - * 2 : + * 2-3 : MappedBuffer */ void GetCecInfoBuffer(Kernel::HLERequestContext& ctx); /** - * GetCecStateAbbreviated service function + * GetCecdState service function * Inputs: * 0: Header Code[0x000E0000] * Outputs: * 1: ResultCode - * 2: CecStateAbbreviated + * 2: CecdState */ - void GetCecStateAbbreviated(Kernel::HLERequestContext& ctx); + void GetCecdState(Kernel::HLERequestContext& ctx); /** * GetCecInfoEventHandle service function @@ -567,6 +558,16 @@ public: */ void GetEventLogStart(Kernel::HLERequestContext& ctx); + /** + * GetCecInfoEventHandleSys service function + * Inputs: + * 0: Header Code[0x40020002] + * Outputs: + * 1: ResultCode + * 3: Event Handle + */ + void GetCecInfoEventHandleSys(Kernel::HLERequestContext& ctx); + private: std::shared_ptr cecd; }; diff --git a/src/core/hle/service/cecd/cecd_s.cpp b/src/core/hle/service/cecd/cecd_s.cpp index a83f9c357..f84d90450 100644 --- a/src/core/hle/service/cecd/cecd_s.cpp +++ b/src/core/hle/service/cecd/cecd_s.cpp @@ -13,25 +13,26 @@ CECD_S::CECD_S(std::shared_ptr cecd) // cecd:u shared commands // clang-format off {0x000100C2, &CECD_S::Open, "Open"}, - {0x00020042, &CECD_S::ReadFile, "ReadFile"}, + {0x00020042, &CECD_S::Read, "Read"}, {0x00030104, &CECD_S::ReadMessage, "ReadMessage"}, {0x00040106, &CECD_S::ReadMessageWithHMAC, "ReadMessageWithHMAC"}, - {0x00050042, &CECD_S::WriteFile, "WriteFile"}, + {0x00050042, &CECD_S::Write, "Write"}, {0x00060104, &CECD_S::WriteMessage, "WriteMessage"}, {0x00070106, &CECD_S::WriteMessageWithHMAC, "WriteMessageWithHMAC"}, {0x00080102, &CECD_S::Delete, "Delete"}, - {0x000900C2, &CECD_S::Cecd_0x000900C2, "Cecd_0x000900C2"}, - {0x000A00C4, &CECD_S::GetSystemInfo, "GetSystemInfo"}, - {0x000B0040, &CECD_S::RunCommand, "RunCommand"}, - {0x000C0040, &CECD_S::RunCommandAlt, "RunCommandAlt"}, - {0x000D0082, nullptr, "GetCecInfoBuffer"}, - {0x000E0000, &CECD_S::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, + {0x000900C2, &CECD_S::SetData, "SetData"}, + {0x000A00C4, &CECD_S::ReadData, "ReadData"}, + {0x000B0040, &CECD_S::Start, "Start"}, + {0x000C0040, &CECD_S::Stop, "Stop"}, + {0x000D0082, &CECD_S::GetCecInfoBuffer, "GetCecInfoBuffer"}, + {0x000E0000, &CECD_S::GetCecdState, "GetCecdState"}, {0x000F0000, &CECD_S::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, {0x00100000, &CECD_S::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, {0x00110104, &CECD_S::OpenAndWrite, "OpenAndWrite"}, {0x00120104, &CECD_S::OpenAndRead, "OpenAndRead"}, {0x001E0082, nullptr, "GetEventLog"}, {0x001F0000, nullptr, "GetEventLogStart"}, + {0x40020002, nullptr, "GetCecInfoEventHandleSys"}, // clang-format on }; diff --git a/src/core/hle/service/cecd/cecd_u.cpp b/src/core/hle/service/cecd/cecd_u.cpp index a580872f0..0f721796a 100644 --- a/src/core/hle/service/cecd/cecd_u.cpp +++ b/src/core/hle/service/cecd/cecd_u.cpp @@ -13,19 +13,19 @@ CECD_U::CECD_U(std::shared_ptr cecd) // cecd:u shared commands // clang-format off {0x000100C2, &CECD_U::Open, "Open"}, - {0x00020042, &CECD_U::ReadFile, "ReadFile"}, + {0x00020042, &CECD_U::Read, "Read"}, {0x00030104, &CECD_U::ReadMessage, "ReadMessage"}, {0x00040106, &CECD_U::ReadMessageWithHMAC, "ReadMessageWithHMAC"}, - {0x00050042, &CECD_U::WriteFile, "WriteFile"}, + {0x00050042, &CECD_U::Write, "Write"}, {0x00060104, &CECD_U::WriteMessage, "WriteMessage"}, {0x00070106, &CECD_U::WriteMessageWithHMAC, "WriteMessageWithHMAC"}, {0x00080102, &CECD_U::Delete, "Delete"}, - {0x000900C2, &CECD_U::Cecd_0x000900C2, "Cecd_0x000900C2"}, - {0x000A00C4, &CECD_U::GetSystemInfo, "GetSystemInfo"}, - {0x000B0040, &CECD_U::RunCommand, "RunCommand"}, - {0x000C0040, &CECD_U::RunCommandAlt, "RunCommandAlt"}, - {0x000D0082, nullptr, "GetCecInfoBuffer"}, - {0x000E0000, &CECD_U::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, + {0x000900C2, &CECD_U::SetData, "SetData"}, + {0x000A00C4, &CECD_U::ReadData, "ReadData"}, + {0x000B0040, &CECD_U::Start, "Start"}, + {0x000C0040, &CECD_U::Stop, "Stop"}, + {0x000D0082, &CECD_U::GetCecInfoBuffer, "GetCecInfoBuffer"}, + {0x000E0000, &CECD_U::GetCecdState, "GetCecdState"}, {0x000F0000, &CECD_U::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, {0x00100000, &CECD_U::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, {0x00110104, &CECD_U::OpenAndWrite, "OpenAndWrite"},