am: Address review comments.

This commit is contained in:
Steveice10 2018-07-06 14:16:15 -07:00
parent 680c6e694d
commit d67f119589
2 changed files with 10 additions and 4 deletions

View file

@ -5,8 +5,8 @@
#pragma once
#include <array>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include "common/common_types.h"
#include "common/swap.h"
@ -126,7 +126,7 @@ private:
u32_be signature_type;
std::vector<u8> tmd_signature;
std::vector<ContentChunk> tmd_chunks;
std::map<u16, size_t> content_index_to_index;
std::unordered_map<u16, size_t> content_index_to_index;
};
} // namespace FileSys

View file

@ -399,8 +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 && tmd.ContentIndexExists(index)) {
index = tmd.ContentIndexToIndex(index);
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);
}
}
content_id = tmd.GetContentIDByIndex(index);
@ -530,6 +534,8 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
u64 romfs_offset = 0;
if (!tmd.ContentIndexExists(content_requested[i])) {
LOG_ERROR(Service_AM, "Attempted to get info for non-existent content index {:04x}.", content_requested[i]);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
rb.Push<u32>(-1); // TODO: Find the right error code
rb.PushMappedBuffer(content_requested_in);