From 730f579d41b64df5b57b52e629d12f23c6fb64ac Mon Sep 17 00:00:00 2001
From: Nathan Iskandar <54045034+natiskan@users.noreply.github.com>
Date: Thu, 22 Apr 2021 15:31:55 -0700
Subject: [PATCH] Preview/2102 (#563)
* 2102 GDK (#552)
* 2102 GDK rapidjson version (#554)
* Resolve incorrect rapidjson version in 2102
* 2102 GDK QFE 1 (#556)
* 2102 GDK QFE1
* 2102 GDK QFE2 (#562)
* 2102 GDK QFE2
---
.../Microsoft.Xbox.Services.141.GDK.C.vcxproj | 20 +-
...ft.Xbox.Services.141.GDK.C.vcxproj.filters | 58 +-
.../Microsoft.Xbox.Services.142.GDK.C.vcxproj | 20 +-
...ft.Xbox.Services.142.GDK.C.vcxproj.filters | 58 +-
...ft.Xbox.Services.UnitTest.141.TAEF.vcxproj | 22 +-
...Services.UnitTest.141.TAEF.vcxproj.filters | 64 +-
...soft.Xbox.Services.UnitTest.141.TE.vcxproj | 22 +-
...x.Services.UnitTest.141.TE.vcxproj.filters | 64 +-
...ft.Xbox.Services.UnitTest.142.TAEF.vcxproj | 22 +-
...Services.UnitTest.142.TAEF.vcxproj.filters | 64 +-
...soft.Xbox.Services.UnitTest.142.TE.vcxproj | 22 +-
...x.Services.UnitTest.142.TE.vcxproj.filters | 64 +-
Custom.props | 4 +-
.../Xal/Source/Xal/Include/Xal/xal_types.h | 1 +
External/rapidjson | 2 +-
.../cpprestinclude/cpprest/asyncrt_utils.h | 2 +-
.../cpprest/details/asyncrt_utils.hpp | 13 +-
.../cpprestinclude/cpprest/details/base64.hpp | 1 +
.../cpprest/details/basic_types.h | 2 +
.../cpprest/details/json_parsing.hpp | 3 +
.../cpprest/details/json_serialization.hpp | 9 +
.../cpprestinclude/cpprest/details/uri.hpp | 1 +
Include/xsapi-c/achievements_c.h | 18 +-
Include/xsapi-c/achievements_manager_c.h | 4 +-
Include/xsapi-c/matchmaking_c.h | 6 +-
Include/xsapi-c/multiplayer_c.h | 58 +-
Include/xsapi-c/multiplayer_manager_c.h | 2 +-
Include/xsapi-c/presence_c.h | 4 +-
Include/xsapi-c/social_c.h | 2 +-
Include/xsapi-c/social_manager_c.h | 6 +-
Include/xsapi-c/title_storage_c.h | 4 +-
Include/xsapi-c/user_statistics_c.h | 12 +-
.../xsapi-c/xbox_live_context_settings_c.h | 6 +-
Include/xsapi-c/xbox_live_global_c.h | 12 +-
Include/xsapi-cpp/impl/achievements.hpp | 10 +-
Include/xsapi-cpp/impl/http_call.hpp | 13 +-
Include/xsapi-cpp/impl/public_utils.h | 2 +-
.../impl/service_call_logging_config.hpp | 26 +
Include/xsapi-cpp/impl/system.hpp | 104 ++
Include/xsapi-cpp/multiplayer.h | 10 +-
.../xsapi-cpp/service_call_logging_config.h | 28 +-
Include/xsapi-cpp/system.h | 81 +-
.../xsapi-cpp/xbox_live_context_settings.h | 10 +-
.../Manager/achievements_manager_api.cpp | 8 +-
.../Manager/achievements_manager_internal.cpp | 44 +-
.../Manager/achievements_manager_internal.h | 14 +-
.../achievement_service_internal.cpp | 57 +-
.../Achievements/achievements_result.cpp | 2 +-
Source/Services/Common/Cpp/pch.cpp | 6 +-
Source/Services/Common/pch_common.h | 17 +-
Source/Services/Common/xbox_live_context.cpp | 41 +-
.../Services/Common/xbox_live_context_api.cpp | 6 +-
.../Common/xbox_live_context_internal.h | 7 -
.../Common/xbox_live_context_settings.cpp | 1 -
.../Services/Common/xbox_live_global_api.cpp | 9 +-
Source/Services/Events/event.cpp | 6 +-
Source/Services/Events/event_queue.cpp | 4 +-
.../Services/Events/event_upload_payload.cpp | 2 +-
Source/Services/Events/events_service_etw.cpp | 34 +-
Source/Services/Events/events_service_etw.h | 2 +-
.../Services/Events/events_service_xsapi.cpp | 1 -
.../Leaderboard/leaderboard_internal.h | 6 +-
.../Leaderboard/leaderboard_result.cpp | 4 +-
.../Leaderboard/leaderboard_service.cpp | 61 +-
.../Matchmaking/matchmaking_internal.h | 275 ----
.../Matchmaking/matchmaking_service.cpp | 332 +----
.../Manager/multiplayer_client_manager.cpp | 33 +-
.../multiplayer_client_pending_reader.cpp | 25 +-
.../Manager/multiplayer_game_client.cpp | 20 +-
.../Manager/multiplayer_lobby_client.cpp | 99 +-
.../Manager/multiplayer_manager.cpp | 4 +-
.../Manager/multiplayer_manager_api.cpp | 6 +
.../Manager/multiplayer_manager_internal.h | 18 +-
.../Manager/multiplayer_manager_utils.cpp | 8 +-
.../Manager/multiplayer_match_client.cpp | 10 +-
.../Manager/multiplayer_session_writer.cpp | 2 +-
...ltiplayer_activity_handle_post_request.cpp | 2 +-
...ultiplayer_activity_query_post_request.cpp | 2 +-
.../Services/Multiplayer/multiplayer_api.cpp | 25 +
.../Multiplayer/multiplayer_internal.h | 74 +-
.../Multiplayer/multiplayer_service.cpp | 18 +-
.../Multiplayer/multiplayer_session.cpp | 44 +-
.../multiplayer_session_member.cpp | 3 +-
.../multiplayer_session_reference.cpp | 66 +-
.../Multiplayer/multiplayer_subscription.cpp | 2 +-
.../multiplayer_activity_service.cpp | 2 +-
.../RTA/achievement_unlock_subscription.cpp | 24 +-
.../RTA/achievement_unlock_subscription.h | 4 +-
.../RTA/game_invite_subscription.cpp | 2 +-
.../UWP/notification_service_uwp.cpp | 9 -
.../Notification/notification_internal.h | 6 +-
.../Notification/notification_service.cpp | 8 +-
.../device_presence_change_subscription.cpp | 2 +-
.../Presence/presence_device_record.cpp | 4 +-
Source/Services/Presence/presence_internal.h | 2 +-
Source/Services/Presence/presence_service.cpp | 6 -
.../Privacy/permission_check_result.cpp | 2 +-
Source/Services/Privacy/privacy_api.cpp | 2 +-
Source/Services/Privacy/privacy_service.cpp | 14 +-
.../real_time_activity_api.cpp | 2 +-
.../real_time_activity_connection.cpp | 18 +-
.../real_time_activity_manager.cpp | 6 +-
.../real_time_activity_manager.h | 2 +-
.../Services/Social/Manager/social_graph.cpp | 22 +-
Source/Services/Social/Manager/social_graph.h | 8 +-
.../Social/Manager/social_manager_api.cpp | 16 +-
.../Manager/social_manager_user_group.cpp | 14 +-
Source/Services/Social/social_internal.h | 4 +-
.../Social/social_relationship_result.cpp | 4 +-
.../Stats/title_managed_statistics_internal.h | 2 +-
.../title_managed_statistics_service.cpp | 2 +-
.../Services/Stats/user_statistics_internal.h | 4 +-
.../Stats/user_statistics_service.cpp | 2 -
.../Services/StringVerify/string_service.cpp | 3 -
.../Android/title_callable_ui_android.cpp | 13 +-
.../TCUI/UWP/title_callable_ui_uwp.cpp | 27 +-
.../TitleStorage/title_storage_service.cpp | 6 +-
Source/Shared/HookedUri/asyncrt_utils.h | 607 +++++++++
Source/Shared/HookedUri/base_uri.h | 460 +++++++
.../HookedUri/details/asyncrt_utils.hpp | 1141 +++++++++++++++++
Source/Shared/HookedUri/details/basic_types.h | 127 ++
.../Shared/HookedUri/details/cpprest_compat.h | 97 ++
Source/Shared/HookedUri/details/nosal.h | 89 ++
Source/Shared/HookedUri/details/uri.hpp | 458 +++++++
.../Shared/HookedUri/details/uri_builder.hpp | 134 ++
Source/Shared/HookedUri/details/uri_parser.h | 219 ++++
.../Shared/HookedUri/details/uri_parser.hpp | 369 ++++++
Source/Shared/HookedUri/uri.h | 35 +
Source/Shared/HookedUri/uri_builder.h | 297 +++++
Source/Shared/Logger/log.cpp | 10 +
Source/Shared/Logger/log.h | 37 +-
Source/Shared/Logger/log_entry.cpp | 6 +-
Source/Shared/Logger/log_hc_output.cpp | 2 +-
Source/Shared/Logger/log_hc_output.h | 2 +-
Source/Shared/Logger/log_output.cpp | 6 +-
Source/Shared/WinRT/local_config_winrt.cpp | 11 +-
Source/Shared/a/http_call_jni.cpp | 55 +-
Source/Shared/a/interop_jni.cpp | 2 +
Source/Shared/a/telemetry_a.cpp | 59 -
Source/Shared/async_helpers.cpp | 9 +-
Source/Shared/build_version.h | 2 +-
Source/Shared/enum_traits.h | 3 +
Source/Shared/errors.cpp | 10 +
Source/Shared/errors_legacy.h | 22 +-
Source/Shared/fault_injection.cpp | 66 +
Source/Shared/fault_injection.h | 31 +
Source/Shared/global_state.cpp | 123 +-
Source/Shared/global_state.h | 92 +-
Source/Shared/http_call_legacy.cpp | 4 +
Source/Shared/http_call_legacy.h | 6 +-
Source/Shared/http_call_request_message.cpp | 8 +-
.../http_call_request_message_internal.h | 8 +-
Source/Shared/http_call_wrapper_internal.cpp | 33 +-
Source/Shared/http_call_wrapper_internal.h | 6 +-
Source/Shared/http_utils.cpp | 436 ++++---
Source/Shared/http_utils.h | 160 ++-
Source/Shared/internal_mem.cpp | 5 +-
Source/Shared/internal_mem.h | 31 +-
Source/Shared/local_config.cpp | 1 -
Source/Shared/public_utils_legacy.cpp | 54 +-
Source/Shared/public_utils_legacy.h | 27 +-
Source/Shared/service_call_logger.cpp | 143 ---
Source/Shared/service_call_logger.h | 59 -
Source/Shared/service_call_logger_data.cpp | 279 ----
Source/Shared/service_call_logger_data.h | 88 --
.../Shared/service_call_logger_protocol.cpp | 163 ---
Source/Shared/service_call_logger_protocol.h | 34 -
Source/Shared/service_call_logging_config.cpp | 61 -
Source/Shared/service_call_logging_config.h | 45 -
Source/Shared/service_call_routed_handler.cpp | 2 +-
Source/Shared/service_call_routed_handler.h | 2 +-
Source/Shared/shared_macros.h | 69 +-
Source/Shared/string_array.h | 4 +-
Source/Shared/telemetry.cpp | 119 --
Source/Shared/telemetry.h | 42 -
Source/Shared/uri_impl.h | 10 +
Source/Shared/user.cpp | 51 +-
Source/Shared/user.h | 2 +-
Source/Shared/utils_locales.cpp | 64 +-
Source/Shared/web_socket.cpp | 9 +-
Source/Shared/xbox_live_app_config.cpp | 12 +-
Source/Shared/xbox_live_app_config_internal.h | 1 +
Source/Shared/xbox_live_services_settings.cpp | 219 ----
Source/Shared/xbox_live_services_settings.h | 222 ----
Source/Shared/xbox_system_factory.cpp | 87 --
Source/Shared/xbox_system_factory.h | 49 -
Source/Shared/xsapi_json_utils.cpp | 119 +-
Source/Shared/xsapi_json_utils.h | 58 +-
Source/Shared/xsapi_utils.cpp | 231 +---
Source/Shared/xsapi_utils.h | 298 +----
Source/System/a/java_interop.cpp | 20 +-
Source/System/a/java_interop.h | 11 +
Source/System/auth_config.cpp | 107 --
Source/System/auth_config.h | 122 --
Source/System/iOS/xbox_live_app_config_ios.mm | 2 +
Source/System/ppltasks_extra.h | 112 --
Tests/ApiExplorer/APIExplorer.Shared.vcxitems | 5 +
.../APIExplorer.Shared.vcxitems.filters | 9 +
Tests/ApiExplorer/APIs/apis.cpp | 40 +
.../ApiExplorer/APIs/apis_cpp_multiplayer.cpp | 58 +-
Tests/ApiExplorer/APIs/apis_cpp_privacy.cpp | 6 +-
.../APIs/apis_cpp_social_manager.cpp | 4 +
.../APIs/apis_cpp_title_storage.cpp | 2 +-
Tests/ApiExplorer/APIs/apis_docs.cpp | 43 +
Tests/ApiExplorer/APIs/apis_libhttp.cpp | 7 +-
Tests/ApiExplorer/APIs/apis_xal.cpp | 2 +
Tests/ApiExplorer/APIs/apis_xblc.cpp | 8 +-
...s_xblc_achievement_unlock_notification.cpp | 4 +-
.../APIs/apis_xblc_achievements_manager.cpp | 28 +-
.../APIs/apis_xblc_multiplayer.cpp | 41 +-
.../APIs/apis_xblc_multiplayer_manager.cpp | 42 +-
.../ApiExplorer/APIs/apis_xblc_stats2017.cpp | 91 +-
.../APIs/apis_xblc_title_storage.cpp | 189 +++
Tests/ApiExplorer/Include/api_explorer.h | 7 +
Tests/ApiExplorer/Include/multidevice.h | 11 +-
Tests/ApiExplorer/Shared/commands.cpp | 129 +-
Tests/ApiExplorer/Shared/mem_hook.cpp | 546 ++++++++
Tests/ApiExplorer/Shared/mem_hook.h | 73 ++
Tests/ApiExplorer/Shared/multidevice.cpp | 34 +-
Tests/ApiExplorer/Shared/pch_apicommon.cpp | 3 +
Tests/ApiExplorer/Shared/pch_common.cpp | 5 +
Tests/ApiExplorer/Shared/pch_common.h | 8 +
Tests/ApiExplorer/Shared/utils.h | 5 +
.../Tests/_luasetup_/xal/common.lua | 25 +-
.../Tests/_luasetup_/xal/setup.lua | 2 +-
Tests/ApiExplorer/Tests/cmds.json | 13 +-
.../titleStorage/title_storage-restCalls.lua | 22 +
.../APIRunner.GDK/APIRunner.GDK.Src.vcxproj | 22 +-
Tests/GDK/APIRunner.GDK/APIRunner.GDK.cpp | 5 +-
Tests/GDK/APIRunner.GDK/DeviceResources.cpp | 52 +-
.../Kits/LiveTK/LiveResources.cpp | 5 -
Tests/GDK/APIRunner.GDK/Main.cpp | 11 +
Tests/GDK/APIRunner.GDK/pch.cpp | 4 +
Tests/UnitTests/Mocks/http_mock.cpp | 24 +-
Tests/UnitTests/Mocks/http_mock.h | 8 +-
Tests/UnitTests/Mocks/mock_rta_service.cpp | 4 +-
Tests/UnitTests/Mocks/mock_rta_service.h | 8 +-
Tests/UnitTests/Support/TAEF/UnitTestBase.cpp | 3 -
Tests/UnitTests/Support/TAEF/UnitTestBase.h | 2 +-
Tests/UnitTests/Support/unit_test_helpers.h | 2 +-
.../Services/AchievementsManagerTests.cpp | 27 +-
.../Tests/Services/AchievementsTests.cpp | 20 +-
.../Tests/Services/MatchmakingTests.cpp | 4 +-
.../Services/MultiplayerActivityTests.cpp | 12 +-
.../Services/MultiplayerManagerTests.cpp | 26 +-
.../Tests/Services/MultiplayerTests.cpp | 97 +-
.../Tests/Services/PresenceTests.cpp | 30 +-
.../UnitTests/Tests/Services/PrivacyTests.cpp | 2 +-
.../UnitTests/Tests/Services/ProfileTests.cpp | 12 +-
.../Services/RealTimeActivityManagerTests.cpp | 10 +-
.../Tests/Services/ReputationTests.cpp | 8 +-
.../Tests/Services/SocialManagerTests.cpp | 34 +-
.../UnitTests/Tests/Services/SocialTests.cpp | 32 +-
Tests/UnitTests/Tests/Services/StatsTests.cpp | 12 +-
.../Tests/Services/StringVerifyTests.cpp | 8 +-
.../Tests/Services/TitleManagedStatsTests.cpp | 2 +-
.../Tests/Services/TitleStorageTests.cpp | 46 +-
Tests/UnitTests/Tests/Shared/LogTests.cpp | 16 +-
Utilities/CMake/CMakeLists.txt | 37 +-
.../VSOBuildScripts/gdkDownloadBuild.ps1 | 46 +
Utilities/VSOBuildScripts/gdkDownloadDocs.ps1 | 43 +
Utilities/VSOBuildScripts/gdkVpackUpdate.ps1 | 72 ++
Utilities/VSOBuildScripts/postBuildScript.cmd | 460 ++++---
.../VSOBuildScripts/postBuildScriptVPack.cmd | 44 +
nuget.config | 6 -
265 files changed, 7959 insertions(+), 5633 deletions(-)
create mode 100644 Include/xsapi-cpp/impl/service_call_logging_config.hpp
create mode 100644 Include/xsapi-cpp/impl/system.hpp
create mode 100644 Source/Shared/HookedUri/asyncrt_utils.h
create mode 100644 Source/Shared/HookedUri/base_uri.h
create mode 100644 Source/Shared/HookedUri/details/asyncrt_utils.hpp
create mode 100644 Source/Shared/HookedUri/details/basic_types.h
create mode 100644 Source/Shared/HookedUri/details/cpprest_compat.h
create mode 100644 Source/Shared/HookedUri/details/nosal.h
create mode 100644 Source/Shared/HookedUri/details/uri.hpp
create mode 100644 Source/Shared/HookedUri/details/uri_builder.hpp
create mode 100644 Source/Shared/HookedUri/details/uri_parser.h
create mode 100644 Source/Shared/HookedUri/details/uri_parser.hpp
create mode 100644 Source/Shared/HookedUri/uri.h
create mode 100644 Source/Shared/HookedUri/uri_builder.h
delete mode 100644 Source/Shared/a/telemetry_a.cpp
create mode 100644 Source/Shared/fault_injection.cpp
create mode 100644 Source/Shared/fault_injection.h
delete mode 100644 Source/Shared/service_call_logger.cpp
delete mode 100644 Source/Shared/service_call_logger.h
delete mode 100644 Source/Shared/service_call_logger_data.cpp
delete mode 100644 Source/Shared/service_call_logger_data.h
delete mode 100644 Source/Shared/service_call_logger_protocol.cpp
delete mode 100644 Source/Shared/service_call_logger_protocol.h
delete mode 100644 Source/Shared/service_call_logging_config.cpp
delete mode 100644 Source/Shared/service_call_logging_config.h
delete mode 100644 Source/Shared/telemetry.cpp
delete mode 100644 Source/Shared/telemetry.h
create mode 100644 Source/Shared/uri_impl.h
delete mode 100644 Source/Shared/xbox_live_services_settings.cpp
delete mode 100644 Source/Shared/xbox_live_services_settings.h
delete mode 100644 Source/Shared/xbox_system_factory.cpp
delete mode 100644 Source/Shared/xbox_system_factory.h
delete mode 100644 Source/System/auth_config.cpp
delete mode 100644 Source/System/auth_config.h
delete mode 100644 Source/System/ppltasks_extra.h
create mode 100644 Tests/ApiExplorer/Shared/mem_hook.cpp
create mode 100644 Tests/ApiExplorer/Shared/mem_hook.h
create mode 100644 Tests/ApiExplorer/Tests/titleStorage/title_storage-restCalls.lua
create mode 100644 Utilities/VSOBuildScripts/gdkDownloadBuild.ps1
create mode 100644 Utilities/VSOBuildScripts/gdkDownloadDocs.ps1
create mode 100644 Utilities/VSOBuildScripts/gdkVpackUpdate.ps1
create mode 100644 Utilities/VSOBuildScripts/postBuildScriptVPack.cmd
delete mode 100644 nuget.config
diff --git a/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj b/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj
index c77ed03b..a0968e33 100644
--- a/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj
+++ b/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj
@@ -229,11 +229,11 @@
+
+
-
-
@@ -250,18 +250,9 @@
-
-
-
-
-
-
-
-
-
@@ -269,20 +260,13 @@
-
-
-
-
-
-
-
diff --git a/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj.filters b/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj.filters
index 8e7a9dbf..1d77b2ae 100644
--- a/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.141.GDK.C/Microsoft.Xbox.Services.141.GDK.C.vcxproj.filters
@@ -295,15 +295,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -334,21 +334,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -364,21 +352,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -651,10 +630,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -693,18 +672,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -714,9 +681,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -726,30 +690,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
diff --git a/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj b/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj
index 6f47090d..6da46426 100644
--- a/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj
+++ b/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj
@@ -229,11 +229,11 @@
+
+
-
-
@@ -250,18 +250,9 @@
-
-
-
-
-
-
-
-
-
@@ -269,20 +260,13 @@
-
-
-
-
-
-
-
diff --git a/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj.filters b/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj.filters
index 8e7a9dbf..1d77b2ae 100644
--- a/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.142.GDK.C/Microsoft.Xbox.Services.142.GDK.C.vcxproj.filters
@@ -295,15 +295,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -334,21 +334,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -364,21 +352,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -651,10 +630,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -693,18 +672,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -714,9 +681,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -726,30 +690,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj b/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj
index b8f179a5..e53bfb08 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj
+++ b/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj
@@ -236,11 +236,11 @@
+
+
-
-
@@ -257,19 +257,9 @@
-
-
-
-
-
-
-
-
-
-
@@ -277,22 +267,15 @@
-
-
-
-
-
-
-
@@ -340,7 +323,6 @@
-
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj.filters b/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj.filters
index 1cb600d1..c5ce0493 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.UnitTest.141.TAEF/Microsoft.Xbox.Services.UnitTest.141.TAEF.vcxproj.filters
@@ -286,15 +286,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -325,24 +325,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -358,21 +343,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -484,9 +460,6 @@
C++ Source\UnitTests\Tests
-
- C++ Source\UnitTests\Tests
-
C++ Source\UnitTests\Tests
@@ -756,10 +729,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -798,18 +771,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -819,9 +780,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -831,30 +789,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
C++ Source\UnitTests\Mocks
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj b/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj
index 09618be1..4244653e 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj
+++ b/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj
@@ -273,11 +273,11 @@
+
+
-
-
@@ -294,19 +294,9 @@
-
-
-
-
-
-
-
-
-
-
@@ -314,22 +304,15 @@
-
-
-
-
-
-
-
@@ -377,7 +360,6 @@
-
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj.filters b/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj.filters
index 7b927cce..3691894e 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.UnitTest.141.TE/Microsoft.Xbox.Services.UnitTest.141.TE.vcxproj.filters
@@ -286,15 +286,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -325,24 +325,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -358,21 +343,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -484,9 +460,6 @@
C++ Source\UnitTests\Tests
-
- C++ Source\UnitTests\Tests
-
C++ Source\UnitTests\Tests
@@ -756,10 +729,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -798,18 +771,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -819,9 +780,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -831,30 +789,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
C++ Source\UnitTests\Mocks
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj b/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj
index 5e2f86ac..8063a73b 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj
+++ b/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj
@@ -236,11 +236,11 @@
+
+
-
-
@@ -257,19 +257,9 @@
-
-
-
-
-
-
-
-
-
-
@@ -277,22 +267,15 @@
-
-
-
-
-
-
-
@@ -340,7 +323,6 @@
-
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj.filters b/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj.filters
index 1cb600d1..c5ce0493 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.UnitTest.142.TAEF/Microsoft.Xbox.Services.UnitTest.142.TAEF.vcxproj.filters
@@ -286,15 +286,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -325,24 +325,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -358,21 +343,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -484,9 +460,6 @@
C++ Source\UnitTests\Tests
-
- C++ Source\UnitTests\Tests
-
C++ Source\UnitTests\Tests
@@ -756,10 +729,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -798,18 +771,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -819,9 +780,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -831,30 +789,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
C++ Source\UnitTests\Mocks
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj b/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj
index d43760fd..e427c22b 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj
+++ b/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj
@@ -273,11 +273,11 @@
+
+
-
-
@@ -294,19 +294,9 @@
-
-
-
-
-
-
-
-
-
-
@@ -314,22 +304,15 @@
-
-
-
-
-
-
-
@@ -377,7 +360,6 @@
-
diff --git a/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj.filters b/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj.filters
index 7b927cce..3691894e 100644
--- a/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj.filters
+++ b/Build/Microsoft.Xbox.Services.UnitTest.142.TE/Microsoft.Xbox.Services.UnitTest.142.TE.vcxproj.filters
@@ -286,15 +286,15 @@
C++ Source\Shared
+
+ C++ Source\Shared
+
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -325,24 +325,9 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -358,21 +343,12 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
@@ -484,9 +460,6 @@
C++ Source\UnitTests\Tests
-
- C++ Source\UnitTests\Tests
-
C++ Source\UnitTests\Tests
@@ -756,10 +729,10 @@
C++ Source\Shared
-
+
C++ Source\Shared
-
+
C++ Source\Shared
@@ -798,18 +771,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -819,9 +780,6 @@
C++ Source\Shared
-
- C++ Source\Shared
-
C++ Source\Shared
@@ -831,30 +789,18 @@
C++ Source\Shared
-
- C++ Source\Shared
-
-
- C++ Source\Shared
-
C++ Source\Shared
C++ Source\Shared
-
- C++ Source\System
-
C++ Source\System
C++ Source\System
-
- C++ Source\System
-
C++ Source\UnitTests\Mocks
diff --git a/Custom.props b/Custom.props
index 72ecde9c..77f68aac 100644
--- a/Custom.props
+++ b/Custom.props
@@ -11,9 +11,7 @@
-
- 1
- 0
+
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Android SDK Tools@Path)
$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools@Path)
diff --git a/External/Xal/Source/Xal/Include/Xal/xal_types.h b/External/Xal/Source/Xal/Include/Xal/xal_types.h
index 8e89e2d6..5c6ee4db 100644
--- a/External/Xal/Source/Xal/Include/Xal/xal_types.h
+++ b/External/Xal/Source/Xal/Include/Xal/xal_types.h
@@ -63,6 +63,7 @@ extern "C"
#define E_XAL_NODEFAULTUSER MAKE_E_HC(0x5111L) // 0x89235111
#define E_XAL_FAILEDTORESOLVE MAKE_E_HC(0x5112L) // 0x89235112
#define E_XAL_NOACCOUNTPROVIDER MAKE_E_HC(0x5113L) // 0x89235113
+#define E_XAL_MISMATCHEDTITLEANDCLIENTIDS MAKE_E_HC(0x5114L) // 0x89235114
// E_XAL_INTERNAL_* values should never be returned to callers of XAL.
#define E_XAL_INTERNAL_SWITCHUSER MAKE_E_HC(0x5171L) // 0x89235171
diff --git a/External/rapidjson b/External/rapidjson
index d87b698d..a1116a83 160000
--- a/External/rapidjson
+++ b/External/rapidjson
@@ -1 +1 @@
-Subproject commit d87b698d0fcc10a5f632ecbc80a9cb2a8fa094a5
+Subproject commit a1116a83bda2313d45d73703932ecf145ae997ec
diff --git a/Include/cpprestinclude/cpprest/asyncrt_utils.h b/Include/cpprestinclude/cpprest/asyncrt_utils.h
index 5069a85c..8e280094 100644
--- a/Include/cpprestinclude/cpprest/asyncrt_utils.h
+++ b/Include/cpprestinclude/cpprest/asyncrt_utils.h
@@ -594,7 +594,7 @@ public:
void set_length(int length) { m_length = length; }
private:
- static const utility::string_t c_allowed_chars;
+ static const utility::char_t* c_allowed_chars;
std::mt19937 m_random;
int m_length;
};
diff --git a/Include/cpprestinclude/cpprest/details/asyncrt_utils.hpp b/Include/cpprestinclude/cpprest/details/asyncrt_utils.hpp
index 995ca308..13d72282 100644
--- a/Include/cpprestinclude/cpprest/details/asyncrt_utils.hpp
+++ b/Include/cpprestinclude/cpprest/details/asyncrt_utils.hpp
@@ -44,6 +44,7 @@
#pragma warning( disable : 26444 ) // ignore various unnamed objects
#pragma warning( disable : 26498 ) // ignore eof warning
#pragma warning( disable : 26812 ) // enum instead of enum class
+#pragma warning( disable : 4365 )
#endif
// Could use C++ standard library if not __GLIBCXX__,
@@ -697,12 +698,12 @@ template
uint64_t timeticks_from_second(StringIterator begin, StringIterator end)
{
int size = (int)(end - begin);
- _ASSERTE(begin[0] == U('.'));
+ _ASSERTE(begin[0] == _T('.'));
uint64_t ufrac_second = 0;
for (int i = 1; i <= 7; ++i)
{
ufrac_second *= 10;
- int add = i < size ? begin[i] - U('0') : 0;
+ int add = i < size ? begin[i] - _T('0') : 0;
ufrac_second += add;
}
return ufrac_second;
@@ -712,7 +713,7 @@ void extract_fractional_second(const utility::string_t& dateString, utility::str
{
resultString = dateString;
// First, the string must be strictly longer than 2 characters, and the trailing character must be 'Z'
- if (resultString.size() > 2 && resultString[resultString.size() - 1] == U('Z'))
+ if (resultString.size() > 2 && resultString[resultString.size() - 1] == _T('Z'))
{
// Second, find the last non-digit by scanning the string backwards
auto last_non_digit = std::find_if_not(resultString.rbegin() + 1, resultString.rend(), is_digit);
@@ -720,7 +721,7 @@ void extract_fractional_second(const utility::string_t& dateString, utility::str
{
// Finally, make sure the last non-digit is a dot:
auto last_dot = last_non_digit.base() - 1;
- if (*last_dot == U('.'))
+ if (*last_dot == _T('.'))
{
// Got it! Now extract the fractional second
auto last_before_Z = std::end(resultString) - 1;
@@ -1046,11 +1047,11 @@ utility::seconds __cdecl timespan::xml_duration_to_seconds(const utility::string
return utility::seconds(numSecs);
}
-const utility::string_t nonce_generator::c_allowed_chars(_XPLATSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
+const utility::char_t * nonce_generator::c_allowed_chars = _XPLATSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
utility::string_t nonce_generator::generate()
{
- std::uniform_int_distribution<> distr(0, static_cast(c_allowed_chars.length() - 1));
+ std::uniform_int_distribution<> distr(0, static_cast(ustrlen(c_allowed_chars) - 1));
utility::string_t result;
result.reserve(length());
std::generate_n(std::back_inserter(result), length(), [&]() { return c_allowed_chars[distr(m_random)]; } );
diff --git a/Include/cpprestinclude/cpprest/details/base64.hpp b/Include/cpprestinclude/cpprest/details/base64.hpp
index 81e4793e..487ed421 100644
--- a/Include/cpprestinclude/cpprest/details/base64.hpp
+++ b/Include/cpprestinclude/cpprest/details/base64.hpp
@@ -28,6 +28,7 @@ using namespace utility;
#if HC_PLATFORM_IS_MICROSOFT
#pragma warning( push )
#pragma warning( disable : 28020 ) // ignore expression validation
+#pragma warning( disable : 4365 )
#endif
std::vector _from_base64(const utility::string_t& str);
diff --git a/Include/cpprestinclude/cpprest/details/basic_types.h b/Include/cpprestinclude/cpprest/details/basic_types.h
index 996b866f..f6bf724d 100644
--- a/Include/cpprestinclude/cpprest/details/basic_types.h
+++ b/Include/cpprestinclude/cpprest/details/basic_types.h
@@ -56,6 +56,7 @@ typedef std::wstringstream stringstream_t;
#define ucout std::wcout
#define ucin std::wcin
#define ucerr std::wcerr
+#define ustrlen wcslen
#else
//
// On POSIX platforms, all strings are narrow
@@ -73,6 +74,7 @@ typedef std::stringstream stringstream_t;
#define ucout std::cout
#define ucin std::cin
#define ucerr std::cerr
+#define ustrlen strlen
#endif // endif _UTF16_STRINGS
#ifndef _TURN_OFF_PLATFORM_STRING
diff --git a/Include/cpprestinclude/cpprest/details/json_parsing.hpp b/Include/cpprestinclude/cpprest/details/json_parsing.hpp
index ef37e29b..7742dda0 100644
--- a/Include/cpprestinclude/cpprest/details/json_parsing.hpp
+++ b/Include/cpprestinclude/cpprest/details/json_parsing.hpp
@@ -18,7 +18,10 @@
#if defined(_MSC_VER)
#pragma warning(disable : 4127) // allow expressions like while(true) pass
+#pragma warning( disable : 4365 )
+#pragma warning( disable : 4061 )
#endif
+
using namespace web;
using namespace web::json;
using namespace utility::conversions;
diff --git a/Include/cpprestinclude/cpprest/details/json_serialization.hpp b/Include/cpprestinclude/cpprest/details/json_serialization.hpp
index 1c875b6d..4e0836d2 100644
--- a/Include/cpprestinclude/cpprest/details/json_serialization.hpp
+++ b/Include/cpprestinclude/cpprest/details/json_serialization.hpp
@@ -25,6 +25,11 @@ using namespace web;
using namespace web::json;
using namespace utility::conversions;
+#if HC_PLATFORM_IS_MICROSOFT
+#pragma warning( push )
+#pragma warning( disable : 4365 )
+#endif
+
//
// JSON Serialization
//
@@ -261,3 +266,7 @@ utility::string_t json::value::serialize() const
#endif
return m_value->to_string();
}
+
+#if HC_PLATFORM_IS_MICROSOFT
+#pragma warning( pop )
+#endif
diff --git a/Include/cpprestinclude/cpprest/details/uri.hpp b/Include/cpprestinclude/cpprest/details/uri.hpp
index d76d512e..b72b59a5 100644
--- a/Include/cpprestinclude/cpprest/details/uri.hpp
+++ b/Include/cpprestinclude/cpprest/details/uri.hpp
@@ -31,6 +31,7 @@ using namespace utility::conversions;
#pragma warning( push )
#pragma warning( disable : 26444 ) // ignore various unnamed objects
#pragma warning( disable : 26812 ) // enum instead of enum class
+#pragma warning( disable : 4365 )
#endif
namespace web { namespace details
diff --git a/Include/xsapi-c/achievements_c.h b/Include/xsapi-c/achievements_c.h
index e84876b9..f7310600 100644
--- a/Include/xsapi-c/achievements_c.h
+++ b/Include/xsapi-c/achievements_c.h
@@ -376,7 +376,7 @@ typedef struct XblAchievement
_Field_z_ const char* id;
///
- /// The UTF-8 encoded ID of the service configuration set associated with the achievement.
+ /// The Service Configuration ID (SCID) that is associated with the achievement. The SCID is considered case sensitive so paste it directly from the Partner Center
///
_Field_z_ const char* serviceConfigurationId;
@@ -467,7 +467,7 @@ typedef struct XblAchievement
XblAchievementReward* rewards;
///
- /// The size of **rewards**>.
+ /// The size of **rewards**.
///
size_t rewardsCount;
@@ -535,12 +535,12 @@ typedef struct XblAchievementUnlockEvent
_Field_z_ const char* deepLink;
///
- /// The ratio of the count of users who have unlocked the achievement / the total number unique users of that title expressed as a float value >= 0.0 and <= 100.0 rounded to 2 decimal places.
+ /// The ratio of the count of users who have unlocked the achievement / the total number unique users of that title expressed as a fractional value >= 0.0 and <= 1.0 rounded to 2 decimal places.
///
float rarityPercentage;
///
- /// "Rare" or "Common" - where Rare achievements are those with a rarityPercentage < 10% and "Common" is everything else. (This string is not localized).
+ /// "Rare" or "Common" - where Rare achievements are those with a rarityPercentage <= 9% (or 0.9) and "Common" is everything else. (This string is not localized).
///
XblAchievementRarityCategory rarityCategory;
@@ -557,7 +557,7 @@ typedef struct XblAchievementUnlockEvent
///
///
/// This handle is used by other APIs to get the achievement objects and to get the
-/// next page of achievements from the service if there is is one.
+/// next page of achievements from the service if there is one.
/// The handle must be closed using
/// when the result is no longer needed.
///
@@ -594,7 +594,7 @@ STDAPI XblAchievementsResultGetAchievements(
/// Checks if there are more pages of achievements to retrieve from the service.
///
/// Achievement result handle.
-/// Passes back True if there are more results to retrieve, false otherwise.
+/// Passes back true if there are more results to retrieve, false otherwise.
/// HRESULT return code for this API operation.
STDAPI XblAchievementsResultHasNext(
_In_ XblAchievementsResultHandle resultHandle,
@@ -716,7 +716,7 @@ STDAPI XblAchievementsUpdateAchievementAsync(
/// An xbox live context handle created with XblContextCreateHandle.
/// The Xbox User ID of the player.
/// The title ID.
-/// The UTF-8 encoded service configuration ID (SCID) for the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The UTF-8 encoded achievement ID as defined by XDP or Dev Center.
/// The completion percentage of the achievement to indicate progress.
/// Valid values are from 1 to 100. Set to 100 to unlock the achievement.
@@ -746,7 +746,7 @@ STDAPI XblAchievementsUpdateAchievementForTitleIdAsync(
///
/// An xbox live context handle created with XblContextCreateHandle.
/// The Xbox User ID of the player.
-/// The UTF-8 encoded service configuration ID (SCID) for the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The UTF-8 encoded unique identifier of the Achievement as defined by XDP or Dev Center.
/// Caller allocated AsyncBlock.
/// HRESULT return code for this API operation.
@@ -769,7 +769,7 @@ STDAPI XblAchievementsGetAchievementAsync(
/// The same AsyncBlock that passed to XblAchievementsGetAchievementAsync.
/// The achievement result handle.
/// This handle is used by other APIs to get the achievement objects
-/// and to get the next page of achievements from the service if there is is one.
+/// and to get the next page of achievements from the service if there is one.
/// The handle must be closed using when the result is no longer needed.
///
/// HRESULT return code for this API operation.
diff --git a/Include/xsapi-c/achievements_manager_c.h b/Include/xsapi-c/achievements_manager_c.h
index 3b43b08c..197f7a6b 100644
--- a/Include/xsapi-c/achievements_manager_c.h
+++ b/Include/xsapi-c/achievements_manager_c.h
@@ -217,8 +217,8 @@ STDAPI XblAchievementsManagerGetAchievement(
/// the result is no longer needed.
///
///
-/// Passing in for sortField yields the same results
-/// as passing in since all achievements tracked
+/// Passing in XblAchievementOrderBy::TitleId for sortField yields the same results
+/// as passing in XblAchievementOrderBy::DefaultOrder since all achievements tracked
/// by achievement manager will have the same TitleId.
///
/// HRESULT return code for this API operation.
diff --git a/Include/xsapi-c/matchmaking_c.h b/Include/xsapi-c/matchmaking_c.h
index c4bfc2a4..7ddd17cd 100644
--- a/Include/xsapi-c/matchmaking_c.h
+++ b/Include/xsapi-c/matchmaking_c.h
@@ -191,7 +191,7 @@ STDAPI XblMatchmakingCreateMatchTicketResult(
/// Deletes a the match ticket on the server.
///
/// Xbox live context for the local user.
-/// The service config id that is specific for the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The name of the hopper where the match ticket is located.
/// The id of the ticket to delete on the server.
/// The AsyncBlock for this operation.
@@ -209,7 +209,7 @@ STDAPI XblMatchmakingDeleteMatchTicketAsync(
/// Retrieves the properties of a match ticket from the server.
///
/// Xbox live context for the local user.
-/// The service config id that is specific for the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The name of the hopper where the match ticket is located.
/// The ticket id of the match ticket to retrieve.
/// The AsyncBlock for this operation.
@@ -257,7 +257,7 @@ STDAPI XblMatchmakingGetMatchTicketDetailsResult(
/// Gets statistics about a hopper such as how many players are in it.
///
/// Xbox live context for the local user.
-/// The service config id that is specific for the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The name of the hopper to query stats for.
/// The AsyncBlock for this operation.
/// HRESULT return code for this API operation.
diff --git a/Include/xsapi-c/multiplayer_c.h b/Include/xsapi-c/multiplayer_c.h
index f03cf38d..a298a615 100644
--- a/Include/xsapi-c/multiplayer_c.h
+++ b/Include/xsapi-c/multiplayer_c.h
@@ -518,7 +518,7 @@ enum class XblMultiplayerSessionMemberStatus : uint32_t
///
/// The member is inactive in the current title.
/// The member may be active in another title as specified by ActiveTitleId.
- /// If a inactive member doesn't mark themselves as Active within the MemberInactiveTimeout they will be removed from the session.
+ /// If an inactive member doesn't mark themselves as Active within the MemberInactiveTimeout they will be removed from the session.
///
Inactive,
@@ -966,7 +966,7 @@ typedef struct XblMultiplayerSessionConstants
uint64_t MemberReservedTimeout;
///
- /// If a inactive member reservation does not become active within this timeout, then inactive member is removed from the session.
+ /// If an inactive member reservation does not become active within this timeout, then the inactive member is removed from the session.
///
uint64_t MemberInactiveTimeout;
@@ -1110,7 +1110,7 @@ typedef struct XblMultiplayerSessionReferenceUri
///
/// Creates an XblMultiplayerSessionReference from a scid, session template name, and session name.
///
-/// The service configuration id that the session is a part of.
+/// The Service Configuration ID (SCID) that the session is a part of. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The session template name.
/// The session name.
/// A reference to the multiplayer session that was created.
@@ -1792,7 +1792,7 @@ typedef struct XblMultiplayerSessionInfo
time_t StartTime;
///
- /// If any timeouts are in progress, this is the date when the the next timer will fire.
+ /// If any timeouts are in progress, this is the date when the next timer will fire.
///
time_t NextTimer;
@@ -2002,13 +2002,14 @@ typedef struct XblMultiplayerSessionStringAttribute
} XblMultiplayerSessionStringAttribute;
///
-/// An associative attribute that can be attached to a multiplayer session search handle when it is created.
+/// An associative attribute that can be attached to a multiplayer session search handle when it is created.
/// Attribute names be lower-case alphanumeric, and start with a letter.
///
typedef struct XblMultiplayerSessionNumberAttribute
{
///
/// Name of the attribute.
+ /// Attribute names be lower-case alphanumeric, and start with a letter.
///
char name[XBL_MULTIPLAYER_SEARCH_HANDLE_MAX_FIELD_LENGTH];
@@ -2141,7 +2142,7 @@ STDAPI_(XblMultiplayerSessionChangeTypes) XblMultiplayerSessionSubscribedChangeT
) XBL_NOEXCEPT;
///
-/// Host candidates are a ordered list of device tokens, ordered by preference as specified by XblMultiplayerMetrics
+/// Host candidates are an ordered list of device tokens, ordered by preference as specified by XblMultiplayerMetrics
/// in the session constants.
///
/// Handle to the multiplayer session.
@@ -2784,7 +2785,7 @@ STDAPI XblMultiplayerSessionLeave(
/// Indicates the current user status.
/// HRESULT return code for this API operation.
///
-/// You cannot set the the user to reserved or ready in this manner.
+/// You cannot set the user to reserved or ready in this manner.
/// Use to add a member reservation.
///
STDAPI XblMultiplayerSessionCurrentUserSetStatus(
@@ -2838,7 +2839,7 @@ typedef struct XblFormattedSecureDeviceAddress
///
STDAPI XblFormatSecureDeviceAddress(
_In_ const char* deviceId,
- _Out_ XblFormattedSecureDeviceAddress* address
+ _Inout_ XblFormattedSecureDeviceAddress* address
) XBL_NOEXCEPT;
#endif
@@ -3194,8 +3195,10 @@ STDAPI XblMultiplayerSearchHandleGetCustomSessionPropertiesJson(
/// The AsyncBlock for this operation.
/// HRESULT return code for this API operation.
///
-/// Call XblMultiplayerWriteSessionResult() to get the result.
-/// Call XblMultiplayerSessionWriteStatus() to get the write status.
+/// In the async callback, call XblMultiplayerWriteSessionResult() to get a XblMultiplayerSessionHandle handle.
+/// Use that handle to call XblMultiplayerSessionWriteStatus() to get the write status.
+/// The call to XblMultiplayerWriteSessionAsync() will only fail if the args passed to it are invalid or in very rare
+/// cases where it could not start the async task.
///
/// Calls V105 PUT /serviceconfigs/{serviceConfigurationId}/sessionTemplates/{sessiontemplateName}/sessions/{sessionName}
STDAPI XblMultiplayerWriteSessionAsync(
@@ -3209,14 +3212,21 @@ STDAPI XblMultiplayerWriteSessionAsync(
/// Gets the result of a XblMultiplayerWriteSessionAsync operation.
///
/// The AsyncBlock for this operation.
-/// Passes back a handle to a new instance of a local multiplayer session object.
-/// It must be release by the caller with .
+/// Passes back a handle to a new instance of a local multiplayer session object.
+/// The XblMultiplayerSessionHandle must be released by the caller by calling .
+/// Use XblMultiplayerSession* APIs to get session data from the handle.
/// If the updated session object is not needed, passing nullptr will cause the new multiplayer
-/// session object to be cleaned up immediately.
-/// HRESULT return code for this API operation.
+/// session object to be cleaned up immediately.
+///
+/// HRESULT return code for this API operation.
+/// It will be a failure HRESULT if there was a network error or failure HTTP status code unless its a 412 (Precondition Failed).
+/// A 412 returns success since the service also returns latest session state, so you must call XblMultiplayerSessionWriteStatus() to get the
+/// write status and call XblMultiplayerSession* APIs to get session data from the handle.
+///
///
-/// Note that if you leave a session that you are the the last member of and the sessionEmptyTimeout
+/// Note that if you leave a session that you are the last member of and the sessionEmptyTimeout
/// is equal to 0, then the session will be deleted immediately.
+/// Call XblMultiplayerSessionWriteStatus() to get the write status.
///
STDAPI XblMultiplayerWriteSessionResult(
_Inout_ XAsyncBlock* async,
@@ -3257,7 +3267,7 @@ STDAPI XblMultiplayerWriteSessionByHandleAsync(
/// If the updated session object is not needed, passing nullptr will cause the new multiplayer session object to be cleaned up immediately.
/// HRESULT return code for this API operation.
///
-/// Note that if you leave a session that you are the the last member of and the sessionEmptyTimeout
+/// Note that if you leave a session that you are the last member of and the sessionEmptyTimeout
/// is equal to 0, then the session will be deleted immediately and a nullptr will be returned.
///
STDAPI XblMultiplayerWriteSessionByHandleResult(
@@ -3379,7 +3389,7 @@ STDAPI XblMultiplayerSetActivityAsync(
/// Clears the user's current activity session for the specified serviceConfigurationId.
///
/// Xbox live context for the local user.
-/// A string containing the serviceConfigurationId in which to clear activity.
+/// The Service Configuration ID (SCID) in which to clear activity. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The AsyncBlock for this operation.
/// HRESULT return code for this API operation.
STDAPI XblMultiplayerClearActivityAsync(
@@ -3483,7 +3493,7 @@ STDAPI XblMultiplayerDeleteSearchHandleAsync(
/// Search for sessions by their associated search handles.
///
/// Xbox live context for the local user.
-/// The scid within which to query for search handles.
+/// The Service Configuration ID (SCID) within which to query for search handles. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The name of the template to query for search handles.
/// This specifies the attribute to sort the search handles by. Pass empty string to default to ordering by 'Timestamp asc'.
/// Pass true to order ascending, false to order descending.
@@ -3595,7 +3605,7 @@ STDAPI XblMultiplayerSendInvitesAsync(
///
/// The AsyncBlock for this operation.
/// The number of handles in the handles array. Size should be equal to the number of invites requested.
-/// A caller allocated array to pass back the invite handle results
+/// A caller allocated array to pass back the invite handle results.
/// The handle ID strings corresponding to the invites that have been sent.
/// HRESULT return code for this API operation.
STDAPI XblMultiplayerSendInvitesResult(
@@ -3609,7 +3619,7 @@ STDAPI XblMultiplayerSendInvitesResult(
/// Queries for the current activity for a socialgroup of users associated with a particular "owner" user.
///
/// Xbox live context for the local user.
-/// The scid within which to query for activities.
+/// The Service Configuration ID (SCID) within which to query for activities. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The person whose social group will be used for the query.
/// The social group to use in order to get the list of users. (e.g. "people" or "favorites")
/// The AsyncBlock for this operation.
@@ -3629,7 +3639,7 @@ STDAPI XblMultiplayerGetActivitiesForSocialGroupAsync(
/// Queries for the current activity for a socialgroup of users associated with a particular "owner" user.
///
/// Xbox live context for the local user.
-/// The scid within which to query for activities.
+/// The Service Configuration ID (SCID) within which to query for activities. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The person whose social group will be used for the query.
/// The social group to use in order to get the list of users. (e.g. "people" or "favorites")
/// The AsyncBlock for this operation.
@@ -3705,7 +3715,7 @@ STDAPI XblMultiplayerGetActivitiesWithPropertiesForSocialGroupResult(
/// Queries for the current activity for a set of users specified by xuid.
///
/// Xbox live context for the local user.
-/// The scid within which to query for activities.
+/// The Service Configuration ID (SCID) within which to query for activities. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The list of user ids to find activities for.
/// The size of the xuids array.
/// The AsyncBlock for this operation.
@@ -3725,7 +3735,7 @@ STDAPI XblMultiplayerGetActivitiesForUsersAsync(
/// Queries for the current activity for a set of users specified by xuid.
///
/// Xbox live context for the local user.
-/// The scid within which to query for activities.
+/// The Service Configuration ID (SCID) within which to query for activities. The SCID is considered case sensitive so paste it directly from the Partner Center
/// The list of user ids to find activities for.
/// The size of the xuids array.
/// The AsyncBlock for this operation.
@@ -3838,7 +3848,7 @@ typedef void CALLBACK XblMultiplayerSessionChangedHandler(
///
/// Registers an event handler for notifications when a multiplayer session changes. If the RTA subscription has not
-/// been explicitly enabled with , adding session changed handlers will
+/// been explicitly enabled with , adding session changed handlers will
/// enable it automatically. Use the returned XblFunctionContext to unregister the handler.
///
/// Xbox live context for the local user.
diff --git a/Include/xsapi-c/multiplayer_manager_c.h b/Include/xsapi-c/multiplayer_manager_c.h
index dc9d5ecc..80621dd2 100644
--- a/Include/xsapi-c/multiplayer_manager_c.h
+++ b/Include/xsapi-c/multiplayer_manager_c.h
@@ -977,7 +977,7 @@ STDAPI_(const char*) XblMultiplayerManagerGameSessionCorrelationId() XBL_NOEXCEP
/// Object containing identifying information for the session.
/// Returns null if a game session has not yet been established.
///
-/// A pointer to the the multiplayer session reference.
+/// A pointer to the multiplayer session reference.
/// The memory for the returned string pointer remains valid until the next call to XblMultiplayerManagerDoWork.
STDAPI_(const XblMultiplayerSessionReference*) XblMultiplayerManagerGameSessionSessionReference() XBL_NOEXCEPT;
diff --git a/Include/xsapi-c/presence_c.h b/Include/xsapi-c/presence_c.h
index 8ee93bee..0c835d2b 100644
--- a/Include/xsapi-c/presence_c.h
+++ b/Include/xsapi-c/presence_c.h
@@ -663,7 +663,7 @@ STDAPI_XBL_DEPRECATED XblPresenceUnsubscribeFromDevicePresenceChange(
///
/// Subscribes to title presence change notifications.
/// DEPRECATED. This API will be removed in a future release. Individual RTA subscription will be managed automatically by XSAPI as
-/// titles are tracked with .
+/// titles are tracked with .
///
/// Xbox live context for the local user.
/// The Xbox User ID of the person of the subscription.
@@ -750,7 +750,7 @@ typedef void CALLBACK XblPresenceTitlePresenceChangedHandler(
///
/// Registers an event handler for title presence change notifications. Notifications will
-/// only be received for the Users and Titles configured with and
+/// only be received for the Users and Titles configured with and
/// respectively.
///
/// Xbox live context for the local user.
diff --git a/Include/xsapi-c/social_c.h b/Include/xsapi-c/social_c.h
index 0f5198e8..a00d8ce0 100644
--- a/Include/xsapi-c/social_c.h
+++ b/Include/xsapi-c/social_c.h
@@ -264,7 +264,7 @@ typedef struct XblSocialRelationshipChangeEventArgs
///
///
/// This handle is used by other APIs to get the social relationship objects and to get
-/// the next page of results from the service if there is is one.
+/// the next page of results from the service if there is one.
/// The handle must be closed using when the result is no longer needed.
///
typedef struct XblSocialRelationshipResult* XblSocialRelationshipResultHandle;
diff --git a/Include/xsapi-c/social_manager_c.h b/Include/xsapi-c/social_manager_c.h
index 7b6739b3..32da9fe8 100644
--- a/Include/xsapi-c/social_manager_c.h
+++ b/Include/xsapi-c/social_manager_c.h
@@ -261,7 +261,7 @@ typedef struct XblSocialManagerPresenceTitleRecord
XblPresenceDeviceType deviceType;
///
- /// Whether or not this is the primary primary presence record.
+ /// Whether or not this is the primary presence record.
///
bool isPrimary;
} XblSocialManagerPresenceTitleRecord;
@@ -515,7 +515,7 @@ typedef const XblSocialManagerUser* const* XblSocialManagerUserPtrArray;
///
STDAPI XblSocialManagerUserGroupGetUsers(
_In_ XblSocialManagerUserGroupHandle group,
- _Outptr_ XblSocialManagerUserPtrArray* users,
+ _Outptr_result_maybenull_ XblSocialManagerUserPtrArray* users,
_Out_ size_t* usersCount
) XBL_NOEXCEPT;
@@ -537,7 +537,7 @@ STDAPI XblSocialManagerUserGroupGetUsers(
///
STDAPI XblSocialManagerUserGroupGetUsersTrackedByGroup(
_In_ XblSocialManagerUserGroupHandle group,
- _Outptr_ const uint64_t** trackedUsers,
+ _Outptr_result_maybenull_ const uint64_t** trackedUsers,
_Out_ size_t* trackedUsersCount
) XBL_NOEXCEPT;
diff --git a/Include/xsapi-c/title_storage_c.h b/Include/xsapi-c/title_storage_c.h
index e7177164..25f59256 100644
--- a/Include/xsapi-c/title_storage_c.h
+++ b/Include/xsapi-c/title_storage_c.h
@@ -237,7 +237,7 @@ STDAPI_(void) XblTitleStorageBlobMetadataResultCloseHandle(
/// Gets title storage quota information for the specified service configuration and storage type.
///
/// An xbox live context handle created with XblContextCreateHandle.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The storage type to get quota information for.
/// Caller allocated AsyncBlock.
/// HRESULT return code for this API operation.
@@ -275,7 +275,7 @@ STDAPI XblTitleStorageGetQuotaResult(
/// Gets a list of blob metadata objects under a given path for the specified service configuration, storage type and storage ID.
///
/// An xbox live context handle created with XblContextCreateHandle.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The storage type to get blob metadata objects for.
/// The root path to enumerate. Results will be for blobs contained in this path and all subpaths. (Optional)
/// The Xbox User ID of the title storage to enumerate. Ignored when enumerating GlobalStorage, so passing 0 is acceptable. (Optional)
diff --git a/Include/xsapi-c/user_statistics_c.h b/Include/xsapi-c/user_statistics_c.h
index c9795817..c3f1db52 100644
--- a/Include/xsapi-c/user_statistics_c.h
+++ b/Include/xsapi-c/user_statistics_c.h
@@ -130,7 +130,7 @@ typedef struct XblStatisticChangeEventArgs
///
/// Xbox live context for the local user.
/// The Xbox User ID of the player to get statistics for.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The name of the statistic to return.
/// The AsyncBlock for this operation.
/// HRESULT return code for this API operation.
@@ -182,7 +182,7 @@ STDAPI XblUserStatisticsGetSingleUserStatisticResult(
///
/// Xbox live context for the local user.
/// The Xbox User ID of the player to get statistics for.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// A collection of statistic names to lookup.
/// The number of statistic names.
/// The AsyncBlock for this operation.
@@ -239,7 +239,7 @@ STDAPI XblUserStatisticsGetSingleUserStatisticsResult(
/// Xbox live context for the local user.
/// A list of the user Xbox user IDs to get stats for.
/// The number of Xbox user IDs.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// A collection of statistic names to lookup.
/// The number of statistic names.
/// The AsyncBlock for this operation.
@@ -361,7 +361,7 @@ STDAPI XblUserStatisticsGetMultipleUserStatisticsForMultipleServiceConfiguration
///
/// Xbox live context for the local user.
/// The Xbox User ID of the player requesting the subscription.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// The name of the statistic to subscribe to.
/// Passes back an XblRealTimeActivitySubscriptionHandle object that contains the state of the subscription.
/// You can register an event handler for statistic changes by calling XblUserStatisticsAddStatisticChangedHandler().
@@ -432,7 +432,7 @@ STDAPI_(void) XblUserStatisticsRemoveStatisticChangedHandler(
/// Xbox live context for the local user.
/// Array of XboxUserIDs for whom to track the provided stats.
/// Length of xboxUserIds array.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// Array of statistic names for which real-time updates will be received.
/// Length of statisticNames array.
/// HRESULT return code for this API operation.
@@ -456,7 +456,7 @@ STDAPI XblUserStatisticsTrackStatistics(
/// Xbox live context for the local user.
/// Array of XboxUserIDs for whom to stop tracking the provided stats.
/// Length of xboxUserIds array.
-/// The service configuration ID (SCID) of the title.
+/// The Service Configuration ID (SCID) for the title. The SCID is considered case sensitive so paste it directly from the Partner Center.
/// Array of statistic names for which real-time updates are no longer needed.
/// Length of statisticNames array.
/// HRESULT return code for this API operation.
diff --git a/Include/xsapi-c/xbox_live_context_settings_c.h b/Include/xsapi-c/xbox_live_context_settings_c.h
index 456df9a6..596fb319 100644
--- a/Include/xsapi-c/xbox_live_context_settings_c.h
+++ b/Include/xsapi-c/xbox_live_context_settings_c.h
@@ -53,7 +53,7 @@ STDAPI XblContextSettingsSetLongHttpTimeout(
/// The default for http_timeout_window is 20 seconds and can be changed using XblContextSettingsSetHttpTimeoutWindow.
/// HRESULT return code for this API operation.
///
-/// If the service returns an an HTTP error with a "Retry-After" header, then all future calls to that API will
+/// If the service returns an HTTP error with a "Retry-After" header, then all future calls to that API will
/// immediately fail with the original error without contacting the service until the "Retry-After" time has been reached.
///
/// Idempotent service calls are retried when a network error occurs or the server responds with one of these HTTP status codes:
@@ -74,7 +74,7 @@ STDAPI XblContextSettingsGetHttpRetryDelay(
///
/// Xbox live context that the settings are associated with.
/// The retry delay in seconds.
-/// Retries are delayed using a exponential back off.
+/// Retries are delayed using an exponential back off.
/// By default, it will delay 2 seconds then the next retry will delay 4 seconds, then 8 seconds,
/// and so on up to a max of 1 min until either the call succeeds or the http_timeout_window
/// is reached, at which point the call will fail.
@@ -82,7 +82,7 @@ STDAPI XblContextSettingsGetHttpRetryDelay(
/// The default for http_timeout_window is 20 seconds and can be changed using XblContextSettingsSetHttpTimeoutWindow.
/// HRESULT return code for this API operation.
///
-/// If the service returns an an HTTP error with a "Retry-After" header, then all future calls to that API will
+/// If the service returns an HTTP error with a "Retry-After" header, then all future calls to that API will
/// immediately fail with the original error without contacting the service until the "Retry-After" time has been reached.
///
/// Idempotent service calls are retried when a network error occurs or the server responds with one of these HTTP status codes:
diff --git a/Include/xsapi-c/xbox_live_global_c.h b/Include/xsapi-c/xbox_live_global_c.h
index 1d6de82c..9d13b9f5 100644
--- a/Include/xsapi-c/xbox_live_global_c.h
+++ b/Include/xsapi-c/xbox_live_global_c.h
@@ -90,7 +90,7 @@ STDAPI XblMemSetFunctions(
///
/// Set to the current allocation callback.
/// Returns the default routine if not previously set.
-/// Set to the to the current memory free callback.
+/// Set to the current memory free callback.
/// Returns the default routine if not previously set.
/// HRESULT return code for this API operation.
///
@@ -120,7 +120,9 @@ typedef struct XblInitArgs
#if !(HC_PLATFORM == HC_PLATFORM_XDK || HC_PLATFORM == HC_PLATFORM_UWP)
///
- /// The service configuration Id for the app.
+ /// The Service Configuration ID (SCID) for the app.
+ /// You can find it on Partner Center in the Game Setup page under Identity details.
+ /// This string is considered case sensitive so paste it directly from the Partner Center
///
_Field_z_ const char* scid;
@@ -270,7 +272,7 @@ enum class XblConfigSetting : uint32_t
/// The config settings value to be passed down.
/// HRESULT return code for this API operation.
///
-/// The asserts will not fire in RETAIL sandbox, and this setting has has no affect in RETAIL sandboxes.
+/// The asserts will not fire in RETAIL sandbox, and this setting has no affect in RETAIL sandboxes.
/// It is best practice to not call this API, and instead adjust the calling pattern but this is provided
/// as a temporary way to get unblocked while in early stages of game development.
///
@@ -279,9 +281,9 @@ STDAPI_(void) XblDisableAssertsForXboxLiveThrottlingInDevSandboxes(
) XBL_NOEXCEPT;
///
-/// For advanced scenarios where a common scid and title Id are needed for cross platform experiences.
+/// For advanced scenarios where a common Service Configuration ID (SCID) and title Id are needed for cross platform experiences.
///
-/// Override scid to be used by multiplayer manager.
+/// Override Service Configuration ID (SCID) to be used by multiplayer manager. This SCID is considered case sensitive so paste it directly from the Partner Center
/// Override title Id to be used by multiplayer manager.
/// HRESULT return code for this API operation.
///
diff --git a/Include/xsapi-cpp/impl/achievements.hpp b/Include/xsapi-cpp/impl/achievements.hpp
index 1676ed25..6e10f957 100644
--- a/Include/xsapi-cpp/impl/achievements.hpp
+++ b/Include/xsapi-cpp/impl/achievements.hpp
@@ -298,12 +298,18 @@ bool achievement::is_revoked() const
achievements_result::achievements_result(XblAchievementsResultHandle handle)
{
- XblAchievementsResultDuplicateHandle(handle, &m_handle);
+ if (handle != nullptr)
+ {
+ XblAchievementsResultDuplicateHandle(handle, &m_handle);
+ }
}
achievements_result::achievements_result(const achievements_result& other)
{
- XblAchievementsResultDuplicateHandle(other.m_handle, &m_handle);
+ if (other.m_handle != nullptr)
+ {
+ XblAchievementsResultDuplicateHandle(other.m_handle, &m_handle);
+ }
}
achievements_result& achievements_result::operator=(achievements_result other)
diff --git a/Include/xsapi-cpp/impl/http_call.hpp b/Include/xsapi-cpp/impl/http_call.hpp
index abd4168a..56794be7 100644
--- a/Include/xsapi-cpp/impl/http_call.hpp
+++ b/Include/xsapi-cpp/impl/http_call.hpp
@@ -307,12 +307,14 @@ void http_call::set_request_body(
_In_ const string_t& value
)
{
- XblHttpCallRequestSetRequestBodyString(m_callHandle, Utils::StringFromStringT(value).c_str());
+ auto convertedValue = Utils::StringFromStringT(value);
+ XblHttpCallRequestSetRequestBodyString(m_callHandle, convertedValue.c_str());
}
void http_call::set_request_body( _In_ const web::json::value& value )
{
- XblHttpCallRequestSetRequestBodyString(m_callHandle, Utils::StringFromStringT(value.serialize()).c_str());
+ auto convertedValue = Utils::StringFromStringT(value.serialize());
+ XblHttpCallRequestSetRequestBodyString(m_callHandle, convertedValue.c_str());
}
void http_call::set_request_body(
@@ -331,10 +333,13 @@ void http_call::set_custom_header(
_In_ const string_t& Value
)
{
+ const auto headerName = Utils::StringFromStringT(Name);
+ const auto headerValue = Utils::StringFromStringT(Value);
+
XblHttpCallRequestSetHeader(
m_callHandle,
- Utils::StringFromStringT(Name).c_str(),
- Utils::StringFromStringT(Value).c_str(),
+ headerName.c_str(),
+ headerValue.c_str(),
false
);
}
diff --git a/Include/xsapi-cpp/impl/public_utils.h b/Include/xsapi-cpp/impl/public_utils.h
index 31149942..2f167b80 100644
--- a/Include/xsapi-cpp/impl/public_utils.h
+++ b/Include/xsapi-cpp/impl/public_utils.h
@@ -295,7 +295,7 @@ struct Utils
{
if (jsonString)
{
- return web::json::value::parse(StringTFromUtf8(jsonString));
+ return web::json::value::parse(Utils::StringTFromUtf8(jsonString));
}
}
catch (web::json::json_exception)
diff --git a/Include/xsapi-cpp/impl/service_call_logging_config.hpp b/Include/xsapi-cpp/impl/service_call_logging_config.hpp
new file mode 100644
index 00000000..f1854d62
--- /dev/null
+++ b/Include/xsapi-cpp/impl/service_call_logging_config.hpp
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#pragma once
+
+#include "public_utils.h"
+
+NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
+
+#if HC_PLATFORM_IS_MICROSOFT
+
+std::shared_ptr service_call_logging_config::get_singleton_instance()
+{
+ static std::shared_ptr s_instance = std::shared_ptr(new service_call_logging_config);
+ return s_instance;
+}
+
+void service_call_logging_config::enable() {}
+void service_call_logging_config::disable() {}
+#if HC_PLATFORM == HC_PLATFORM_XDK || HC_PLATFORM == HC_PLATFORM_UWP || XSAPI_UNIT_TESTS
+void service_call_logging_config::_Register_for_protocol_activation() {}
+#endif
+
+#endif
+
+NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END
\ No newline at end of file
diff --git a/Include/xsapi-cpp/impl/system.hpp b/Include/xsapi-cpp/impl/system.hpp
new file mode 100644
index 00000000..04bbeb92
--- /dev/null
+++ b/Include/xsapi-cpp/impl/system.hpp
@@ -0,0 +1,104 @@
+// Copyright (c) Microsoft Corporation
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#pragma once
+
+#include "public_utils.h"
+
+NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_BEGIN
+
+std::shared_ptr xbox_live_services_settings::get_singleton_instance(_In_ bool createIfRequired)
+{
+ UNREFERENCED_PARAMETER(createIfRequired);
+
+ static std::shared_ptr instance = std::shared_ptr(new xbox_live_services_settings);
+ return instance;
+}
+
+void xbox_live_services_settings::set_memory_allocation_hooks(
+ _In_ const std::function<_Ret_maybenull_ _Post_writable_byte_size_(dwSize) void*(_In_ size_t dwSize)>& memAllocHandler,
+ _In_ const std::function& memFreeHandler
+)
+{
+ static std::function allocHook{ nullptr };
+ static std::function freeHook{ nullptr };
+
+ if (memAllocHandler != nullptr && memFreeHandler != nullptr)
+ {
+ allocHook = memAllocHandler;
+ freeHook = memFreeHandler;
+
+ XblMemSetFunctions(
+ [](size_t size, HCMemoryType)
+ {
+ return allocHook(size);
+ },
+ [](void* pointer, HCMemoryType)
+ {
+ freeHook(pointer);
+ }
+ );
+ }
+ else if (memAllocHandler == nullptr && memFreeHandler == nullptr)
+ {
+ XblMemSetFunctions(nullptr, nullptr);
+ }
+}
+
+
+function_context xbox_live_services_settings::add_logging_handler(
+ std::function handler
+)
+{
+ UNREFERENCED_PARAMETER(handler);
+ return function_context{};
+}
+
+void xbox_live_services_settings::remove_logging_handler(_In_ function_context context)
+{
+ UNREFERENCED_PARAMETER(context);
+}
+
+xbox_services_diagnostics_trace_level xbox_live_services_settings::diagnostics_trace_level() const
+{
+ HCTraceLevel traceLevel{};
+ HCSettingsGetTraceLevel(&traceLevel);
+
+ switch (traceLevel)
+ {
+ case HCTraceLevel::Off: return xbox_services_diagnostics_trace_level::off;
+ case HCTraceLevel::Error: return xbox_services_diagnostics_trace_level::error;
+ case HCTraceLevel::Warning: return xbox_services_diagnostics_trace_level::warning;
+ case HCTraceLevel::Important: return xbox_services_diagnostics_trace_level::info;
+ case HCTraceLevel::Verbose: return xbox_services_diagnostics_trace_level::verbose;
+ default: return xbox_services_diagnostics_trace_level::off;
+ }
+}
+
+void xbox_live_services_settings::set_diagnostics_trace_level(_In_ xbox_services_diagnostics_trace_level value)
+{
+ HCTraceLevel traceLevel{ HCTraceLevel::Off };
+ switch (value)
+ {
+ case xbox_services_diagnostics_trace_level::off: traceLevel = HCTraceLevel::Off; break;
+ case xbox_services_diagnostics_trace_level::error: traceLevel = HCTraceLevel::Error; break;
+ case xbox_services_diagnostics_trace_level::warning: traceLevel = HCTraceLevel::Warning; break;
+ case xbox_services_diagnostics_trace_level::info: traceLevel = HCTraceLevel::Information; break;
+ case xbox_services_diagnostics_trace_level::verbose: traceLevel = HCTraceLevel::Verbose; break;
+ default: break;
+ }
+ HCSettingsSetTraceLevel(traceLevel);
+}
+
+function_context xbox_live_services_settings::add_wns_handler(_In_ const std::function& handler)
+{
+ UNREFERENCED_PARAMETER(handler);
+ return function_context{};
+}
+
+void xbox_live_services_settings::remove_wns_handler(_In_ function_context context)
+{
+ UNREFERENCED_PARAMETER(context);
+}
+
+NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_END
\ No newline at end of file
diff --git a/Include/xsapi-cpp/multiplayer.h b/Include/xsapi-cpp/multiplayer.h
index 416084e6..6260cfd0 100644
--- a/Include/xsapi-cpp/multiplayer.h
+++ b/Include/xsapi-cpp/multiplayer.h
@@ -252,7 +252,7 @@ enum class multiplayer_session_member_status
///
/// The member is inactive in the current title.
/// The member may be active in another title as specified by ActiveTitleId.
- /// If a inactive member doesn't mark themselves as Active within the MemberInactiveTimeout they will be removed from the session.
+ /// If an inactive member doesn't mark themselves as Active within the MemberInactiveTimeout they will be removed from the session.
///
inactive,
@@ -741,7 +741,7 @@ public:
inline std::chrono::milliseconds member_reserved_time_out() const;
///
- /// If a inactive member reservation does not become active within this timeout, then inactive member is removed from the session.
+ /// If an inactive member reservation does not become active within this timeout, then the inactive member is removed from the session.
///
inline std::chrono::milliseconds member_inactive_timeout() const;
@@ -1689,7 +1689,7 @@ public:
inline utility::datetime start_time() const;
///
- /// If any timeouts are in progress, this is the date when the the next timer will fire.
+ /// If any timeouts are in progress, this is the date when the next timer will fire.
///
inline utility::datetime date_of_next_timer() const;
@@ -1727,7 +1727,7 @@ public:
inline multiplayer_session_change_types subscribed_change_types() const;
///
- /// Host candidates are a ordered list of device tokens, ordered by preference as specified by MultiplayerSessionConstants::PeerToHostRequirements::HostSelectionMetric.
+ /// Host candidates are an ordered list of device tokens, ordered by preference as specified by MultiplayerSessionConstants::PeerToHostRequirements::HostSelectionMetric.
///
inline std::vector host_candidates() const;
@@ -2085,7 +2085,7 @@ public:
/// Call multiplayer_service::write_session after this to write batched local changes to the service.
/// If this is called without multiplayer_service::write_session, this will only change the local session object but does not commit it to the service.
/// Set the current user to active or inactive.
- /// You cannot set the the user to reserved or ready in this manner.
+ /// You cannot set the user to reserved or ready in this manner.
/// Use AddMemberReservation() to add a member reservation.
/// The member must first be joined to the session.
///
diff --git a/Include/xsapi-cpp/service_call_logging_config.h b/Include/xsapi-cpp/service_call_logging_config.h
index 72a92f75..bf1d370b 100644
--- a/Include/xsapi-cpp/service_call_logging_config.h
+++ b/Include/xsapi-cpp/service_call_logging_config.h
@@ -12,34 +12,34 @@ class service_call_logging_config
public:
///
- /// Gets the service_call_logger singleton instance
+ /// Deprecated. Service call logging feature is no longer supported.
///
- static std::shared_ptr get_singleton_instance();
+ _XSAPICPP_DEPRECATED inline static std::shared_ptr get_singleton_instance();
///
- /// Enables the tracking of service calls
+ /// Deprecated. Service call logging feature is no longer supported.
///
- void enable();
+ _XSAPICPP_DEPRECATED inline void enable();
///
- /// Disables the tracking of service calls
+ /// Deprecated. Service call logging feature is no longer supported.
///
- void disable();
+ _XSAPICPP_DEPRECATED inline void disable();
#if HC_PLATFORM == HC_PLATFORM_XDK || HC_PLATFORM == HC_PLATFORM_UWP || XSAPI_UNIT_TESTS
///
- /// Internal API
- /// Enables Logs to be enabled/disabled through protocol activation
+ /// Deprecated
///
- void _Register_for_protocol_activation();
+ _XSAPICPP_DEPRECATED inline void _Register_for_protocol_activation();
#endif
private:
- service_call_logging_config();
- service_call_logging_config(const service_call_logging_config&);
- void operator=(const service_call_logging_config&);
- friend struct ::XblContext;
+ service_call_logging_config() = default;
+ service_call_logging_config(const service_call_logging_config&) = delete;
+ void operator=(const service_call_logging_config&) = delete;
};
#endif // HC_PLATFORM_IS_MICROSOFT
-NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END
\ No newline at end of file
+NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END
+
+#include "impl/service_call_logging_config.hpp"
\ No newline at end of file
diff --git a/Include/xsapi-cpp/system.h b/Include/xsapi-cpp/system.h
index 2c1ea32f..019198c5 100644
--- a/Include/xsapi-cpp/system.h
+++ b/Include/xsapi-cpp/system.h
@@ -34,14 +34,6 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
///
namespace system {
- // Forward declaration
- class sign_out_completed_event_args;
- class user_impl;
- class token_and_signature_result_internal;
- class user_factory;
- class xbox_live_server_impl;
- class auth_config;
-
class xbox_live_wns_event_args
{
public:
@@ -85,15 +77,12 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
///
/// Gets the singleton instance
///
- static std::shared_ptr get_singleton_instance(_In_ bool createIfRequired = true);
+ inline static std::shared_ptr get_singleton_instance(_In_ bool createIfRequired = true);
///
/// Used by titles to register memory allocation hooks that are used by XSAPI when it
/// needs to allocate a large block of memory such as SocialManager which uses a large block
/// of memory to keep track of the friends list.
- ///
- /// Note that not all memory that XSAPI uses goes through this allocator (for example std::string),
- /// but these allocations are typically small and transient.
///
/// The title's allocation function. Input is size of memory block that's being requested. Return is pointer to the allocated memory block
/// The title's memory free function. Input is address of memory to free
@@ -103,86 +92,48 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
/// It is important to provide an implementation for both memAllocHandler and memFreeHandler if you hook them;
/// hooking only one of them will be considered an error.
///
- static void set_memory_allocation_hooks(
+ inline static void set_memory_allocation_hooks(
_In_ const std::function<_Ret_maybenull_ _Post_writable_byte_size_(dwSize) void*(_In_ size_t dwSize)>& memAllocHandler,
_In_ const std::function& memFreeHandler
);
///
- /// Registers to receive logging messages for levels that are enabled. Event handlers will receive the level, category, and content of the message.
+ /// Deprecated. XSAPI is using libHttpClient logging. A logging handler can be added using HCTraceSetClientCallback.
///
- /// The event handler function to call.
- ///
- /// A function_context object that can be used to unregister the event handler.
- ///
- function_context add_logging_handler(_In_ std::function handler);
+ _XSAPICPP_DEPRECATED inline function_context add_logging_handler(_In_ std::function handler);
///
- /// Unregisters from receiving logging messages.
+ /// Deprecated. See above.
///
- /// The function_context object that was returned when the event handler was registered.
- void remove_logging_handler(_In_ function_context context);
+ _XSAPICPP_DEPRECATED inline void remove_logging_handler(_In_ function_context context);
///
/// Indicates the level of debug messages to send to the debugger's Output window.
///
- xbox_services_diagnostics_trace_level diagnostics_trace_level() const;
+ inline xbox_services_diagnostics_trace_level diagnostics_trace_level() const;
///
/// Sets the level of debug messages to send to the debugger's Output window.
///
- void set_diagnostics_trace_level(_In_ xbox_services_diagnostics_trace_level value);
+ inline void set_diagnostics_trace_level(_In_ xbox_services_diagnostics_trace_level value);
///
- /// Registers to receive Windows Push Notification Service(WNS) events. Event handlers will receive the xbox user id and notification type.
+ /// Deprecated. Registering WNS callbacks though XSAPI is no longer supported.
///
- /// The event handler function to call.
- ///
- /// A function_context object that can be used to unregister the event handler.
- ///
- function_context add_wns_handler(_In_ const std::function& handler);
+ _XSAPICPP_DEPRECATED inline function_context add_wns_handler(_In_ const std::function& handler);
///
- /// Unregisters from receiving Windows Push Notification Service(WNS) events.
+ /// Deprecated. Registering WNS callbacks though XSAPI is no longer supported.
///
- /// The function_context object that was returned when the event handler was registered.
- void remove_wns_handler(_In_ function_context context);
-
- ///
- /// Internal function
- ///
- void _Raise_logging_event(_In_ xbox_services_diagnostics_trace_level level, _In_ const std::string& category, _In_ const std::string& message);
-
- ///
- /// Internal function
- ///
- void _Raise_wns_event(_In_ const string_t& xbox_user_id, _In_ const string_t& nofitication_type, _In_ const string_t& content);
-
- ///
- /// Internal function
- ///
- bool _Is_at_diagnostics_trace_level(_In_ xbox_services_diagnostics_trace_level level);
+ _XSAPICPP_DEPRECATED inline void remove_wns_handler(_In_ function_context context);
private:
- xbox_live_services_settings();
-
- void set_log_level_from_diagnostics_trace_level();
-
- xbox_services_diagnostics_trace_level m_traceLevel;
- std::mutex m_loggingWriteLock;
- std::unordered_map> m_loggingHandlers;
- uint32_t m_loggingHandlersCounter{ 1 };
-
- std::mutex m_wnsEventLock;
- std::unordered_map> m_wnsHandlers;
- uint32_t m_wnsHandlersCounter{ 1 };
-
- friend class xsapi_memory;
- friend void *custom_mem_alloc_wrapper(_In_ size_t size, _In_ uint32_t memoryType);
- friend void custom_mem_free_wrapper(_In_ void *pointer, _In_ uint32_t memoryType);
+ xbox_live_services_settings() = default;
};
} // namespace system
NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END
-
+#if !XSAPI_NO_PPL
+#include "impl/system.hpp"
+#endif
diff --git a/Include/xsapi-cpp/xbox_live_context_settings.h b/Include/xsapi-cpp/xbox_live_context_settings.h
index 85edfdc9..adb438bd 100644
--- a/Include/xsapi-cpp/xbox_live_context_settings.h
+++ b/Include/xsapi-cpp/xbox_live_context_settings.h
@@ -111,13 +111,13 @@ public:
///
/// Gets the HTTP retry delay in seconds.
///
- /// Retries are delayed using a exponential back off. By default, it will delay 2 seconds then the
+ /// Retries are delayed using an exponential back off. By default, it will delay 2 seconds then the
/// next retry will delay 4 seconds, then 8 seconds, and so on up to a max of 1 min until either
/// the call succeeds or the http_timeout_window is reached, at which point the call will fail.
/// The delay is also jittered between the current and next delay to spread out service load.
/// The default for http_timeout_window is 20 seconds and can be changed using set_http_timeout_window()
///
- /// If the service returns an an HTTP error with a "Retry-After" header, then all future calls to that API
+ /// If the service returns an HTTP error with a "Retry-After" header, then all future calls to that API
/// will immediately fail with the original error without contacting the service until the "Retry-After"
/// time has been reached.
///
@@ -134,13 +134,13 @@ public:
///
/// Sets the HTTP retry delay in seconds. The default and minimum delay is 2 seconds.
///
- /// Retries are delayed using a exponential back off. By default, it will delay 2 seconds then the
+ /// Retries are delayed using an exponential back off. By default, it will delay 2 seconds then the
/// next retry will delay 4 seconds, then 8 seconds, and so on up to a max of 1 min until either
/// the call succeeds or the http_timeout_window is reached, at which point the call will fail.
/// The delay is also jittered between the current and next delay to spread out service load.
/// The default for http_timeout_window is 20 seconds and can be changed using set_http_timeout_window()
///
- /// If the service returns an an HTTP error with a "Retry-After" header, then all future calls to that API
+ /// If the service returns an HTTP error with a "Retry-After" header, then all future calls to that API
/// will immediately fail with the original error without contacting the service until the "Retry-After"
/// time has been reached.
///
@@ -211,7 +211,7 @@ public:
///
/// Disables asserts for Xbox Live throttling in dev sandboxes.
- /// The asserts will not fire in RETAIL sandbox, and this setting has has no affect in RETAIL sandboxes.
+ /// The asserts will not fire in RETAIL sandbox, and this setting has no affect in RETAIL sandboxes.
/// It is best practice to not call this API, and instead adjust the calling pattern but this is provided
/// as a temporary way to get unblocked while in early stages of game development.
///
diff --git a/Source/Services/Achievements/Manager/achievements_manager_api.cpp b/Source/Services/Achievements/Manager/achievements_manager_api.cpp
index 8713af0f..a0fba776 100644
--- a/Source/Services/Achievements/Manager/achievements_manager_api.cpp
+++ b/Source/Services/Achievements/Manager/achievements_manager_api.cpp
@@ -156,12 +156,12 @@ STDAPI XblAchievementsManagerGetAchievement(
_Outptr_result_maybenull_ XblAchievementsManagerResultHandle* achievementResult
) XBL_NOEXCEPT
{
+ RETURN_HR_INVALIDARGUMENT_IF(achievementId == nullptr || achievementResult == nullptr);
+ RETURN_HR_INVALIDARGUMENT_IF_EMPTY_STRING(achievementId);
+ *achievementResult = nullptr;
+
return ApiImpl([&](AchievementsManager& achievementsManager)
{
- RETURN_HR_INVALIDARGUMENT_IF(achievementId == nullptr || achievementResult == nullptr);
- RETURN_HR_INVALIDARGUMENT_IF_EMPTY_STRING(achievementId);
- *achievementResult = nullptr;
-
auto achievement = achievementsManager.GetAchievement(xboxUserId, achievementId);
if (Failed(achievement))
{
diff --git a/Source/Services/Achievements/Manager/achievements_manager_internal.cpp b/Source/Services/Achievements/Manager/achievements_manager_internal.cpp
index 12504b82..359fac79 100644
--- a/Source/Services/Achievements/Manager/achievements_manager_internal.cpp
+++ b/Source/Services/Achievements/Manager/achievements_manager_internal.cpp
@@ -8,7 +8,7 @@
using namespace xbox::services;
-XblAchievementsManagerResult::XblAchievementsManagerResult(const XblAchievement & achievement)
+XblAchievementsManagerResult::XblAchievementsManagerResult(_In_ const XblAchievement & achievement)
: m_achievements({ achievement }),
m_explicitCleanup(false),
m_achievementsData(nullptr),
@@ -16,7 +16,7 @@ XblAchievementsManagerResult::XblAchievementsManagerResult(const XblAchievement
{
}
-XblAchievementsManagerResult::XblAchievementsManagerResult(Vector& achievements, bool explicitCleanup)
+XblAchievementsManagerResult::XblAchievementsManagerResult(_In_ Vector& achievements, _In_ bool explicitCleanup)
: m_achievements(std::move(achievements)),
m_achievementsData(m_achievements.data()),
m_achievementsCount(m_achievements.size()),
@@ -24,7 +24,7 @@ XblAchievementsManagerResult::XblAchievementsManagerResult(Vector AchievementsManagerUser::GetAchievement(const String & id)
+Result AchievementsManagerUser::GetAchievement(_In_ const String & id)
{
if (m_userAchievements.find(id) == m_userAchievements.end())
{
@@ -346,7 +346,7 @@ uint64_t AchievementsManagerUser::GetAchievementCount() const
return m_userAchievements.size();
}
-Result AchievementsManagerUser::CanUpdateAchievement(const String & achievementId, uint8_t progress)
+Result AchievementsManagerUser::CanUpdateAchievement(_In_ const String & achievementId, _In_ uint8_t progress)
{
if (m_userAchievements.find(achievementId) == m_userAchievements.end())
{
@@ -386,10 +386,10 @@ Result AchievementsManagerUser::CanUpdateAchievement(const String & achiev
);
return { E_INVALIDARG, errorMsg };
}
- return true;
+ return S_OK;
}
-Result AchievementsManagerUser::UpdateAchievement(const String& achievementId, uint8_t percent)
+Result AchievementsManagerUser::UpdateAchievement(_In_ const String& achievementId, _In_ uint8_t percent)
{
return m_xblContext->AchievementsService()->UpdateAchievement(
m_xuid,
@@ -422,21 +422,21 @@ ProgressValueType IsNumber(const char* str)
{
char* p = nullptr;
- strtoul(str, &p, 0);
+ (void)strtoul(str, &p, 0);
if (p == nullptr)
{
return ProgressValueType::UnsignedLong;
}
// If it couldn't be represented as an unsigned long, check to see if it can be signed next.
- strtol(str, &p, 0);
+ (void)strtol(str, &p, 0);
if (p == nullptr)
{
return ProgressValueType::SignedLong;
}
// If neither of those, then either it is a floating point number, or it is non-numeric.
- strtod(str, &p);
+ (void)strtod(str, &p);
if (p == nullptr)
{
return ProgressValueType::FloatingPoint;
@@ -789,7 +789,7 @@ Vector GenerateEventFromAchievementDiff(uint64_t xu
return generatedEvents;
}
-HRESULT AchievementsManagerUser::FetchAchievements(AsyncContext async)
+HRESULT AchievementsManagerUser::FetchAchievements(_In_ AsyncContext async)
{
constexpr uint32_t achievementsPerFetch = 100;
@@ -818,10 +818,10 @@ HRESULT AchievementsManagerUser::FetchAchievements(AsyncContext async)
}
HRESULT AchievementsManagerUser::HandleAchievementsResults(
- Result> result,
- uint32_t achievementsPerFetch,
- AsyncContext async,
- Vector fetchedAchievements
+ _In_ Result> result,
+ _In_ uint32_t achievementsPerFetch,
+ _In_ AsyncContext async,
+ _In_ Vector fetchedAchievements
)
{
if (Succeeded(result))
@@ -1015,7 +1015,7 @@ HRESULT AchievementsManager::CleanUpAchievementCopyForResult(XblAchievement& ach
return S_OK;
}
-XblAchievement AchievementsManager::DeepCopyAchievement(const XblAchievement & other)
+XblAchievement AchievementsManager::DeepCopyAchievement(_In_ const XblAchievement & other)
{
XblAchievement copy
{
@@ -1144,7 +1144,7 @@ Vector AchievementsManager::DeepCopyAchievements(const Vector lock{ m_mutex };
@@ -1321,7 +1321,7 @@ Result AchievementsManager::GetAchievement(
return m_localUsers[xuid]->GetAchievement(achievementId);
}
-Result> AchievementsManager::GetAchievements(uint64_t xuid)
+Result> AchievementsManager::GetAchievements(_In_ uint64_t xuid)
{
if (m_localUsers.find(xuid) == m_localUsers.end())
{
@@ -1390,17 +1390,17 @@ Result AchievementsManager::UpdateAchievement(
return localUser->UpdateAchievement(achievementId, progress);
}
-bool AchievementsManager::HasUser(uint64_t xuid) const
+bool AchievementsManager::HasUser(_In_ uint64_t xuid) const
{
return m_localUsers.find(xuid) != m_localUsers.end();
}
-bool AchievementsManager::IsUserInitialized(uint64_t xuid)
+bool AchievementsManager::IsUserInitialized(_In_ uint64_t xuid)
{
return m_localUsers[xuid]->IsInitialized();
}
-uint64_t AchievementsManager::GetUserAchievementCount(uint64_t xuid)
+uint64_t AchievementsManager::GetUserAchievementCount(_In_ uint64_t xuid)
{
return m_localUsers[xuid]->GetAchievementCount();
}
diff --git a/Source/Services/Achievements/Manager/achievements_manager_internal.h b/Source/Services/Achievements/Manager/achievements_manager_internal.h
index af20fe1a..744d30ff 100644
--- a/Source/Services/Achievements/Manager/achievements_manager_internal.h
+++ b/Source/Services/Achievements/Manager/achievements_manager_internal.h
@@ -22,8 +22,8 @@ struct XblAchievementsManagerResult : public xbox::services::RefCounter, public
{
public:
XblAchievementsManagerResult(_In_ const XblAchievement& achievement);
- XblAchievementsManagerResult(_In_ Vector& achievements, bool explicitCleanup = false);
- XblAchievementsManagerResult(_In_ XblAchievement* achievements, _In_ size_t achievementCount, bool explicitCleanup = false);
+ XblAchievementsManagerResult(_In_ Vector& achievements, _In_ bool explicitCleanup = false);
+ XblAchievementsManagerResult(_In_ XblAchievement* achievements, _In_ size_t achievementCount, _In_ bool explicitCleanup = false);
virtual ~XblAchievementsManagerResult();
const Vector& Achievements() const;
@@ -151,17 +151,17 @@ private:
bool m_isInitialized = false;
Map m_userAchievements;
- XblAchievement* m_achievementCache;
- uint64_t m_xuid;
+ XblAchievement* m_achievementCache{ nullptr };
+ uint64_t m_xuid{ 0 };
Vector m_eventsToProcess;
Vector m_generatedEvents;
std::shared_ptr m_xblContext;
- XblFunctionContext m_achievementProgressToken;
- XblFunctionContext m_rtaResyncToken;
- XblFunctionContext m_rtaConnectionToken;
+ XblFunctionContext m_achievementProgressToken{ 0 };
+ XblFunctionContext m_rtaResyncToken{ 0 };
+ XblFunctionContext m_rtaConnectionToken{ 0 };
std::shared_ptr m_rtaManager;
diff --git a/Source/Services/Achievements/achievement_service_internal.cpp b/Source/Services/Achievements/achievement_service_internal.cpp
index 36565807..265ae2c9 100644
--- a/Source/Services/Achievements/achievement_service_internal.cpp
+++ b/Source/Services/Achievements/achievement_service_internal.cpp
@@ -117,20 +117,14 @@ HRESULT AchievementsService::UpdateAchievement(
#if HC_PLATFORM == HC_PLATFORM_XDK
{
- auto xsapiSingleton = get_xsapi_singleton();
- if (!xsapiSingleton)
+ auto state = GlobalState::Get();
+ if (!state)
{
- return utils::convert_xbox_live_error_code_to_hresult(xbl_error_code::runtime_error);
+ return E_XBL_NOT_INITIALIZED;
}
- std::lock_guard lock(xsapiSingleton->m_achievementServiceInitLock);
- if (!xsapiSingleton->m_bHasAchievementServiceInitialized)
+ // Register ETX provider if it hasn't been registered yet
+ if (XSAPI_Update_Achievement_Handle == 0)
{
- HRESULT hr = CoCreateGuid(&xsapiSingleton->m_eventPlayerSessionId);
- if (FAILED(hr))
- {
- return hr;
- }
-
string_t wScid = utils::string_t_from_internal_string(lowercaseScid);
std::error_code errC = utils::guid_from_string(wScid, const_cast(&XSAPI_Update_Achievement_Provider.Guid), false);
if (errC)
@@ -138,23 +132,10 @@ HRESULT AchievementsService::UpdateAchievement(
return utils::convert_xbox_live_error_code_to_hresult(errC);
}
- CHAR strTitleId[16] = "";
- sprintf_s(strTitleId, "%0.8X", titleId);
-
- std::stringstream ss;
- ss << "XSAPI_";
- ss << strTitleId;
- xsapiSingleton->m_eventProviderName = ss.str();
- XSAPI_Update_Achievement_Provider.Name = xsapiSingleton->m_eventProviderName.c_str();
+ XSAPI_Update_Achievement_Provider.Name = state->AchievementsProviderName().data();
ULONG errorCode = EtxRegister(&XSAPI_Update_Achievement_Provider, &XSAPI_Update_Achievement_Handle);
- hr = HRESULT_FROM_WIN32(errorCode);
- if (FAILED(hr))
- {
- return hr;
- }
-
- xsapiSingleton->m_bHasAchievementServiceInitialized = true;
+ RETURN_HR_IF_FAILED(HRESULT_FROM_WIN32(errorCode));
}
}
#endif
@@ -277,7 +258,7 @@ ULONG AchievementsService::EventWriteAchievementUpdate(
EtxFillCommonFields_v7(&eventData[0], scratch, EventWriteAchievementUpdate_ScratchSize);
EventDataDescCreate(&eventData[1], userId, (ULONG)((wcslen(userId) + 1) * sizeof(WCHAR)));
- EventDataDescCreate(&eventData[2], &get_xsapi_singleton()->m_eventPlayerSessionId, sizeof(GUID));
+ EventDataDescCreate(&eventData[2], &GlobalState::Get()->AchievementsSessionId(), sizeof(GUID));
EventDataDescCreate(&eventData[3], achievementId, (ULONG)((wcslen(achievementId) + 1) * sizeof(WCHAR)));
EventDataDescCreate(&eventData[4], &percentComplete, sizeof(percentComplete));
@@ -299,7 +280,7 @@ AchievementsService::WriteOfflineUpdateAchievement(
{
ULONG errorCode = EventWriteAchievementUpdate(
utils::uint64_to_string_t(xboxLiveContextImpl->Xuid()).c_str(),
- utils::string_t_from_internal_string(achievementId).c_str(),
+ convert::utf8_to_utf16(achievementId).c_str(),
percentComplete
);
HRESULT hr = HRESULT_FROM_WIN32(errorCode);
@@ -559,7 +540,7 @@ String AchievementsService::GetAchievementsSubpath(
path << xboxUserId;
path << (")/achievements");
- subPathBuilder.append_path(utils::string_t_from_internal_string(path.str()));
+ subPathBuilder.append_path(path.str());
Stringstream titleQuery;
auto &last = titleIds.back();
@@ -571,28 +552,28 @@ String AchievementsService::GetAchievementsSubpath(
titleQuery << (",");
}
}
- subPathBuilder.append_query(_T("titleId"), utils::string_t_from_internal_string(titleQuery.str()));
+ subPathBuilder.append_query("titleId", titleQuery.str());
if (type != XblAchievementType::All)
{
- subPathBuilder.append_query(_T("types"), utils::string_t_from_internal_string(EnumName(type)));
+ subPathBuilder.append_query("types", EnumName(type));
}
if (unlockedOnly)
{
- subPathBuilder.append_query(_T("unlockedOnly=true"));
+ subPathBuilder.append_query("unlockedOnly=true");
}
switch (orderBy)
{
case XblAchievementOrderBy::TitleId:
{
- subPathBuilder.append_query(_T("orderBy"), _T("title"));
+ subPathBuilder.append_query("orderBy", "title");
break;
}
case XblAchievementOrderBy::UnlockTime:
{
- subPathBuilder.append_query(_T("orderBy"), _T("unlocktime"));
+ subPathBuilder.append_query("orderBy", "unlocktime");
break;
}
default: break;
@@ -605,7 +586,7 @@ String AchievementsService::GetAchievementsSubpath(
continuationToken
);
- return utils::internal_string_from_string_t(subPathBuilder.to_string());
+ return subPathBuilder.to_string();
}
void AchievementsService::CleanupAchievement(XblAchievement& a)
@@ -874,7 +855,7 @@ Result AchievementsService::DeserializeReward(
auto mediaAssetResult = DeserializeMediaAsset(json["mediaAsset"]);
reward.mediaAsset = Make(mediaAssetResult.ExtractPayload());
- if (Failed(mediaAssetResult) || errc)
+ if (Failed(mediaAssetResult) || FAILED(errc))
{
return Result{ reward, E_FAIL };
}
@@ -971,7 +952,7 @@ Result AchievementsService::DeserializeAchievement(
a.rewards = MakeArray(rewardsVector);
a.rewardsCount = rewardsVector.size();
- std::chrono::seconds seconds;
+ std::chrono::seconds seconds{};
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonStringTimespanInSeconds(json, "estimatedTime", seconds, true));
a.estimatedUnlockTime = seconds.count();
xsapi_internal_string deeplink;
@@ -992,7 +973,7 @@ Result AchievementsService::DeserializeAchievement(
}
a.progression = progressionResult.ExtractPayload();
- if (Failed(progressionResult) || Failed(timeWindowResult) || errCode)
+ if (Failed(progressionResult) || Failed(timeWindowResult) || FAILED(errCode))
{
CleanupAchievement(a);
return Result{ E_FAIL };
diff --git a/Source/Services/Achievements/achievements_result.cpp b/Source/Services/Achievements/achievements_result.cpp
index c5766b62..0cbc071f 100644
--- a/Source/Services/Achievements/achievements_result.cpp
+++ b/Source/Services/Achievements/achievements_result.cpp
@@ -43,7 +43,7 @@ Result> XblAchievementsResult::Deserializ
}
}
- if (errCode)
+ if (FAILED(errCode))
{
return Result>{ errCode };
}
diff --git a/Source/Services/Common/Cpp/pch.cpp b/Source/Services/Common/Cpp/pch.cpp
index 625d3839..3c8a183f 100644
--- a/Source/Services/Common/Cpp/pch.cpp
+++ b/Source/Services/Common/Cpp/pch.cpp
@@ -3,6 +3,8 @@
#include "pch.h"
-#ifndef _LINK_WITH_CPPRESTSDK
+#if !_LINK_WITH_CPPRESTSDK && HC_PLATFORM != HC_PLATFORM_GDK
#include "cpprestsdk_impl.h"
-#endif
\ No newline at end of file
+#endif
+#include
+#include "uri_impl.h"
\ No newline at end of file
diff --git a/Source/Services/Common/pch_common.h b/Source/Services/Common/pch_common.h
index 4a7cdb55..cf5348d2 100644
--- a/Source/Services/Common/pch_common.h
+++ b/Source/Services/Common/pch_common.h
@@ -69,6 +69,9 @@
#include
#include
#include
+#if HC_PLATFORM_IS_MICROSOFT
+#include
+#endif
#include "httpClient/pal.h"
#include "httpClient/httpClient.h"
@@ -83,10 +86,23 @@
#include
#include "http_headers.h"
+#if HC_PLATFORM != HC_PLATFORM_GDK
#include "cpprest/http_msg.h"
+#endif
#include "http_utils.h"
+#if HC_PLATFORM == HC_PLATFORM_GDK
+#include "HookedUri/uri.h"
+#endif
+#undef max // needed for the version of RapidJson we're using to avoid warnings
+#undef min
+
+#define RAPIDJSON_NAMESPACE xbox::services::rapidjson
+#define RAPIDJSON_NAMESPACE_BEGIN namespace xbox { namespace services { namespace rapidjson {
+#define RAPIDJSON_NAMESPACE_END } } }
#include "rapidjson/document.h"
+#include "rapidjson/stringbuffer.h"
+#include "rapidjson/writer.h"
#include "async_helpers.h"
#include "xsapi_utils.h"
@@ -95,7 +111,6 @@
#include "ref_counter.h"
#include "internal_errors.h"
#include "Logger/log.h"
-#include "telemetry.h"
#include "xbox_live_app_config_internal.h"
#include "user.h"
#include "http_call_wrapper_internal.h"
diff --git a/Source/Services/Common/xbox_live_context.cpp b/Source/Services/Common/xbox_live_context.cpp
index a7e278ff..b5c03b29 100644
--- a/Source/Services/Common/xbox_live_context.cpp
+++ b/Source/Services/Common/xbox_live_context.cpp
@@ -2,8 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
-#include "shared_macros.h"
-#include "xbox_system_factory.h"
#include "xbox_live_context_internal.h"
#include "presence_internal.h"
@@ -25,10 +23,9 @@ using namespace xbox::services::system;
) noexcept
{
auto xblContext = std::shared_ptr(
- new (Alloc(sizeof(XblContext))) XblContext
- {
- std::move(user)
- }
+ new (Alloc(sizeof(XblContext))) XblContext{ std::move(user) },
+ Deleter(),
+ Allocator()
);
return xblContext;
}
@@ -58,6 +55,14 @@ HRESULT XblContext::Initialize(
m_xboxLiveContextSettings = MakeShared();
std::weak_ptr thisWeakPtr = shared_from_this();
+ TaskQueue globalQueue;
+ {
+ auto state = GlobalState::Get();
+ if (state)
+ {
+ globalQueue = state->Queue();
+ }
+ }
{
Result userResult = m_user.Copy();
@@ -140,7 +145,7 @@ HRESULT XblContext::Initialize(
{
Result userResult = m_user.Copy();
RETURN_HR_IF_FAILED(userResult.Hresult());
- m_multiplayerActivityService = MakeShared(userResult.ExtractPayload(), get_xsapi_singleton_async_queue(), m_xboxLiveContextSettings);
+ m_multiplayerActivityService = MakeShared(userResult.ExtractPayload(), globalQueue, m_xboxLiveContextSettings);
}
{
@@ -150,7 +155,7 @@ HRESULT XblContext::Initialize(
m_eventsService = MakeShared(
userResult.ExtractPayload()
#if XSAPI_INTERNAL_EVENTS_SERVICE
- , get_xsapi_singleton_async_queue()
+ , globalQueue
#endif
);
RETURN_HR_IF_FAILED(m_eventsService->Initialize());
@@ -168,14 +173,16 @@ HRESULT XblContext::Initialize(
m_notificationService = MakeShared(userResult.ExtractPayload(), m_xboxLiveContextSettings);
#elif HC_PLATFORM == HC_PLATFORM_UWP
m_notificationService = MakeShared(userResult.ExtractPayload(), m_xboxLiveContextSettings);
- m_notificationService->RegisterWithNotificationService(AsyncContext{TaskQueue{ get_xsapi_singleton_async_queue() }});
+ m_notificationService->RegisterWithNotificationService(AsyncContext{ globalQueue });
#endif
#endif
}
+#if XSAPI_NOTIFICATION_SERVICE
auto userChangedRegistrationResult = User::RegisterChangeEventHandler(
[
- thisWeakPtr
+ thisWeakPtr,
+ queue{ globalQueue.DeriveWorkerQueue() }
]
(UserLocalId localId, UserChangeType changeType)
{
@@ -184,18 +191,16 @@ HRESULT XblContext::Initialize(
{
if (sharedThis->m_user.LocalId() == localId.value && changeType == XalUserChange_SignedOut)
{
-#if XSAPI_NOTIFICATION_SERVICE
- sharedThis->NotificationService()->UnregisterFromNotificationService(
- AsyncContext
- {
- TaskQueue{ get_xsapi_singleton_async_queue() }
- });
-#endif
+ sharedThis->NotificationService()->UnregisterFromNotificationService(AsyncContext{ queue });
}
}
});
- return userChangedRegistrationResult.Hresult();
+ RETURN_HR_IF_FAILED(userChangedRegistrationResult.Hresult());
+ m_userChangeEventToken = userChangedRegistrationResult.Payload();
+#endif
+
+ return S_OK;
}
uint64_t XblContext::Xuid() const
diff --git a/Source/Services/Common/xbox_live_context_api.cpp b/Source/Services/Common/xbox_live_context_api.cpp
index 65cbcbe7..944a473f 100644
--- a/Source/Services/Common/xbox_live_context_api.cpp
+++ b/Source/Services/Common/xbox_live_context_api.cpp
@@ -89,9 +89,9 @@ void XblSetApiType(
_In_ XblApiType apiType
) XBL_NOEXCEPT
{
- auto singleton = get_xsapi_singleton();
- if (singleton)
+ auto state = GlobalState::Get();
+ if (state)
{
- singleton->m_apiType = apiType;
+ state->ApiType = apiType;
}
}
diff --git a/Source/Services/Common/xbox_live_context_internal.h b/Source/Services/Common/xbox_live_context_internal.h
index cccc50fa..01522a49 100644
--- a/Source/Services/Common/xbox_live_context_internal.h
+++ b/Source/Services/Common/xbox_live_context_internal.h
@@ -95,13 +95,6 @@ public:
///
std::shared_ptr LeaderboardService();
-#if !XSAPI_NO_PPL
- ///
- /// A service for managing matchmaking sessions.
- ///
- xbox::services::matchmaking::legacy::matchmaking_service& matchmaking_service();
-#endif // !XSAPI_NO_PPL
-
///
/// A service for managing Rich Presence.
///
diff --git a/Source/Services/Common/xbox_live_context_settings.cpp b/Source/Services/Common/xbox_live_context_settings.cpp
index e5ea12b3..53c67d15 100644
--- a/Source/Services/Common/xbox_live_context_settings.cpp
+++ b/Source/Services/Common/xbox_live_context_settings.cpp
@@ -3,7 +3,6 @@
#include "pch.h"
#include "xbox_live_context_internal.h"
-#include "xbox_system_factory.h"
#include "xbox_live_app_config_internal.h"
#if HC_PLATFORM == HC_PLATFORM_ANDROID
diff --git a/Source/Services/Common/xbox_live_global_api.cpp b/Source/Services/Common/xbox_live_global_api.cpp
index 040b0570..8a7f27c5 100644
--- a/Source/Services/Common/xbox_live_global_api.cpp
+++ b/Source/Services/Common/xbox_live_global_api.cpp
@@ -88,10 +88,10 @@ XblGetAsyncQueue() XBL_NOEXCEPT
try
{
XTaskQueueHandle duplicatedHandle{ nullptr };
- auto queue{ get_xsapi_singleton_async_queue() };
- if (queue)
+ auto state = GlobalState::Get();
+ if (state && state->Queue().GetHandle())
{
- XTaskQueueDuplicateHandle(queue, &duplicatedHandle);
+ XTaskQueueDuplicateHandle(state->Queue().GetHandle(), &duplicatedHandle);
}
return duplicatedHandle;
}
@@ -216,4 +216,5 @@ STDAPI_(void) XblRemoveServiceCallRoutedHandler(
{
state->RemoveServiceCallRoutedHandler(token);
}
-}
\ No newline at end of file
+}
+
diff --git a/Source/Services/Events/event.cpp b/Source/Services/Events/event.cpp
index e19f0519..ffd327b6 100644
--- a/Source/Services/Events/event.cpp
+++ b/Source/Services/Events/event.cpp
@@ -91,7 +91,7 @@ Result Event::Deserialize(
// tab-separated (0x0A)
// xuid | event name | timestamp | dimensions json | measurements json
- auto parts = utils::string_split(inputData, '\t');
+ auto parts = utils::string_split_internal(inputData, '\t');
if (parts.size() < 5)
{
@@ -100,7 +100,7 @@ Result Event::Deserialize(
auto xuid = utils::internal_string_to_uint64(parts[0]);
auto& eventName = parts[1];
- auto timestamp = xbox::services::datetime::from_string(utils::string_t_from_internal_string(parts[2]), xbox::services::datetime::ISO_8601);
+ auto timestamp = xbox::services::datetime::from_string(parts[2], xbox::services::datetime::ISO_8601);
JsonDocument dimensionsJson;
dimensionsJson.Parse(parts[3].data());
@@ -158,7 +158,7 @@ xsapi_internal_string Event::Serialize() const
ss << m_xuid << seperator;
ss << m_eventName << seperator;
- ss << utils::internal_string_from_string_t(m_timestamp.to_string(xbox::services::datetime::ISO_8601)) << seperator;
+ ss << m_timestamp.to_string(xbox::services::datetime::ISO_8601) << seperator;
ss << JsonUtils::SerializeJson(m_dimensions) << seperator;
ss << JsonUtils::SerializeJson(m_measurements);
diff --git a/Source/Services/Events/event_queue.cpp b/Source/Services/Events/event_queue.cpp
index 74e0cccf..10ca22bc 100644
--- a/Source/Services/Events/event_queue.cpp
+++ b/Source/Services/Events/event_queue.cpp
@@ -36,7 +36,7 @@ void EventQueue::Initialize()
if (sharedThis && Succeeded(result))
{
auto& bytes = result.Payload();
- auto fileMetadata = utils::string_split(xsapi_internal_string{ bytes.begin(), bytes.end() }, '\n');
+ auto fileMetadata = utils::string_split_internal(xsapi_internal_string{ bytes.begin(), bytes.end() }, '\n');
std::lock_guard lock{ sharedThis->m_mutex };
for (auto& metadata : fileMetadata)
@@ -184,7 +184,7 @@ HRESULT EventQueue::Populate()
if (sharedThis && Succeeded(readResult) && sharedThis->m_mode == Mode::Normal)
{
auto& bytes = readResult.Payload();
- auto serializedEvents = utils::string_split(xsapi_internal_string{ bytes.begin(), bytes.end() }, '\n');
+ auto serializedEvents = utils::string_split_internal(xsapi_internal_string{ bytes.begin(), bytes.end() }, '\n');
for (const auto& serializedEvent : serializedEvents)
{
diff --git a/Source/Services/Events/event_upload_payload.cpp b/Source/Services/Events/event_upload_payload.cpp
index 39ad522e..c9d9bbd8 100644
--- a/Source/Services/Events/event_upload_payload.cpp
+++ b/Source/Services/Events/event_upload_payload.cpp
@@ -66,7 +66,7 @@ HRESULT EventUploadPayload::GetRequestData(
EventsService::IKey(),
event.FullEventName(),
event.Data(),
- StringFromStringT(event.Timestamp().to_string(xbox::services::datetime::date_format::ISO_8601)),
+ event.Timestamp().to_string(xbox::services::datetime::date_format::ISO_8601).c_str(),
cll::LatencyNormal,
cll::PersistenceUnspecified,
cll::SensitivityUnspecified,
diff --git a/Source/Services/Events/events_service_etw.cpp b/Source/Services/Events/events_service_etw.cpp
index a7cf5f12..2f2d299c 100644
--- a/Source/Services/Events/events_service_etw.cpp
+++ b/Source/Services/Events/events_service_etw.cpp
@@ -6,8 +6,6 @@
#if XSAPI_WRL_EVENTS_SERVICE
#include "events_service_etw.h"
-#include "service_call_logger_data.h"
-#include "service_call_logger.h"
#include
#include
@@ -160,23 +158,6 @@ HRESULT EventsService::WriteInGameEventHelper(
{
try
{
- //Log service call
- if (xbox::services::service_call_logger::get_singleton_instance()->is_enabled())
- {
- std::shared_ptr tracker = service_call_logger::get_singleton_instance();
-
- service_call_logger_data logData(
- m_user.Xuid(),
- eventName,
- m_playSession,
- JsonUtils::SerializeJson(dimensions),
- JsonUtils::SerializeJson(measurements),
- chrono_clock_t::now()
- );
-
- tracker->log(logData.to_string());
- }
-
auto fields = CreateLoggingFields(eventName, dimensions, measurements);
//m_loggingChannel->loge
@@ -225,8 +206,8 @@ ComPtr EventsService::CreateLoggingFields(
fields->BeginStruct(HStringReference(L"properties").Get());
for (const auto& jsonPair : dimensions.GetObject())
{
- std::pair pair;
- pair.first = utils::string_t_from_internal_string(jsonPair.name.GetString());
+ std::pair pair;
+ pair.first = jsonPair.name.GetString();
JsonUtils::CopyFrom(pair.second, jsonPair.value);
AddValuePair(fields, pair);
}
@@ -239,8 +220,8 @@ ComPtr EventsService::CreateLoggingFields(
fields->BeginStruct(HStringReference(L"measurements").Get());
for (const auto& jsonPair : measurements.GetObject())
{
- std::pair pair;
- pair.first = utils::string_t_from_internal_string(jsonPair.name.GetString());
+ std::pair pair;
+ pair.first = jsonPair.name.GetString();
JsonUtils::CopyFrom(pair.second, jsonPair.value);
AddValuePair(fields, pair);
}
@@ -254,21 +235,22 @@ ComPtr EventsService::CreateLoggingFields(
void EventsService::AddValuePair(
_Inout_ Microsoft::WRL::ComPtr fields,
- _In_ const std::pair& pair
+ _In_ const std::pair& pair
)
{
// check property name.
const auto& name = pair.first;
THROW_CPP_INVALIDARGUMENT_IF_STRING_EMPTY(name);
- regex_t regex(L"[A-Za-z]+[A-Za-z0-9]*");
+ std::regex regex("[A-Za-z]+[A-Za-z0-9]*");
bool matchFound = std::regex_match(name, regex);
if (!matchFound)
{
throw std::invalid_argument("Invalid properties or measurements name");
}
- HStringReference propertyName{ name.data() };
+ auto s = utility::conversions::utf8_to_utf16(name.data());
+ HStringReference propertyName{ s.c_str() };
const auto& value = pair.second;
switch (value.GetType())
diff --git a/Source/Services/Events/events_service_etw.h b/Source/Services/Events/events_service_etw.h
index 6dd4d61d..39ede124 100644
--- a/Source/Services/Events/events_service_etw.h
+++ b/Source/Services/Events/events_service_etw.h
@@ -46,7 +46,7 @@ private:
void AddValuePair(
_Inout_ Microsoft::WRL::ComPtr fields,
- _In_ const std::pair& pair
+ _In_ const std::pair& pair
);
Microsoft::WRL::ComPtr CreateLoggingFields(
diff --git a/Source/Services/Events/events_service_xsapi.cpp b/Source/Services/Events/events_service_xsapi.cpp
index ed5fa77e..9c370ee4 100644
--- a/Source/Services/Events/events_service_xsapi.cpp
+++ b/Source/Services/Events/events_service_xsapi.cpp
@@ -5,7 +5,6 @@
#include "xsapi-c/events_c.h"
#include "events_service_xsapi.h"
#include "xbox_live_context_internal.h"
-#include "xbox_system_factory.h"
#include
using namespace xbox::services;
diff --git a/Source/Services/Leaderboard/leaderboard_internal.h b/Source/Services/Leaderboard/leaderboard_internal.h
index 61417157..9f8097dc 100644
--- a/Source/Services/Leaderboard/leaderboard_internal.h
+++ b/Source/Services/Leaderboard/leaderboard_internal.h
@@ -37,7 +37,7 @@ struct LeaderboardGlobalQuery
xsapi_internal_string xuid;
xsapi_internal_string socialGroup;
xsapi_internal_vector columns;
- bool isTitleManaged;
+ bool isTitleManaged{ false };
};
struct LeaderboardSocialQuery
@@ -47,7 +47,7 @@ struct LeaderboardSocialQuery
xsapi_internal_string statName;
xsapi_internal_string socialGroup;
xsapi_internal_string sortOrder;
- bool isTitleManaged;
+ bool isTitleManaged{ false };
};
class LeaderboardColumn
@@ -117,7 +117,7 @@ private:
xsapi_internal_string m_modernGamertagSuffix;
xsapi_internal_string m_uniqueModernGamertag;
uint64_t m_xuid{ 0 };
- double m_percentile{ 0 };
+ double m_percentile{ 0.0 };
uint32_t m_rank{ 0 };
uint32_t m_globalRank{ 0 };
xsapi_internal_vector m_columnValues;
diff --git a/Source/Services/Leaderboard/leaderboard_result.cpp b/Source/Services/Leaderboard/leaderboard_result.cpp
index 1543aa88..f2c8c98d 100644
--- a/Source/Services/Leaderboard/leaderboard_result.cpp
+++ b/Source/Services/Leaderboard/leaderboard_result.cpp
@@ -225,11 +225,11 @@ LeaderboardResult::ParseSocialGroup(xsapi_internal_string socialGroupStr)
{
XblSocialGroupType socialGroup = XblSocialGroupType::None;
- if (utils::str_icmp_internal(socialGroupStr, utils::internal_string_from_string_t(xbox::services::social::legacy::social_group_constants::people())) == 0)
+ if (utils::str_icmp_internal(socialGroupStr, xbox::services::social::legacy::social_group_constants::people()) == 0)
{
socialGroup = XblSocialGroupType::People;
}
- else if (utils::str_icmp_internal(socialGroupStr, utils::internal_string_from_string_t(xbox::services::social::legacy::social_group_constants::favorite())) == 0)
+ else if (utils::str_icmp_internal(socialGroupStr, xbox::services::social::legacy::social_group_constants::favorite()) == 0)
{
socialGroup = XblSocialGroupType::Favorites;
}
diff --git a/Source/Services/Leaderboard/leaderboard_service.cpp b/Source/Services/Leaderboard/leaderboard_service.cpp
index a94a7249..4f7f84f3 100644
--- a/Source/Services/Leaderboard/leaderboard_service.cpp
+++ b/Source/Services/Leaderboard/leaderboard_service.cpp
@@ -2,9 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
-#include "shared_macros.h"
-#include "xbox_system_factory.h"
-#include "xsapi_utils.h"
#include "xbox_live_context_internal.h"
#include "leaderboard_internal.h"
@@ -59,33 +56,33 @@ CreateLeaderboardUrl(
xsapi_internal_stringstream path;
path << "/scids/";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(scid), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(scid, xbox::services::uri::components::path);
if (isTitleManaged)
{
path << "/leaderboards/stat(";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(name), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(name, xbox::services::uri::components::path);
path << ")";
}
else
{
path << "/leaderboards/";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(name), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(name, xbox::services::uri::components::path);
}
- builder.set_path(utils::string_t_from_internal_string(path.str()));
+ builder.set_path(path.str());
if (metadata)
{
- builder.append_query(_T("include"), _T("valuemetadata"));
+ builder.append_query("include", "valuemetadata");
}
if (!xuid.empty())
{
- builder.append_query(_T("xuid"), utils::string_t_from_internal_string(xuid));
+ builder.append_query("xuid", xuid);
}
if (maxItems > 0)
{
- builder.append_query(_T("maxItems"), maxItems);
+ builder.append_query("maxItems", maxItems);
}
if (!skipToXuid.empty())
@@ -95,27 +92,27 @@ CreateLeaderboardUrl(
return xbl_result(xbl_error_code::invalid_argument, "Cannot skip to XUID and rank");
}
- builder.append_query(_T("skipToUser"), utils::string_t_from_internal_string(skipToXuid));
+ builder.append_query("skipToUser", skipToXuid);
}
else
{
if (!continuationToken.empty())
{
- builder.append_query(_T("continuationToken"), utils::string_t_from_internal_string(continuationToken));
+ builder.append_query("continuationToken", continuationToken);
}
else if (skipToRank > 0)
{
- builder.append_query(_T("skipToRank"), skipToRank);
+ builder.append_query("skipToRank", skipToRank);
}
}
if (!socialGroup.empty())
{
- builder.append_query(_T("view"), _T("People"));
- builder.append_query(_T("viewTarget"), utils::string_t_from_internal_string(socialGroup));
+ builder.append_query("view", "People");
+ builder.append_query("viewTarget", socialGroup);
}
- return xbl_result(utils::internal_string_from_string_t(builder.to_string()));
+ return xbl_result(builder.to_string());
}
HRESULT
@@ -151,7 +148,7 @@ LeaderboardService::GetLeaderboard(
if (url.err()) return utils::convert_xbox_live_error_code_to_hresult(url.err());
- std::shared_ptr query = std::make_shared();
+ std::shared_ptr query = MakeShared();
query->scid = scid;
query->name = name;
query->xuid = xuid;
@@ -267,42 +264,42 @@ CreateLeaderboardForSocialGroupUrl(
xsapi_internal_stringstream path;
path << "/users/xuid(";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(xuid), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(xuid, xbox::services::uri::components::path);
path << ")/scids/";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(scid), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(scid, xbox::services::uri::components::path);
path << "/stats/";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(statName), xbox::services::uri::components::path));
+ path << xbox::services::uri::encode_uri(statName, xbox::services::uri::components::path);
path << "/people/";
- path << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(socialGroup), xbox::services::uri::components::path));
- builder.set_path(utils::string_t_from_internal_string(path.str()));
+ path << xbox::services::uri::encode_uri(socialGroup, xbox::services::uri::components::path);
+ builder.set_path(path.str());
if (!sortOrder.empty())
{
- builder.append_query(_T("sort"), utils::string_t_from_internal_string(sortOrder));
+ builder.append_query("sort", sortOrder);
}
if (maxItems > 0)
{
- builder.append_query(_T("maxItems"), maxItems);
+ builder.append_query("maxItems", maxItems);
}
if (!skipToXuid.empty())
{
- builder.append_query(_T("skipToUser"), utils::string_t_from_internal_string(skipToXuid));
+ builder.append_query("skipToUser", skipToXuid);
}
else
{
if (!continuationToken.empty())
{
- builder.append_query(_T("continuationToken"), utils::string_t_from_internal_string(continuationToken));
+ builder.append_query("continuationToken", continuationToken);
}
else if (skipToRank > 0)
{
- builder.append_query(_T("skipToRank"), skipToRank);
+ builder.append_query("skipToRank", skipToRank);
}
}
- return xbl_result(utils::internal_string_from_string_t(builder.to_string()));
+ return xbl_result(builder.to_string());
}
HRESULT
@@ -345,7 +342,7 @@ LeaderboardService::GetLeaderboardForSocialGroup(
if (url.err()) return utils::convert_xbox_live_error_code_to_hresult(url.err());
- auto query = std::make_shared();
+ auto query = MakeShared();
query->xuid = xuid;
query->scid = scid;
query->statName = statName;
@@ -460,11 +457,11 @@ STDAPI XblLeaderboardGetLeaderboardAsync(
xsapi_internal_string socialGroup("");
if (leaderboardQuery.socialGroup == XblSocialGroupType::People)
{
- socialGroup = utils::internal_string_from_string_t(xbox::services::social::legacy::social_group_constants::people());
+ socialGroup = xbox::services::social::legacy::social_group_constants::people();
}
else if (leaderboardQuery.socialGroup == XblSocialGroupType::Favorites)
{
- socialGroup = utils::internal_string_from_string_t(xbox::services::social::legacy::social_group_constants::favorite());
+ socialGroup = xbox::services::social::legacy::social_group_constants::favorite();
}
if ((leaderboardQuery.queryType == XblLeaderboardQueryType::UserStatBacked && leaderboardQuery.leaderboardName) ||
@@ -505,7 +502,7 @@ STDAPI XblLeaderboardGetLeaderboardAsync(
{
if (socialGroup.empty())
{
- socialGroup = utils::internal_string_from_string_t(xbox::services::social::legacy::social_group_constants::people());
+ socialGroup = xbox::services::social::legacy::social_group_constants::people();
}
xsapi_internal_string statName("");
diff --git a/Source/Services/Matchmaking/matchmaking_internal.h b/Source/Services/Matchmaking/matchmaking_internal.h
index eecb4bd6..f6737b90 100644
--- a/Source/Services/Matchmaking/matchmaking_internal.h
+++ b/Source/Services/Matchmaking/matchmaking_internal.h
@@ -198,279 +198,4 @@ private:
};
-#if !defined(XBOX_LIVE_CREATORS_SDK)
-#if !XSAPI_NO_PPL
-namespace legacy
-{
-
- ///
- /// Defines values used to indicate whether a match ticket is for a new
- /// game session or an existing session.
- ///
- enum class preserve_session_mode
- {
- ///
- /// The server returned an unrecognized response.
- ///
- unknown,
-
- ///
- /// Always use an existing game session. This is for matching more players
- /// for a game session that is already created or in progress.
- ///
- always,
-
- ///
- /// Never use an existing game session. This is for matching players
- /// for a new game session.
- ///
- never
- };
-
- ///
- /// Defines values used to indicate the status of the match request.
- ///
- enum class ticket_status
- {
- ///
- /// The status of the match request has not been returned by the server yet
- /// or the server returned an unrecognized response.
- ///
- unknown,
-
- ///
- /// Matchmaking has not found a match and the search
- /// request has expired according to its give up duration.
- ///
- expired,
-
- ///
- /// Matchmaking has not found a match yet and it is
- /// still searching.
- ///
- searching,
-
- ///
- /// Matchmaking has found a match and the ticket contains a
- /// reference to the session that is to be created.
- ///
- found,
-
- ///
- /// Matchmaking has been canceled for this ticket.
- ///
- canceled
- };
-
- ///
- /// Represents a server response to a create match ticket request.
- ///
- class create_match_ticket_response
- {
- public:
- ///
- /// Internal function
- ///
- create_match_ticket_response();
-
- ///
- /// Internal function
- ///
- create_match_ticket_response(
- XblCreateMatchTicketResponse response
- );
-
- ///
- /// Ticket ID of a match request.
- ///
- string_t match_ticket_id() const;
-
- ///
- /// Estimated wait time for a match request to be matched with other players.
- ///
- std::chrono::seconds estimated_wait_time() const;
-
- private:
- XblCreateMatchTicketResponse m_createMatchTicketResponse;
- };
-
- ///
- /// Represents a server response to a request for match ticket details.
- ///
- class match_ticket_details_response
- {
- public:
- ///
- /// Internal function
- ///
- match_ticket_details_response();
-
- ///
- /// Internal function
- ///
- match_ticket_details_response(
- std::shared_ptr buffer
- );
-
- ///
- /// Status of a match request.
- ///
- ticket_status match_status() const;
-
- ///
- /// Estimated wait time for a match request to be matched with other players.
- ///
- std::chrono::seconds estimated_wait_time() const;
-
- ///
- /// An enum value to specify whether the match should preserve the session on which the match has been requested.
- ///
- preserve_session_mode preserve_session() const;
-
- ///
- /// The session on which the match was requested.
- ///
- xbox::services::multiplayer::legacy::multiplayer_session_reference ticket_session() const;
-
- ///
- /// The session on which a match request has been found.
- ///
- xbox::services::multiplayer::legacy::multiplayer_session_reference target_session() const;
-
- ///
- /// The attributes of a match request.
- ///
- web::json::value ticket_attributes() const;
-
- private:
- static ticket_status convert_string_to_ticket_status(_In_ const string_t& value);
-
- static preserve_session_mode convert_string_to_preserve_session_mode(_In_ const string_t& value);
-
- std::shared_ptr m_buffer;
- XblMatchTicketDetailsResponse m_matchTicketDetailsResponse;
- };
-
- ///
- /// Represents a server response to a hopper statistics request.
- ///
- class hopper_statistics_response
- {
- public:
-
- ///
- /// Internal function
- ///
- hopper_statistics_response();
-
- ///
- /// Internal function
- ///
- hopper_statistics_response(
- std::shared_ptr buffer
- );
-
- ///
- /// Name of the hopper in which a match was requested.
- ///
- string_t hopper_name() const;
-
- ///
- /// Estimated wait time for a match request to be matched with other players.
- ///
- std::chrono::seconds estimated_wait_time() const;
-
- ///
- /// The number of players in the hopper waiting to be matched.
- ///
- uint32_t players_waiting_to_match() const;
-
- private:
- std::shared_ptr m_buffer;
- XblHopperStatisticsResponse m_hopperStatisticsResponse;
- };
-
- ///
- /// Represents the Matchmaking Service.
- ///
- class matchmaking_service
- {
- public:
- ///
- /// Sends a matchmaking request to the server and returns the match ticket with a ticket id.
- ///
- /// The multiplayer session to use for the match.
- /// The service configuration ID for the match.
- /// The name of the hopper.
- /// The maximum time to wait for players to join the session.
- /// Indicates if the session should be preserved.
- /// The ticket attributes for the session. (Optional)
- /// The async object for notifying when the operation is completed. With the handler, a new match ticket
- /// object is returned. The match ticket object contains server returned information such as ticket id and wait
- /// time, and also contains copies of the title specified data from the ticket data object.
- /// Calls V103 POST /serviceconfigs/{serviceConfigId}/hoppers/{hopperName}
- pplx::task> create_match_ticket(
- _In_ const xbox::services::multiplayer::legacy::multiplayer_session_reference& ticketSessionReference,
- _In_ const string_t& matchmakingServiceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const std::chrono::seconds& ticketTimeout,
- _In_ preserve_session_mode preserveSession,
- _In_ const web::json::value& ticketAttributesJson = web::json::value()
- );
-
- ///
- /// Deletes a the match ticket on the server.
- ///
- /// The service config id that is specific for the title.
- /// The name of the hopper where the match ticket is located.
- /// The id of the ticket to delete on the server.
- /// The async object for notifying when the operation has been completed.
- /// Calls V103 DELETE /serviceconfigs/{serviceConfigId}/hoppers/{hopperName}/tickets/{ticketId}
- pplx::task> delete_match_ticket(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const string_t& ticketId
- );
-
- ///
- /// Retrieves the properties of a match ticket from the server.
- ///
- /// The service config id that is specific for the title.
- /// The name of the hopper where the match ticket is located.
- /// The ticket id of the match ticket to retrieve.
- /// The async object for notifying when the operation is completed. With the handler, the match
- /// ticket object with the data for the ticket, including ticket id and wait time information, is returned
- /// returned from the server.
- /// Calls V103 GET /serviceconfigs/{serviceConfigId}/hoppers/{hopperName}/tickets/{ticketId}
- pplx::task> get_match_ticket_details(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const string_t& ticketId
- );
-
- ///
- /// Gets statistics about a hopper such as how many players are in it.
- ///
- /// The service config id that is specific for the title.
- /// The name of the hopper to query stats for.
- /// The async object for notifying when the operation is completed. With the handler, an object
- /// containing statistics about the hopper is returned.
- /// Calls V103 GET /serviceconfigs/{serviceConfigId}/hoppers/{hopperName}/stats
- pplx::task> get_hopper_statistics(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName
- );
-
- matchmaking_service(const matchmaking_service& other);
- matchmaking_service& operator=(matchmaking_service other);
- ~matchmaking_service();
-
- private:
- matchmaking_service(_In_ XblContextHandle contextHandle);
-
- XblContextHandle m_xblContext;
- };
-}
-#endif // !XSAPI_NO_PPL
-#endif // !defined(XBOX_LIVE_CREATORS_SDK)
NAMESPACE_MICROSOFT_XBOX_SERVICES_MATCHMAKING_CPP_END
\ No newline at end of file
diff --git a/Source/Services/Matchmaking/matchmaking_service.cpp b/Source/Services/Matchmaking/matchmaking_service.cpp
index 2f7c19e5..5b7284ab 100644
--- a/Source/Services/Matchmaking/matchmaking_service.cpp
+++ b/Source/Services/Matchmaking/matchmaking_service.cpp
@@ -3,13 +3,11 @@
#include "pch.h"
#include "shared_macros.h"
-#include "xbox_system_factory.h"
#include "matchmaking_internal.h"
#include "xbox_live_app_config_internal.h"
#include "xbox_live_context_internal.h"
using namespace xbox::services;
-using namespace xbox::services::legacy;
NAMESPACE_MICROSOFT_XBOX_SERVICES_MATCHMAKING_CPP_BEGIN
@@ -143,7 +141,7 @@ xsapi_internal_string MatchmakingService::ConvertPreserveSessionModeToString(
);
}
- if (errc)
+ if (FAILED(errc))
{
return WEB_E_INVALID_JSON_STRING;
}
@@ -173,7 +171,7 @@ xsapi_internal_string MatchmakingService::ConvertPreserveSessionModeToString(
result.estimatedWaitTime = waitTime;
}
- if (errc)
+ if (FAILED(errc))
{
return WEB_E_INVALID_JSON_STRING;
}
@@ -236,7 +234,7 @@ xsapi_internal_string MatchmakingService::ConvertPreserveSessionModeToString(
}
- if (errc)
+ if (FAILED(errc))
{
return WEB_E_INVALID_JSON_STRING;
}
@@ -554,330 +552,6 @@ HRESULT MatchmakingService::GetHopperStatistics(
});
}
-#if !defined(XBOX_LIVE_CREATORS_SDK)
-#if !XSAPI_NO_PPL
-namespace legacy
-{
- match_ticket_details_response::match_ticket_details_response() :
- m_buffer(),
- m_matchTicketDetailsResponse()
- {
- }
-
- match_ticket_details_response::match_ticket_details_response(std::shared_ptr buffer) :
- m_buffer(buffer),
- m_matchTicketDetailsResponse(*reinterpret_cast(m_buffer.get()))
- {
- }
-
- ticket_status
- match_ticket_details_response::match_status() const
- {
- return static_cast(m_matchTicketDetailsResponse.matchStatus);
- }
-
- std::chrono::seconds
- match_ticket_details_response::estimated_wait_time() const
- {
- return std::chrono::seconds(m_matchTicketDetailsResponse.estimatedWaitTime);
- }
-
- preserve_session_mode
- match_ticket_details_response::preserve_session() const
- {
- return static_cast(m_matchTicketDetailsResponse.preserveSession);
- }
-
- xbox::services::multiplayer::legacy::multiplayer_session_reference
- match_ticket_details_response::ticket_session() const
- {
- return xbox::services::multiplayer::legacy::multiplayer_session_reference(
- StringTFromUtf8(m_matchTicketDetailsResponse.ticketSession.Scid),
- StringTFromUtf8(m_matchTicketDetailsResponse.ticketSession.SessionTemplateName),
- StringTFromUtf8(m_matchTicketDetailsResponse.ticketSession.SessionName));
- }
-
- xbox::services::multiplayer::legacy::multiplayer_session_reference
- match_ticket_details_response::target_session() const
- {
- return xbox::services::multiplayer::legacy::multiplayer_session_reference(
- StringTFromUtf8(m_matchTicketDetailsResponse.targetSession.Scid),
- StringTFromUtf8(m_matchTicketDetailsResponse.targetSession.SessionTemplateName),
- StringTFromUtf8(m_matchTicketDetailsResponse.targetSession.SessionName));
- }
-
- web::json::value
- match_ticket_details_response::ticket_attributes() const
- {
- return web::json::value(StringTFromUtf8(m_matchTicketDetailsResponse.ticketAttributes));
- }
-
- ticket_status match_ticket_details_response::convert_string_to_ticket_status(
- _In_ const string_t& value
- )
- {
- ticket_status ticketStatus = ticket_status::unknown;
- if (!value.empty())
- {
- if (Stricmp(value, _T("expired")) == 0)
- {
- ticketStatus = ticket_status::expired;
- }
- else if (Stricmp(value, _T("searching")) == 0)
- {
- ticketStatus = ticket_status::searching;
- }
- else if (Stricmp(value, _T("found")) == 0)
- {
- ticketStatus = ticket_status::found;
- }
- else if (Stricmp(value, _T("canceled")) == 0)
- {
- ticketStatus = ticket_status::canceled;
- }
- }
-
- return ticketStatus;
- }
-
- preserve_session_mode match_ticket_details_response::convert_string_to_preserve_session_mode(
- _In_ const string_t& value
- )
- {
- preserve_session_mode preserve_session_mode = preserve_session_mode::unknown;
- if (!value.empty())
- {
- if (Stricmp(value, _T("always")) == 0)
- {
- preserve_session_mode = preserve_session_mode::always;
- }
- else if (Stricmp(value, _T("never")) == 0)
- {
- preserve_session_mode = preserve_session_mode::never;
- }
- }
- return preserve_session_mode;
- }
-
-
- hopper_statistics_response::hopper_statistics_response() :
- m_buffer(),
- m_hopperStatisticsResponse()
- {
- }
-
- hopper_statistics_response::hopper_statistics_response(std::shared_ptr buffer) :
- m_buffer(buffer),
- m_hopperStatisticsResponse(*reinterpret_cast(m_buffer.get()))
- {
- }
-
- ///
- /// Name of the hopper in which a match was requested.
- ///
- string_t
- hopper_statistics_response::hopper_name() const
- {
- return StringTFromUtf8(m_hopperStatisticsResponse.hopperName);
- }
-
- ///
- /// Estimated wait time for a match request to be matched with other players.
- ///
- std::chrono::seconds hopper_statistics_response::estimated_wait_time() const
- {
- return std::chrono::seconds(m_hopperStatisticsResponse.estimatedWaitTime);
- }
-
- ///
- /// The number of players in the hopper waiting to be matched.
- ///
- uint32_t hopper_statistics_response::players_waiting_to_match() const
- {
- return m_hopperStatisticsResponse.playersWaitingToMatch;
- }
-
- create_match_ticket_response::create_match_ticket_response() :
- m_createMatchTicketResponse{ }
- {
- }
-
- create_match_ticket_response::create_match_ticket_response(
- XblCreateMatchTicketResponse response
- ) :
- m_createMatchTicketResponse(response)
- {
- }
-
- string_t
- create_match_ticket_response::match_ticket_id() const
- {
- return StringTFromUtf8(m_createMatchTicketResponse.matchTicketId);
- }
-
- std::chrono::seconds
- create_match_ticket_response::estimated_wait_time() const
- {
- return std::chrono::seconds(m_createMatchTicketResponse.estimatedWaitTime);
- }
-
- matchmaking_service::matchmaking_service(_In_ XblContextHandle contextHandle)
- {
- XblContextDuplicateHandle(contextHandle, &m_xblContext);
- }
-
- matchmaking_service::matchmaking_service(const matchmaking_service& other)
- {
- XblContextDuplicateHandle(other.m_xblContext, &m_xblContext);
- }
-
- matchmaking_service& matchmaking_service::operator=(matchmaking_service other)
- {
- std::swap(m_xblContext, other.m_xblContext);
- return *this;
- }
-
- matchmaking_service::~matchmaking_service()
- {
- XblContextCloseHandle(m_xblContext);
- }
-
- pplx::task> matchmaking_service::create_match_ticket(
- _In_ const xbox::services::multiplayer::legacy::multiplayer_session_reference& ticketSessionReference,
- _In_ const string_t& matchmakingServiceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const std::chrono::seconds& ticketTimeout,
- _In_ preserve_session_mode preserveSession,
- _In_ const web::json::value& ticketAttributesJson
- )
- {
- auto xblContext = m_xblContext;
-
- auto asyncWrapper = new xbox::services::legacy::AsyncWrapper(
- [](XAsyncBlock* async, create_match_ticket_response& result)
- {
- XblCreateMatchTicketResponse resultResponse;
- auto hr = XblMatchmakingCreateMatchTicketResult(async, &resultResponse);
- if (SUCCEEDED(hr))
- {
- result = create_match_ticket_response(resultResponse);
- }
- return hr;
- });
-
- XblMultiplayerSessionReference _ticketSessionReference;
- Utf8FromCharT(ticketSessionReference.service_configuration_id().data(), _ticketSessionReference.Scid, sizeof(_ticketSessionReference.Scid));
- Utf8FromCharT(ticketSessionReference.session_template_name().data(), _ticketSessionReference.SessionTemplateName, sizeof(_ticketSessionReference.SessionTemplateName));
- Utf8FromCharT(ticketSessionReference.session_name().data(), _ticketSessionReference.SessionName, sizeof(_ticketSessionReference.SessionName));
-
- auto hr = XblMatchmakingCreateMatchTicketAsync(
- xblContext,
- _ticketSessionReference,
- StringFromStringT(matchmakingServiceConfigurationId).c_str(),
- StringFromStringT(hopperName).c_str(),
- ticketTimeout.count(),
- static_cast(preserveSession),
- StringFromStringT(ticketAttributesJson.serialize()).c_str(),
- &asyncWrapper->async
- );
-
- return asyncWrapper->Task(hr);
- }
-
- pplx::task> matchmaking_service::delete_match_ticket(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const string_t& ticketId
- )
- {
- auto xblContext = m_xblContext;
-
- auto asyncWrapper = new xbox::services::legacy::AsyncWrapper();
- auto hr = XblMatchmakingDeleteMatchTicketAsync(
- xblContext,
- StringFromStringT(serviceConfigurationId).c_str(),
- StringFromStringT(hopperName).c_str(),
- StringFromStringT(ticketId).c_str(),
- &asyncWrapper->async);
-
- return asyncWrapper->Task(hr);
- }
-
- pplx::task> matchmaking_service::get_match_ticket_details(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName,
- _In_ const string_t& ticketId
- )
- {
- auto xblContext = m_xblContext;
-
- auto asyncWrapper = new xbox::services::legacy::AsyncWrapper(
- [](XAsyncBlock* async, match_ticket_details_response& result)
- {
- size_t bufferSize;
- auto hr = XblMatchmakingGetMatchTicketDetailsResultSize(async, &bufferSize);
- if (SUCCEEDED(hr))
- {
- std::shared_ptr buffer(new char[bufferSize], std::default_delete());
- XblMatchTicketDetailsResponse* resultPtr;
- hr = XblMatchmakingGetMatchTicketDetailsResult(async, bufferSize, buffer.get(), &resultPtr, nullptr);
-
- if (SUCCEEDED(hr))
- {
- result = match_ticket_details_response(buffer);
- }
- }
- return hr;
- });
-
- auto hr = XblMatchmakingGetMatchTicketDetailsAsync(
- xblContext,
- StringFromStringT(serviceConfigurationId).c_str(),
- StringFromStringT(hopperName).c_str(),
- StringFromStringT(ticketId).c_str(),
- &asyncWrapper->async);
-
- return asyncWrapper->Task(hr);
- }
-
- pplx::task> matchmaking_service::get_hopper_statistics(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& hopperName
- )
- {
- auto xblContext = m_xblContext;
-
- auto asyncWrapper = new xbox::services::legacy::AsyncWrapper(
- [](XAsyncBlock* async, hopper_statistics_response& result)
- {
- size_t bufferSize;
- auto hr = XblMatchmakingGetHopperStatisticsResultSize(async, &bufferSize);
- if (SUCCEEDED(hr))
- {
- std::shared_ptr buffer(new char[bufferSize], std::default_delete());
- XblHopperStatisticsResponse* resultPtr;
- hr = XblMatchmakingGetHopperStatisticsResult(async, bufferSize, buffer.get(), &resultPtr, nullptr);
-
- if (SUCCEEDED(hr))
- {
- result = hopper_statistics_response(buffer);
- }
- }
- return hr;
- });
-
- auto hr = XblMatchmakingGetHopperStatisticsAsync(
- xblContext,
- StringFromStringT(serviceConfigurationId).c_str(),
- StringFromStringT(hopperName).c_str(),
- &asyncWrapper->async);
-
- return asyncWrapper->Task(hr);
- }
-}
-#endif // !XSAPI_NO_PPL
-#endif // !defined(XBOX_LIVE_CREATORS_SDK)
-
NAMESPACE_MICROSOFT_XBOX_SERVICES_MATCHMAKING_CPP_END
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_client_manager.cpp b/Source/Services/Multiplayer/Manager/multiplayer_client_manager.cpp
index b5c618e0..ccb03be1 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_client_manager.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_client_manager.cpp
@@ -9,7 +9,11 @@
#include "multiplayer_manager_internal.h"
#include "multiplayer_internal.h"
#include "xbox_live_app_config_internal.h"
+
+#if HC_PLATFORM != HC_PLATFORM_WIN32 && !XSAPI_NO_PPL
#include "xsapi-cpp/title_callable_ui.h"
+#endif
+
#if HC_PLATFORM == HC_PLATFORM_GDK
#include "XGameUI.h"
@@ -97,16 +101,17 @@ MultiplayerClientManager::Initialize()
{
if (m_multiplayerLocalUserManager == nullptr)
{
- m_multiplayerLocalUserManager = std::make_shared();
+ m_multiplayerLocalUserManager = MakeShared();
RegisterLocalUserManagerEvents();
}
- m_latestPendingRead = std::make_shared(
+ m_latestPendingRead = MakeShared(
+ m_queue,
m_lobbySessionTemplateName,
m_multiplayerLocalUserManager
);
- m_lastPendingRead = std::make_shared();
+ m_lastPendingRead = MakeShared(m_queue);
m_subscriptionsLostFired.store(false);
m_latestPendingRead->SetAutoFillMembersDuringMatchmaking(m_autoFillMembers);
}
@@ -286,7 +291,7 @@ MultiplayerClientManager::JoinLobby(
if (!invitedUserFound)
{
// The invited user hasn't been added.
- std::shared_ptr joinLobbyEventArgs = std::make_shared(invitedXuid);
+ std::shared_ptr joinLobbyEventArgs = MakeShared(invitedXuid);
// Since m_latestPendingRead hasn't been initialized yet, this will ensure
// the event is still returned correctly through multiplayer_manager::do_work();
@@ -376,7 +381,7 @@ MultiplayerClientManager::JoinGame(
initArgs.InitiatorXuids = xboxUserIds.data();
initArgs.InitiatorXuidsCount = static_cast(xboxUserIds.size());
- auto gameSession = std::make_shared(
+ auto gameSession = MakeShared(
primaryContext->Xuid(),
&gameSessionRef,
&initArgs
@@ -537,8 +542,8 @@ MultiplayerClientManager::InviteFriends(
#elif HC_PLATFORM == HC_PLATFORM_GDK
- XAsyncBlock* asyncBlock = utils::MakeAsyncBlock();
- asyncBlock->queue = get_xsapi_singleton_async_queue();
+ XAsyncBlock* asyncBlock = Make();
+ asyncBlock->queue = m_queue.GetHandle();
asyncBlock->context = utils::store_shared_ptr(shared_from_this());
asyncBlock->callback = [](_In_ XAsyncBlock* asyncBlock)
{
@@ -778,7 +783,7 @@ MultiplayerClientManager::OnMultiplayerConnectionIdChanged()
if (lobbySession && lobbyClientSessionSafe.CurrentUser() && lobbyClientSessionSafe.CurrentUser()->Status == XblMultiplayerSessionMemberStatus::Active)
{
MultiplayerSessionMember::Get(lobbyClientSessionSafe.CurrentUser())->SetStatus(lobbyClientSessionSafe.CurrentUser()->Status);
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
lobbyClient->AddToPendingQueue(pendingRequest);
}
@@ -788,7 +793,7 @@ MultiplayerClientManager::OnMultiplayerConnectionIdChanged()
if (gameSession && gameClientSessionSafe.CurrentUser() && gameClientSessionSafe.CurrentUser()->Status == XblMultiplayerSessionMemberStatus::Active)
{
MultiplayerSessionMember::Get(gameClientSessionSafe.CurrentUser())->SetStatus(gameClientSessionSafe.CurrentUser()->Status);
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
gameClient->AddToPendingQueue(pendingRequest);
}
}
@@ -1030,7 +1035,7 @@ MultiplayerClientManager::HandleMemberListChanged(
gameMembers.push_back(latestPendingRead->ConvertToGameMember(member));
}
- std::shared_ptr memberJoinedEventArgs = std::make_shared(gameMembers);
+ std::shared_ptr memberJoinedEventArgs = MakeShared(gameMembers);
AddToLatestPendingReadEventQueue(
XblMultiplayerEventType::MemberJoined,
@@ -1047,7 +1052,7 @@ MultiplayerClientManager::HandleMemberListChanged(
gameMembers.push_back(latestPendingRead->ConvertToGameMember(member));
}
- std::shared_ptr memberLeftEventArgs = std::make_shared(
+ std::shared_ptr memberLeftEventArgs = MakeShared(
gameMembers
);
@@ -1107,7 +1112,7 @@ MultiplayerClientManager::HandleMemberPropertiesChanged(
{
continue;
}
- std::shared_ptr memberPropertiesChangedArgs = std::make_shared(
+ std::shared_ptr memberPropertiesChangedArgs = MakeShared(
latestPendingRead->ConvertToGameMember(member),
member->CustomPropertiesJson
);
@@ -1157,7 +1162,7 @@ MultiplayerClientManager::HandleSessionPropertiesChanged(
}
XblMultiplayerSessionReadLockGuard currentSessionSafe(currentSession);
- auto gamePropertiesChangedArgs = std::make_shared(
+ auto gamePropertiesChangedArgs = MakeShared(
currentSessionSafe.SessionProperties().SessionCustomPropertiesJson
);
@@ -1186,7 +1191,7 @@ MultiplayerClientManager::HandleHostChanged(
}
}
- std::shared_ptr hostChangedEventArgs = std::make_shared(
+ std::shared_ptr hostChangedEventArgs = MakeShared(
hostMember
);
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_client_pending_reader.cpp b/Source/Services/Multiplayer/Manager/multiplayer_client_pending_reader.cpp
index 542d7e7c..42c7d5cd 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_client_pending_reader.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_client_pending_reader.cpp
@@ -44,13 +44,14 @@ void MultiplayerClientPendingReader::deep_copy_if_updated(
}
}
-MultiplayerClientPendingReader::MultiplayerClientPendingReader() :
+MultiplayerClientPendingReader::MultiplayerClientPendingReader(const TaskQueue& queue) :
+ m_queue{ queue.DeriveWorkerQueue() },
m_autoFillMembers(false)
{
- m_multiplayerLocalUserManager = std::make_shared();
- m_lobbyClient = std::make_shared(get_xsapi_singleton_async_queue());
- m_gameClient = std::make_shared(get_xsapi_singleton_async_queue());
- m_matchClient = std::make_shared(get_xsapi_singleton_async_queue(), m_multiplayerLocalUserManager);
+ m_multiplayerLocalUserManager = MakeShared();
+ m_lobbyClient = MakeShared(m_queue);
+ m_gameClient = MakeShared(m_queue);
+ m_matchClient = MakeShared(m_queue, m_multiplayerLocalUserManager);
}
MultiplayerClientPendingReader::~MultiplayerClientPendingReader()
@@ -62,15 +63,17 @@ MultiplayerClientPendingReader::~MultiplayerClientPendingReader()
}
MultiplayerClientPendingReader::MultiplayerClientPendingReader(
+ _In_ const TaskQueue& queue,
_In_ const xsapi_internal_string& lobbySessionTemplateName,
_In_ std::shared_ptr localUserManager
) :
+ m_queue{ queue.DeriveWorkerQueue() },
m_autoFillMembers(false),
m_multiplayerLocalUserManager(localUserManager)
{
- m_lobbyClient = std::make_shared(get_xsapi_singleton_async_queue(), lobbySessionTemplateName, m_multiplayerLocalUserManager);
- m_gameClient = std::make_shared(get_xsapi_singleton_async_queue(), m_multiplayerLocalUserManager);
- m_matchClient = std::make_shared(get_xsapi_singleton_async_queue(), m_multiplayerLocalUserManager);
+ m_lobbyClient = MakeShared(m_queue, lobbySessionTemplateName, m_multiplayerLocalUserManager);
+ m_gameClient = MakeShared(m_queue, m_multiplayerLocalUserManager);
+ m_matchClient = MakeShared(m_queue, m_multiplayerLocalUserManager);
m_lobbyClient->Initialize();
m_gameClient->Initialize();
}
@@ -291,7 +294,7 @@ MultiplayerClientPendingReader::SetProperties(
_In_opt_ context_t context
)
{
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetSessionProperties(name, valueJson, context);
AddToPendingQueue(sessionRef, pendingRequest);
return S_OK;
@@ -304,7 +307,7 @@ MultiplayerClientPendingReader::SetSynchronizedHost(
_In_opt_ context_t context
)
{
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetSynchronizedHostDeviceToken(hostDeviceToken, context);
AddToPendingQueue(sessionRef, pendingRequest);
return S_OK;
@@ -318,7 +321,7 @@ MultiplayerClientPendingReader::SetSynchronizedProperties(
_In_opt_ context_t context
)
{
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetSynchronizedSessionProperties(name, valueJson, context);
AddToPendingQueue(sessionRef, pendingRequest);
return S_OK;
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_game_client.cpp b/Source/Services/Multiplayer/Manager/multiplayer_game_client.cpp
index 9c8cff96..3f2ab0ae 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_game_client.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_game_client.cpp
@@ -202,7 +202,7 @@ MultiplayerGameClient::ConvertToMultiplayerGame(
gameMembers.push_back(gameMember);
}
- return std::make_shared(
+ return MakeShared(
sessionToConvert,
hostMember,
gameMembers
@@ -500,7 +500,7 @@ MultiplayerGameClient::RemoveStaleUsersFromRemoteSession()
{
std::weak_ptr weakSessionWriter = shared_from_this();
- auto sessionToCommit = std::make_shared(localUser->Xuid(), &gameSession->SessionReference(), nullptr);
+ auto sessionToCommit = MakeShared(localUser->Xuid(), &gameSession->SessionReference(), nullptr);
sessionToCommit->Leave();
m_sessionWriter->WriteSession(localUser->Context(), sessionToCommit, XblMultiplayerSessionWriteMode::UpdateExisting, true,
[weakSessionWriter](Result> result)
@@ -716,7 +716,7 @@ HRESULT MultiplayerGameClient::JoinGameForAllLocalMembers(
if (joinResult.Hresult() == HTTP_E_STATUS_NOT_FOUND && !m_handleIdToJoin.empty())
{
// We tried to join an existing session but it didn't exist. Create a new game session
- // from the lobby and clear the the existing handleId since it must be invalid.
+ // from the lobby and clear the existing handleId since it must be invalid.
if (m_createGameIfFailedToJoin)
{
m_callback(lobbyClient->CreateGameFromLobby());
@@ -780,8 +780,16 @@ HRESULT MultiplayerGameClient::JoinGameFromLobbyHelper(
// Check if the lobby has a game session associated with it to join.
XblMultiplayerSessionReadLockGuard lobbySessionSafe(lobbySession);
- auto lobbyProperties = ParseJson(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
- if (!lobbyProperties.has_field(utils::string_t_from_internal_string(MultiplayerLobbyClient_TransferHandlePropertyName)))
+
+ JsonDocument jsonDoc;
+ jsonDoc.Parse(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
+
+ xsapi_internal_string transferHandle;
+ if (!jsonDoc.HasParseError())
+ {
+ JsonUtils::ExtractJsonString(jsonDoc, MultiplayerLobbyClient_TransferHandlePropertyName, transferHandle, false);
+ }
+ if (transferHandle.empty()) // aka the field isn't there
{
return lobbyClient->CreateGameFromLobby();
}
@@ -806,7 +814,7 @@ void MultiplayerGameClient::LeaveRemoteSession(
_In_ bool triggerCompletionEvent
) noexcept
{
- auto processingRequest = std::make_shared();
+ auto processingRequest = MakeShared();
m_processingQueue.push_back(processingRequest);
m_sessionWriter->LeaveRemoteSession(session,
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_lobby_client.cpp b/Source/Services/Multiplayer/Manager/multiplayer_lobby_client.cpp
index 9b8f11c9..0127eeaf 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_lobby_client.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_lobby_client.cpp
@@ -240,7 +240,7 @@ MultiplayerLobbyClient::ConvertToMultiplayerLobby(
gameMembers.push_back(gameMember);
}
- return std::make_shared(
+ return MakeShared(
sessionToConvert,
hostMember,
gameMembers,
@@ -333,7 +333,7 @@ MultiplayerLobbyClient::AddLocalUser(
localUser = localUserResult.ExtractPayload();
}
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUser(localUser);
pendingRequest->SetLobbyState(userState);
if (userState == MultiplayerLocalUserLobbyState::Join)
@@ -383,7 +383,7 @@ MultiplayerLobbyClient::RemoveLocalUser(
auto localUser = m_multiplayerLocalUserManager->GetLocalUserHelper(user);
RETURN_HR_IF_LOG_DEBUG(localUser == nullptr || localUser->Context() == nullptr, E_UNEXPECTED, "Call add_local_user() first.");
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUser(localUser);
pendingRequest->SetLobbyState(MultiplayerLocalUserLobbyState::Leave);
AddToPendingQueue(pendingRequest);
@@ -404,7 +404,7 @@ MultiplayerLobbyClient::RemoveAllLocalUsers()
const auto& localUser = xboxLiveContext.second;
if (localUser != nullptr)
{
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUser(localUser);
pendingRequest->SetLobbyState(MultiplayerLocalUserLobbyState::Leave);
AddToPendingQueue(pendingRequest);
@@ -427,7 +427,7 @@ MultiplayerLobbyClient::SetLocalMemberProperties(
auto localUser = m_multiplayerLocalUserManager->GetLocalUserHelper(user);
RETURN_HR_IF_LOG_DEBUG(localUser == nullptr || localUser->Context() == nullptr, E_UNEXPECTED, "Call add_local_user() before setting local member properties.");
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUserProperties(localUser, name, valueJson, context);
AddToPendingQueue(pendingRequest);
@@ -447,7 +447,7 @@ MultiplayerLobbyClient::DeleteLocalMemberProperties(
auto localUser = m_multiplayerLocalUserManager->GetLocalUserHelper(user);
RETURN_HR_IF_LOG_DEBUG(localUser == nullptr || localUser->Context() == nullptr, E_UNEXPECTED, "Call add_local_user() before deleting local member properties.");
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUserProperties(localUser, name, JsonValue(), context);
AddToPendingQueue(pendingRequest);
@@ -467,7 +467,7 @@ MultiplayerLobbyClient::SetLocalMemberConnectionAddress(
auto localUser = m_multiplayerLocalUserManager->GetLocalUserHelper(user);
RETURN_HR_IF_LOG_DEBUG(localUser == nullptr || localUser->Context() == nullptr, E_UNEXPECTED, "Call add_local_user() before setting local member connection address.");
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetLocalUserConnectionAddress(localUser, address, context);
AddToPendingQueue(pendingRequest);
@@ -481,7 +481,7 @@ HRESULT MultiplayerLobbyClient::SetJoinability(
{
RETURN_HR_INVALIDARGUMENT_IF(value < XblMultiplayerJoinability::JoinableByFriends || value > XblMultiplayerJoinability::Closed);
- auto pendingRequest = std::make_shared();
+ auto pendingRequest = MakeShared();
pendingRequest->SetJoinability(value, context);
AddToPendingQueue(pendingRequest);
@@ -606,7 +606,10 @@ MultiplayerLobbyClient::DoWork()
// than the join fails for the whole list of users.
for (auto pendingRequest : processingQueue)
{
- xuidsInOrder.push_back(pendingRequest->LocalUser()->Xuid());
+ if (pendingRequest->LocalUser())
+ {
+ xuidsInOrder.push_back(pendingRequest->LocalUser()->Xuid());
+ }
}
}
@@ -1358,7 +1361,7 @@ void MultiplayerLobbyClient::AdvertiseGameSession() noexcept
void CreateTransferHandle(std::shared_ptr lobbySession) noexcept
{
- rapidjson::Document lobbyProperties;
+ JsonDocument lobbyProperties;
{
XblMultiplayerSessionReadLockGuard lobbySessionSafe(lobbySession);
lobbyProperties.Parse(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
@@ -1533,18 +1536,22 @@ MultiplayerLobbyClient::IsTransferHandleState(
}
XblMultiplayerSessionReadLockGuard lobbySessionSafe(lobbySession);
- auto lobbyProperties = ParseJson(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
- auto propertyName = utils::string_t_from_internal_string(MultiplayerLobbyClient_TransferHandlePropertyName);
- if (lobbyProperties.has_field(propertyName))
+ JsonDocument jsonDoc;
+ jsonDoc.Parse(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
+
+ if (!jsonDoc.HasParseError())
{
- auto transferHandleProp = utils::internal_string_from_string_t(lobbyProperties.at(propertyName).as_string());
- xsapi_internal_vector transferHandleSplit = utils::string_split(transferHandleProp, '~');
-
- if (transferHandleSplit.size() > 0 &&
- utils::str_icmp_internal(transferHandleSplit[0], state) == 0)
+ xsapi_internal_string transferHandleProp;
+ if (SUCCEEDED(JsonUtils::ExtractJsonString(jsonDoc, MultiplayerLobbyClient_TransferHandlePropertyName, transferHandleProp, true)))
{
- return true;
+ xsapi_internal_vector transferHandleSplit = utils::string_split_internal(transferHandleProp, '~');
+
+ if (transferHandleSplit.size() > 0 &&
+ utils::str_icmp_internal(transferHandleSplit[0], state) == 0)
+ {
+ return true;
+ }
}
}
@@ -1561,22 +1568,26 @@ MultiplayerLobbyClient::GetTransferHandle()
}
XblMultiplayerSessionReadLockGuard lobbySessionSafe(lobbySession);
- auto lobbyProperties = ParseJson(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
- auto propertyName = utils::string_t_from_internal_string(MultiplayerLobbyClient_TransferHandlePropertyName);
+ JsonDocument jsonDoc;
+ jsonDoc.Parse(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
- if (lobbyProperties.has_field(propertyName))
+ if (!jsonDoc.HasParseError())
{
- auto transferHandleProp = utils::internal_string_from_string_t(lobbyProperties.at(propertyName).as_string());
- xsapi_internal_vector transferHandleSplit = utils::string_split(transferHandleProp, '~');
-
- if (transferHandleSplit.size() == 2)
+ xsapi_internal_string transferHandleProp;
+ if (SUCCEEDED(JsonUtils::ExtractJsonString(jsonDoc, MultiplayerLobbyClient_TransferHandlePropertyName, transferHandleProp, true)))
{
- return transferHandleSplit[1];
+ xsapi_internal_vector transferHandleSplit = utils::string_split_internal(transferHandleProp, '~');
+
+ if (transferHandleSplit.size() == 2)
+ {
+ return transferHandleSplit[1];
+ }
}
}
return xsapi_internal_string();
}
+
void
MultiplayerLobbyClient::LeaveRemoteSession(
_In_ std::shared_ptr session
@@ -1731,22 +1742,28 @@ MultiplayerLobbyClient::HandleJoinLobbyCompleted(
// Join game via the transfer handle.
XblMultiplayerSessionReadLockGuard lobbySessionSafe(lobbySession);
- auto lobbyProperties = ParseJson(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
- if (lobbyProperties.size() > 0)
+
+ JsonDocument lobbyProperties;
+ lobbyProperties.Parse(lobbySessionSafe.SessionProperties().SessionCustomPropertiesJson);
+
+ if (!lobbyProperties.HasParseError())
{
- xsapi_internal_string transferHandle;
-
- if (IsTransferHandleState("completed"))
+ if (lobbyProperties.IsObject() && lobbyProperties.MemberCount() > 0)
{
- transferHandle = GetTransferHandle();
- }
- else
- {
- // No existing game session
- return;
- }
+ xsapi_internal_string transferHandle;
- gameClient->JoinGameByHandle(transferHandle, false, nullptr);
+ if (IsTransferHandleState("completed"))
+ {
+ transferHandle = GetTransferHandle();
+ }
+ else
+ {
+ // No existing game session
+ return;
+ }
+
+ gameClient->JoinGameByHandle(transferHandle, false, nullptr);
+ }
}
}
}
@@ -1757,7 +1774,7 @@ MultiplayerLobbyClient::JoinLobbyCompleted(
_In_ uint64_t invitedXboxUserId
)
{
- std::shared_ptr joinLobbyEventArgs = std::make_shared(
+ std::shared_ptr joinLobbyEventArgs = MakeShared(
invitedXboxUserId
);
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_manager.cpp b/Source/Services/Multiplayer/Manager/multiplayer_manager.cpp
index 7b24a31d..88b7322f 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_manager.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_manager.cpp
@@ -49,7 +49,7 @@ void MultiplayerManager::Initialize(
m_multiplayerClientManager = MakeShared(lobbySessionTemplateName, m_queue);
m_multiplayerClientManager->RegisterLocalUserManagerEvents();
- m_multiplayerLobbySession = std::make_shared(m_multiplayerClientManager);
+ m_multiplayerLobbySession = MakeShared(m_multiplayerClientManager);
}
bool MultiplayerManager::IsDirty()
@@ -153,7 +153,7 @@ MultiplayerManager::SetMultiplayerLobbySession(
}
// Don't set the lobby to null so that the title can add local users whenever it chooses.
- m_multiplayerLobbySession = std::make_shared(m_multiplayerClientManager);
+ m_multiplayerLobbySession = MakeShared(m_multiplayerClientManager);
}
else
{
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_manager_api.cpp b/Source/Services/Multiplayer/Manager/multiplayer_manager_api.cpp
index 9b54a982..ea6e0a93 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_manager_api.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_manager_api.cpp
@@ -281,7 +281,10 @@ STDAPI XblMultiplayerManagerLobbySessionLocalMembers(
RETURN_HR_INVALIDARGUMENT_IF(localMembers == nullptr && localMembersCount > 0);
for (size_t i = 0; i < localMembersVector.size(); ++i)
{
+ DISABLE_WARNING_PUSH;
+ SUPPRESS_WARNING_NULL_PTR_DEREFERENCE; // null pointer deref
localMembers[i] = localMembersVector[i]->GetReference();
+ DISABLE_WARNING_POP;
}
return S_OK;
});
@@ -649,7 +652,10 @@ STDAPI XblMultiplayerManagerGameSessionMembers(
RETURN_HR_INVALIDARGUMENT_IF(members == nullptr && membersCount > 0);
for (size_t i = 0; i < membersVector.size(); ++i)
{
+ DISABLE_WARNING_PUSH;
+ SUPPRESS_WARNING_NULL_PTR_DEREFERENCE;
members[i] = membersVector[i]->GetReference();
+ DISABLE_WARNING_POP;
}
return S_OK;
});
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_manager_internal.h b/Source/Services/Multiplayer/Manager/multiplayer_manager_internal.h
index 1c34c803..3ff1edd0 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_manager_internal.h
+++ b/Source/Services/Multiplayer/Manager/multiplayer_manager_internal.h
@@ -311,9 +311,9 @@ private:
xsapi_internal_vector> m_localMembers;
xsapi_internal_string m_customPropertiesJson;
- XblMultiplayerSessionConstants m_sessionConstants;
+ XblMultiplayerSessionConstants m_sessionConstants{};
xsapi_internal_vector m_initiatorXuids;
- XblMultiplayerMemberInitialization m_memberInitialization;
+ XblMultiplayerMemberInitialization m_memberInitialization{};
xsapi_internal_string m_constantsCustomJson;
xsapi_internal_string m_constantsCloudComputePackageJson;
xsapi_internal_string m_constantsMeasurementServerAddressesJson;
@@ -1133,9 +1133,10 @@ private:
class MultiplayerClientPendingReader : public std::enable_shared_from_this
{
public:
- MultiplayerClientPendingReader();
+ MultiplayerClientPendingReader(const TaskQueue& queue);
~MultiplayerClientPendingReader();
MultiplayerClientPendingReader(
+ _In_ const TaskQueue& queue,
_In_ const xsapi_internal_string& lobbySessionTemplateName,
_In_ std::shared_ptr localUserManager
);
@@ -1215,6 +1216,7 @@ private:
static bool IsLocal(_In_ uint64_t xuid, _In_ const xsapi_internal_map>& xboxLiveContextMap);
+ TaskQueue m_queue;
bool m_autoFillMembers;
MultiplayerEventQueue m_multiplayerEventQueue;
mutable std::mutex m_clientRequestLock;
@@ -1544,12 +1546,12 @@ private:
std::mutex m_synchronizeWriteWithTapLock;
std::atomic m_subscriptionsLostFired;
- bool m_autoFillMembers;
+ bool m_autoFillMembers{ false };
xsapi_internal_string m_lobbySessionTemplateName;
- XblFunctionContext m_sessionChangedContext;
- XblFunctionContext m_connectionIdChangedContext;
- XblFunctionContext m_subscriptionLostContext;
- XblFunctionContext m_rtaResyncContext;
+ XblFunctionContext m_sessionChangedContext{ 0 };
+ XblFunctionContext m_connectionIdChangedContext{ 0 };
+ XblFunctionContext m_subscriptionLostContext{ 0 };
+ XblFunctionContext m_rtaResyncContext{ 0 };
MultiplayerEventQueue m_multiplayerEventQueue;
std::shared_ptr m_primaryXboxLiveContext;
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_manager_utils.cpp b/Source/Services/Multiplayer/Manager/multiplayer_manager_utils.cpp
index 6dfe55b4..b7954759 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_manager_utils.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_manager_utils.cpp
@@ -65,12 +65,12 @@ XblMultiplayerJoinability MultiplayerManagerUtils::GetJoinability(
)
{
xsapi_internal_string joinableStr;
- auto customPropertiesjson = ParseJson(sessionProperties.SessionCustomPropertiesJson);
- auto propertyName = utils::string_t_from_internal_string(MultiplayerLobbyClient_JoinabilityPropertyName);
+ JsonDocument jsonDoc;
+ jsonDoc.Parse(sessionProperties.SessionCustomPropertiesJson);
- if (customPropertiesjson.has_field(propertyName))
+ if (!jsonDoc.HasParseError())
{
- joinableStr = utils::internal_string_from_string_t(customPropertiesjson.at(propertyName).as_string());
+ JsonUtils::ExtractJsonString(jsonDoc, MultiplayerLobbyClient_JoinabilityPropertyName, joinableStr, false);
}
return ConvertStringToJoinability(joinableStr);
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_match_client.cpp b/Source/Services/Multiplayer/Manager/multiplayer_match_client.cpp
index 590b0eed..d6b8f300 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_match_client.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_match_client.cpp
@@ -18,7 +18,7 @@ using namespace Windows::Xbox::Networking;
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_MANAGER_CPP_BEGIN
MultiplayerMatchClient::MultiplayerMatchClient(
- const TaskQueue& queue,
+ _In_ const TaskQueue& queue,
_In_ std::shared_ptr localUserManager
) noexcept :
m_queue{ queue.DeriveWorkerQueue() },
@@ -164,14 +164,14 @@ MultiplayerMatchClient::CheckNextTimer()
void
MultiplayerMatchClient::HandleQosMeasurements()
{
- std::shared_ptr performQosEventArgs = std::make_shared();
+ std::shared_ptr performQosEventArgs = MakeShared();
XblMultiplayerSessionReadLockGuard sessionSafe(Session());
for (const auto& member : sessionSafe.Members())
{
if (!member.IsCurrentUser)
{
- std::vector base64ConnectionAddress(xbox::services::convert::from_base64(utils::string_t_from_internal_string(member.SecureDeviceBaseAddress64)));
+ std::vector base64ConnectionAddress(xbox::services::convert::from_base64(member.SecureDeviceBaseAddress64));
const xsapi_internal_string& secureDeviceAddress = xsapi_internal_string(base64ConnectionAddress.begin(), base64ConnectionAddress.end());
if (!secureDeviceAddress.empty())
{
@@ -215,7 +215,7 @@ MultiplayerMatchClient::HandleFindMatchCompleted(
failure = matchSessionSafe.CurrentUser()->InitializationFailureCause;
}
- std::shared_ptr findMatchEventArgs = std::make_shared(
+ std::shared_ptr findMatchEventArgs = MakeShared(
m_matchStatus,
failure
);
@@ -564,7 +564,7 @@ void MultiplayerMatchClient::HandleMatchFound(
m_matchStatus = XblMultiplayerMatchStatus::Found;
auto& targetSessionRef = currentSession->MatchmakingServer()->TargetSessionRef;
- auto targetGameSession = std::make_shared(
+ auto targetGameSession = MakeShared(
primaryXboxLiveContext->Xuid(),
&targetSessionRef,
nullptr
diff --git a/Source/Services/Multiplayer/Manager/multiplayer_session_writer.cpp b/Source/Services/Multiplayer/Manager/multiplayer_session_writer.cpp
index 5b05c831..c38202d1 100644
--- a/Source/Services/Multiplayer/Manager/multiplayer_session_writer.cpp
+++ b/Source/Services/Multiplayer/Manager/multiplayer_session_writer.cpp
@@ -626,7 +626,7 @@ MultiplayerSessionWriter::HandleEvents(
eventQueue.AddEvent(
XblMultiplayerEventType::SynchronizedHostWriteCompleted,
sessionType,
- std::make_shared(),
+ MakeShared(),
error,
request->Context()
);
diff --git a/Source/Services/Multiplayer/multiplayer_activity_handle_post_request.cpp b/Source/Services/Multiplayer/multiplayer_activity_handle_post_request.cpp
index 7d584b6c..37fe8286 100644
--- a/Source/Services/Multiplayer/multiplayer_activity_handle_post_request.cpp
+++ b/Source/Services/Multiplayer/multiplayer_activity_handle_post_request.cpp
@@ -21,7 +21,7 @@ MultiplayerActivityHandlePostRequest::SessionReference() const
}
void
-MultiplayerActivityHandlePostRequest::Serialize(_Out_ JsonValue& json, JsonDocument::AllocatorType& allocator) const
+MultiplayerActivityHandlePostRequest::Serialize(_Out_ JsonValue& json, _In_ JsonDocument::AllocatorType& allocator) const
{
json.SetObject();
diff --git a/Source/Services/Multiplayer/multiplayer_activity_query_post_request.cpp b/Source/Services/Multiplayer/multiplayer_activity_query_post_request.cpp
index dc376feb..a1dfd3f5 100644
--- a/Source/Services/Multiplayer/multiplayer_activity_query_post_request.cpp
+++ b/Source/Services/Multiplayer/multiplayer_activity_query_post_request.cpp
@@ -54,7 +54,7 @@ MultiplayerActivityQueryPostRequest::SocialGroupXuid() const
}
void
-MultiplayerActivityQueryPostRequest::Serialize(_Out_ JsonValue& json, JsonDocument::AllocatorType& allocator)
+MultiplayerActivityQueryPostRequest::Serialize(_Out_ JsonValue& json, _In_ JsonDocument::AllocatorType& allocator)
{
XSAPI_ASSERT(m_socialGroup.empty() || m_xuids.empty());
XSAPI_ASSERT(!m_socialGroup.empty() || !m_xuids.empty());
diff --git a/Source/Services/Multiplayer/multiplayer_api.cpp b/Source/Services/Multiplayer/multiplayer_api.cpp
index 53fc1678..37c90b28 100644
--- a/Source/Services/Multiplayer/multiplayer_api.cpp
+++ b/Source/Services/Multiplayer/multiplayer_api.cpp
@@ -198,6 +198,31 @@ STDAPI XblMultiplayerCreateSearchHandleAsync(
RETURN_HR_INVALIDARGUMENT_IF(numberAttributesCount > 0 && numberAttributes == nullptr);
RETURN_HR_INVALIDARGUMENT_IF(stringAttributesCount > 0 && stringAttributes == nullptr);
+ //ensure all attributes are properly terminated, otherwise we'll write a property
+ //longer than is allowed into the json, which will crash eventually on deserialization
+ if (tagsCount > 0)
+ {
+ for (size_t i = 0; i < tagsCount; i++)
+ {
+ RETURN_HR_INVALIDARGUMENT_IF(utils::EnsureLessThanMaxLength(tags[i].value, XBL_MULTIPLAYER_SEARCH_HANDLE_MAX_FIELD_LENGTH) == false);
+ }
+ }
+ if (numberAttributesCount > 0)
+ {
+ for (size_t i = 0; i < numberAttributesCount; i++)
+ {
+ RETURN_HR_INVALIDARGUMENT_IF(utils::EnsureLessThanMaxLength(numberAttributes[i].name, XBL_MULTIPLAYER_SEARCH_HANDLE_MAX_FIELD_LENGTH) == false);
+ }
+ }
+ if (stringAttributesCount > 0)
+ {
+ for (size_t i = 0; i < stringAttributesCount; i++)
+ {
+ RETURN_HR_INVALIDARGUMENT_IF(utils::EnsureLessThanMaxLength(stringAttributes[i].name, XBL_MULTIPLAYER_SEARCH_HANDLE_MAX_FIELD_LENGTH) == false);
+ RETURN_HR_INVALIDARGUMENT_IF(utils::EnsureLessThanMaxLength(stringAttributes[i].value, XBL_MULTIPLAYER_SEARCH_HANDLE_MAX_FIELD_LENGTH) == false);
+ }
+ }
+
MultiplayerSearchHandleRequest request{ *sessionRef };
if (tagsCount > 0)
{
diff --git a/Source/Services/Multiplayer/multiplayer_internal.h b/Source/Services/Multiplayer/multiplayer_internal.h
index 2937649a..8d77019d 100644
--- a/Source/Services/Multiplayer/multiplayer_internal.h
+++ b/Source/Services/Multiplayer/multiplayer_internal.h
@@ -117,7 +117,7 @@ private:
xsapi_internal_vector m_encounters; // TODO these never get deserialized
xsapi_internal_vector m_membersInGroupIds;
- XblMultiplayerSessionChangeTypes m_subscribedChangeTypes;
+ XblMultiplayerSessionChangeTypes m_subscribedChangeTypes{ XblMultiplayerSessionChangeTypes::None };
xsapi_internal_string m_matchmakingResultServerMeasurementsJson;
xsapi_internal_string m_serverMeasurementsJson;
xsapi_internal_string m_qosMeasurementsJson;
@@ -572,78 +572,6 @@ private:
Vector m_values{};
};
-#if !XSAPI_NO_PPL
-namespace legacy
-{
- ///
- /// Represents a reference to a multiplayer session.
- ///
- class multiplayer_session_reference
- {
- public:
- ///
- /// Constructs a null MultiplayerSession object.
- ///
- multiplayer_session_reference();
-
- ///
- /// Constructs the MultiplayerSession object with data about the session.
- ///
- /// A service configuration ID appropriate for the title.
- /// The name of the template for the session to be based on.
- /// A unique name for the session.
- multiplayer_session_reference(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& sessionTemplateName,
- _In_ const string_t& sessionName
- );
-
- ///
- /// The service configuration ID specific to the title.
- ///
- string_t service_configuration_id() const;
-
- ///
- /// The name of the template for the session.
- ///
- string_t session_template_name() const;
-
- ///
- /// The name of the session.
- ///
- string_t session_name() const;
-
- ///
- /// Whether this object has been properly constructed
- ///
- bool is_null() const;
-
- ///
- /// Returns a URI path representation of the session reference.
- ///
- string_t to_uri_path() const;
-
- ///
- /// Returns the session reference parsed from URI.
- ///
- static multiplayer_session_reference parse_from_uri_path(_In_ const string_t& path);
-
- ///
- /// Internal function
- ///
- multiplayer_session_reference(_In_ const XblMultiplayerSessionReference& reference);
-
- private:
- mutable XblMultiplayerSessionReference m_reference;
- //friend class multiplayer_session;
- //friend class multiplayer_service;
- //friend class multiplayer_search_handle_request;
- //friend class social::reputation_service;
- };
-
-}
-#endif
-
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_CPP_END
struct XblMultiplayerSession : public xbox::services::RefCounter, public std::enable_shared_from_this
diff --git a/Source/Services/Multiplayer/multiplayer_service.cpp b/Source/Services/Multiplayer/multiplayer_service.cpp
index 48f99839..d9d285a8 100644
--- a/Source/Services/Multiplayer/multiplayer_service.cpp
+++ b/Source/Services/Multiplayer/multiplayer_service.cpp
@@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
-#include "xbox_system_factory.h"
#include "multiplayer_internal.h"
#include "xbox_live_context_internal.h"
#include "real_time_activity_manager.h"
@@ -260,7 +259,7 @@ String SessionQuery::PathAndQuery() const noexcept
{
Stringstream param;
param << "xuid=";
- param << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::uint64_to_string_t(XuidFilters[0])));
+ param << xbox::services::uri::encode_uri(utils::uint64_to_internal_string(XuidFilters[0]));
params.push_back(param.str());
}
@@ -268,7 +267,7 @@ String SessionQuery::PathAndQuery() const noexcept
{
Stringstream param;
param << "keyword=";
- param << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_utf8(KeywordFilter)));
+ param << xbox::services::uri::encode_uri(KeywordFilter);
params.push_back(param.str());
}
@@ -276,7 +275,7 @@ String SessionQuery::PathAndQuery() const noexcept
{
Stringstream param;
param << "visibility=";
- param << utils::internal_string_from_string_t(xbox::services::uri::encode_uri(utils::string_t_from_internal_string(Serializers::StringFromMultiplayerSessionVisibility(VisibilityFilter))));
+ param << xbox::services::uri::encode_uri(Serializers::StringFromMultiplayerSessionVisibility(VisibilityFilter));
params.push_back(param.str());
}
@@ -486,7 +485,7 @@ HRESULT MultiplayerService::SetTransferHandle(
auto result = Serializers::DeserializeMultiplayerInvite(httpResult.Payload()->GetResponseBodyJson());
auto multiplayerInvite = result.Payload();
- if (result.Hresult())
+ if (Failed(result))
{
return async.Complete(result.Hresult());
}
@@ -648,7 +647,7 @@ HRESULT MultiplayerService::DeleteSearchHandle(
m_xboxLiveContextSettings,
"DELETE",
XblHttpCall::BuildUrl("sessiondirectory", handleStr),
- xbox_live_api::set_activity
+ xbox_live_api::delete_search_handle
));
RETURN_HR_IF_FAILED(httpCall->SetXblServiceContractVersion(MULTIPLAYER_SERVICE_CONTRACT_VERSION));
@@ -1077,7 +1076,8 @@ HRESULT MultiplayerService::WriteSessionUsingSubpath(
}
else if (statusCode == 204)
{
- return async.Complete({ xbl_error_code::no_error });
+ // Consistent with XDK behavior, return success on 204 when writing session
+ return async.Complete(S_OK);
}
auto responseJson = httpResult.Payload()->GetResponseBodyJson();
@@ -1110,7 +1110,7 @@ HRESULT MultiplayerService::WriteSessionUsingSubpath(
httpResult.Payload()->GetResponseBodyJson()
);
- if (session->DeserializationError() && SUCCEEDED(hr))
+ if (FAILED(session->DeserializationError()) && SUCCEEDED(hr))
{
// WriteSession failed due to deserialization error
hr = session->DeserializationError();
@@ -1316,7 +1316,7 @@ void MultiplayerService::RemoveMultiplayerSubscriptionLostHandler(
}
XblFunctionContext MultiplayerService::AddMultiplayerConnectionIdChangedHandler(
- MultiplayerSubscription::ConnectionIdChangedHandler handler
+ _In_ MultiplayerSubscription::ConnectionIdChangedHandler handler
) noexcept
{
std::lock_guard lock{ m_mutexMultiplayerService };
diff --git a/Source/Services/Multiplayer/multiplayer_session.cpp b/Source/Services/Multiplayer/multiplayer_session.cpp
index 2392c55a..d1a43bbd 100644
--- a/Source/Services/Multiplayer/multiplayer_session.cpp
+++ b/Source/Services/Multiplayer/multiplayer_session.cpp
@@ -2,9 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
-
-#include "xbox_system_factory.h"
-#include "xsapi_utils.h"
#include "multiplayer_internal.h"
using namespace xbox::services;
@@ -61,7 +58,7 @@ XblMultiplayerSession::XblMultiplayerSession(
m_writeConstants(false),
m_memberRequestIndex(0)
{
- auto sessionDatetime = xbox::services::datetime::from_string(utils::string_t_from_internal_string(responseDate), xbox::services::datetime::date_format::RFC_1123);
+ auto sessionDatetime = xbox::services::datetime::from_string(responseDate, xbox::services::datetime::date_format::RFC_1123);
m_sessionRetrievedTime = utils::time_t_from_datetime(sessionDatetime);
Initialize();
Deserialize(json);
@@ -1466,7 +1463,7 @@ HRESULT XblMultiplayerSession::Deserialize(
{
return Result(WEB_E_INVALID_JSON_STRING);
}
- XblDeviceToken token;
+ XblDeviceToken token{};
utils::strcpy(token.Value, sizeof(token.Value), json.GetString());
return Result(token);
}, json, "hostCandidates", m_hostCandidates, false));
@@ -1991,21 +1988,32 @@ bool XblMultiplayerSession::HasSessionPropertyChanged(
return false;
}
- auto propertyName = utils::string_t_from_internal_string(_propertyName);
+ auto propertyName = _propertyName;
- auto customProp1 = ParseJson(session1->m_sessionCustomPropertiesJson.data());
- auto customProp2 = ParseJson(session2->m_sessionCustomPropertiesJson.data());
- if ((customProp1.has_field(propertyName) && !customProp2.has_field(propertyName)) ||
- (!customProp1.has_field(propertyName) && customProp2.has_field(propertyName)))
- {
- return true;
- }
+ JsonDocument customProp1;
+ JsonDocument customProp2;
+ customProp1.Parse(session1->m_sessionCustomPropertiesJson.data());
+ customProp2.Parse(session2->m_sessionCustomPropertiesJson.data());
- if (customProp1.has_field(propertyName) && customProp2.has_field(propertyName))
+ if (!customProp1.HasParseError() &&
+ !customProp2.HasParseError())
{
- const auto& prop1 = customProp1.at(propertyName).as_string();
- const auto& prop2 = customProp2.at(propertyName).as_string();
- return utils::str_icmp(prop1, prop2) != 0;
+ xsapi_internal_string prop1;
+ xsapi_internal_string prop2;
+
+ bool isInProp1 = SUCCEEDED(JsonUtils::ExtractJsonString(customProp1, propertyName, prop1, true));
+ bool isInProp2 = SUCCEEDED(JsonUtils::ExtractJsonString(customProp2, propertyName, prop2, true));
+
+ if ((isInProp1 && !isInProp2) ||
+ (!isInProp1 && isInProp2))
+ {
+ return true;
+ }
+
+ if (isInProp1 && isInProp2)
+ {
+ return utils::str_icmp(prop1.c_str(), prop2.c_str()) != 0;
+ }
}
return false;
@@ -3113,7 +3121,7 @@ STDAPI XblMultiplayerSessionCurrentUserSetSecureDeviceAddressBase64(
#if HC_PLATFORM != HC_PLATFORM_XDK && HC_PLATFORM != HC_PLATFORM_UWP
STDAPI XblFormatSecureDeviceAddress(
_In_ const char* deviceId,
- _Out_ XblFormattedSecureDeviceAddress* address
+ _Inout_ XblFormattedSecureDeviceAddress* address
) XBL_NOEXCEPT
{
RETURN_HR_INVALIDARGUMENT_IF_NULL(address);
diff --git a/Source/Services/Multiplayer/multiplayer_session_member.cpp b/Source/Services/Multiplayer/multiplayer_session_member.cpp
index 5395ec8d..ca0964a9 100644
--- a/Source/Services/Multiplayer/multiplayer_session_member.cpp
+++ b/Source/Services/Multiplayer/multiplayer_session_member.cpp
@@ -705,8 +705,10 @@ void MultiplayerSessionMember::SetExternalMemberPointer(XblMultiplayerSessionMem
auto internalMember = Get(&member);
internalMember->m_member = &member;
+ member.InitialTeam = internalMember->m_initialTeam.empty() ? nullptr : internalMember->m_initialTeam.data();
member.CustomConstantsJson = internalMember->m_customConstantsJson.empty() ? nullptr :internalMember->m_customConstantsJson.data();
member.SecureDeviceBaseAddress64 = internalMember->m_secureDeviceAddressBase64.empty() ? nullptr : internalMember->m_secureDeviceAddressBase64.data();
+ member.Roles = internalMember->m_roles.empty() ? nullptr : internalMember->m_roles.data();
member.CustomPropertiesJson = internalMember->m_customPropertiesString.empty() ? nullptr : internalMember->m_customPropertiesString.data();
member.MatchmakingResultServerMeasurementsJson = internalMember->m_matchmakingResultServerMeasurementsJson.empty() ? nullptr : internalMember->m_matchmakingResultServerMeasurementsJson.data();
member.ServerMeasurementsJson = internalMember->m_serverMeasurementsJson.empty() ? nullptr : internalMember->m_serverMeasurementsJson.data();
@@ -714,7 +716,6 @@ void MultiplayerSessionMember::SetExternalMemberPointer(XblMultiplayerSessionMem
member.QosMeasurementsJson = internalMember->m_qosMeasurementsJson.empty() ? nullptr : internalMember->m_qosMeasurementsJson.data();
member.Groups = internalMember->m_groups.empty() ? nullptr : internalMember->m_groups.data();
member.Encounters = internalMember->m_encounters.empty() ? nullptr : internalMember->m_encounters.data();
- member.Roles = internalMember->m_roles.empty() ? nullptr : internalMember->m_roles.data();
}
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_CPP_END
diff --git a/Source/Services/Multiplayer/multiplayer_session_reference.cpp b/Source/Services/Multiplayer/multiplayer_session_reference.cpp
index 966791a0..05ec047b 100644
--- a/Source/Services/Multiplayer/multiplayer_session_reference.cpp
+++ b/Source/Services/Multiplayer/multiplayer_session_reference.cpp
@@ -19,7 +19,7 @@ STDAPI XblMultiplayerSessionReferenceParseFromUriPath(
// / 0 / 1 / 2 / 3 / 4 / 5
// /serviceconfigs/{scid}/sessiontemplates/{session-template-name}/sessions/{session-name}
- xsapi_internal_vector pathComponents = utils::string_split(xsapi_internal_string(path), '/');
+ xsapi_internal_vector pathComponents = utils::string_split_internal(xsapi_internal_string(path), '/');
if (pathComponents.size() < 6)
{
return E_INVALIDARG;
@@ -103,68 +103,4 @@ bool operator==(const XblMultiplayerSessionReference& lhs, const XblMultiplayerS
utils::str_icmp(lhs.SessionTemplateName, rhs.SessionTemplateName) == 0;
}
-#if !XSAPI_NO_PPL
-namespace legacy
-{
- multiplayer_session_reference::multiplayer_session_reference() : m_reference{}
- {
- }
-
- multiplayer_session_reference::multiplayer_session_reference(
- _In_ const string_t& serviceConfigurationId,
- _In_ const string_t& sessionTemplateName,
- _In_ const string_t& sessionName
- )
- {
- Utf8FromCharT(serviceConfigurationId.data(), m_reference.Scid, sizeof(m_reference.Scid));
- Utf8FromCharT(sessionTemplateName.data(), m_reference.SessionTemplateName, sizeof(m_reference.SessionTemplateName));
- Utf8FromCharT(sessionName.data(), m_reference.SessionName, sizeof(m_reference.SessionName));
- }
-
- multiplayer_session_reference::multiplayer_session_reference(
- _In_ const XblMultiplayerSessionReference& reference
- )
- : m_reference(reference)
- {
- }
-
- string_t multiplayer_session_reference::service_configuration_id() const
- {
- return StringTFromUtf8(m_reference.Scid);
- }
-
- string_t multiplayer_session_reference::session_template_name() const
- {
- return StringTFromUtf8(m_reference.SessionTemplateName);
- }
-
- string_t multiplayer_session_reference::session_name() const
- {
- return StringTFromUtf8(m_reference.SessionName);
- }
-
- bool multiplayer_session_reference::is_null() const
- {
- return m_reference.Scid[0] == 0 ||
- m_reference.SessionName[0] == 0 ||
- m_reference.SessionTemplateName[0] == 0;
- }
-
- string_t multiplayer_session_reference::to_uri_path() const
- {
- XblMultiplayerSessionReferenceUri uri{};
- XblMultiplayerSessionReferenceToUriPath(&m_reference, &uri);
-
- return StringTFromUtf8(uri.value);
- }
-
- multiplayer_session_reference multiplayer_session_reference::parse_from_uri_path(_In_ const string_t& path)
- {
- XblMultiplayerSessionReference reference;
- XblMultiplayerSessionReferenceParseFromUriPath(StringFromStringT(path).data(), &reference);
- return multiplayer_session_reference(reference);
- }
-}
-#endif
-
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_CPP_END
\ No newline at end of file
diff --git a/Source/Services/Multiplayer/multiplayer_subscription.cpp b/Source/Services/Multiplayer/multiplayer_subscription.cpp
index 0974764b..f825a227 100644
--- a/Source/Services/Multiplayer/multiplayer_subscription.cpp
+++ b/Source/Services/Multiplayer/multiplayer_subscription.cpp
@@ -95,7 +95,7 @@ void MultiplayerSubscription::OnEvent(
{
String resourceName;
JsonUtils::ExtractJsonString(tapValue, "resource", resourceName, true);
- Vector nameComponents = utils::string_split(resourceName, '~');
+ Vector nameComponents = utils::string_split_internal(resourceName, '~');
if (nameComponents.size() != 3)
{
diff --git a/Source/Services/MultiplayerActivity/multiplayer_activity_service.cpp b/Source/Services/MultiplayerActivity/multiplayer_activity_service.cpp
index 83a0a090..51bcabfd 100644
--- a/Source/Services/MultiplayerActivity/multiplayer_activity_service.cpp
+++ b/Source/Services/MultiplayerActivity/multiplayer_activity_service.cpp
@@ -244,7 +244,7 @@ HRESULT MultiplayerActivityService::SetActivity(
m_xboxLiveContextSettings,
"PUT",
XblHttpCall::BuildUrl(MPA_SERVICE_NAME, path.str()),
- xbox_live_api::update_activity
+ xbox_live_api::set_activity
));
RETURN_HR_IF_FAILED(httpCall->SetRequestBody(requestBody));
diff --git a/Source/Services/Notification/RTA/achievement_unlock_subscription.cpp b/Source/Services/Notification/RTA/achievement_unlock_subscription.cpp
index c85e5776..d03b153d 100644
--- a/Source/Services/Notification/RTA/achievement_unlock_subscription.cpp
+++ b/Source/Services/Notification/RTA/achievement_unlock_subscription.cpp
@@ -70,7 +70,7 @@ AchievementUnlockSubscription::OnResync() noexcept
LOGS_ERROR << __FUNCTION__ << ": Achievement Unlock event may have been discarded by RTA service";
}
-AchievementUnlockEvent::AchievementUnlockEvent( AchievementUnlockEvent&& event ) :
+AchievementUnlockEvent::AchievementUnlockEvent( AchievementUnlockEvent&& event ) noexcept:
m_achievementId(std::move(event.m_achievementId)),
m_achievementName(std::move(event.m_achievementName)),
m_achievementDescription(std::move(event.m_achievementDescription)),
@@ -126,7 +126,7 @@ Result AchievementUnlockEvent::Deserialize( _In_ const J
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "achievementId", result.m_achievementId, true));
- RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "achievementDescription", result.m_achievementDescription, true));
+ RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "achievementDescription", result.m_achievementDescription, false));
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "achievementName", result.m_achievementName, true));
@@ -136,15 +136,16 @@ Result AchievementUnlockEvent::Deserialize( _In_ const J
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonUInt64( json, "gamerscore", result.gamerscore, true));
- RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonInt(json, "xuid", result.xboxUserId, true));
-
+ RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonXuid(json, "xuid", result.xboxUserId, true));
+
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "extendedInfoUrl", result.m_deepLink, true));
- RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonDouble( json, "rarityPercentage", rarityPercentage, true));
-
- RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString( json, "rarityCategory", rarityCategory, true));
-
- RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonTimeT( json, "unlockTime", result.timeUnlocked));
+ // RarityPercentage and rarityCategory are only in payload version 2 so make them optional
+ RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonDouble(json, "rarityPercentage", rarityPercentage, false));
+
+ RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "rarityCategory", rarityCategory, false));
+
+ RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonTimeT(json, "unlockTime", result.timeUnlocked));
result.titleId = static_cast(titleId);
result.rarityPercentage = static_cast(rarityPercentage);
@@ -153,7 +154,10 @@ Result AchievementUnlockEvent::Deserialize( _In_ const J
// strings for the C API
result.achievementId = result.m_achievementId.c_str();
result.achievementName = result.m_achievementName.c_str();
- result.achievementDescription = result.m_achievementDescription.c_str();
+ if (!result.m_achievementDescription.empty())
+ {
+ result.achievementDescription = result.m_achievementDescription.c_str();
+ }
result.achievementIcon = result.m_achievementIconUri.c_str();
result.m_deepLink = result.m_deepLink.c_str();
diff --git a/Source/Services/Notification/RTA/achievement_unlock_subscription.h b/Source/Services/Notification/RTA/achievement_unlock_subscription.h
index 2151a944..6cb8da65 100644
--- a/Source/Services/Notification/RTA/achievement_unlock_subscription.h
+++ b/Source/Services/Notification/RTA/achievement_unlock_subscription.h
@@ -14,10 +14,10 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_NOTIFICATION_CPP_BEGIN
public:
AchievementUnlockEvent() = default;
- AchievementUnlockEvent( AchievementUnlockEvent&& event);
+ AchievementUnlockEvent( AchievementUnlockEvent&& event) noexcept;
AchievementUnlockEvent(const AchievementUnlockEvent& event);
- static Result Deserialize( const JsonValue& json ) noexcept;
+ static Result Deserialize(_In_ const JsonValue& json ) noexcept;
private:
diff --git a/Source/Services/Notification/RTA/game_invite_subscription.cpp b/Source/Services/Notification/RTA/game_invite_subscription.cpp
index d1f5d968..1d3d945f 100644
--- a/Source/Services/Notification/RTA/game_invite_subscription.cpp
+++ b/Source/Services/Notification/RTA/game_invite_subscription.cpp
@@ -51,7 +51,7 @@ size_t GameInviteSubscription::RemoveHandler(
std::lock_guard lock{ m_mutex };
m_mpaInviteHandlers.erase(token);
m_mpsdInviteHandlers.erase(token);
- return m_mpaInviteHandlers.size() + m_mpaInviteHandlers.size();
+ return m_mpaInviteHandlers.size() + m_mpsdInviteHandlers.size();
}
void GameInviteSubscription::OnEvent(
diff --git a/Source/Services/Notification/UWP/notification_service_uwp.cpp b/Source/Services/Notification/UWP/notification_service_uwp.cpp
index 99572a6f..c1c6f4f7 100644
--- a/Source/Services/Notification/UWP/notification_service_uwp.cpp
+++ b/Source/Services/Notification/UWP/notification_service_uwp.cpp
@@ -149,15 +149,6 @@ void UWPNotificationService::OnPushNotificationReceived(
{
LOGS_INFO << "Received WNS notification, type: " << notificationTypeString << ", xuid: " << xuid;
- auto xsapiSingleton = get_xsapi_singleton();
- if (!xsapiSingleton)
- {
-
- LOGS_ERROR << "Receiving WNS notification error: xsapi_singleton is null.";
- }
-
- xsapiSingleton->m_xboxServiceSettingsSingleton->_Raise_wns_event(utils::string_t_from_internal_string(xuid), utils::string_t_from_internal_string(notificationTypeString), content);
-
if (utils::str_icmp(notificationTypeString.c_str(), "spop") == 0)
{
User::SetTokenExpired(utils::internal_string_to_uint64(xuid));
diff --git a/Source/Services/Notification/notification_internal.h b/Source/Services/Notification/notification_internal.h
index e17bd813..0733598b 100644
--- a/Source/Services/Notification/notification_internal.h
+++ b/Source/Services/Notification/notification_internal.h
@@ -40,7 +40,7 @@ public:
PendingUnregistration,
Registered,
Registering
- } m_registrationStatus;
+ } m_registrationStatus{ RegistrationStatus::Unregistered };
NotificationService(
_In_ User&& user,
@@ -78,7 +78,7 @@ protected:
std::shared_ptr m_contextSettings;
String m_endpointId;
- bool m_isInitialized;
+ bool m_isInitialized{ false };
std::recursive_mutex m_mutex;
};
@@ -108,7 +108,7 @@ public:
GameInviteNotificationEventArgs& operator=(GameInviteNotificationEventArgs other) noexcept = delete;
static Result Deserialize(
- const JsonValue& json
+ _In_ const JsonValue& json
) noexcept;
private:
diff --git a/Source/Services/Notification/notification_service.cpp b/Source/Services/Notification/notification_service.cpp
index 60f565e0..e260d1d7 100644
--- a/Source/Services/Notification/notification_service.cpp
+++ b/Source/Services/Notification/notification_service.cpp
@@ -2,9 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
-#include "shared_macros.h"
-#include "xbox_system_factory.h"
-#include "xbox_live_app_config_internal.h"
#include "xbox_live_context_internal.h"
#include "notification_internal.h"
@@ -180,10 +177,11 @@ HRESULT NotificationService::RegisterForNotificationsHelper(
payload.AddMember("transportPath", JsonValue(AppConfig::Instance()->APNSEnvironment().c_str(), allocator).Move(), allocator);
#elif HC_PLATFORM == HC_PLATFORM_ANDROID
payload.AddMember("transport", "FCM", allocator);
-#elif HC_PLATFORM == HC_PLATFORM_WIN32 || HC_PLATFORM == HC_PLATFORM_GDK
+#elif HC_PLATFORM == HC_PLATFORM_WIN32 || HC_PLATFORM == HC_PLATFORM_GDK || HC_PLATFORM_IS_EXTERNAL
payload.AddMember("transport", "RTA", allocator);
#endif
- payload.AddMember("locale", JsonValue(utils::get_locales().c_str(), allocator).Move(), allocator);
+ xsapi_internal_string locale = utils::get_locales();
+ payload.AddMember("locale", JsonValue(locale.c_str(), allocator).Move(), allocator);
payload.AddMember("titleId", JsonValue(titleId.c_str(), allocator).Move(), allocator);
if (!deviceName.empty())
diff --git a/Source/Services/Presence/device_presence_change_subscription.cpp b/Source/Services/Presence/device_presence_change_subscription.cpp
index 4c8042f6..0b2fb4cf 100644
--- a/Source/Services/Presence/device_presence_change_subscription.cpp
+++ b/Source/Services/Presence/device_presence_change_subscription.cpp
@@ -49,7 +49,7 @@ void DevicePresenceChangeSubscription::OnEvent(
auto presenceService{ m_presenceService.lock() };
if (presenceService && data.IsString())
{
- auto devicePresenceValues = utils::string_split(String{ data.GetString() }, ':');
+ auto devicePresenceValues = utils::string_split_internal(String{ data.GetString() }, ':');
if (devicePresenceValues.size() == 2)
{
presenceService->HandleDevicePresenceChanged(
diff --git a/Source/Services/Presence/presence_device_record.cpp b/Source/Services/Presence/presence_device_record.cpp
index 6132b5ce..2725a952 100644
--- a/Source/Services/Presence/presence_device_record.cpp
+++ b/Source/Services/Presence/presence_device_record.cpp
@@ -125,7 +125,7 @@ Result DeviceRecord::DeserializeTitleRecord(_In_ const J
}
}
- if (!errc)
+ if (SUCCEEDED(errc))
{
titleRecord.titleName = Make(titleName);
titleRecord.richPresenceString = Make(richPresenceString);
@@ -154,7 +154,7 @@ Result DeviceRecord::DeserializeBroadcastRecord(_In_
xsapi_internal_string broadcastId;
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(json, "id", broadcastId));
- if (!errc)
+ if (SUCCEEDED(errc))
{
broadcastRecord.broadcastId = Make(broadcastId);
}
diff --git a/Source/Services/Presence/presence_internal.h b/Source/Services/Presence/presence_internal.h
index d98bfc0c..73ac2389 100644
--- a/Source/Services/Presence/presence_internal.h
+++ b/Source/Services/Presence/presence_internal.h
@@ -91,7 +91,7 @@ public:
protected:
void OnSubscribe(const JsonValue& data) noexcept override;
- void OnEvent(const JsonValue& event) noexcept override;
+ void OnEvent(_In_ const JsonValue& event) noexcept override;
void OnResync() noexcept override;
private:
diff --git a/Source/Services/Presence/presence_service.cpp b/Source/Services/Presence/presence_service.cpp
index 28db600b..3258f09c 100644
--- a/Source/Services/Presence/presence_service.cpp
+++ b/Source/Services/Presence/presence_service.cpp
@@ -309,12 +309,6 @@ HRESULT PresenceService::SetPresence(
{
heartbeatDelayInMins = 5;
}
-
- auto xsapiSingleton = get_xsapi_singleton();
- if (xsapiSingleton && xsapiSingleton->m_onSetPresenceFinish)
- {
- xsapiSingleton->m_onSetPresenceFinish(heartbeatDelayInMins);
- }
}
async.Complete(hr);
} });
diff --git a/Source/Services/Privacy/permission_check_result.cpp b/Source/Services/Privacy/permission_check_result.cpp
index 38fb2543..59b31074 100644
--- a/Source/Services/Privacy/permission_check_result.cpp
+++ b/Source/Services/Privacy/permission_check_result.cpp
@@ -95,7 +95,7 @@ Result PermissionCheckResult::Deserialize(
result.reasons = result.m_reasons.data();
result.reasonsCount = result.m_reasons.size();
- if (errc)
+ if (FAILED(errc))
{
return WEB_E_INVALID_JSON_STRING;
}
diff --git a/Source/Services/Privacy/privacy_api.cpp b/Source/Services/Privacy/privacy_api.cpp
index d228697d..c91d4d5e 100644
--- a/Source/Services/Privacy/privacy_api.cpp
+++ b/Source/Services/Privacy/privacy_api.cpp
@@ -354,7 +354,7 @@ STDAPI XblPrivacyBatchCheckPermissionResult(
RETURN_HR_INVALIDARGUMENT_IF(results == nullptr || resultsCount == nullptr);
// bufferUsed is needed to calculate resultsCount
- auto bufferUsedPtr = std::make_unique();
+ auto bufferUsedPtr = MakeUnique();
if (bufferUsed == nullptr)
{
bufferUsed = bufferUsedPtr.get();
diff --git a/Source/Services/Privacy/privacy_service.cpp b/Source/Services/Privacy/privacy_service.cpp
index 424d14c8..30dd76f8 100644
--- a/Source/Services/Privacy/privacy_service.cpp
+++ b/Source/Services/Privacy/privacy_service.cpp
@@ -122,12 +122,12 @@ HRESULT PrivacyService::CheckPermission(
{
// users/xuid({xuid})/permission/validate?setting={setting}&target={target})
xbox::services::uri_builder subPathBuilder;
- stringstream_t path;
- path << _T("/users/xuid(") << m_user.Xuid() << _T(")/permission/validate");
+ xsapi_internal_stringstream path;
+ path << "/users/xuid(" << m_user.Xuid() << ")/permission/validate";
subPathBuilder.append_path(path.str());
- subPathBuilder.append_query(_T("setting"), StringTFromUtf8(XblPermissionName(permission).data()));
- subPathBuilder.append_query(_T("target"), StringTFromUtf8(targetQuery.data()));
+ subPathBuilder.append_query("setting", XblPermissionName(permission).data());
+ subPathBuilder.append_query("target", targetQuery);
Result userResult = m_user.Copy();
RETURN_HR_IF_FAILED(userResult.Hresult());
@@ -136,7 +136,7 @@ HRESULT PrivacyService::CheckPermission(
RETURN_HR_IF_FAILED(httpCall->Init(
m_contextSettings,
"GET",
- XblHttpCall::BuildUrl("privacy", utils::internal_string_from_string_t(subPathBuilder.to_string())),
+ XblHttpCall::BuildUrl("privacy", subPathBuilder.to_string()),
xbox_live_api::check_permission_with_target_user
));
@@ -261,7 +261,7 @@ Result> PrivacyService::DeserializeUserList(
uint64_t xuid = 0;
HRESULT tempErr = JsonUtils::ExtractJsonXuid(json, "xuid", xuid, true);
- if (tempErr)
+ if (FAILED(tempErr))
{
errc = tempErr;
}
@@ -271,7 +271,7 @@ Result> PrivacyService::DeserializeUserList(
json, ("users"), xuids, true
));
- if (errc)
+ if (FAILED(errc))
{
return WEB_E_INVALID_JSON_STRING;
}
diff --git a/Source/Services/RealTimeActivityManager/real_time_activity_api.cpp b/Source/Services/RealTimeActivityManager/real_time_activity_api.cpp
index f0c27012..4644c1e0 100644
--- a/Source/Services/RealTimeActivityManager/real_time_activity_api.cpp
+++ b/Source/Services/RealTimeActivityManager/real_time_activity_api.cpp
@@ -72,7 +72,7 @@ STDAPI_(XblFunctionContext) XblRealTimeActivityAddConnectionStateChangeHandler(
{
try
{
- handler(context, state);
+ handler(context, state);
}
catch (...)
{
diff --git a/Source/Services/RealTimeActivityManager/real_time_activity_connection.cpp b/Source/Services/RealTimeActivityManager/real_time_activity_connection.cpp
index 9574e857..17336397 100644
--- a/Source/Services/RealTimeActivityManager/real_time_activity_connection.cpp
+++ b/Source/Services/RealTimeActivityManager/real_time_activity_connection.cpp
@@ -116,7 +116,8 @@ Result> Connection::Make(
std::move(stateChangedHandler),
std::move(resyncHandler)
},
- Deleter()
+ Deleter(),
+ Allocator()
);
auto hr = rtaConnection->InitializeWebsocket();
@@ -171,12 +172,15 @@ void Connection::Cleanup()
m_unsubscribeAsyncContexts.clear();
lock.unlock();
- m_queue.Terminate(true);
-
- for (auto& async : pendingAsyncContexts)
- {
- async.Complete(E_ABORT);
- }
+ m_queue.Terminate(
+ false,
+ [pendingAsyncContexts = std::move(pendingAsyncContexts)]() {
+ for (auto& async : pendingAsyncContexts)
+ {
+ async.Complete(E_ABORT);
+ }
+ }
+ );
}
#if HC_PLATFORM == HC_PLATFORM_GDK
diff --git a/Source/Services/RealTimeActivityManager/real_time_activity_manager.cpp b/Source/Services/RealTimeActivityManager/real_time_activity_manager.cpp
index 8f3ea282..cc79261b 100644
--- a/Source/Services/RealTimeActivityManager/real_time_activity_manager.cpp
+++ b/Source/Services/RealTimeActivityManager/real_time_activity_manager.cpp
@@ -81,6 +81,7 @@ HRESULT RealTimeActivityManager::RemoveSubscription(
if (iter != sharedThis->m_rtaConnections.end() && iter->second->SubscriptionCount() == 0 && sharedThis->m_legacyActivations[xuid] == 0)
{
LOGS_DEBUG << __FUNCTION__ << ": No remaining activations or subscriptions, tearing down connection";
+ iter->second->Cleanup();
sharedThis->m_rtaConnections.erase(iter);
// Maintain legacy behavior and raise Disconnected event even on intentional shutdown
@@ -147,7 +148,7 @@ void RealTimeActivityManager::Activate(
if (titleActivation)
{
m_titleActivated = true;
- GetConnection(user);
+ (void)GetConnection(user);
}
}
@@ -173,7 +174,8 @@ void RealTimeActivityManager::Deactivate(
if (m_titleActivated || connectionIter->second->SubscriptionCount() == 0)
{
LOGS_DEBUG << __FUNCTION__ << ": No remaining activations tearing down connection";
- m_rtaConnections.erase(user.Xuid());
+ connectionIter->second->Cleanup();
+ m_rtaConnections.erase(connectionIter);
// Maintain legacy behavior and raise Disconnected event even on intentional shutdown
auto handlers{ m_stateChangedHandlers[user.Xuid()] };
diff --git a/Source/Services/RealTimeActivityManager/real_time_activity_manager.h b/Source/Services/RealTimeActivityManager/real_time_activity_manager.h
index a2b608a7..b1cf0fe7 100644
--- a/Source/Services/RealTimeActivityManager/real_time_activity_manager.h
+++ b/Source/Services/RealTimeActivityManager/real_time_activity_manager.h
@@ -77,7 +77,7 @@ private:
// Legacy API support
Map m_legacyActivations;
- bool m_titleActivated;
+ bool m_titleActivated{ false };
mutable std::recursive_mutex m_lock;
};
diff --git a/Source/Services/Social/Manager/social_graph.cpp b/Source/Services/Social/Manager/social_graph.cpp
index 6024ca51..b95fadf7 100644
--- a/Source/Services/Social/Manager/social_graph.cpp
+++ b/Source/Services/Social/Manager/social_graph.cpp
@@ -48,7 +48,7 @@ struct ServiceCallManager : public std::enable_shared_from_this lock) noexcept;
@@ -145,7 +145,11 @@ Result> SocialGraph::Make(
return userResult.Hresult();
}
- auto graph = std::shared_ptr(new (Alloc(sizeof(SocialGraph))) SocialGraph{ userResult.ExtractPayload(), queue, rtaManager });
+ auto graph = std::shared_ptr(
+ new (Alloc(sizeof(SocialGraph))) SocialGraph{ userResult.ExtractPayload(), queue, rtaManager },
+ Deleter(),
+ Allocator()
+ );
auto hr = graph->Initialize();
if (FAILED(hr))
{
@@ -188,7 +192,7 @@ Result