From 2f9e562aac0b930c35f0b3a67cb63bfaa5fc6ad6 Mon Sep 17 00:00:00 2001 From: CT5 Date: Fri, 7 Nov 2025 15:57:20 +1100 Subject: [PATCH] Integrated Config File --- .../Implementation/Windows.Xbox.System.User.h | 3 ++- .../Windows.Xbox.System.UserDisplayInfo.cpp | 25 +++++++++++++------ .../Windows.Xbox.System.UserDisplayInfo.h | 3 ++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.System.User.h b/dlls/winrt_x/Implementation/Windows.Xbox.System.User.h index 148a887..061a3d6 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.System.User.h +++ b/dlls/winrt_x/Implementation/Windows.Xbox.System.User.h @@ -6,7 +6,7 @@ namespace winrt::Windows::Xbox::System::implementation struct User : UserT { User() = default; - User(uint64_t id) : m_id(id) {} + User(uint64_t id) : m_id(id), wdcfg(WinDurangoConfig::Instance()) {} static winrt::Windows::Xbox::System::UserOnlineState OnlineState(); static winrt::event_token OnlineStateChanged(winrt::Windows::Foundation::EventHandler const& handler); @@ -58,6 +58,7 @@ namespace winrt::Windows::Xbox::System::implementation inline static winrt::event> m_signOutCompletedEvent; inline static winrt::Windows::Xbox::System::User staticUser = {nullptr}; inline static winrt::Windows::Foundation::Collections::IVector staticUsers = {nullptr}; + WinDurangoConfig& wdcfg; }; } namespace winrt::Windows::Xbox::System::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 2052449..793f653 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp +++ b/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.cpp @@ -7,43 +7,54 @@ namespace winrt::Windows::Xbox::System::implementation hstring UserDisplayInfo::Gamertag() { LOG_INFO("UserDisplayInfo::Gamertag() called"); - - return L"HelloWorld"; + + return winrt::to_hstring(wdcfg.GetData().gamertag); } uint32_t UserDisplayInfo::GamerScore() { LOG_INFO("UserDisplayInfo::GamerScore() called"); - return 0; + return wdcfg.GetData().gamerscore; } hstring UserDisplayInfo::ApplicationDisplayName() { LOG_INFO("UserDisplayInfo::GameDisplayName() called"); - return to_hstring("WinDurango"); + return winrt::to_hstring(wdcfg.GetData().gamertag); } hstring UserDisplayInfo::GameDisplayName() { LOG_INFO("UserDisplayInfo::GameDisplayName() called"); - return L"HelloWorld"; + return winrt::to_hstring(wdcfg.GetData().gamertag); } int32_t UserDisplayInfo::Reputation() { LOG_INFO("UserDisplayInfo::Reputation() called"); - return 1; + return wdcfg.GetData().reputation; } UserAgeGroup UserDisplayInfo::AgeGroup() { LOG_INFO("UserDisplayInfo::AgeGroup() called"); - return UserAgeGroup::Unknown; + switch (wdcfg.GetData().ageGroup) { + case WinDurangoConfigData::AgeGroup::Adult: + return UserAgeGroup::Adult; + case WinDurangoConfigData::AgeGroup::Child: + return UserAgeGroup::Child; + case WinDurangoConfigData::AgeGroup::Teen: + return UserAgeGroup::Teen; + case WinDurangoConfigData::AgeGroup::Unknown: + return UserAgeGroup::Unknown; + default: + return UserAgeGroup::Unknown; + } } Foundation::Collections::IVectorView UserDisplayInfo::Privileges() diff --git a/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.h b/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.h index d0ac2ed..9d0a87c 100644 --- a/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.h +++ b/dlls/winrt_x/Implementation/Windows.Xbox.System.UserDisplayInfo.h @@ -6,7 +6,7 @@ namespace winrt::Windows::Xbox::System::implementation struct UserDisplayInfo : UserDisplayInfoT { UserDisplayInfo() = default; - UserDisplayInfo(hstring gamertag) {} + UserDisplayInfo(hstring gamertag) : wdcfg(WinDurangoConfig::Instance()) {} hstring Gamertag(); uint32_t GamerScore(); @@ -15,5 +15,6 @@ namespace winrt::Windows::Xbox::System::implementation int32_t Reputation(); UserAgeGroup AgeGroup(); Foundation::Collections::IVectorView Privileges(); + WinDurangoConfig& wdcfg; }; }