am: Revert changes to content index handling.
This commit is contained in:
parent
d67f119589
commit
ba35079449
6 changed files with 16 additions and 42 deletions
|
@ -384,7 +384,7 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo
|
|||
}
|
||||
|
||||
std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16 index,
|
||||
bool update, bool contentIndex) {
|
||||
bool update) {
|
||||
std::string content_path = GetTitlePath(media_type, tid) + "content/";
|
||||
|
||||
if (media_type == Service::FS::MediaType::GameCard) {
|
||||
|
@ -399,16 +399,12 @@ std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16
|
|||
u32 content_id = 0;
|
||||
FileSys::TitleMetadata tmd;
|
||||
if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) {
|
||||
if(contentIndex) {
|
||||
if(tmd.ContentIndexExists(index)) {
|
||||
index = tmd.ContentIndexToIndex(index);
|
||||
} else {
|
||||
LOG_ERROR(Service_AM, "Attempted to get path for non-existent content index {:04x}.", index);
|
||||
}
|
||||
if(index < tmd.GetContentCount()) {
|
||||
content_id = tmd.GetContentIDByIndex(index);
|
||||
} else {
|
||||
LOG_ERROR(Service_AM, "Attempted to get path for non-existent content index {:04x}.", index);
|
||||
}
|
||||
|
||||
content_id = tmd.GetContentIDByIndex(index);
|
||||
|
||||
// TODO(shinyquagsire23): how does DLC actually get this folder on hardware?
|
||||
// For now, check if the second (index 1) content has the optional flag set, for most
|
||||
// apps this is usually the manual and not set optional, DLC has it set optional.
|
||||
|
@ -533,7 +529,7 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
|||
std::shared_ptr<FileUtil::IOFile> romfs_file;
|
||||
u64 romfs_offset = 0;
|
||||
|
||||
if (!tmd.ContentIndexExists(content_requested[i])) {
|
||||
if (content_requested[i] >= tmd.GetContentCount()) {
|
||||
LOG_ERROR(Service_AM, "Attempted to get info for non-existent content index {:04x}.", content_requested[i]);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
|
@ -543,16 +539,14 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
u16 index = tmd.ContentIndexToIndex(content_requested[i]);
|
||||
|
||||
ContentInfo content_info = {};
|
||||
content_info.index = content_requested[i];
|
||||
content_info.type = tmd.GetContentTypeByIndex(index);
|
||||
content_info.content_id = tmd.GetContentIDByIndex(index);
|
||||
content_info.size = tmd.GetContentSizeByIndex(index);
|
||||
content_info.type = tmd.GetContentTypeByIndex(content_requested[i]);
|
||||
content_info.content_id = tmd.GetContentIDByIndex(content_requested[i]);
|
||||
content_info.size = tmd.GetContentSizeByIndex(content_requested[i]);
|
||||
content_info.ownership = OWNERSHIP_OWNED; // TODO: Pull this from the ticket.
|
||||
|
||||
if (FileUtil::Exists(GetTitleContentPath(media_type, title_id, index))) {
|
||||
if (FileUtil::Exists(GetTitleContentPath(media_type, title_id, content_requested[i]))) {
|
||||
content_info.ownership |= OWNERSHIP_DOWNLOADED;
|
||||
}
|
||||
|
||||
|
@ -600,7 +594,7 @@ void Module::Interface::ListDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
|||
u64 romfs_offset = 0;
|
||||
|
||||
ContentInfo content_info = {};
|
||||
content_info.index = tmd.GetContentIndexByIndex(i);
|
||||
content_info.index = static_cast<u16>(i);
|
||||
content_info.type = tmd.GetContentTypeByIndex(i);
|
||||
content_info.content_id = tmd.GetContentIDByIndex(i);
|
||||
content_info.size = tmd.GetContentSizeByIndex(i);
|
||||
|
@ -937,7 +931,7 @@ void Module::Interface::CheckContentRights(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// TODO(shinyquagsire23): Read tickets for this instead?
|
||||
bool has_rights =
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index, false, true));
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
|
@ -953,7 +947,7 @@ void Module::Interface::CheckContentRightsIgnorePlatform(Kernel::HLERequestConte
|
|||
|
||||
// TODO(shinyquagsire23): Read tickets for this instead?
|
||||
bool has_rights =
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index, false, true));
|
||||
FileUtil::Exists(GetTitleContentPath(Service::FS::MediaType::SDMC, tid, content_index));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
|
|
|
@ -121,11 +121,10 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo
|
|||
* @param tid the title ID to get
|
||||
* @param index the content index to get
|
||||
* @param update set true if the incoming TMD should be used instead of the current TMD
|
||||
* @param contentIndex set true if the supplied index is a 3DS content index value instead of a raw index.
|
||||
* @returns string path to the .app file
|
||||
*/
|
||||
std::string GetTitleContentPath(Service::FS::MediaType media_type, u64 tid, u16 index = 0,
|
||||
bool update = false, bool contentIndex = false);
|
||||
bool update = false);
|
||||
|
||||
/**
|
||||
* Get the folder for a title's installed content.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue