[XAM] Implemented: XamReadTile(Ex)

- Added missing param to XamContentAggregateCreateEnumerator
This commit is contained in:
Gliniak 2025-05-05 22:55:49 +02:00
parent c15dde52d6
commit d18f80457d
2 changed files with 57 additions and 4 deletions

View File

@ -79,7 +79,7 @@ void AddODDContentTest(object_ref<XStaticEnumerator<XCONTENT_AGGREGATE_DATA>> e,
dword_result_t XamContentAggregateCreateEnumerator_entry(qword_t xuid,
dword_t device_id,
dword_t content_type,
unknown_t unk3,
dword_t title_id,
lpdword_t handle_out) {
assert_not_null(handle_out);
@ -99,12 +99,14 @@ dword_result_t XamContentAggregateCreateEnumerator_entry(qword_t xuid,
extra->magic = kXObjSignature;
extra->handle = e->handle();
auto content_type_enum = XContentType(uint32_t(content_type));
const XContentType content_type_enum =
static_cast<XContentType>(content_type.value());
if (!device_info || device_info->device_type == DeviceType::HDD) {
// 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};
std::vector<uint32_t> title_ids{title_id ? title_id.value()
: 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();
@ -112,7 +114,7 @@ dword_result_t XamContentAggregateCreateEnumerator_entry(qword_t xuid,
std::back_inserter(title_ids));
}
for (auto& title_id : title_ids) {
for (const auto& title_id : title_ids) {
// Get all content data.
auto content_datas = kernel_state()->content_manager()->ListContent(
static_cast<uint32_t>(DummyDeviceId::HDD),

View File

@ -631,6 +631,57 @@ dword_result_t XamUserCreateTitlesPlayedEnumerator_entry(
}
DECLARE_XAM_EXPORT1(XamUserCreateTitlesPlayedEnumerator, kUserProfiles, kStub);
dword_result_t XamReadTile_entry(dword_t tile_type, dword_t title_id,
qword_t item_id, dword_t user_index,
lpdword_t output_ptr,
lpdword_t buffer_size_ptr,
dword_t overlapped_ptr) {
auto user = kernel_state()->xam_state()->GetUserProfile(user_index);
if (!user) {
return X_ERROR_INVALID_PARAMETER;
}
if (!buffer_size_ptr) {
return X_ERROR_INVALID_PARAMETER;
}
std::span<const uint8_t> tile =
kernel_state()->xam_state()->user_tracker()->GetIcon(
user->xuid(), title_id, static_cast<XTileType>(tile_type.value()),
item_id);
if (tile.empty()) {
return X_ERROR_FILE_NOT_FOUND;
}
*buffer_size_ptr = static_cast<uint32_t>(tile.size());
auto result = X_ERROR_SUCCESS;
if (output_ptr) {
memcpy(output_ptr, tile.data(), tile.size());
} else {
result = X_ERROR_INSUFFICIENT_BUFFER;
}
if (overlapped_ptr) {
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
return X_ERROR_IO_PENDING;
}
return result;
}
DECLARE_XAM_EXPORT1(XamReadTile, kUserProfiles, kSketchy);
dword_result_t XamReadTileEx_entry(dword_t tile_type, dword_t game_id,
qword_t item_id, dword_t offset,
dword_t unk1, dword_t unk2,
lpdword_t output_ptr,
lpdword_t buffer_size_ptr) {
return XamReadTile_entry(tile_type, game_id, item_id, offset, output_ptr,
buffer_size_ptr, 0);
}
DECLARE_XAM_EXPORT1(XamReadTileEx, kUserProfiles, kSketchy);
dword_result_t XamParseGamerTileKey_entry(pointer_t<X_USER_DATA> key_ptr,
lpdword_t title_id_ptr,
lpdword_t big_tile_id_ptr,