[Kernel] Fix XamReadTile not returning profile pic, breaking dash profile...

This caused dash not to load profile anymore, since dash passes user_index == kNone...
The new method should be closer to how things are actually meant to work.
This commit is contained in:
emoose 2020-01-05 20:23:44 +00:00 committed by illusion
parent 18c930c1b2
commit d2edb53282
1 changed files with 10 additions and 5 deletions

View File

@ -766,11 +766,6 @@ dword_result_t XamReadTile(dword_t tile_type, dword_t game_id, qword_t item_id,
size_t data_len = 0; size_t data_len = 0;
std::unique_ptr<MappedMemory> mmap; std::unique_ptr<MappedMemory> mmap;
auto user_profile = kernel_state()->user_profile(user_index);
if (!user_profile) {
return X_ERROR_INVALID_PARAMETER; // TODO: proper error code!
}
if (!output_ptr || !buffer_size_ptr) { if (!output_ptr || !buffer_size_ptr) {
return X_ERROR_FILE_NOT_FOUND; return X_ERROR_FILE_NOT_FOUND;
} }
@ -779,6 +774,11 @@ dword_result_t XamReadTile(dword_t tile_type, dword_t game_id, qword_t item_id,
if (kTileFileNames.count(type)) { if (kTileFileNames.count(type)) {
// image_id = XUID of profile to retrieve from // image_id = XUID of profile to retrieve from
auto user_profile = kernel_state()->user_profile(image_id);
if (!user_profile) {
return X_ERROR_INVALID_PARAMETER; // TODO: proper error code!
}
auto file_path = user_profile->path(); auto file_path = user_profile->path();
file_path += kTileFileNames.at(type); file_path += kTileFileNames.at(type);
@ -789,6 +789,11 @@ dword_result_t XamReadTile(dword_t tile_type, dword_t game_id, qword_t item_id,
data = mmap->data(); data = mmap->data();
data_len = mmap->size(); data_len = mmap->size();
} else { } else {
auto user_profile = kernel_state()->user_profile(user_index);
if (!user_profile) {
return X_ERROR_INVALID_PARAMETER; // TODO: proper error code!
}
auto gpd = user_profile->GetTitleGpd(game_id.value()); auto gpd = user_profile->GetTitleGpd(game_id.value());
if (!gpd) { if (!gpd) {