This commit is contained in:
Zaid Ismail 2025-08-24 23:45:47 +00:00 committed by GitHub
commit d426679d01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 27 deletions

View file

@ -657,17 +657,19 @@ void KernelState::RegisterNotifyListener(XNotifyListener* listener) {
if (!has_notified_startup_ && listener->mask() & 0x00000001) { if (!has_notified_startup_ && listener->mask() & 0x00000001) {
has_notified_startup_ = true; has_notified_startup_ = true;
// XN_SYS_UI (on, off) // XN_SYS_UI (on, off)
listener->EnqueueNotification(0x00000009, 1); listener->EnqueueNotification(kXNotificationIDSystemUI, 1);
listener->EnqueueNotification(0x00000009, 0); listener->EnqueueNotification(kXNotificationIDSystemUI, 0);
// XN_SYS_SIGNINCHANGED x2 // XN_SYS_SIGNINCHANGED x2
listener->EnqueueNotification(0x0000000A, 1); listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 1);
listener->EnqueueNotification(0x0000000A, 1); listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 1);
// XN_SYS_INPUTDEVICESCHANGED x2 // XN_SYS_INPUTDEVICESCHANGED x2
listener->EnqueueNotification(0x00000012, 0); listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 0);
listener->EnqueueNotification(0x00000012, 0); listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 0);
// XN_SYS_INPUTDEVICECONFIGCHANGED x2 // XN_SYS_INPUTDEVICECONFIGCHANGED x2
listener->EnqueueNotification(0x00000013, 0); listener->EnqueueNotification(
listener->EnqueueNotification(0x00000013, 0); kXNotificationIDSystemInputDeviceConfigChanged, 0);
listener->EnqueueNotification(
kXNotificationIDSystemInputDeviceConfigChanged, 0);
} }
} }

View file

@ -239,6 +239,13 @@ class KernelState {
friend class XObject; friend class XObject;
}; };
enum : XNotificationID {
kXNotificationIDSystemUI = 0x00000009,
kXNotificationIDSystemSignInChanged = 0x0000000A,
kXNotificationIDSystemInputDevicesChanged = 0x00000012,
kXNotificationIDSystemInputDeviceConfigChanged = 0x00000013,
};
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe

View file

