mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	IPC: Skip the entire u64 of the command id when receiving an IPC request.
Service code now doesn't have to deal with this.
This commit is contained in:
		
							parent
							
								
									226786f0b0
								
							
						
					
					
						commit
						b0ceb4df70
					
				@ -107,8 +107,9 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
 | 
				
			|||||||
        ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
 | 
					        ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    data_payload_offset = rp.GetCurrentOffset();
 | 
					 | 
				
			||||||
    command = rp.Pop<u32_le>();
 | 
					    command = rp.Pop<u32_le>();
 | 
				
			||||||
 | 
					    rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
 | 
				
			||||||
 | 
					    data_payload_offset = rp.GetCurrentOffset();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf,
 | 
					ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf,
 | 
				
			||||||
 | 
				
			|||||||
@ -100,8 +100,6 @@ void SM::Initialize(Kernel::HLERequestContext& ctx) {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
void SM::GetService(Kernel::HLERequestContext& ctx) {
 | 
					void SM::GetService(Kernel::HLERequestContext& ctx) {
 | 
				
			||||||
    IPC::RequestParser rp{ctx};
 | 
					    IPC::RequestParser rp{ctx};
 | 
				
			||||||
    u32 unk1 = rp.Pop<u32>();
 | 
					 | 
				
			||||||
    u32 unk2 = rp.Pop<u32>();
 | 
					 | 
				
			||||||
    auto name_buf = rp.PopRaw<std::array<char, 9>>();
 | 
					    auto name_buf = rp.PopRaw<std::array<char, 9>>();
 | 
				
			||||||
    std::string name(name_buf.data());
 | 
					    std::string name(name_buf.data());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -117,22 +115,13 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto session = client_port.Unwrap()->Connect();
 | 
					    auto session = client_port.Unwrap()->Connect();
 | 
				
			||||||
 | 
					    ASSERT(session.Succeeded());
 | 
				
			||||||
    if (session.Succeeded()) {
 | 
					    if (session.Succeeded()) {
 | 
				
			||||||
        LOG_DEBUG(Service_SM, "called service=%s -> session=%u", name.c_str(),
 | 
					        LOG_DEBUG(Service_SM, "called service=%s -> session=%u", name.c_str(),
 | 
				
			||||||
                  (*session)->GetObjectId());
 | 
					                  (*session)->GetObjectId());
 | 
				
			||||||
        IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, 1);
 | 
					        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 1);
 | 
				
			||||||
        rb.Push(session.Code());
 | 
					        rb.Push<u64>(0);
 | 
				
			||||||
        rb.PushObjects(std::move(session).Unwrap());
 | 
					        rb.PushObjects(std::move(session).Unwrap());
 | 
				
			||||||
    } else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED /*&& return_port_on_failure*/) {
 | 
					 | 
				
			||||||
        LOG_WARNING(Service_SM, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED, *port*=%u",
 | 
					 | 
				
			||||||
                    name.c_str(), (*client_port)->GetObjectId());
 | 
					 | 
				
			||||||
        IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, 1);
 | 
					 | 
				
			||||||
        rb.Push(ERR_MAX_CONNECTIONS_REACHED);
 | 
					 | 
				
			||||||
        rb.PushObjects(std::move(client_port).Unwrap());
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        LOG_ERROR(Service_SM, "called service=%s -> error 0x%08X", name.c_str(), session.Code());
 | 
					 | 
				
			||||||
        IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, 0);
 | 
					 | 
				
			||||||
        rb.Push(session.Code());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user