Bringing over 1611 QFE 2 and 1612 Changes (#58)
This commit is contained in:
Родитель
2863c27550
Коммит
8d968b6a14
|
@ -115,6 +115,10 @@
|
|||
<AdditionalDependencies>windowsapp.lib;msxml6.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>
|
||||
api-ms-win-gaming-tcui-l1-1-2.dll;
|
||||
%(DelayLoadDLLs)
|
||||
</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
|
|
|
@ -67,6 +67,23 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
// Detect if app is MUA and API is supported
|
||||
bool IsMultiUserAPISupported()
|
||||
{
|
||||
// Save the result in memory, as we only need to check once;
|
||||
static int isSupported = -1;
|
||||
|
||||
// Only RS1 sdk will have this check.
|
||||
#ifdef NTDDI_WIN10_RS1
|
||||
if (isSupported == -1)
|
||||
{
|
||||
// all RS1 based TCUI calls are based around multi-user
|
||||
isSupported = Windows::Foundation::Metadata::ApiInformation::IsMethodPresent("Windows.System.UserPicker", "IsSupported");
|
||||
}
|
||||
#endif
|
||||
return isSupported == 1;
|
||||
}
|
||||
|
||||
void WINAPI UICompletionRoutine(
|
||||
_In_ HRESULT returnCode,
|
||||
_In_ void* context
|
||||
|
@ -178,7 +195,7 @@ title_callable_ui::show_player_picker_ui(
|
|||
else
|
||||
{
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = ShowPlayerPickerUIForUser(
|
||||
|
@ -256,7 +273,7 @@ title_callable_ui::show_game_invite_ui(
|
|||
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = ShowGameInviteUIForUser(
|
||||
|
@ -319,7 +336,7 @@ title_callable_ui::show_profile_card_ui(
|
|||
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = ShowProfileCardUIForUser(
|
||||
|
@ -376,7 +393,7 @@ title_callable_ui::show_change_friend_relationship_ui(
|
|||
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = ShowChangeFriendRelationshipUIForUser(
|
||||
|
@ -432,7 +449,7 @@ title_callable_ui::show_title_achievements_ui(
|
|||
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = ShowTitleAchievementsUIForUser(
|
||||
|
@ -504,7 +521,7 @@ title_callable_ui::check_gaming_privilege_silently(
|
|||
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = CheckGamingPrivilegeSilentlyForUser(
|
||||
|
@ -555,7 +572,7 @@ title_callable_ui::check_gaming_privilege_with_ui(
|
|||
BOOL hasPrivilege = FALSE;
|
||||
HRESULT hr = S_OK;
|
||||
#if UWP_API
|
||||
if (user != nullptr)
|
||||
if (user != nullptr && IsMultiUserAPISupported())
|
||||
{
|
||||
ABI::Windows::System::IUser* userAbi = reinterpret_cast<ABI::Windows::System::IUser*>(user);
|
||||
hr = CheckGamingPrivilegeWithUIForUser(
|
||||
|
|
|
@ -375,6 +375,12 @@ social_graph::apply_event(
|
|||
)
|
||||
{
|
||||
const auto& inactiveBuffer = m_userBuffer.inactive_buffer();
|
||||
if (inactiveBuffer == nullptr)
|
||||
{
|
||||
LOG_ERROR("In active buffer null in event processing");
|
||||
return;
|
||||
}
|
||||
|
||||
social_event_type eventType = social_event_type::unknown;
|
||||
switch (evt.event_type())
|
||||
{
|
||||
|
@ -792,6 +798,11 @@ social_graph::setup_rta_subscriptions(
|
|||
|
||||
if (shouldReinitialize)
|
||||
{
|
||||
if (m_userBuffer.inactive_buffer() == nullptr)
|
||||
{
|
||||
LOG_ERROR("Failed to reinitialize rta subs");
|
||||
return;
|
||||
}
|
||||
std::vector<uint64_t> users;
|
||||
for (auto& userPair : m_userBuffer.inactive_buffer()->socialUserGraph)
|
||||
{
|
||||
|
@ -1020,6 +1031,11 @@ social_graph::perform_diff(
|
|||
std::lock_guard<std::recursive_mutex> lock(m_socialGraphMutex);
|
||||
std::lock_guard<std::recursive_mutex> priorityLock(m_socialGraphPriorityMutex);
|
||||
m_perfTester.start_timer(_T("set_state"));
|
||||
if (m_userBuffer.inactive_buffer() == nullptr)
|
||||
{
|
||||
LOG_ERROR("Diff cannot happening with null buffer");
|
||||
return;
|
||||
}
|
||||
set_state(social_graph_state::diff);
|
||||
m_perfTester.stop_timer(_T("set_state"));
|
||||
}
|
||||
|
@ -1386,6 +1402,11 @@ social_graph::presence_timer_callback(
|
|||
std::lock_guard<std::recursive_mutex> lock(pThis->m_socialGraphMutex);
|
||||
std::lock_guard<std::recursive_mutex> priorityLock(pThis->m_socialGraphPriorityMutex);
|
||||
pThis->m_perfTester.start_timer(_T("social graph refresh state set"));
|
||||
if (pThis->m_userBuffer.inactive_buffer() == nullptr)
|
||||
{
|
||||
LOG_ERROR("Cannot update presence when user buffer is null");
|
||||
return;
|
||||
}
|
||||
pThis->set_state(social_graph_state::refresh);
|
||||
pThis->m_perfTester.start_timer(_T("social graph refresh state set"));
|
||||
}
|
||||
|
@ -1759,7 +1780,7 @@ user_buffers_holder::buffer_alloc(
|
|||
_In_ size_t freeSpaceRequired
|
||||
)
|
||||
{
|
||||
if (numUsers == 0)
|
||||
if (numUsers == 0 && freeSpaceRequired == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1820,12 +1841,16 @@ user_buffers_holder::add_users_to_buffer(
|
|||
++size;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<xbox_social_user> socialVec(size);
|
||||
if (size > 0)
|
||||
{
|
||||
#if _WIN32
|
||||
memcpy_s(&socialVec[0], socialVec.size() * sizeof(xbox_social_user), &userBufferInactive.buffer[0], size * sizeof(xbox_social_user));
|
||||
memcpy_s(&socialVec[0], socialVec.size() * sizeof(xbox_social_user), &userBufferInactive.buffer[0], size * sizeof(xbox_social_user));
|
||||
#else
|
||||
memcpy(&socialVec[0], &userBufferInactive.buffer[0], size * sizeof(xbox_social_user));
|
||||
memcpy(&socialVec[0], &userBufferInactive.buffer[0], size * sizeof(xbox_social_user));
|
||||
#endif
|
||||
}
|
||||
xsapi_memory::mem_free(userBufferInactive.buffer);
|
||||
initialize_buffer(userBufferInactive, socialVec, totalSizeNeeded);
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ user_impl_idp::initialize_provider()
|
|||
}
|
||||
|
||||
pplx::task<WebAccountProvider^> findProviderTask;
|
||||
if (m_creationContext == nullptr)
|
||||
if (m_creationContext == nullptr || !is_multi_user_application())
|
||||
{
|
||||
findProviderTask = create_task(WebAuthenticationCoreManager::FindAccountProviderAsync("https://xsts.auth.xboxlive.com"));
|
||||
}
|
||||
|
|
|
@ -2080,6 +2080,55 @@ public:
|
|||
VerifyUserBuffer(userBufferHolder.user_buffer_b(), userGroupSize);
|
||||
}
|
||||
|
||||
DEFINE_TEST_CASE(TestSocialManagerUserBufferAddUsersWithNoInit)
|
||||
{
|
||||
DEFINE_TEST_CASE_PROPERTIES_FOCUS(TestSocialManagerUserBufferAddUsersWithNoInit);
|
||||
auto peopleHubService = SocialManagerHelper::GetPeoplehubService();
|
||||
auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(web::json::value::parse(peoplehubResponse));
|
||||
|
||||
user_buffers_holder userBufferHolder;
|
||||
|
||||
std::vector<string_t> xuids;
|
||||
xuids.push_back(_T("1"));
|
||||
auto userGroup = peopleHubService.get_social_graph(_T("TestXboxUserId"), social_manager_extra_detail_level::preferred_color_level, xuids).get();
|
||||
VERIFY_IS_TRUE(!userGroup.err());
|
||||
|
||||
userBufferHolder.initialize(std::vector<xbox_social_user>());
|
||||
userBufferHolder.add_users_to_buffer(userGroup.payload(), *userBufferHolder.inactive_buffer());
|
||||
userBufferHolder.add_users_to_buffer(userGroup.payload(), *userBufferHolder.active_buffer());
|
||||
size_t userGroupSize = userGroup.payload().size();
|
||||
|
||||
VERIFY_IS_TRUE(&userBufferHolder.user_buffer_a() == userBufferHolder.active_buffer());
|
||||
VERIFY_IS_TRUE(&userBufferHolder.user_buffer_b() == userBufferHolder.inactive_buffer());
|
||||
|
||||
VerifyUserBuffer(userBufferHolder.user_buffer_a(), userGroupSize);
|
||||
VerifyUserBuffer(userBufferHolder.user_buffer_b(), userGroupSize);
|
||||
}
|
||||
|
||||
DEFINE_TEST_CASE(TestSocialManagerUserBufferAddUsersNoData)
|
||||
{
|
||||
DEFINE_TEST_CASE_PROPERTIES_FOCUS(TestSocialManagerUserBufferAddUsersNoData);
|
||||
auto peopleHubService = SocialManagerHelper::GetPeoplehubService();
|
||||
auto httpCall = m_mockXboxSystemFactory->GetMockHttpCall();
|
||||
httpCall->ResultValue = StockMocks::CreateMockHttpCallResponse(web::json::value::parse(peoplehubResponse));
|
||||
|
||||
user_buffers_holder userBufferHolder;
|
||||
|
||||
userBufferHolder.initialize(std::vector<xbox_social_user>());
|
||||
userBufferHolder.add_users_to_buffer(std::vector<xbox_social_user>(), *userBufferHolder.inactive_buffer());
|
||||
userBufferHolder.add_users_to_buffer(std::vector<xbox_social_user>(), *userBufferHolder.active_buffer());
|
||||
|
||||
VERIFY_IS_TRUE(&userBufferHolder.user_buffer_a() == userBufferHolder.active_buffer());
|
||||
VERIFY_IS_TRUE(&userBufferHolder.user_buffer_b() == userBufferHolder.inactive_buffer());
|
||||
|
||||
VERIFY_IS_TRUE(userBufferHolder.user_buffer_a().socialUserGraph.size() == 0);
|
||||
VERIFY_IS_TRUE(userBufferHolder.user_buffer_b().socialUserGraph.size() == 0);
|
||||
|
||||
VERIFY_IS_TRUE(userBufferHolder.user_buffer_a().freeData.size() == 0);
|
||||
VERIFY_IS_TRUE(userBufferHolder.user_buffer_b().freeData.size() == 0);
|
||||
}
|
||||
|
||||
// Verifies that get_user_copy API (C++ only) works properly in copying the data
|
||||
DEFINE_TEST_CASE(TestSocialManagerUserGroupCopy)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче