mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Services/AM: Rename and adjust FindContentInfos for accuracy
This commit is contained in:
		
							parent
							
								
									ac2ee3035a
								
							
						
					
					
						commit
						c6e43ae79d
					
				
					 4 changed files with 25 additions and 8 deletions
				
			
		|  | @ -401,14 +401,28 @@ void GetNumPrograms(Service::Interface* self) { | ||||||
|     rb.Push<u32>(am_title_list[media_type].size()); |     rb.Push<u32>(am_title_list[media_type].size()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void FindContentInfos(Service::Interface* self) { | void FindDLCContentInfos(Service::Interface* self) { | ||||||
|     IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1002, 4, 4); // 0x10020104
 |     IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1002, 4, 4); // 0x10020104
 | ||||||
| 
 | 
 | ||||||
|     auto media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>()); |     auto media_type = static_cast<Service::FS::MediaType>(rp.Pop<u8>()); | ||||||
|     u64 title_id = rp.Pop<u64>(); |     u64 title_id = rp.Pop<u64>(); | ||||||
|     u32 content_count = rp.Pop<u32>(); |     u32 content_count = rp.Pop<u32>(); | ||||||
|     VAddr content_requested_in = rp.PopMappedBuffer(); | 
 | ||||||
|     VAddr content_info_out = rp.PopMappedBuffer(); |     size_t input_buffer_size, output_buffer_size; | ||||||
|  |     IPC::MappedBufferPermissions input_buffer_perms, output_buffer_perms; | ||||||
|  |     VAddr content_requested_in = rp.PopMappedBuffer(&input_buffer_size, &input_buffer_perms); | ||||||
|  |     VAddr content_info_out = rp.PopMappedBuffer(&output_buffer_size, &output_buffer_perms); | ||||||
|  | 
 | ||||||
|  |     // Validate that only DLC TIDs are passed in
 | ||||||
|  |     u32 tid_high = static_cast<u32>(title_id >> 32); | ||||||
|  |     if (tid_high != TID_HIGH_DLC) { | ||||||
|  |         IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); | ||||||
|  |         rb.Push(ResultCode(ErrCodes::InvalidTIDInList, ErrorModule::AM, | ||||||
|  |                            ErrorSummary::InvalidArgument, ErrorLevel::Usage)); | ||||||
|  |         rb.PushMappedBuffer(content_requested_in, input_buffer_size, input_buffer_perms); | ||||||
|  |         rb.PushMappedBuffer(content_info_out, output_buffer_size, output_buffer_perms); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     std::vector<u16_le> content_requested(content_count); |     std::vector<u16_le> content_requested(content_count); | ||||||
|     Memory::ReadBlock(content_requested_in, content_requested.data(), content_count * sizeof(u16)); |     Memory::ReadBlock(content_requested_in, content_requested.data(), content_count * sizeof(u16)); | ||||||
|  | @ -440,8 +454,10 @@ void FindContentInfos(Service::Interface* self) { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); |     IPC::RequestBuilder rb = rp.MakeBuilder(1, 4); | ||||||
|     rb.Push(RESULT_SUCCESS); |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.PushMappedBuffer(content_requested_in, input_buffer_size, input_buffer_perms); | ||||||
|  |     rb.PushMappedBuffer(content_info_out, output_buffer_size, output_buffer_perms); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ListContentInfos(Service::Interface* self) { | void ListContentInfos(Service::Interface* self) { | ||||||
|  |  | ||||||
|  | @ -96,7 +96,8 @@ void ScanForAllTitles(); | ||||||
| void GetNumPrograms(Service::Interface* self); | void GetNumPrograms(Service::Interface* self); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * AM::FindContentInfos service function |  * AM::FindDLCContentInfos service function | ||||||
|  |  * Explicitly checks that TID high value is 0004008C or an error is returned. | ||||||
|  *  Inputs: |  *  Inputs: | ||||||
|  *      1 : MediaType |  *      1 : MediaType | ||||||
|  *    2-3 : u64, Title ID |  *    2-3 : u64, Title ID | ||||||
|  | @ -106,7 +107,7 @@ void GetNumPrograms(Service::Interface* self); | ||||||
|  *  Outputs: |  *  Outputs: | ||||||
|  *      1 : Result, 0 on success, otherwise error code |  *      1 : Result, 0 on success, otherwise error code | ||||||
|  */ |  */ | ||||||
| void FindContentInfos(Service::Interface* self); | void FindDLCContentInfos(Service::Interface* self); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * AM::ListContentInfos service function |  * AM::ListContentInfos service function | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ namespace AM { | ||||||
| 
 | 
 | ||||||
| const Interface::FunctionInfo FunctionTable[] = { | const Interface::FunctionInfo FunctionTable[] = { | ||||||
|     {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, |     {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, | ||||||
|     {0x10020104, FindContentInfos, "FindContentInfos"}, |     {0x10020104, FindDLCContentInfos, "FindDLCContentInfos"}, | ||||||
|     {0x10030142, ListContentInfos, "ListContentInfos"}, |     {0x10030142, ListContentInfos, "ListContentInfos"}, | ||||||
|     {0x10040102, DeleteContents, "DeleteContents"}, |     {0x10040102, DeleteContents, "DeleteContents"}, | ||||||
|     {0x10050084, GetDLCTitleInfos, "GetDLCTitleInfos"}, |     {0x10050084, GetDLCTitleInfos, "GetDLCTitleInfos"}, | ||||||
|  |  | ||||||
|  | @ -55,7 +55,7 @@ const Interface::FunctionInfo FunctionTable[] = { | ||||||
|     {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, |     {0x002C0084, nullptr, "GetProgramInfosIgnorePlatform"}, | ||||||
|     {0x002D00C0, CheckContentRightsIgnorePlatform, "CheckContentRightsIgnorePlatform"}, |     {0x002D00C0, CheckContentRightsIgnorePlatform, "CheckContentRightsIgnorePlatform"}, | ||||||
|     {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, |     {0x100100C0, GetNumContentInfos, "GetNumContentInfos"}, | ||||||
|     {0x10020104, FindContentInfos, "FindContentInfos"}, |     {0x10020104, FindDLCContentInfos, "FindDLCContentInfos"}, | ||||||
|     {0x10030142, ListContentInfos, "ListContentInfos"}, |     {0x10030142, ListContentInfos, "ListContentInfos"}, | ||||||
|     {0x10040102, DeleteContents, "DeleteContents"}, |     {0x10040102, DeleteContents, "DeleteContents"}, | ||||||
|     {0x10050084, GetDLCTitleInfos, "GetDLCTitleInfos"}, |     {0x10050084, GetDLCTitleInfos, "GetDLCTitleInfos"}, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue