mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Kernel/IPC: Support translation of null handles
Missed this in my first implementation. Thanks to @wwylele for pointing out that this was missing.
This commit is contained in:
		
							parent
							
								
									c4f0927a62
								
							
						
					
					
						commit
						f64d0b3f26
					
				
					 2 changed files with 35 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -67,10 +67,13 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const u32_le* sr
 | 
			
		|||
            ASSERT(i + num_handles <= command_size); // TODO(yuriks): Return error
 | 
			
		||||
            for (u32 j = 0; j < num_handles; ++j) {
 | 
			
		||||
                Handle handle = src_cmdbuf[i];
 | 
			
		||||
                SharedPtr<Object> object = src_table.GetGeneric(handle);
 | 
			
		||||
                ASSERT(object != nullptr); // TODO(yuriks): Return error
 | 
			
		||||
                if (descriptor == IPC::DescriptorType::MoveHandle) {
 | 
			
		||||
                    src_table.Close(handle);
 | 
			
		||||
                SharedPtr<Object> object = nullptr;
 | 
			
		||||
                if (handle != 0) {
 | 
			
		||||
                    object = src_table.GetGeneric(handle);
 | 
			
		||||
                    ASSERT(object != nullptr); // TODO(yuriks): Return error
 | 
			
		||||
                    if (descriptor == IPC::DescriptorType::MoveHandle) {
 | 
			
		||||
                        src_table.Close(handle);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                cmd_buf[i++] = AddOutgoingHandle(std::move(object));
 | 
			
		||||
| 
						 | 
				
			
			@ -112,9 +115,11 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
 | 
			
		|||
            ASSERT(i + num_handles <= command_size);
 | 
			
		||||
            for (u32 j = 0; j < num_handles; ++j) {
 | 
			
		||||
                SharedPtr<Object> object = GetIncomingHandle(cmd_buf[i]);
 | 
			
		||||
 | 
			
		||||
                // TODO(yuriks): Figure out the proper error handling for if this fails
 | 
			
		||||
                Handle handle = dst_table.Create(object).Unwrap();
 | 
			
		||||
                Handle handle = 0;
 | 
			
		||||
                if (object != nullptr) {
 | 
			
		||||
                    // TODO(yuriks): Figure out the proper error handling for if this fails
 | 
			
		||||
                    handle = dst_table.Create(object).Unwrap();
 | 
			
		||||
                }
 | 
			
		||||
                dst_cmdbuf[i++] = handle;
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue