From 07e5a6de1e4028ee8fbd92edbc9afd3f48fa2296 Mon Sep 17 00:00:00 2001 From: Serenity <34622204+oSerenity@users.noreply.github.com> Date: Tue, 3 Jun 2025 06:15:14 -0400 Subject: [PATCH] Implement event handling and logging improvements - Updated `ChatMuteList` to implement `UserMuteStateChanged` methods with logging and event handling. - Modified `UserDisplayInfo` methods to log informational messages instead of throwing exceptions. - Introduced `m_notificationPositionHint` in `SystemUI` and updated `SetNotificationPositionHint` to log changes. - Updated header files to declare new static members for better accessibility. --- .../Windows.Xbox.Chat.ChatMuteList.cpp | 6 ++- .../Windows.Xbox.Chat.ChatMuteList.h | 2 + .../Windows.Xbox.System.UserDisplayInfo.cpp | 15 +++---- .../Windows.Xbox.UI.SystemUI.cpp | 42 ++++++++++++++++++- .../Implementation/Windows.Xbox.UI.SystemUI.h | 2 + 5 files changed, 57 insertions(+), 10 deletions(-) diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.cpp b/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.cpp index 6ba177c..ba64610 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.cpp +++ b/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.cpp @@ -6,10 +6,12 @@ namespace winrt::Windows::Xbox::Chat::implementation { winrt::event_token ChatMuteList::UserMuteStateChanged(winrt::Windows::Foundation::EventHandler const& handler) { - LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented(); + LOG_WARNING("ChatMuteList::UserMuteStateChanged(winrt::Windows::Foundation::EventHandler const& handler) Stubbed!!"); + return m_muteEvent.add(handler); } void ChatMuteList::UserMuteStateChanged(winrt::event_token const& token) noexcept { - LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented(); + LOG_WARNING("ChatMuteList::UserMuteStateChanged(winrt::event_token const& token) Stubbed!!"); + m_muteEvent.remove(token); } } diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.h b/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.h index 1ad1ccd..8b56e83 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.h +++ b/dlls/winrt_x/Implementation/Windows.Xbox.Chat.ChatMuteList.h @@ -9,6 +9,8 @@ namespace winrt::Windows::Xbox::Chat::implementation static winrt::event_token UserMuteStateChanged(winrt::Windows::Foundation::EventHandler const& handler); static void UserMuteStateChanged(winrt::event_token const& token) noexcept; + private: + inline static winrt::event> m_muteEvent; }; } namespace winrt::Windows::Xbox::Chat::factory_implementation diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp b/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp index 558a177..474a13a 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp +++ b/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp @@ -6,39 +6,40 @@ namespace winrt::Windows::Xbox::System::implementation { hstring UserDisplayInfo::Gamertag() { - LOG_NOT_IMPLEMENTED(); + LOG_INFO("UserDisplayInfo::Gamertag() called"); hstring gamertag = L"durangler" + m_gamertag; return gamertag; } uint32_t UserDisplayInfo::GamerScore() { - LOG_NOT_IMPLEMENTED(); return 0; + LOG_INFO("UserDisplayInfo::GamerScore() called"); + return 0; } hstring UserDisplayInfo::ApplicationDisplayName() { - LOG_NOT_IMPLEMENTED(); + LOG_INFO("UserDisplayInfo::GameDisplayName() called"); return winrt::to_hstring("WinDurango"); } hstring UserDisplayInfo::GameDisplayName() { - LOG_NOT_IMPLEMENTED(); + LOG_INFO("UserDisplayInfo::GameDisplayName() called"); hstring gamertag = L"durangler" + m_gamertag; return gamertag; } int32_t UserDisplayInfo::Reputation() { - LOG_NOT_IMPLEMENTED(); + LOG_INFO("UserDisplayInfo::Reputation() called"); return 1; } winrt::Windows::Xbox::System::UserAgeGroup UserDisplayInfo::AgeGroup() { - Logger::Info("UserDisplayInfo::AgeGroup() called"); + LOG_INFO("UserDisplayInfo::AgeGroup() called"); return UserAgeGroup::Unknown; } winrt::Windows::Foundation::Collections::IVectorView UserDisplayInfo::Privileges() { - LOG_NOT_IMPLEMENTED(); + LOG_INFO("UserDisplayInfo::Privileges() called"); auto vector = winrt::single_threaded_vector(); vector.Append(1); return vector.GetView(); diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.cpp b/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.cpp index 9452da6..f2feb96 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.cpp +++ b/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.cpp @@ -8,8 +8,11 @@ void* g_pD3D11XEventFunc = nullptr; void* g_pWDWaitForKeyboardFunc = nullptr; + namespace winrt::Windows::Xbox::UI::implementation { + winrt::Windows::Xbox::UI::NotificationPositionHint SystemUI::m_notificationPositionHint = + winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight; winrt::Windows::Foundation::IAsyncAction SystemUI::ShowEpgAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Foundation::Collections::IIterable> propertySet) { LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented(); @@ -114,7 +117,44 @@ namespace winrt::Windows::Xbox::UI::implementation } void SystemUI::SetNotificationPositionHint(winrt::Windows::Xbox::UI::NotificationPositionHint const& value) { - LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented(); + LOG_WARNING("SystemUI::SetNotificationPositionHint called.. Function Stubbed!!!"); + switch (value) + { + case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomCenter: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomCenter.\n"); + m_notificationPositionHint = value; + break; + + case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomLeft: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomLeft.\n"); + m_notificationPositionHint = value; + break; + + case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomRight: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomRight.\n"); + m_notificationPositionHint = value; + break; + + case winrt::Windows::Xbox::UI::NotificationPositionHint::TopCenter: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopCenter.\n"); + m_notificationPositionHint = value; + break; + + case winrt::Windows::Xbox::UI::NotificationPositionHint::TopLeft: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopLeft.\n"); + m_notificationPositionHint = value; + break; + + case winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopRight.\n"); + m_notificationPositionHint = value; + break; + + default: + LOG_WARNING("SystemUI::SetNotificationPositionHint: Received unknown value! Defaulting to TopRight.\n"); + m_notificationPositionHint = winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight; + break; + } } winrt::Windows::Foundation::IAsyncOperation SystemUI::AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri, winrt::Windows::Foundation::Uri callbackUri) { diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.h b/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.h index 62143ea..a4385c8 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.h +++ b/dlls/winrt_x/Implementation/Windows.Xbox.UI.SystemUI.h @@ -34,7 +34,9 @@ namespace winrt::Windows::Xbox::UI::implementation static winrt::Windows::Foundation::IAsyncOperation AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri, winrt::Windows::Foundation::Uri callbackUri); static winrt::Windows::Foundation::IAsyncOperation AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri); static winrt::Windows::Foundation::Uri GetCurrentApplicationCallbackUri(winrt::Windows::Xbox::System::IUser const& requestingUser); + static winrt::Windows::Xbox::UI::NotificationPositionHint m_notificationPositionHint; }; + } namespace winrt::Windows::Xbox::UI::factory_implementation {