[Kernel] Fixed incorrect amount of propagated notifications on boot

- Created dedicated method: IsUIActive
This commit is contained in:
Gliniak
2026-01-30 23:49:54 +01:00
committed by Radosław Gliński
parent 7e1506ff23
commit 4dd0842087
4 changed files with 9 additions and 9 deletions

View File

@@ -910,11 +910,8 @@ void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
// https://cs.rin.ru/forum/viewtopic.php?f=38&t=60668&hilit=resident+evil+5&start=375 // https://cs.rin.ru/forum/viewtopic.php?f=38&t=60668&hilit=resident+evil+5&start=375
if (!has_notified_startup_ && listener->mask() & kXNotifySystem) { if (!has_notified_startup_ && listener->mask() & kXNotifySystem) {
has_notified_startup_ = true; has_notified_startup_ = true;
// XN_SYS_UI (on, off) listener->EnqueueNotification(kXNotificationSystemUI,
listener->EnqueueNotification(kXNotificationSystemUI, 1); xam_state()->IsUIActive());
listener->EnqueueNotification(kXNotificationSystemUI, 0);
// XN_SYS_SIGNINCHANGED x2
listener->EnqueueNotification(kXNotificationSystemSignInChanged, 1);
listener->EnqueueNotification(kXNotificationSystemSignInChanged, 1); listener->EnqueueNotification(kXNotificationSystemSignInChanged, 1);
} }
if (!has_notified_live_startup_ && listener->mask() & kXNotifyLive) { if (!has_notified_live_startup_ && listener->mask() & kXNotifyLive) {

View File

@@ -107,7 +107,7 @@ dword_result_t XamInputGetState_entry(dword_t user_index, dword_t flags,
return X_ERROR_DEVICE_NOT_CONNECTED; return X_ERROR_DEVICE_NOT_CONNECTED;
} }
if (kernel_state()->xam_state()->xam_dialogs_shown_ > 0) { if (kernel_state()->xam_state()->IsUIActive()) {
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }
@@ -181,7 +181,7 @@ dword_result_t XamInputGetKeystrokeEx_entry(
keystroke.Zero(); keystroke.Zero();
if (kernel_state()->xam_state()->xam_dialogs_shown_ > 0) { if (kernel_state()->xam_state()->IsUIActive()) {
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }

View File

@@ -54,11 +54,14 @@ class XamState {
bool IsUserSignedIn(uint32_t user_index) const; bool IsUserSignedIn(uint32_t user_index) const;
bool IsUserSignedIn(uint64_t xuid) const; bool IsUserSignedIn(uint64_t xuid) const;
//
void LoadSpaInfo(const SpaInfo* info); void LoadSpaInfo(const SpaInfo* info);
void SetContentRegisterCallback(uint32_t callback); void SetContentRegisterCallback(uint32_t callback);
bool IsUIActive() const {
return xam_dialogs_shown_ > 0 || xam_nui_dialogs_shown_ > 0;
}
X_DASH_APP_INFO dash_app_info_ = {}; X_DASH_APP_INFO dash_app_info_ = {};
uint32_t dash_backstack_nodes_count_ = 0; uint32_t dash_backstack_nodes_count_ = 0;
X_DASH_BACKSTACK_DATA dash_backstack_data_[2] = {}; X_DASH_BACKSTACK_DATA dash_backstack_data_[2] = {};

View File

@@ -390,7 +390,7 @@ static dword_result_t XamShowMessageBoxUi(
} }
dword_result_t XamIsUIActive_entry() { dword_result_t XamIsUIActive_entry() {
return kernel_state()->xam_state()->xam_dialogs_shown_ > 0; return kernel_state()->xam_state()->IsUIActive();
} }
DECLARE_XAM_EXPORT2(XamIsUIActive, kUI, kImplemented, kHighFrequency); DECLARE_XAM_EXPORT2(XamIsUIActive, kUI, kImplemented, kHighFrequency);