[Kernel] Let XamContentAggregate.. make use of XEX alt-title-ids header
This commit is contained in:
parent
c889a8af3f
commit
716d4c412a
|
@ -11,6 +11,7 @@
|
|||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string_util.h"
|
||||
#include "xenia/kernel/kernel_state.h"
|
||||
#include "xenia/kernel/user_module.h"
|
||||
#include "xenia/kernel/util/shim_utils.h"
|
||||
#include "xenia/kernel/xam/xam_content_device.h"
|
||||
#include "xenia/kernel/xam/xam_private.h"
|
||||
|
@ -99,13 +100,26 @@ dword_result_t XamContentAggregateCreateEnumerator(qword_t xuid,
|
|||
auto content_type_enum = XContentType(uint32_t(content_type));
|
||||
|
||||
if (!device_info || device_info->device_type == DeviceType::HDD) {
|
||||
// Get all content data.
|
||||
auto content_datas = kernel_state()->content_manager()->ListContent(
|
||||
static_cast<uint32_t>(DummyDeviceId::HDD), content_type_enum);
|
||||
for (const auto& content_data : content_datas) {
|
||||
auto item = reinterpret_cast<XCONTENT_AGGREGATE_DATA*>(e->AppendItem());
|
||||
assert_not_null(item);
|
||||
*item = content_data;
|
||||
// Fetch any alternate title IDs defined in the XEX header
|
||||
// (used by games to load saves from other titles, etc)
|
||||
std::vector<uint32_t> title_ids{kCurrentlyRunningTitleId};
|
||||
auto exe_module = kernel_state()->GetExecutableModule();
|
||||
if (exe_module && exe_module->xex_module()) {
|
||||
const auto& alt_ids = exe_module->xex_module()->opt_alternate_title_ids();
|
||||
std::copy(alt_ids.cbegin(), alt_ids.cend(),
|
||||
std::back_inserter(title_ids));
|
||||
}
|
||||
|
||||
for (auto& title_id : title_ids) {
|
||||
// Get all content data.
|
||||
auto content_datas = kernel_state()->content_manager()->ListContent(
|
||||
static_cast<uint32_t>(DummyDeviceId::HDD), content_type_enum,
|
||||
title_id);
|
||||
for (const auto& content_data : content_datas) {
|
||||
auto item = reinterpret_cast<XCONTENT_AGGREGATE_DATA*>(e->AppendItem());
|
||||
assert_not_null(item);
|
||||
*item = content_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue