From 2749ab12848837f6a3c32bbb0781f91722112d1b Mon Sep 17 00:00:00 2001 From: Gliniak Date: Thu, 9 Jan 2020 14:17:51 +0100 Subject: [PATCH] [XAM/User] Added title_id == 0 check for few User functions Games like to report title_id as 0 (it is expected behaviour). 0 in this case means currently opened title --- src/xenia/kernel/xam/xam_user.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index 4600067c1..fd4e7e32e 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -254,7 +254,7 @@ dword_result_t XamUserReadProfileSettings( auto gpd = user_profile->GetDashboardGpd(); if (title_id != kDashboardID) { - gpd = user_profile->GetTitleGpd(title_id); + gpd = user_profile->GetTitleGpd(!title_id ? kernel_state()->title_id() : title_id); } // First call asks for size (fill buffer_size_ptr). @@ -403,7 +403,8 @@ dword_result_t XamUserWriteProfileSettings( auto gpd = user_profile->GetDashboardGpd(); if (title_id != kDashboardID) { - gpd = user_profile->GetTitleGpd(title_id); + gpd = user_profile->GetTitleGpd(!title_id ? kernel_state()->title_id() + : title_id); } if (!gpd) { @@ -605,7 +606,9 @@ dword_result_t XamUserCreateAchievementEnumerator(dword_t title_id, *handle_ptr = e->handle(); // Copy achievements into the enumerator if game GPD is loaded - auto* game_gpd = user_profile->GetTitleGpd(title_id); + auto* game_gpd = user_profile->GetTitleGpd( + !title_id ? kernel_state()->title_id() : title_id); + if (!game_gpd) { XELOGE( "XamUserCreateAchievementEnumerator failed to find GPD for title %X!",