@ -142,7 +142,8 @@ X_HRESULT XmpApp::XMPPlayTitlePlaylist(uint32_t playlist_handle,
active_song_index_ = 0; active_song_index_ = 0;
state_ = State::kPlaying; state_ = State::kPlaying;
OnStateChanged(); OnStateChanged();
kernel_state_->BroadcastNotification(kMsgPlaybackBehaviorChanged, 1); kernel_state_->
BroadcastNotification(kNotificationPlaybackBehaviorChanged, 1);
return X_E_SUCCESS; return X_E_SUCCESS;
} }
@ -202,7 +203,7 @@ X_HRESULT XmpApp::XMPPrevious() {
} }
void XmpApp::OnStateChanged() { void XmpApp::OnStateChanged() {
kernel_state_->BroadcastNotification(kMsgStateChanged, kernel_state_->BroadcastNotification(kNotificationStateChanged,
static_cast<uint32_t>(state_)); static_cast<uint32_t>(state_));
} }
@ -270,7 +271,8 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
playback_mode_ = static_cast<PlaybackMode>(uint32_t(args->playback_mode)); playback_mode_ = static_cast<PlaybackMode>(uint32_t(args->playback_mode));
repeat_mode_ = static_cast<RepeatMode>(uint32_t(args->repeat_mode)); repeat_mode_ = static_cast<RepeatMode>(uint32_t(args->repeat_mode));
unknown_flags_ = args->flags; unknown_flags_ = args->flags;
kernel_state_->BroadcastNotification(kMsgPlaybackBehaviorChanged, 0); kernel_state_->
BroadcastNotification(kNotificationPlaybackBehaviorChanged, 0);
return X_E_SUCCESS; return X_E_SUCCESS;
} }
case 0x00070009: { case 0x00070009: {
@ -405,8 +407,9 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
uint32_t(args->controller), uint32_t(args->playback_client)); uint32_t(args->controller), uint32_t(args->playback_client));
playback_client_ = PlaybackClient(uint32_t(args->playback_client)); playback_client_ = PlaybackClient(uint32_t(args->playback_client));
kernel_state_->BroadcastNotification(kMsgPlaybackControllerChanged, kernel_state_->BroadcastNotification(
!args->playback_client); kNotificationPlaybackControllerChanged,
!args->playback_client);
return X_E_SUCCESS; return X_E_SUCCESS;
} }
case 0x0007001B: { case 0x0007001B: {

View file

@ -46,6 +46,11 @@ class XmpApp : public App {
// kNoRepeat = ?, // kNoRepeat = ?,
kUnknown = 0, kUnknown = 0,
}; };
enum : XNotificationID {
kNotificationStateChanged = 0x0A000001,
kNotificationPlaybackBehaviorChanged = 0x0A000002,
kNotificationPlaybackControllerChanged = 0x0A000003,
};
struct Song { struct Song {
enum class Format : uint32_t { enum class Format : uint32_t {
kWma = 0, kWma = 0,
@ -92,10 +97,6 @@ class XmpApp : public App {
uint32_t buffer_length) override; uint32_t buffer_length) override;
private: private:
static const uint32_t kMsgStateChanged = 0x0A000001;
static const uint32_t kMsgPlaybackBehaviorChanged = 0x0A000002;
static const uint32_t kMsgPlaybackControllerChanged = 0x0A000003;
void OnStateChanged(); void OnStateChanged();
State state_; State state_;

View file

@ -71,7 +71,7 @@ X_RESULT xeXamDispatchDialog(T* dialog,
uint32_t overlapped) { uint32_t overlapped) {
auto pre = []() { auto pre = []() {
// Broadcast XN_SYS_UI = true // Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
}; };
auto run = [dialog, close_callback]() -> X_RESULT { auto run = [dialog, close_callback]() -> X_RESULT {
X_RESULT result; X_RESULT result;
@ -95,7 +95,7 @@ X_RESULT xeXamDispatchDialog(T* dialog,
auto post = []() { auto post = []() {
xe::threading::Sleep(std::chrono::milliseconds(100)); xe::threading::Sleep(std::chrono::milliseconds(100));
// Broadcast XN_SYS_UI = false // Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
}; };
if (!overlapped) { if (!overlapped) {
pre(); pre();
@ -114,7 +114,7 @@ X_RESULT xeXamDispatchDialogEx(
uint32_t overlapped) { uint32_t overlapped) {
auto pre = []() { auto pre = []() {
// Broadcast XN_SYS_UI = true // Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
}; };
auto run = [dialog, close_callback](uint32_t& extended_error, auto run = [dialog, close_callback](uint32_t& extended_error,
uint32_t& length) -> X_RESULT { uint32_t& length) -> X_RESULT {
@ -139,7 +139,7 @@ X_RESULT xeXamDispatchDialogEx(
auto post = []() { auto post = []() {
xe::threading::Sleep(std::chrono::milliseconds(100)); xe::threading::Sleep(std::chrono::milliseconds(100));
// Broadcast XN_SYS_UI = false // Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
}; };
if (!overlapped) { if (!overlapped) {
pre(); pre();
@ -158,12 +158,12 @@ X_RESULT xeXamDispatchHeadless(std::function<X_RESULT()> run_callback,
uint32_t overlapped) { uint32_t overlapped) {
auto pre = []() { auto pre = []() {
// Broadcast XN_SYS_UI = true // Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
}; };
auto post = []() { auto post = []() {
xe::threading::Sleep(std::chrono::milliseconds(100)); xe::threading::Sleep(std::chrono::milliseconds(100));
// Broadcast XN_SYS_UI = false // Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
}; };
if (!overlapped) { if (!overlapped) {
pre(); pre();
@ -182,12 +182,12 @@ X_RESULT xeXamDispatchHeadlessEx(
uint32_t overlapped) { uint32_t overlapped) {
auto pre = []() { auto pre = []() {
// Broadcast XN_SYS_UI = true // Broadcast XN_SYS_UI = true
kernel_state()->BroadcastNotification(0x9, true); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true);
}; };
auto post = []() { auto post = []() {
xe::threading::Sleep(std::chrono::milliseconds(100)); xe::threading::Sleep(std::chrono::milliseconds(100));
// Broadcast XN_SYS_UI = false // Broadcast XN_SYS_UI = false
kernel_state()->BroadcastNotification(0x9, false); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false);
}; };
if (!overlapped) { if (!overlapped) {
pre(); pre();

View file

@ -521,10 +521,10 @@ dword_result_t XamShowSigninUI_entry(dword_t unk, dword_t unk_mask) {
// To fix game modes that display a 4 profile signin UI (even if playing // To fix game modes that display a 4 profile signin UI (even if playing
// alone): // alone):
// XN_SYS_SIGNINCHANGED // XN_SYS_SIGNINCHANGED
kernel_state()->BroadcastNotification(0x0000000A, 1); kernel_state()->BroadcastNotification(kXNotificationIDSystemSignInChanged, 1);
// Games seem to sit and loop until we trigger this notification: // Games seem to sit and loop until we trigger this notification:
// XN_SYS_UI (off) // XN_SYS_UI (off)
kernel_state()->BroadcastNotification(0x00000009, 0); kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, 0);
return X_ERROR_SUCCESS; return X_ERROR_SUCCESS;
} }
DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kStub); DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kStub);