mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	service/cecd: Stub some functions
This commit is contained in:
		
							parent
							
								
									22e172946b
								
							
						
					
					
						commit
						5dacf92fd7
					
				
					 4 changed files with 528 additions and 35 deletions
				
			
		|  | @ -13,6 +13,162 @@ | ||||||
| namespace Service { | namespace Service { | ||||||
| namespace CECD { | namespace CECD { | ||||||
| 
 | 
 | ||||||
|  | void Module::Interface::OpenRawFile(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x01, 3, 2); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const u32 path_type = rp.Pop<u32>(); | ||||||
|  |     const u32 file_open_flag = rp.Pop<u32>(); | ||||||
|  |     rp.PopPID(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.Push<u32>(0); /// File size?
 | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, | ||||||
|  |                 "(STUBBED) called, ncch_program_id={:#010x}, path_type={:#010x}, " | ||||||
|  |                 "file_open_flag={:#010x}", | ||||||
|  |                 ncch_program_id, path_type, file_open_flag); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::ReadRawFile(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x02, 1, 2); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     auto buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.Push<u32>(0); /// Read size
 | ||||||
|  |     rb.PushStaticBuffer(buffer, 0); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, buffer_size={:#010x}", buffer_size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x03, 4, 4); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const bool is_out_box = rp.Pop<bool>(); | ||||||
|  |     const u32 message_id_size = rp.Pop<u32>(); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto message_id_buffer = rp.PopStaticBuffer(); | ||||||
|  |     auto write_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(2, 4); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.Push<u32>(0); /// Read size
 | ||||||
|  |     rb.PushStaticBuffer(message_id_buffer, 0); | ||||||
|  |     rb.PushStaticBuffer(write_buffer, 1); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, ncch_program_id={:#010x}, is_out_box={}", | ||||||
|  |                 ncch_program_id, is_out_box); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x04, 4, 6); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const bool is_out_box = rp.Pop<bool>(); | ||||||
|  |     const u32 message_id_size = rp.Pop<u32>(); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto message_id_buffer = rp.PopStaticBuffer(); | ||||||
|  |     const auto hmac_key_buffer = rp.PopStaticBuffer(); | ||||||
|  |     auto write_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(2, 6); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.Push<u32>(0); /// Read size
 | ||||||
|  |     rb.PushStaticBuffer(message_id_buffer, 0); | ||||||
|  |     rb.PushStaticBuffer(hmac_key_buffer, 1); | ||||||
|  |     rb.PushStaticBuffer(write_buffer, 2); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, ncch_program_id={:#010x}, is_out_box={}", | ||||||
|  |                 ncch_program_id, is_out_box); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::WriteRawFile(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x05, 1, 2); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(buffer, 0); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, buffer_size={:#010x}", buffer_size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x06, 4, 4); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const bool is_out_box = rp.Pop<bool>(); | ||||||
|  |     const u32 message_id_size = rp.Pop<u32>(); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto read_buffer = rp.PopStaticBuffer(); | ||||||
|  |     auto message_id_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(read_buffer, 0); | ||||||
|  |     rb.PushStaticBuffer(message_id_buffer, 1); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, ncch_program_id={:#010x}, is_out_box={}", | ||||||
|  |                 ncch_program_id, is_out_box); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x07, 4, 6); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const bool is_out_box = rp.Pop<bool>(); | ||||||
|  |     const u32 message_id_size = rp.Pop<u32>(); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto read_buffer = rp.PopStaticBuffer(); | ||||||
|  |     const auto hmac_key_buffer = rp.PopStaticBuffer(); | ||||||
|  |     auto message_id_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 6); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(read_buffer, 0); | ||||||
|  |     rb.PushStaticBuffer(hmac_key_buffer, 1); | ||||||
|  |     rb.PushStaticBuffer(message_id_buffer, 2); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, "(STUBBED) called, ncch_program_id={:#010x}, is_out_box={}", | ||||||
|  |                 ncch_program_id, is_out_box); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::Delete(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x10, 4, 2); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const u32 path_type = rp.Pop<u32>(); | ||||||
|  |     const bool is_out_box = rp.Pop<bool>(); | ||||||
|  |     const u32 message_id_size = rp.Pop<u32>(); | ||||||
|  |     const auto message_id_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(message_id_buffer, 0); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, | ||||||
|  |                 "(STUBBED) called, ncch_program_id={:#010x}, path_type={:#010x}, is_out_box={}", | ||||||
|  |                 ncch_program_id, path_type, is_out_box); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::GetSystemInfo(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x10, 3, 4); | ||||||
|  |     const u32 dest_buffer_size = rp.Pop<u32>(); | ||||||
|  |     const u32 info_type = rp.Pop<u32>(); | ||||||
|  |     const u32 param_buffer_size = rp.Pop<u32>(); | ||||||
|  |     const auto param_buffer = rp.PopStaticBuffer(); | ||||||
|  |     auto dest_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(param_buffer, 0); | ||||||
|  |     rb.PushStaticBuffer(dest_buffer, 1); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, | ||||||
|  |                 "(STUBBED) called, dest_buffer_size={:#010x}, info_type={:#010x}, " | ||||||
|  |                 "param_buffer_size={:#010x}", | ||||||
|  |                 dest_buffer_size, info_type, param_buffer_size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void Module::Interface::GetCecStateAbbreviated(Kernel::HLERequestContext& ctx) { | void Module::Interface::GetCecStateAbbreviated(Kernel::HLERequestContext& ctx) { | ||||||
|     IPC::RequestParser rp(ctx, 0x0E, 0, 0); |     IPC::RequestParser rp(ctx, 0x0E, 0, 0); | ||||||
| 
 | 
 | ||||||
|  | @ -43,6 +199,44 @@ void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx | ||||||
|     LOG_WARNING(Service_CECD, "(STUBBED) called"); |     LOG_WARNING(Service_CECD, "(STUBBED) called"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x11, 4, 4); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const u32 path_type = rp.Pop<u32>(); | ||||||
|  |     const u32 file_open_flag = rp.Pop<u32>(); | ||||||
|  |     rp.PopPID(); | ||||||
|  |     const auto read_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(read_buffer, 0); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, | ||||||
|  |                 "(STUBBED) called, ncch_program_id={:#010x}, path_type={:#010x}, " | ||||||
|  |                 "file_open_flag={:#010x}", | ||||||
|  |                 ncch_program_id, path_type, file_open_flag); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) { | ||||||
|  |     IPC::RequestParser rp(ctx, 0x12, 4, 4); | ||||||
|  |     const u32 buffer_size = rp.Pop<u32>(); | ||||||
|  |     const u32 ncch_program_id = rp.Pop<u32>(); | ||||||
|  |     const u32 path_type = rp.Pop<u32>(); | ||||||
|  |     const u32 file_open_flag = rp.Pop<u32>(); | ||||||
|  |     rp.PopPID(); | ||||||
|  |     auto write_buffer = rp.PopStaticBuffer(); | ||||||
|  | 
 | ||||||
|  |     IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushStaticBuffer(write_buffer, 0); | ||||||
|  | 
 | ||||||
|  |     LOG_WARNING(Service_CECD, | ||||||
|  |                 "(STUBBED) called, ncch_program_id={:#010x}, path_type={:#010x}, " | ||||||
|  |                 "file_open_flag={:#010x}", | ||||||
|  |                 ncch_program_id, path_type, file_open_flag); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| Module::Interface::Interface(std::shared_ptr<Module> cecd, const char* name, u32 max_session) | Module::Interface::Interface(std::shared_ptr<Module> cecd, const char* name, u32 max_session) | ||||||
|     : ServiceFramework(name, max_session), cecd(std::move(cecd)) {} |     : ServiceFramework(name, max_session), cecd(std::move(cecd)) {} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,31 +10,263 @@ | ||||||
| namespace Service { | namespace Service { | ||||||
| namespace CECD { | namespace CECD { | ||||||
| 
 | 
 | ||||||
| enum class CecStateAbbreviated : u32 { |  | ||||||
|     CEC_STATE_ABBREV_IDLE = 1,      ///< Corresponds to CEC_STATE_IDLE
 |  | ||||||
|     CEC_STATE_ABBREV_NOT_LOCAL = 2, ///< Corresponds to CEC_STATEs *FINISH*, *POST, and OVER_BOSS
 |  | ||||||
|     CEC_STATE_ABBREV_SCANNING = 3,  ///< Corresponds to CEC_STATE_SCANNING
 |  | ||||||
|     CEC_STATE_ABBREV_WLREADY = |  | ||||||
|         4, ///< Corresponds to CEC_STATE_WIRELESS_READY when some unknown bool is true
 |  | ||||||
|     CEC_STATE_ABBREV_OTHER = 5, ///< Corresponds to CEC_STATEs besides *FINISH*, *POST, and
 |  | ||||||
|                                 /// OVER_BOSS and those listed here
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| class Module final { | class Module final { | ||||||
| public: | public: | ||||||
|     Module(); |     Module(); | ||||||
|     ~Module() = default; |     ~Module() = default; | ||||||
| 
 | 
 | ||||||
|  |     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 CecCommand : u32 { | ||||||
|  |         CEC_COMMAND_NONE = 0, | ||||||
|  |         CEC_COMMAND_START = 1, | ||||||
|  |         CEC_COMMAND_RESET_START = 2, | ||||||
|  |         CEC_COMMAND_READYSCAN = 3, | ||||||
|  |         CEC_COMMAND_READYSCANWAIT = 4, | ||||||
|  |         CEC_COMMAND_STARTSCAN = 5, | ||||||
|  |         CEC_COMMAND_RESCAN = 6, | ||||||
|  |         CEC_COMMAND_NDM_RESUME = 7, | ||||||
|  |         CEC_COMMAND_NDM_SUSPEND = 8, | ||||||
|  |         CEC_COMMAND_NDM_SUSPEND_IMMEDIATE = 9, | ||||||
|  |         CEC_COMMAND_STOPWAIT = 0x0A, | ||||||
|  |         CEC_COMMAND_STOP = 0x0B, | ||||||
|  |         CEC_COMMAND_STOP_FORCE = 0x0C, | ||||||
|  |         CEC_COMMAND_STOP_FORCE_WAIT = 0x0D, | ||||||
|  |         CEC_COMMAND_RESET_FILTER = 0x0E, | ||||||
|  |         CEC_COMMAND_DAEMON_STOP = 0x0F, | ||||||
|  |         CEC_COMMAND_DAEMON_START = 0x10, | ||||||
|  |         CEC_COMMAND_EXIT = 0x11, | ||||||
|  |         CEC_COMMAND_OVER_BOSS = 0x12, | ||||||
|  |         CEC_COMMAND_OVER_BOSS_FORCE = 0x13, | ||||||
|  |         CEC_COMMAND_OVER_BOSS_FORCE_WAIT = 0x14, | ||||||
|  |         CEC_COMMAND_END = 0x15, | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     class Interface : public ServiceFramework<Interface> { |     class Interface : public ServiceFramework<Interface> { | ||||||
|     public: |     public: | ||||||
|         Interface(std::shared_ptr<Module> cecd, const char* name, u32 max_session); |         Interface(std::shared_ptr<Module> cecd, const char* name, u32 max_session); | ||||||
|         ~Interface() = default; |         ~Interface() = default; | ||||||
| 
 | 
 | ||||||
|     protected: |     protected: | ||||||
|  |         /**
 | ||||||
|  |          * CECD::OpenRawFile service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x000100C2] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : Path type | ||||||
|  |          *      3 : File open flag | ||||||
|  |          *      4 : Descriptor for process ID | ||||||
|  |          *      5 : Placeholder for process ID | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : File size? | ||||||
|  |          */ | ||||||
|  |         void OpenRawFile(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::ReadRawFile service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00020042] | ||||||
|  |          *      1 : Buffer size (unused) | ||||||
|  |          *      2 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Read size | ||||||
|  |          *      3 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      4 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void ReadRawFile(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::ReadMessage service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00030104] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : bool is_out_box? | ||||||
|  |          *      3 : Message ID size (unused, always 8) | ||||||
|  |          *      4 : Buffer size (unused) | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : Message ID address | ||||||
|  |          *      7 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      8 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Read size | ||||||
|  |          *      3 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      4 : Message ID address | ||||||
|  |          *      5 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      6 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void ReadMessage(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::ReadMessageWithHMAC service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00040106] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : bool is_out_box? | ||||||
|  |          *      3 : Message ID size(unused, always 8) | ||||||
|  |          *      4 : Buffer size(unused) | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : Message ID address | ||||||
|  |          *      7 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      8 : HMAC key address | ||||||
|  |          *      9 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *     10 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Read size | ||||||
|  |          *      3 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      4 : Message ID address | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : HMAC key address | ||||||
|  |          *      7 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      8 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void ReadMessageWithHMAC(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::WriteRawFile service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00050042] | ||||||
|  |          *      1 : Buffer size(unused) | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void WriteRawFile(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::WriteMessage service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00060104] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : bool is_out_box? | ||||||
|  |          *      3 : Message ID size(unused, always 8) | ||||||
|  |          *      4 : Buffer size(unused) | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : Buffer address | ||||||
|  |          *      7 : Descriptor for mapping a read/write buffer in the target process | ||||||
|  |          *      8 : Message ID address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          *      4 : Descriptor for mapping a read/write buffer in the target process | ||||||
|  |          *      5 : Message ID address | ||||||
|  |          */ | ||||||
|  |         void WriteMessage(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::WriteMessageWithHMAC service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00070106] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : bool is_out_box? | ||||||
|  |          *      3 : Message ID size(unused, always 8) | ||||||
|  |          *      4 : Buffer size(unused) | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : Buffer address | ||||||
|  |          *      7 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      8 : HMAC key address | ||||||
|  |          *      9 : Descriptor for mapping a read/write buffer in the target process | ||||||
|  |          *     10 : Message ID address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          *      4 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      5 : HMAC key address | ||||||
|  |          *      6 : Descriptor for mapping a read/write buffer in the target process | ||||||
|  |          *      7 : Message ID address | ||||||
|  |          */ | ||||||
|  |         void WriteMessageWithHMAC(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::Delete service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00080102] | ||||||
|  |          *      1 : NCCH Program ID | ||||||
|  |          *      2 : Path type | ||||||
|  |          *      3 : bool is_out_box? | ||||||
|  |          *      4 : Message ID size (unused) | ||||||
|  |          *      5 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      6 : Message ID address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Message ID address | ||||||
|  |          */ | ||||||
|  |         void Delete(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::GetSystemInfo service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x000A00C4] | ||||||
|  |          *      1 : Destination buffer size (unused) | ||||||
|  |          *      2 : Info type | ||||||
|  |          *      3 : Param buffer size (unused) | ||||||
|  |          *      4 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      5 : Param buffer address | ||||||
|  |          *      6 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      7 : Destination buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Param buffer address | ||||||
|  |          *      4 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      5 : Destination buffer address | ||||||
|  |          */ | ||||||
|  |         void GetSystemInfo(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::RunCommand 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); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::RunCommandAlt 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); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::GetCecInfoBuffer service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x000D0082] | ||||||
|  |          *      1 : unknown | ||||||
|  |          *      2 : unknown | ||||||
|  |          *      3 : buffer descriptor | ||||||
|  |          *      4 : buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : | ||||||
|  |          */ | ||||||
|  |         void GetCecInfoBuffer(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|         /**
 |         /**
 | ||||||
|          * GetCecStateAbbreviated service function |          * GetCecStateAbbreviated service function | ||||||
|          *  Inputs: |          *  Inputs: | ||||||
|          *      0: 0x000E0000 |          *      0: Header Code[0x000E0000] | ||||||
|          *  Outputs: |          *  Outputs: | ||||||
|          *      1: ResultCode |          *      1: ResultCode | ||||||
|          *      2: CecStateAbbreviated |          *      2: CecStateAbbreviated | ||||||
|  | @ -44,7 +276,7 @@ public: | ||||||
|         /**
 |         /**
 | ||||||
|          * GetCecInfoEventHandle service function |          * GetCecInfoEventHandle service function | ||||||
|          *  Inputs: |          *  Inputs: | ||||||
|          *      0: 0x000F0000 |          *      0: Header Code[0x000F0000] | ||||||
|          *  Outputs: |          *  Outputs: | ||||||
|          *      1: ResultCode |          *      1: ResultCode | ||||||
|          *      3: Event Handle |          *      3: Event Handle | ||||||
|  | @ -54,13 +286,76 @@ public: | ||||||
|         /**
 |         /**
 | ||||||
|          * GetChangeStateEventHandle service function |          * GetChangeStateEventHandle service function | ||||||
|          *  Inputs: |          *  Inputs: | ||||||
|          *      0: 0x00100000 |          *      0: Header Code[0x00100000] | ||||||
|          *  Outputs: |          *  Outputs: | ||||||
|          *      1: ResultCode |          *      1: ResultCode | ||||||
|          *      3: Event Handle |          *      3: Event Handle | ||||||
|          */ |          */ | ||||||
|         void GetChangeStateEventHandle(Kernel::HLERequestContext& ctx); |         void GetChangeStateEventHandle(Kernel::HLERequestContext& ctx); | ||||||
| 
 | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::OpenAndWrite service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00110104] | ||||||
|  |          *      1 : Buffer size (unused) | ||||||
|  |          *      2 : NCCH Program ID | ||||||
|  |          *      3 : Path type | ||||||
|  |          *      4 : File open flag? | ||||||
|  |          *      5 : Descriptor for process ID | ||||||
|  |          *      6 : Placeholder for process ID | ||||||
|  |          *      7 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      8 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Descriptor for mapping a read-only buffer in the target process | ||||||
|  |          *      3 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void OpenAndWrite(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::OpenAndRead service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x00120104] | ||||||
|  |          *      1 : Buffer size (unused) | ||||||
|  |          *      2 : NCCH Program ID | ||||||
|  |          *      3 : Path type | ||||||
|  |          *      4 : File open flag? | ||||||
|  |          *      5 : Descriptor for process ID | ||||||
|  |          *      6 : Placeholder for process ID | ||||||
|  |          *      7 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      8 : Buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : Toal bytes read | ||||||
|  |          *      3 : Descriptor for mapping a write-only buffer in the target process | ||||||
|  |          *      4 : Buffer address | ||||||
|  |          */ | ||||||
|  |         void OpenAndRead(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::GetEventLog service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x001E0082] | ||||||
|  |          *      1 : unknown | ||||||
|  |          *      2 : unknown | ||||||
|  |          *      3 : buffer descriptor | ||||||
|  |          *      4 : buffer address | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : unknown | ||||||
|  |          */ | ||||||
|  |         void GetEventLog(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|  |         /**
 | ||||||
|  |          * CECD::GetEventLogStart service function | ||||||
|  |          *  Inputs: | ||||||
|  |          *      0 : Header Code[0x001F0000] | ||||||
|  |          *  Outputs: | ||||||
|  |          *      1 : Result of function, 0 on success, otherwise error code | ||||||
|  |          *      2 : unknown | ||||||
|  |          */ | ||||||
|  |         void GetEventLogStart(Kernel::HLERequestContext& ctx); | ||||||
|  | 
 | ||||||
|     private: |     private: | ||||||
|         std::shared_ptr<Module> cecd; |         std::shared_ptr<Module> cecd; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -12,22 +12,24 @@ CECD_S::CECD_S(std::shared_ptr<Module> cecd) | ||||||
|     static const FunctionInfo functions[] = { |     static const FunctionInfo functions[] = { | ||||||
|         // cecd:u shared commands
 |         // cecd:u shared commands
 | ||||||
|         // clang-format off
 |         // clang-format off
 | ||||||
|         {0x000100C2, nullptr, "OpenRawFile"}, |         {0x000100C2, &CECD_S::OpenRawFile, "OpenRawFile"}, | ||||||
|         {0x00020042, nullptr, "ReadRawFile"}, |         {0x00020042, &CECD_S::ReadRawFile, "ReadRawFile"}, | ||||||
|         {0x00030104, nullptr, "ReadMessage"}, |         {0x00030104, &CECD_S::ReadMessage, "ReadMessage"}, | ||||||
|         {0x00040106, nullptr, "ReadMessageWithHMAC"}, |         {0x00040106, &CECD_S::ReadMessageWithHMAC, "ReadMessageWithHMAC"}, | ||||||
|         {0x00050042, nullptr, "WriteRawFile"}, |         {0x00050042, &CECD_S::WriteRawFile, "WriteRawFile"}, | ||||||
|         {0x00060104, nullptr, "WriteMessage"}, |         {0x00060104, &CECD_S::WriteMessage, "WriteMessage"}, | ||||||
|         {0x00070106, nullptr, "WriteMessageWithHMAC"}, |         {0x00070106, &CECD_S::WriteMessageWithHMAC, "WriteMessageWithHMAC"}, | ||||||
|         {0x00080102, nullptr, "Delete"}, |         {0x00080102, &CECD_S::Delete, "Delete"}, | ||||||
|         {0x000A00C4, nullptr, "GetSystemInfo"}, |         {0x000A00C4, &CECD_S::GetSystemInfo, "GetSystemInfo"}, | ||||||
|         {0x000B0040, nullptr, "RunCommand"}, |         {0x000B0040, nullptr, "RunCommand"}, | ||||||
|         {0x000C0040, nullptr, "RunCommandAlt"}, |         {0x000C0040, nullptr, "RunCommandAlt"}, | ||||||
|         {0x000E0000, &CECD_S::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, |         {0x000E0000, &CECD_S::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, | ||||||
|         {0x000F0000, &CECD_S::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, |         {0x000F0000, &CECD_S::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, | ||||||
|         {0x00100000, &CECD_S::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, |         {0x00100000, &CECD_S::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, | ||||||
|         {0x00110104, nullptr, "OpenAndWrite"}, |         {0x00110104, &CECD_S::OpenAndWrite, "OpenAndWrite"}, | ||||||
|         {0x00120104, nullptr, "OpenAndRead"}, |         {0x00120104, &CECD_S::OpenAndRead, "OpenAndRead"}, | ||||||
|  |         {0x001E0082, nullptr, "GetEventLog"}, | ||||||
|  |         {0x001F0000, nullptr, "GetEventLogStart"}, | ||||||
|         // clang-format on
 |         // clang-format on
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,22 +12,24 @@ CECD_U::CECD_U(std::shared_ptr<Module> cecd) | ||||||
|     static const FunctionInfo functions[] = { |     static const FunctionInfo functions[] = { | ||||||
|         // cecd:u shared commands
 |         // cecd:u shared commands
 | ||||||
|         // clang-format off
 |         // clang-format off
 | ||||||
|         {0x000100C2, nullptr, "OpenRawFile"}, |         {0x000100C2, &CECD_U::OpenRawFile, "OpenRawFile"}, | ||||||
|         {0x00020042, nullptr, "ReadRawFile"}, |         {0x00020042, &CECD_U::ReadRawFile, "ReadRawFile"}, | ||||||
|         {0x00030104, nullptr, "ReadMessage"}, |         {0x00030104, &CECD_U::ReadMessage, "ReadMessage"}, | ||||||
|         {0x00040106, nullptr, "ReadMessageWithHMAC"}, |         {0x00040106, &CECD_U::ReadMessageWithHMAC, "ReadMessageWithHMAC"}, | ||||||
|         {0x00050042, nullptr, "WriteRawFile"}, |         {0x00050042, &CECD_U::WriteRawFile, "WriteRawFile"}, | ||||||
|         {0x00060104, nullptr, "WriteMessage"}, |         {0x00060104, &CECD_U::WriteMessage, "WriteMessage"}, | ||||||
|         {0x00070106, nullptr, "WriteMessageWithHMAC"}, |         {0x00070106, &CECD_U::WriteMessageWithHMAC, "WriteMessageWithHMAC"}, | ||||||
|         {0x00080102, nullptr, "Delete"}, |         {0x00080102, &CECD_U::Delete, "Delete"}, | ||||||
|         {0x000A00C4, nullptr, "GetSystemInfo"}, |         {0x000A00C4, &CECD_U::GetSystemInfo, "GetSystemInfo"}, | ||||||
|         {0x000B0040, nullptr, "RunCommand"}, |         {0x000B0040, nullptr, "RunCommand"}, | ||||||
|         {0x000C0040, nullptr, "RunCommandAlt"}, |         {0x000C0040, nullptr, "RunCommandAlt"}, | ||||||
|         {0x000E0000, &CECD_U::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, |         {0x000E0000, &CECD_U::GetCecStateAbbreviated, "GetCecStateAbbreviated"}, | ||||||
|         {0x000F0000, &CECD_U::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, |         {0x000F0000, &CECD_U::GetCecInfoEventHandle, "GetCecInfoEventHandle"}, | ||||||
|         {0x00100000, &CECD_U::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, |         {0x00100000, &CECD_U::GetChangeStateEventHandle, "GetChangeStateEventHandle"}, | ||||||
|         {0x00110104, nullptr, "OpenAndWrite"}, |         {0x00110104, &CECD_U::OpenAndWrite, "OpenAndWrite"}, | ||||||
|         {0x00120104, nullptr, "OpenAndRead"}, |         {0x00120104, &CECD_U::OpenAndRead, "OpenAndRead"}, | ||||||
|  |         {0x001E0082, nullptr, "GetEventLog"}, | ||||||
|  |         {0x001F0000, nullptr, "GetEventLogStart"}, | ||||||
|         // clang-format on
 |         // clang-format on
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue