[XAM] XamShowSigninUI: Send signin and UI close notification with delay from separate thread

This is to prevent situation when game waits for notification, but receives it beforehand
This commit is contained in:
Gliniak 2024-09-21 22:35:03 +02:00
parent 629707b935
commit d246e3bc70

View file

@ -548,6 +548,8 @@ dword_result_t XamShowSigninUI_entry(dword_t users_needed, dword_t unk_mask) {
kernel_state()->UpdateUsedUserProfiles(); kernel_state()->UpdateUsedUserProfiles();
// Mask values vary. Probably matching user types? Local/remote? // Mask values vary. Probably matching user types? Local/remote?
// Games seem to sit and loop until we trigger this notification: // Games seem to sit and loop until we trigger this notification:
auto run = [users_needed]() -> void {
uint32_t user_mask = 0; uint32_t user_mask = 0;
uint32_t active_users = 0; uint32_t active_users = 0;
@ -559,12 +561,17 @@ dword_result_t XamShowSigninUI_entry(dword_t users_needed, dword_t unk_mask) {
} }
} }
std::this_thread::sleep_for(std::chrono::milliseconds(150));
// XN_SYS_SIGNINCHANGED (players) // XN_SYS_SIGNINCHANGED (players)
kernel_state()->BroadcastNotification(kXNotificationIDSystemSignInChanged, kernel_state()->BroadcastNotification(kXNotificationIDSystemSignInChanged,
user_mask); user_mask);
// XN_SYS_UI (off) // XN_SYS_UI (off)
kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, 0); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, 0);
};
std::thread thread(run);
thread.detach();
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }
DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kStub); DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kStub);