From 95df198d8a85d253acf8b6ec60625dcec955bf89 Mon Sep 17 00:00:00 2001 From: The-Little-Wolf <116989599+The-Little-Wolf@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:12:42 -0800 Subject: [PATCH] [Xbox] kXNotification Additions - Discovered new unknown kXNotificationID use by XNotifyBroadcast together and wanted to record them before I forget them. - Changed kXNotificationID to kXNotification - Added kXNotificationSystemPXLiveSystemUpdate --- src/xenia/app/emulator_window.cc | 6 +- src/xenia/apu/audio_media_player.cc | 2 +- src/xenia/emulator.cc | 3 +- src/xenia/hid/input_system.cc | 2 +- src/xenia/kernel/kernel_state.cc | 8 +- src/xenia/kernel/xam/apps/xmp_app.cc | 6 +- src/xenia/kernel/xam/profile_manager.cc | 6 +- src/xenia/kernel/xam/xam_ui.cc | 26 +++---- src/xenia/xbox.h | 99 +++++++++++++++---------- 9 files changed, 88 insertions(+), 70 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 9f0f8766b..e820bb635 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -1405,15 +1405,13 @@ void EmulatorWindow::ToggleDisplayConfigDialog() { void EmulatorWindow::ToggleProfilesConfigDialog() { if (!profile_config_dialog_) { disable_hotkeys_ = true; - emulator_->kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, - 1); + emulator_->kernel_state()->BroadcastNotification(kXNotificationSystemUI, 1); profile_config_dialog_ = std::make_unique(imgui_drawer_.get(), this); kernel::xam::xam_dialogs_shown_++; } else { disable_hotkeys_ = false; - emulator_->kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, - 0); + emulator_->kernel_state()->BroadcastNotification(kXNotificationSystemUI, 0); profile_config_dialog_.reset(); kernel::xam::xam_dialogs_shown_--; } diff --git a/src/xenia/apu/audio_media_player.cc b/src/xenia/apu/audio_media_player.cc index 035b8ec36..867c967d9 100644 --- a/src/xenia/apu/audio_media_player.cc +++ b/src/xenia/apu/audio_media_player.cc @@ -483,7 +483,7 @@ void AudioMediaPlayer::SetCaptureCallback(uint32_t callback, uint32_t context, } void AudioMediaPlayer::OnStateChanged() { - kernel_state_->BroadcastNotification(kNotificationXmpStateChanged, + kernel_state_->BroadcastNotification(kXNotificationXmpStateChanged, static_cast(state_)); } diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 0ac14d537..43be92ef5 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -835,8 +835,7 @@ X_STATUS Emulator::InstallContentPackage( return error_code; } - kernel_state()->BroadcastNotification(kXNotificationIDLiveContentInstalled, - 0); + kernel_state()->BroadcastNotification(kXNotificationLiveContentInstalled, 0); return error_code; } diff --git a/src/xenia/hid/input_system.cc b/src/xenia/hid/input_system.cc index 6912deb3d..6ac765521 100644 --- a/src/xenia/hid/input_system.cc +++ b/src/xenia/hid/input_system.cc @@ -59,7 +59,7 @@ void InputSystem::UpdateUsedSlot(InputDriver* driver, uint8_t slot, connected_slots.flip(slot); if (kernel::kernel_state()) { kernel::kernel_state()->BroadcastNotification( - kXNotificationIDSystemInputDevicesChanged, 0); + kXNotificationSystemInputDevicesChanged, 0); } if (driver) { diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 8b9bbe34f..aef639dda 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -867,11 +867,11 @@ void KernelState::RegisterNotifyListener(XNotifyListener* listener) { if (!has_notified_startup_ && listener->mask() & kXNotifySystem) { has_notified_startup_ = true; // XN_SYS_UI (on, off) - listener->EnqueueNotification(kXNotificationIDSystemUI, 1); - listener->EnqueueNotification(kXNotificationIDSystemUI, 0); + listener->EnqueueNotification(kXNotificationSystemUI, 1); + listener->EnqueueNotification(kXNotificationSystemUI, 0); // XN_SYS_SIGNINCHANGED x2 - listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 1); - listener->EnqueueNotification(kXNotificationIDSystemSignInChanged, 1); + listener->EnqueueNotification(kXNotificationSystemSignInChanged, 1); + listener->EnqueueNotification(kXNotificationSystemSignInChanged, 1); } } diff --git a/src/xenia/kernel/xam/apps/xmp_app.cc b/src/xenia/kernel/xam/apps/xmp_app.cc index 80ec50d71..511a5bcff 100644 --- a/src/xenia/kernel/xam/apps/xmp_app.cc +++ b/src/xenia/kernel/xam/apps/xmp_app.cc @@ -108,7 +108,7 @@ X_HRESULT XmpApp::XMPPlayTitlePlaylist(uint32_t playlist_handle, XELOGD("XMPPlayTitlePlaylist({:08X}, {:08X})", playlist_handle, song_handle); kernel_state_->emulator()->audio_media_player()->Play(playlist_handle, song_handle, false); - kernel_state_->BroadcastNotification(kNotificationXmpPlaybackBehaviorChanged, + kernel_state_->BroadcastNotification(kXNotificationXmpPlaybackBehaviorChanged, 1); return X_E_SUCCESS; } @@ -214,7 +214,7 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, static_cast(uint32_t(args->flags))); kernel_state_->BroadcastNotification( - kNotificationXmpPlaybackBehaviorChanged, 0); + kXNotificationXmpPlaybackBehaviorChanged, 0); return X_E_SUCCESS; } case 0x00070009: { @@ -359,7 +359,7 @@ X_HRESULT XmpApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, PlaybackClient(uint32_t(args->playback_client))); kernel_state_->BroadcastNotification( - kNotificationXmpPlaybackControllerChanged, + kXNotificationXmpPlaybackControllerChanged, kernel_state_->emulator() ->audio_media_player() ->IsTitleInPlaybackControl()); diff --git a/src/xenia/kernel/xam/profile_manager.cc b/src/xenia/kernel/xam/profile_manager.cc index acd76f547..c5cf26272 100644 --- a/src/xenia/kernel/xam/profile_manager.cc +++ b/src/xenia/kernel/xam/profile_manager.cc @@ -324,7 +324,7 @@ void ProfileManager::Login(const uint64_t xuid, const uint8_t user_index, } if (notify) { - kernel_state_->BroadcastNotification(kXNotificationIDSystemSignInChanged, + kernel_state_->BroadcastNotification(kXNotificationSystemSignInChanged, GetUsedUserSlots().to_ulong()); } UpdateConfig(xuid, assigned_user_slot); @@ -338,7 +338,7 @@ void ProfileManager::Logout(const uint8_t user_index, bool notify) { DismountProfile(profile->second->xuid()); logged_profiles_.erase(profile); if (notify) { - kernel_state_->BroadcastNotification(kXNotificationIDSystemSignInChanged, + kernel_state_->BroadcastNotification(kXNotificationSystemSignInChanged, GetUsedUserSlots().to_ulong()); } UpdateConfig(0, user_index); @@ -352,7 +352,7 @@ void ProfileManager::LoginMultiple( slots_mask |= (1 << slot); } - kernel_state_->BroadcastNotification(kXNotificationIDSystemSignInChanged, + kernel_state_->BroadcastNotification(kXNotificationSystemSignInChanged, slots_mask); } diff --git a/src/xenia/kernel/xam/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc index c1ecf4310..c96a51f58 100644 --- a/src/xenia/kernel/xam/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -85,7 +85,7 @@ X_RESULT xeXamDispatchDialog(T* dialog, std::function close_callback, uint32_t overlapped) { auto pre = []() { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); }; auto run = [dialog, close_callback]() -> X_RESULT { X_RESULT result; @@ -108,7 +108,7 @@ X_RESULT xeXamDispatchDialog(T* dialog, }; auto post = []() { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; if (!overlapped) { pre(); @@ -126,7 +126,7 @@ X_RESULT xeXamDispatchDialogEx( T* dialog, std::function close_callback, uint32_t overlapped) { auto pre = []() { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); }; auto run = [dialog, close_callback](uint32_t& extended_error, uint32_t& length) -> X_RESULT { @@ -150,7 +150,7 @@ X_RESULT xeXamDispatchDialogEx( }; auto post = []() { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; if (!overlapped) { pre(); @@ -168,11 +168,11 @@ X_RESULT xeXamDispatchDialogEx( X_RESULT xeXamDispatchHeadless(std::function run_callback, uint32_t overlapped) { auto pre = []() { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); }; auto post = []() { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; if (!overlapped) { pre(); @@ -190,11 +190,11 @@ X_RESULT xeXamDispatchHeadlessEx( std::function run_callback, uint32_t overlapped) { auto pre = []() { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); }; auto post = []() { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; if (!overlapped) { pre(); @@ -213,7 +213,7 @@ X_RESULT xeXamDispatchHeadlessEx( template X_RESULT xeXamDispatchDialogAsync(T* dialog, std::function close_callback) { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); ++xam_dialogs_shown_; // Important to pass captured vars by value here since we return from this @@ -226,7 +226,7 @@ X_RESULT xeXamDispatchDialogAsync(T* dialog, auto run = []() -> void { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; std::thread thread(run); @@ -237,7 +237,7 @@ X_RESULT xeXamDispatchDialogAsync(T* dialog, } X_RESULT xeXamDispatchHeadlessAsync(std::function run_callback) { - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, true); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, true); ++xam_dialogs_shown_; auto display_window = kernel_state()->emulator()->display_window(); @@ -248,7 +248,7 @@ X_RESULT xeXamDispatchHeadlessAsync(std::function run_callback) { auto run = []() -> void { xe::threading::Sleep(std::chrono::milliseconds(100)); - kernel_state()->BroadcastNotification(kXNotificationIDSystemUI, false); + kernel_state()->BroadcastNotification(kXNotificationSystemUI, false); }; std::thread thread(run); @@ -1295,7 +1295,7 @@ X_HRESULT xeXShowMarketplaceUIEx(dword_t user_index, dword_t ui_type, cvars::license_mask = 1; kernel_state()->BroadcastNotification( - kXNotificationIDLiveContentInstalled, 0); + kXNotificationLiveContentInstalled, 0); } } }; diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index 765f511b0..5e982940b 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -271,60 +271,81 @@ constexpr uint8_t XUserIndexAny = 0xFF; // https://github.com/ThirteenAG/Ultimate-ASI-Loader/blob/master/source/xlive/xliveless.h typedef uint32_t XNotificationID; enum : XNotificationID { + /* Notes: + - kXNotificationSystemUnknown, kXNotificationLiveUnknown, + kXNotificationCustomGamercard, kXNotificationDvdDriveUnknown, + kXNotificationXmpUnknown, kXNotificationFriendsUnknown, and + kXNotificationMsgrUnknown are all called together by XNotifyBroadcast + */ + // Notification Areas kXNotifySystem = 0x00000001, kXNotifyLive = 0x00000002, kXNotifyFriends = 0x00000004, kXNotifyCustom = 0x00000008, + kXNotifyDvdDrive = 0x00000010, // ? kXNotifyXmp = 0x00000020, kXNotifyMsgr = 0x00000040, kXNotifyParty = 0x00000080, kXNotifyAll = 0x000000EF, - // XNotification System - kXNotificationIDSystemUI = 0x00000009, - kXNotificationIDSystemSignInChanged = 0x0000000A, - kXNotificationIDSystemStorageDevicesChanged = 0x0000000B, - kXNotificationIDSystemProfileSettingChanged = 0x0000000E, - kXNotificationIDSystemMuteListChanged = 0x00000011, - kXNotificationIDSystemInputDevicesChanged = 0x00000012, - kXNotificationIDSystemInputDeviceConfigChanged = 0x00000013, - kXNotificationIDSystemPlayerTimerNotice = 0x00000015, - kXNotificationIDSystemAvatarChanged = 0x00000017, - kXNotificationIDSystemNUIHardwareStatusChanged = 0x00000019, - kXNotificationIDSystemNUIPause = 0x0000001A, - kXNotificationIDSystemNUIUIApproach = 0x0000001B, - kXNotificationIDSystemDeviceRemap = 0x0000001C, - kXNotificationIDSystemNUIBindingChanged = 0x0000001D, - kXNotificationIDSystemAudioLatencyChanged = 0x0000001E, - kXNotificationIDSystemNUIChatBindingChanged = 0x0000001F, - kXNotificationIDSystemInputActivityChanged = 0x00000020, + // XNotification System (35 total) + kXNotificationSystemUI = 0x00000009, + kXNotificationSystemSignInChanged = 0x0000000A, + kXNotificationSystemStorageDevicesChanged = 0x0000000B, + kXNotificationSystemProfileSettingChanged = 0x0000000E, + kXNotificationSystemMuteListChanged = 0x00000011, + kXNotificationSystemInputDevicesChanged = 0x00000012, + kXNotificationSystemInputDeviceConfigChanged = 0x00000013, + kXNotificationSystemPlayerTimerNotice = 0x00000015, + kXNotificationSystemPXLiveSystemUpdate = 0x00000016, + kXNotificationSystemAvatarChanged = 0x00000017, + kXNotificationSystemUnknown = 0x00000018, + kXNotificationSystemNUIHardwareStatusChanged = 0x00000019, + kXNotificationSystemNUIPause = 0x0000001A, + kXNotificationSystemNUIUIApproach = 0x0000001B, + kXNotificationSystemDeviceRemap = 0x0000001C, + kXNotificationSystemNUIBindingChanged = 0x0000001D, + kXNotificationSystemAudioLatencyChanged = 0x0000001E, + kXNotificationSystemNUIChatBindingChanged = 0x0000001F, + kXNotificationSystemInputActivityChanged = 0x00000020, - // XNotification Live - kXNotificationIDLiveConnectionChanged = 0x02000001, - kXNotificationIDLiveInviteAccepted = 0x02000002, - kXNotificationIDLiveLinkStateChanged = 0x02000003, - kXNotificationIDLiveContentInstalled = 0x02000007, - kXNotificationIDLiveMembershipPurchased = 0x02000008, - kXNotificationIDLiveVoicechatAway = 0x02000009, - kXNotificationIDLivePresenceChanged = 0x0200000A, + // XNotification Live (20 total) + kXNotificationLiveConnectionChanged = 0x02000001, + kXNotificationLiveInviteAccepted = 0x02000002, + kXNotificationLiveLinkStateChanged = 0x02000003, + kXNotificationLiveContentInstalled = 0x02000007, + kXNotificationLiveMembershipPurchased = 0x02000008, + kXNotificationLiveVoicechatAway = 0x02000009, + kXNotificationLivePresenceChanged = 0x0200000A, + kXNotificationLiveUnknown = 0x02000012, - // XNotification Friends - kXNotificationIDFriendsPresenceChanged = 0x04000001, - kXNotificationIDFriendsFriendAdded = 0x04000002, - kXNotificationIDFriendsFriendRemoved = 0x04000003, + // XNotification Friends (9 total) + kXNotificationFriendsPresenceChanged = 0x04000001, + kXNotificationFriendsFriendAdded = 0x04000002, + kXNotificationFriendsFriendRemoved = 0x04000003, + kXNotificationFriendsUnknown = 0x04000008, - // XNotification Custom - kXNotificationIDCustomActionPressed = 0x06000003, - kXNotificationIDCustomGamercard = 0x06000004, + // XNotification Custom (5 total) + kXNotificationCustomActionPressed = 0x06000003, + kXNotificationCustomGamercard = 0x06000004, - // XNotification XMP - kNotificationXmpStateChanged = 0x0A000001, - kNotificationXmpPlaybackBehaviorChanged = 0x0A000002, - kNotificationXmpPlaybackControllerChanged = 0x0A000003, + // XNotification Dvd ? + kXNotificationDvdDriveUnknown = 0x80000003, + kXNotificationDvdDriveTrayStateChanged = 0x8000000D, - // XNotification Party - kXNotificationIDPartyMembersChanged = 0x0E000002, + // XNotification XMP (13 total) + kXNotificationXmpStateChanged = 0x0A000001, + kXNotificationXmpPlaybackBehaviorChanged = 0x0A000002, + kXNotificationXmpPlaybackControllerChanged = 0x0A000003, + kXNotificationXmpUnknown = 0x0A00000C, + + // XNotification Party (6 total) + kXNotificationPartyMembersChanged = 0x0E000002, + kXNotificationFriendUnknown = 0x0E000005, + + // XNotification Msgr + kXNotificationMsgrUnknown = 0x0C00000E, }; // https://github.com/CodeAsm/ffplay360/blob/master/Common/XTLOnPC.h