diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index b8d91715a..8c4c0dde4 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -11,6 +11,7 @@ #include #include +#include #include "third_party/fmt/include/fmt/format.h" #include "xenia/base/filesystem.h" @@ -96,28 +97,47 @@ std::vector ContentManager::ListContent( title_id = kernel_state_->title_id(); } - // Search path: - // content_root/title_id/type_name/* - auto package_root = ResolvePackageRoot(content_type, title_id); - auto file_infos = xe::filesystem::ListFiles(package_root); - for (const auto& file_info : file_infos) { - if (file_info.type != xe::filesystem::FileInfo::Type::kDirectory) { - // Directories only. - continue; - } + std::set title_ids = {title_id}; - XCONTENT_AGGREGATE_DATA content_data; - if (XSUCCEEDED( - ReadContentHeaderFile(xe::path_to_utf8(file_info.name) + ".header", - content_type, content_data, title_id))) { - result.emplace_back(std::move(content_data)); - } else { - content_data.device_id = device_id; - content_data.content_type = content_type; - content_data.set_display_name(xe::path_to_utf16(file_info.name)); - content_data.set_file_name(xe::path_to_utf8(file_info.name)); - content_data.title_id = title_id; - result.emplace_back(std::move(content_data)); + if (content_type == XContentType::kPublisher) { + std::string publisher_id_regex = + fmt::format("^{:04X}.*", static_cast(title_id >> 16)); + // Get all publisher entries + auto publisher_entries = xe::filesystem::FilterByName( + xe::filesystem::ListDirectories(root_path_), + std::regex(publisher_id_regex)); + + for (const auto& entry : publisher_entries) { + title_ids.insert(xe::string_util::from_string( + xe::path_to_utf8(entry.name), true)); + } + } + + for (const uint32_t& title_id : title_ids) { + // Search path: + // content_root/title_id/type_name/* + auto package_root = ResolvePackageRoot(content_type, title_id); + auto file_infos = xe::filesystem::ListFiles(package_root); + + for (const auto& file_info : file_infos) { + if (file_info.type != xe::filesystem::FileInfo::Type::kDirectory) { + // Directories only. + continue; + } + + XCONTENT_AGGREGATE_DATA content_data; + if (XSUCCEEDED(ReadContentHeaderFile( + xe::path_to_utf8(file_info.name) + ".header", content_type, + content_data, title_id))) { + result.emplace_back(std::move(content_data)); + } else { + content_data.device_id = device_id; + content_data.content_type = content_type; + content_data.set_display_name(xe::path_to_utf16(file_info.name)); + content_data.set_file_name(xe::path_to_utf8(file_info.name)); + content_data.title_id = title_id; + result.emplace_back(std::move(content_data)); + } } } return result;