mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[XAM] Added iterating over publisher type content.
Importing savefiles this way still doesn't work
This commit is contained in:
parent
c847987c27
commit
7e7784347b
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "third_party/fmt/include/fmt/format.h"
|
#include "third_party/fmt/include/fmt/format.h"
|
||||||
#include "xenia/base/filesystem.h"
|
#include "xenia/base/filesystem.h"
|
||||||
|
|
@ -96,28 +97,47 @@ std::vector<XCONTENT_AGGREGATE_DATA> ContentManager::ListContent(
|
||||||
title_id = kernel_state_->title_id();
|
title_id = kernel_state_->title_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search path:
|
std::set<uint32_t> title_ids = {title_id};
|
||||||
// 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 (content_type == XContentType::kPublisher) {
|
||||||
if (XSUCCEEDED(
|
std::string publisher_id_regex =
|
||||||
ReadContentHeaderFile(xe::path_to_utf8(file_info.name) + ".header",
|
fmt::format("^{:04X}.*", static_cast<uint16_t>(title_id >> 16));
|
||||||
content_type, content_data, title_id))) {
|
// Get all publisher entries
|
||||||
result.emplace_back(std::move(content_data));
|
auto publisher_entries = xe::filesystem::FilterByName(
|
||||||
} else {
|
xe::filesystem::ListDirectories(root_path_),
|
||||||
content_data.device_id = device_id;
|
std::regex(publisher_id_regex));
|
||||||
content_data.content_type = content_type;
|
|
||||||
content_data.set_display_name(xe::path_to_utf16(file_info.name));
|
for (const auto& entry : publisher_entries) {
|
||||||
content_data.set_file_name(xe::path_to_utf8(file_info.name));
|
title_ids.insert(xe::string_util::from_string<uint32_t>(
|
||||||
content_data.title_id = title_id;
|
xe::path_to_utf8(entry.name), true));
|
||||||
result.emplace_back(std::move(content_data));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue