* 2110 GDK (#578)
This commit is contained in:
Nathan Iskandar 2021-10-26 17:27:32 -07:00 коммит произвёл GitHub
Родитель 9e7e51e086
Коммит 69e4b003ae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
70 изменённых файлов: 2008 добавлений и 1109 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -24,7 +24,6 @@ External/Packages/*
#mobile
External/sdk.mobile
.gradle/
# Xcode - from github
## User settings
@ -161,8 +160,9 @@ Microsoft.Xbox.Services.*.sln.log
Microsoft.Xbox.Services.*.sln.out
**/apirunner-log.txt
# Android Studio generated files
# Android and Android Studio files
**/.idea
**/*.iml
**/.cxx
**/local.properties
**/.cxx
**/.gradle/*

Просмотреть файл

@ -30,7 +30,7 @@
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<GenerateManifest>false</GenerateManifest>
<TargetName>Microsoft_Xbox_Services_141_GDK_C_Thunks</TargetName>
<TargetName>Microsoft.Xbox.Services.141.GDK.C.Thunks</TargetName>
<RootNamespace>Microsoft.Xbox.Services</RootNamespace>
<XsapiPlatform>GDK</XsapiPlatform>
<XsapiBuildFromSource>1</XsapiBuildFromSource>

Просмотреть файл

@ -1,4 +1,4 @@
LIBRARY Microsoft_Xbox_Services_141_GDK_C_Thunks
LIBRARY Microsoft.Xbox.Services.141.GDK.C.Thunks.dll
EXPORTS
XblAchievementsGetAchievementAsync
XblAchievementsGetAchievementResult

Просмотреть файл

@ -26,7 +26,7 @@ namespace ThunksGenerator
fns.Sort();
Console.WriteLine($"Writing apis to {thunksDefFile.FullName}");
string content = "LIBRARY Microsoft_Xbox_Services_141_GDK_C_Thunks\n";
string content = "LIBRARY Microsoft.Xbox.Services.141.GDK.C.Thunks.dll\n";
content += "EXPORTS\n";
foreach (string fn in fns)
{

2
External/Xal/External/libHttpClient поставляемый

@ -1 +1 @@
Subproject commit d34b3b125f3cb23da81428aa350f66930bc99f8c
Subproject commit 02825da86c6d6e773782fcc8c59abef091a85b03

Просмотреть файл

@ -20,6 +20,6 @@ extern "C"
/// YYYYMMDD Date string describing the date the build was created
/// rrr QFE number (000 indicates base release)
/// </summary>
#define XAL_VERSION "2021.06.20210518.000"
#define XAL_VERSION "2021.10.20210913.000"
}

Просмотреть файл

@ -801,6 +801,7 @@ STDAPI_(void) XblAchievementsResultCloseHandle(
_In_ XblAchievementsResultHandle handle
) XBL_NOEXCEPT;
#if HC_PLATFORM == HC_PLATFORM_WIN32 || HC_PLATFORM_IS_EXTERNAL
/// <summary>
/// Handle for Function handling achievement unlock events.
/// </summary>
@ -836,6 +837,7 @@ STDAPI_(void) XblAchievementUnlockRemoveNotificationHandler(
_In_ XblContextHandle xblContextHandle,
_In_ XblFunctionContext functionContext
) XBL_NOEXCEPT;
#endif
/// <summary>
/// A callback invoked when a progress is made on an achievement.

Просмотреть файл

@ -64,6 +64,13 @@ typedef struct XblGameInviteNotificationEventArgs
/// </summary>
_Field_z_ const char* inviteProtocol;
/// <summary>
/// Invite Context.
/// The memory for the returned string pointer only remains valid inside the XblGameInviteHandler,
/// so deep copy the string if you need to refer to it outside the handler.
/// </summary>
_Field_z_ const char* inviteContext;
/// <summary>
/// Sender Image URL.
/// The memory for the returned string pointer only remains valid inside the XblGameInviteHandler,

Просмотреть файл

@ -2771,6 +2771,8 @@ STDAPI_(void) XblMultiplayerSessionSetInitializationSucceeded(
/// <returns></returns>
/// <remarks>
/// If "peerToHostRequirements" is set and this is set, the measurement stage assumes the given host is the correct host and only measures metrics to that host.
/// Note that host device tokens are generated from a session member's secure device address, so ensure that the secure device address is set
/// (see <see cref="XblMultiplayerSessionCurrentUserSetSecureDeviceAddressBase64"/>) for the desired host prior to calling this method.
/// </remarks>
STDAPI_(void) XblMultiplayerSessionSetHostDeviceToken(
_In_ XblMultiplayerSessionHandle handle,
@ -2904,7 +2906,8 @@ STDAPI XblMultiplayerSessionCurrentUserSetStatus(
/// <returns>HRESULT return code for this API operation.</returns>
/// <remarks>
/// On platforms that don't have a secure device address, call XblFormatSecureDeviceAddress
/// to generate a value that can be used by this function.
/// to generate a value that can be used by this function. Note that setting a secure device address is required
/// to manually set a session host.
/// </remarks>
STDAPI XblMultiplayerSessionCurrentUserSetSecureDeviceAddressBase64(
_In_ XblMultiplayerSessionHandle handle,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,7 +13,7 @@ notification_service::notification_service(_In_ XblContextHandle contextHandle)
notification_service::~notification_service()
{
#if !XSAPI_UNIT_TESTS && !HC_PLATFORM_IS_EXTERNAL
#if !XSAPI_UNIT_TESTS
unsubscribe_from_notifications().wait();
#endif
XblContextCloseHandle(m_xblContext);
@ -77,6 +77,11 @@ string_t invite_notification_event_args::invite_protocol() const
return Utils::StringTFromUtf8(m_gameInviteArgs.inviteProtocol);
}
string_t invite_notification_event_args::invite_context() const
{
return Utils::StringTFromUtf8(m_gameInviteArgs.inviteContext);
}
utility::datetime invite_notification_event_args::expiration() const
{
return Utils::DatetimeFromTimeT(m_gameInviteArgs.expiration);
@ -194,13 +199,10 @@ pplx::task<xbox_live_result<void>> notification_service::unsubscribe_from_notifi
#elif HC_PLATFORM == HC_PLATFORM_WIN32 && !XSAPI_UNIT_TESTS
pplx::task<xbox_live_result<void>> notification_service::unsubscribe_from_notifications()
{
auto xblContext = m_xblContext;
auto asyncWrapper = new AsyncWrapper<void>();
XblGameInviteRemoveNotificationHandler(m_xblContext, m_gameinviteFunctionContext);
XblAchievementUnlockRemoveNotificationHandler(m_xblContext, m_achievementUnlockFunctionContext);
XblGameInviteRemoveNotificationHandler(xblContext, m_gameinviteFunctionContext);
XblAchievementUnlockRemoveNotificationHandler(xblContext, m_achievementUnlockFunctionContext);
return asyncWrapper->Task(S_OK);
return pplx::task_from_result(xbox::services::xbox_live_result<void>());
}
#endif
#endif

Просмотреть файл

@ -21,6 +21,7 @@ public:
inline string_t sender_gamertag() const;
inline string_t invite_handle_id() const;
inline string_t invite_protocol() const;
inline string_t invite_context() const;
inline utility::datetime expiration() const;
inline const multiplayer::multiplayer_session_reference session_reference() const;
@ -87,9 +88,7 @@ public:
#endif
);
#if !HC_PLATFORM_IS_EXTERNAL
inline pplx::task<xbox_live_result<void>> unsubscribe_from_notifications();
#endif
#if HC_PLATFORM == HC_PLATFORM_WIN32 && !XSAPI_UNIT_TESTS
inline std::function<void(invite_notification_event_args&)>& game_invite_handler();

Просмотреть файл

@ -107,6 +107,7 @@ Result<void> AchievementsManagerUser::Initialize(
{
assert(!m_isInitialized);
RETURN_HR_IF_FAILED(m_xblContext->Initialize(m_rtaManager));
m_xblContext->Settings()->SetHttpUserAgent(HttpCallAgent::AchievementsManager);
std::weak_ptr<AchievementsManagerUser> weakThis{ shared_from_this() };
m_achievementProgressToken = m_xblContext->AchievementsService()->AddAchievementProgressChangeHandler(

Просмотреть файл

@ -57,6 +57,16 @@ void XboxLiveContextSettings::SetWebsocketTimeoutWindow(_In_ uint32_t timeoutInS
m_websocketTimeoutWindowInSeconds = timeoutInSeconds;
}
HttpCallAgent XboxLiveContextSettings::HttpUserAgent() const
{
return m_userAgent;
}
void XboxLiveContextSettings::SetHttpUserAgent(_In_ HttpCallAgent userAgent)
{
m_userAgent = userAgent;
}
#if XSAPI_WINRT
bool XboxLiveContextSettings::UseCoreDispatcherForEventRouting() const
{

Просмотреть файл

@ -27,6 +27,15 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
#define DEFAULT_RETRY_DELAY_SECONDS (2)
#define MIN_RETRY_DELAY_SECONDS (2)
enum class HttpCallAgent : uint32_t
{
Title,
MultiplayerManager,
SocialManager,
MultiplayerActivity,
AchievementsManager
};
class XboxLiveContextSettings
{
public:
@ -44,6 +53,9 @@ public:
uint32_t WebsocketTimeoutWindow() const;
void SetWebsocketTimeoutWindow(_In_ uint32_t timeoutInSeconds);
HttpCallAgent HttpUserAgent() const;
void SetHttpUserAgent(_In_ HttpCallAgent userAgent);
#if XSAPI_WINRT // WinRT only
bool UseCoreDispatcherForEventRouting() const;
@ -65,6 +77,7 @@ private:
uint32_t m_httpRetryDelayInSeconds{ DEFAULT_RETRY_DELAY_SECONDS };
uint32_t m_httpTimeoutWindowInSeconds{ DEFAULT_HTTP_RETRY_WINDOW_SECONDS };
uint32_t m_websocketTimeoutWindowInSeconds{ DEFAULT_WEBSOCKET_TIMEOUT_SECONDS };
HttpCallAgent m_userAgent{ HttpCallAgent::Title };
#if XSAPI_WINRT
bool m_useCoreDispatcherForEventRouting{ false };
#endif

Просмотреть файл

@ -43,9 +43,11 @@ HRESULT EventsService::WriteInGameEvent(
return hr;
}
String lowercaseScid = utils::ToLower(scid);
return XGameEventWrite(
m_user.Handle(),
scid,
lowercaseScid.c_str(),
m_playSession.c_str(),
eventName,
dimensions,

Просмотреть файл

@ -27,6 +27,7 @@ MultiplayerLocalUser::MultiplayerLocalUser(
m_xboxLiveContextImpl = XblContext::Make(std::move(user));
m_xboxLiveContextImpl->Initialize(GlobalState::Get()->RTAManager());
m_xboxLiveContextImpl->Settings()->SetHttpUserAgent(HttpCallAgent::MultiplayerManager);
}
MultiplayerLocalUser::~MultiplayerLocalUser()

Просмотреть файл

@ -96,13 +96,15 @@ HRESULT MultiplayerActivityService::FlushRecentPlayers(
Stringstream path{};
path << "/titles/" << titleId << "/recentplayers";
return XblHttpCall::Init(
RETURN_HR_IF_FAILED(XblHttpCall::Init(
contextSettings,
"POST",
XblHttpCall::BuildUrl(MPA_SERVICE_NAME, path.str()),
xbox_live_api::post_recent_players,
HttpCallAgent::MultiplayerActivity
);
xbox_live_api::post_recent_players
));
RETURN_HR_IF_FAILED(XblHttpCall::SetUserAgent(HttpCallAgent::MultiplayerActivity));
return S_OK;
}
HRESULT PerformWithRetry(

Просмотреть файл

@ -179,6 +179,7 @@ GameInviteNotificationEventArgs::GameInviteNotificationEventArgs(
: XblGameInviteNotificationEventArgs{ other },
m_inviteHandleId{ other.m_inviteHandleId },
m_inviteProtocol{ other.m_inviteProtocol },
m_inviteContext{ other.m_inviteContext },
m_senderImageUrl{ other.m_senderImageUrl }
{
if (!m_inviteHandleId.empty())
@ -189,6 +190,10 @@ GameInviteNotificationEventArgs::GameInviteNotificationEventArgs(
{
inviteProtocol = m_inviteProtocol.data();
}
if (!m_inviteContext.empty())
{
inviteContext = m_inviteContext.data();
}
if (!m_senderImageUrl.empty())
{
senderImageUrl = m_senderImageUrl.data();
@ -209,6 +214,16 @@ Result<GameInviteNotificationEventArgs> GameInviteNotificationEventArgs::Deseria
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonXuid(inviteHandle, "senderXuid", result.senderXboxUserId, true));
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(inviteHandle, "id", result.m_inviteHandleId, true));
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(inviteHandle, "inviteProtocol", result.m_inviteProtocol, true));
if (inviteHandle.IsObject() && inviteHandle.HasMember("inviteAttributes"))
{
const JsonValue& inviteAttributesValue = inviteHandle["inviteAttributes"];
if (inviteAttributesValue.HasMember("context"))
{
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonString(inviteAttributesValue, "context", result.m_inviteContext, true));
}
}
RETURN_HR_IF_FAILED(JsonUtils::ExtractJsonTimeT(inviteHandle, "expiration", result.expiration, true));
result.sessionReference = xbox::services::multiplayer::Serializers::DeserializeSessionReference(inviteHandle["sessionRef"]).Payload();

Просмотреть файл

@ -27,6 +27,7 @@ public:
private:
String m_inviteHandleId;
String m_inviteProtocol;
String m_inviteContext;
String m_senderImageUrl;
};

Просмотреть файл

@ -156,6 +156,7 @@ HRESULT NotificationService::RegisterForNotificationsHelper(
}
default:
{
auto workQueue = async.Queue().DeriveWorkerQueue();
m_registrationAsync = AsyncContext<HRESULT>::Collapse({ std::move(m_registrationAsync), std::move(async) });
m_registrationStatus = RegistrationStatus::Registering;
@ -213,17 +214,15 @@ HRESULT NotificationService::RegisterForNotificationsHelper(
RETURN_HR_IF_FAILED(httpCall->SetRequestBody(payload));
return httpCall->Perform(AsyncContext<HttpResult>{
async.Queue().DeriveWorkerQueue(),
workQueue,
[
thisWeakPtr = std::weak_ptr<NotificationService>{ shared_from_this() },
async
thisWeakPtr = std::weak_ptr<NotificationService>{ shared_from_this() }
](HttpResult httpResult)
{
std::shared_ptr<NotificationService> pThis(thisWeakPtr.lock());
if (pThis == nullptr)
{
async.Complete(E_XBL_RUNTIME_ERROR);
return;
}

Просмотреть файл

@ -40,7 +40,7 @@ void TitleRequest::Serialize(_Out_ JsonValue& serializedObject, _In_ JsonDocumen
{
JsonValue presenceTokenIDsJson(rapidjson::kArrayType);
JsonUtils::SerializeVector(JsonUtils::JsonStringSerializer, m_presenceTokenIds, presenceTokenIDsJson, allocator);
serializedObject.AddMember("params", presenceTokenIDsJson, allocator);
richPresenceJson.AddMember("params", presenceTokenIDsJson, allocator);
}
serializedObject.AddMember("activity", JsonValue(rapidjson::kObjectType).AddMember("richPresence", richPresenceJson, allocator).Move(), allocator);

Просмотреть файл

@ -400,7 +400,14 @@ void Connection::SubscribeResponseHandler(_In_ const JsonValue& message) noexcep
sub->m_state->serviceId = message[3].GetInt();
const auto& data = message[4];
m_activeSubs[sub->m_state->serviceId] = sub;
if (m_activeSubs.find(sub->m_state->serviceId) == m_activeSubs.end())
{
m_activeSubs[sub->m_state->serviceId] = { { sub->m_state->clientId, sub } };
}
else
{
m_activeSubs[sub->m_state->serviceId][sub->m_state->clientId] = sub;
}
switch (sub->m_state->serviceStatus)
{
@ -515,7 +522,7 @@ void Connection::UnsubscribeResponseHandler(_In_ const JsonValue& message) noexc
return;
}
auto sub{ subIter->second };
m_activeSubs.erase(sub->m_state->serviceId);
m_activeSubs[sub->m_state->serviceId].erase(clientId);
LOGS_DEBUG << __FUNCTION__ << ": [" << sub->m_state->clientId <<"] ServiceStatus=" << EnumName(sub->m_state->serviceStatus);
@ -561,11 +568,14 @@ void Connection::EventHandler(_In_ const JsonValue& message) const noexcept
auto subIter{ m_activeSubs.find(serviceId) };
assert(subIter != m_activeSubs.end());
auto sub = subIter->second;
auto subs = subIter->second;
lock.unlock();
sub->OnEvent(data);
for (auto& subPair : subs)
{
subPair.second->OnEvent(data);
}
}
void Connection::ResyncHandler() const noexcept

Просмотреть файл

@ -82,7 +82,7 @@ private:
Map<uint32_t, std::shared_ptr<Subscription>> m_subs;
Map<uint32_t, AsyncContext<Result<void>>> m_subscribeAsyncContexts;
Map<uint32_t, AsyncContext<Result<void>>> m_unsubscribeAsyncContexts;
Map<uint32_t, std::shared_ptr<Subscription>> m_activeSubs;
Map<uint32_t, Map<uint32_t, std::shared_ptr<Subscription>>> m_activeSubs;
uint32_t m_nextSubId{ 1 };

Просмотреть файл

@ -96,8 +96,7 @@ HRESULT PeoplehubService::MakeServiceCall(
m_httpSettings,
relationshipType == RelationshipType::Batch ? "POST" : "GET",
XblHttpCall::BuildUrl("peoplehub", subpath.str()),
xbox_live_api::get_social_graph,
HttpCallAgent::SocialManager
xbox_live_api::get_social_graph
));
httpCall->SetXblServiceContractVersion(3);

Просмотреть файл

@ -106,6 +106,7 @@ HRESULT SocialGraph::Initialize() noexcept
m_xblContext = XblContext::Make(copiedUser.ExtractPayload());
RETURN_HR_IF_FAILED(m_xblContext->Initialize(m_rtaManager));
m_xblContext->Settings()->SetHttpUserAgent(HttpCallAgent::SocialManager);
return S_OK;
}

Просмотреть файл

@ -51,6 +51,36 @@ void StatisticChangeSubscription::OnSubscribe(
stream << field.GetInt();
value = stream.str();
}
else if (field.IsInt64())
{
Stringstream stream;
stream << field.GetInt64();
value = stream.str();
}
else if (field.IsUint())
{
Stringstream stream;
stream << field.GetUint();
value = stream.str();
}
else if (field.IsUint64())
{
Stringstream stream;
stream << field.GetUint64();
value = stream.str();
}
else if (field.IsDouble())
{
Stringstream stream;
stream << field.GetDouble();
value = stream.str();
}
else if (field.IsBool())
{
Stringstream stream;
stream << field.GetBool();
value = stream.str();
}
else if (field.IsString())
{
value = field.GetString();
@ -106,17 +136,18 @@ void StatisticChangeSubscription::OnResync() noexcept
if (Succeeded(result))
{
auto& payload{ result.Payload() };
assert(payload.ServiceConfigurationStatistics().size() == 1);
assert(payload.ServiceConfigurationStatistics()[0].Statistics().size() == 1);
statisticsService->HandleStatisticChanged(StatisticChangeEventArgs
{
sharedThis->m_xuid,
sharedThis->m_scid,
sharedThis->m_statisticName,
sharedThis->m_statisticType,
payload.ServiceConfigurationStatistics()[0].Statistics()[0].Value()
});
if (payload.ServiceConfigurationStatistics().size() >= 1 &&
payload.ServiceConfigurationStatistics()[0].Statistics().size() >= 1)
{
statisticsService->HandleStatisticChanged(StatisticChangeEventArgs
{
sharedThis->m_xuid,
sharedThis->m_scid,
sharedThis->m_statisticName,
sharedThis->m_statisticType,
payload.ServiceConfigurationStatistics()[0].Statistics()[0].Value()
});
}
}
}
});

Просмотреть файл

@ -130,6 +130,13 @@ TaskQueue TaskQueue::DeriveWorkerQueue(XTaskQueueHandle handle) noexcept
TaskQueue derivedQueue{ nullptr };
TaskQueue queue{ handle };
// If handle is null, derive a queue from XSAPI global queue
if (!queue.m_handle)
{
queue = TaskQueue{};
}
// If queue is still null, try to derive from the process default queue
if (!queue.m_handle)
{
TaskQueue processQueue{ nullptr };
@ -141,7 +148,7 @@ TaskQueue TaskQueue::DeriveWorkerQueue(XTaskQueueHandle handle) noexcept
}
assert(queue.m_handle);
XTaskQueuePortHandle worker{ nullptr };
auto hr = XTaskQueueGetPort(queue.m_handle, XTaskQueuePort::Work, &worker);
assert(SUCCEEDED(hr));

Просмотреть файл

@ -9,4 +9,4 @@
//*********************************************************
#pragma once
#define XBOX_SERVICES_API_VERSION_STRING "2021.06.20210908.3"
#define XBOX_SERVICES_API_VERSION_STRING "2021.10.20210928.0"

Просмотреть файл

@ -51,6 +51,13 @@ HRESULT GlobalState::Create(
RETURN_HR_INVALIDARGUMENT_IF_EMPTY_STRING(args->scid);
#endif
XTaskQueueHandle processQueue{ nullptr };
bool haveProcessQueue = XTaskQueueGetCurrentProcessTaskQueue(&processQueue);
if (!haveProcessQueue && args->queue == nullptr)
{
return E_NO_TASK_QUEUE;
}
if (AccessHelper(AccessMode::GET))
{
return E_XBL_ALREADY_INITIALIZED;

Просмотреть файл

@ -546,8 +546,7 @@ HRESULT XblHttpCall::Init(
_In_ std::shared_ptr<XboxLiveContextSettings> contextSettings,
_In_ const xsapi_internal_string& httpMethod,
_In_ const xsapi_internal_string& fullUrl,
_In_ xbox_live_api xboxLiveApi,
_In_ HttpCallAgent agent
_In_ xbox_live_api xboxLiveApi
)
{
m_httpMethod = httpMethod;
@ -562,39 +561,9 @@ HRESULT XblHttpCall::Init(
RETURN_HR_IF_FAILED(SetHeader(CONTRACT_VERSION_HEADER, "1"));
RETURN_HR_IF_FAILED(SetHeader(CONTENT_TYPE_HEADER, "application/json; charset=utf-8"));
RETURN_HR_IF_FAILED(SetHeader(ACCEPT_LANGUAGE_HEADER, utils::get_locales()));
xsapi_internal_string userAgent = DEFAULT_USER_AGENT;
if (agent != HttpCallAgent::Title)
{
userAgent += EnumName(agent);
}
RETURN_HR_IF_FAILED(SetUserAgent(contextSettings->HttpUserAgent()));
XblApiType apiType{ XblApiType::XblCApi };
{
auto state{ GlobalState::Get() };
if (state)
{
apiType = state->ApiType;
}
}
switch (apiType)
{
case XblApiType::XblCApi:
{
userAgent += " c";
break;
}
case XblApiType::XblCPPApi:
{
userAgent += " cpp";
break;
}
}
return SetHeader(USER_AGENT_HEADER, userAgent);
return S_OK;
}
HRESULT XblHttpCall::CalcHttpTimeout()
@ -626,6 +595,40 @@ HRESULT XblHttpCall::SetHeader(
return HttpCall::SetHeader(key, value, allowTracing);
}
HRESULT XblHttpCall::SetUserAgent(_In_ HttpCallAgent userAgent)
{
String headerValue{ DEFAULT_USER_AGENT };
if (userAgent != HttpCallAgent::Title)
{
headerValue += EnumName(userAgent);
}
XblApiType apiType{ XblApiType::XblCApi };
{
auto state{ GlobalState::Get() };
if (state)
{
apiType = state->ApiType;
}
}
switch (apiType)
{
case XblApiType::XblCApi:
{
headerValue += " c";
break;
}
case XblApiType::XblCPPApi:
{
headerValue += " cpp";
break;
}
}
return SetHeader(USER_AGENT_HEADER, headerValue);
}
HRESULT XblHttpCall::SetRequestBody(const xsapi_internal_vector<uint8_t>& bytes)
{
m_requestBody = bytes;

Просмотреть файл

@ -189,15 +189,6 @@ protected:
HRESULT ResetAndCopyForRetry();
};
enum class HttpCallAgent : uint32_t
{
Title,
MultiplayerManager,
SocialManager,
StatsManager,
MultiplayerActivity
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END
@ -215,8 +206,7 @@ public:
_In_ std::shared_ptr<XboxLiveContextSettings> contextSettings,
_In_ const xsapi_internal_string& httpMethod,
_In_ const xsapi_internal_string& fullUrl,
_In_ xbox_live_api xboxLiveApi,
_In_ HttpCallAgent agent = HttpCallAgent::Title
_In_ xbox_live_api xboxLiveApi
);
HRESULT SetHeader(
@ -225,6 +215,9 @@ public:
_In_ bool allowTracing = true
) override;
// Override the UserAgent that was specified in the contextSettings
HRESULT SetUserAgent(_In_ HttpCallAgent userAgent);
void SetLongHttpCall(_In_ bool longHttpCall);
HRESULT SetXblServiceContractVersion(uint32_t contractVersion);

Просмотреть файл

@ -254,7 +254,9 @@
<None Include="$(MSBuildThisFileDirectory)Tests\achievements\achievements_manager_update_achievements.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\achievements\achievements_progress_notification.lua" />
<None Include="$(MSBuildThisFileDirectory)Tests\achievements\achievements_progress_notification.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\achievements\PerformanceTestMockResponse.json">
<DeploymentContent>true</DeploymentContent>
</None>
@ -282,7 +284,9 @@
<None Include="$(MSBuildThisFileDirectory)Tests\gdk-gameinvite\game-invite-send.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\leaderboard\leaderboard-2017.lua" />
<None Include="$(MSBuildThisFileDirectory)Tests\leaderboard\leaderboard-2017.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\leaderboard\leaderboard-bvt.lua">
<DeploymentContent>true</DeploymentContent>
</None>
@ -481,9 +485,15 @@
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_manager_remove_realloc.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_manager_wait.lua" >
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_relationship_changed.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_sub_unsub.lua">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\stats2017\stats2017-test429.lua">
<DeploymentContent>true</DeploymentContent>
</None>

Просмотреть файл

@ -789,5 +789,11 @@
<None Include="$(MSBuildThisFileDirectory)Tests\titleStorage\title_storage-restCalls.lua">
<Filter>Tests\titleStorage</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_manager_wait.lua">
<Filter>Tests\social</Filter>
</None>
<None Include="$(MSBuildThisFileDirectory)Tests\social\social_sub_unsub.lua">
<Filter>Tests\social</Filter>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -17,6 +17,7 @@ int GetCheckHR_Lua(lua_State *L)
int Sleep_Lua(lua_State *L)
{
DWORD time = (DWORD)GetUint32FromLua(L, 1, 0);
LogToScreen("Sleep(%d)", time);
pal::Sleep(time);
return LuaReturnHR(L, S_OK);
}
@ -66,7 +67,6 @@ int LogToFile_Lua(lua_State *L)
int LogToScreen_Lua(lua_State *L)
{
return LogHelper(false, L);
}
@ -223,6 +223,16 @@ int APIRunner_MemLogUnhookedStats_Lua(lua_State *L)
return LuaReturnHR(L, S_OK);
}
int IsGDKPlatform_Lua(lua_State *L)
{
#if HC_PLATFORM == HC_PLATFORM_GDK
lua_pushboolean(L, true);
#else
lua_pushboolean(L, false);
#endif
return 1;
}
void RegisterLuaAPIs()
{
SetupAPIs_Xal();
@ -296,6 +306,7 @@ void RegisterLuaAPIs()
lua_register(Data()->L, "APIRunner_LogStats", APIRunner_LogStats_Lua);
lua_register(Data()->L, "APIRunner_AssertOnAllocOfId", APIRunner_AssertOnAllocOfId_Lua);
lua_register(Data()->L, "APIRunner_MemLogUnhookedStats", APIRunner_MemLogUnhookedStats_Lua);
lua_register(Data()->L, "IsGDKPlatform", IsGDKPlatform_Lua);
}
void SetupAPIS_Platform()

Просмотреть файл

@ -47,7 +47,10 @@ int XTaskQueueCloseHandle_Lua(lua_State *L)
XTaskQueueHandle queue = Data()->queue;
// CODE SNIPPET START: XTaskQueueCloseHandle
XTaskQueueCloseHandle(queue);
if (queue != nullptr)
{
XTaskQueueCloseHandle(queue);
}
// CODE SNIPPET END
Data()->queue = nullptr;

Просмотреть файл

@ -811,10 +811,10 @@ int MultiplayerSessionSetCurrentUserSecureDeviceAddressBase64Cpp_Lua(lua_State *
int MultiplayerSessionSetCurrentUserRolesCpp_Lua(lua_State *L)
{
string_t roleTypeName1 = L"roleTypeName1";
string_t roleName1 = L"roleName1";
string_t roleTypeName2 = L"roleTypeName2";
string_t roleName2 = L"roleName2";
string_t roleTypeName1 = _T("roleTypeName1");
string_t roleName1 = _T("roleName1");
string_t roleTypeName2 = _T("roleTypeName2");
string_t roleName2 = _T("roleName2");
std::unordered_map<string_t, string_t> roleInfo{
std::pair<string_t, string_t>(roleTypeName1, roleName1),
@ -1049,7 +1049,7 @@ int MultiplayerServiceGetCurrentSessionByHandle_Lua(lua_State *L)
auto sessionIndex{ GetUint64FromLua(L, 2, 0) };
if (handleId.empty())
{
handleId = L"86191619-4002-044f-4846-f8f903c71512";
handleId = _T("86191619-4002-044f-4846-f8f903c71512");
}
LogToFile("handleId: %s", xbox::services::Utils::StringFromStringT(handleId).c_str());
@ -1400,9 +1400,9 @@ int MultiplayerServiceSetTransferHandle_Lua(lua_State* L)
int MultiplayerServiceSetSearchHandle_Lua(lua_State *L)
{
std::vector<string_t> tags{ L"SessionTag" };
std::unordered_map<string_t, double> numbersMetadata{ std::pair<string_t, double>(L"numberattributename", 1.1) };
std::unordered_map<string_t, string_t> stringsMetadata{ std::pair<string_t, string_t>(L"stringattributename", L"string attribute value") };
std::vector<string_t> tags{ _T("SessionTag") };
std::unordered_map<string_t, double> numbersMetadata{ std::pair<string_t, double>(_T("numberattributename"), 1.1) };
std::unordered_map<string_t, string_t> stringsMetadata{ std::pair<string_t, string_t>(_T("stringattributename"), _T("string attribute value")) };
xbox::services::multiplayer::multiplayer_session_reference sessionRef = MPStateCpp()->sessionRef;
xbox::services::multiplayer::multiplayer_search_handle_request searchRequest(sessionRef);
@ -1447,10 +1447,10 @@ int MultiplayerServiceClearSearchHandle_Lua(lua_State *L)
int MultiplayerServiceGetSearchHandles_Lua(lua_State *L)
{
string_t serviceConfigurationId = xbox::services::Utils::StringTFromUtf8(Data()->scid);
string_t sessionTemplateName = L"MinGameSession";
string_t orderByAttribute = L"";
bool orderAscending{ false };
string_t searchFilter = L"";
string_t sessionTemplateName = _T("MinGameSession");
string_t orderByAttribute = _T("");
string_t searchFilter = _T("");
std::shared_ptr<xbox::services::xbox_live_context> xblc = std::make_shared<xbox::services::xbox_live_context>(Data()->xboxLiveContext);
xblc->multiplayer_service().get_search_handles(

Просмотреть файл

@ -142,7 +142,7 @@ int PresenceServiceGetPresence_Lua(lua_State *L)
int PresenceServiceGetPresenceForMultipleUsers_Lua(lua_State* L)
{
#if CPP_TESTS_ENABLED
std::vector<string_t> xuids{ L"2814639011617876", L"2814641789541994" };
std::vector<string_t> xuids{ _T("2814639011617876"), _T("2814641789541994") };
std::vector<xbox::services::presence::presence_device_type> deviceTypes;
std::vector<uint32_t> titleIds;
xbox::services::presence::presence_detail_level detailLevel = xbox::services::presence::presence_detail_level::all;
@ -206,8 +206,7 @@ int PresenceServiceGetPresenceForSocialGroup_Lua(lua_State *L)
int PresenceServiceSubscribeToDevicePresenceChange_Lua(lua_State* L)
{
#if CPP_TESTS_ENABLED
string_t xuid{ L"2814639011617876" };
string_t xuid{ _T("2814639011617876") };
std::shared_ptr<xbox::services::xbox_live_context> xblc = std::make_shared<xbox::services::xbox_live_context>(Data()->xboxLiveContext);
xbox::services::xbox_live_result<std::shared_ptr<xbox::services::presence::device_presence_change_subscription>> result = xblc->presence_service().subscribe_to_device_presence_change(xuid);
@ -249,8 +248,7 @@ int PresenceServiceUnsubscribeFromDevicePresenceChange_Lua(lua_State* L)
int PresenceServiceSubscribeToTitlePresenceChange_Lua(lua_State* L)
{
#if CPP_TESTS_ENABLED
string_t xuid{ L"2814639011617876" };
string_t xuid{ _T("2814639011617876") };
std::shared_ptr<xbox::services::xbox_live_context> xblc = std::make_shared<xbox::services::xbox_live_context>(Data()->xboxLiveContext);
xbox::services::xbox_live_result<std::shared_ptr<xbox::services::presence::title_presence_change_subscription>> result = xblc->presence_service().subscribe_to_title_presence_change(xuid, Data()->titleId);

Просмотреть файл

@ -202,11 +202,12 @@ int SocialServiceRemoveSocialRelationshipChangedHandler_Lua(lua_State *L)
int ReputationServiceSubmitReputationFeedback_Lua(lua_State* L)
{
#if CPP_TESTS_ENABLED
string_t xuid = L"2814639011617876";
xbox::services::social::reputation_feedback_type reputationFeedbackType = xbox::services::social::reputation_feedback_type::positive_helpful_player;
string_t sessionName = L"";
string_t reasonMessage = L"Helpful player";
string_t evidenceResourceId = L"";
string_t xuid = _T("2814639011617876");
string_t sessionName = _T("");
string_t reasonMessage = _T("Helpful player");
string_t evidenceResourceId = _T("");
std::shared_ptr<xbox::services::xbox_live_context> xblc = std::make_shared<xbox::services::xbox_live_context>(Data()->xboxLiveContext);
xblc->reputation_service().submit_reputation_feedback(
@ -233,16 +234,17 @@ int ReputationServiceSubmitBatchReputationFeedback_Lua(lua_State *L)
{
#if CPP_TESTS_ENABLED
std::vector<xbox::services::social::reputation_feedback_item> feedbackItems;
feedbackItems.push_back(xbox::services::social::reputation_feedback_item
{
L"2814639011617876",
_T("2814639011617876"),
xbox::services::social::reputation_feedback_type::positive_helpful_player,
xbox::services::multiplayer::multiplayer_session_reference(),
L"Helpful player",
L""
_T("Helpful player"),
_T("")
});
// Add any additional feedback items here
// Add any additional feedback items here
std::shared_ptr<xbox::services::xbox_live_context> xblc = std::make_shared<xbox::services::xbox_live_context>(Data()->xboxLiveContext);
xblc->reputation_service().submit_batch_reputation_feedback(feedbackItems).then(
[](xbox::services::xbox_live_result<void> result)

Просмотреть файл

@ -114,8 +114,8 @@ xbox::services::social::manager::social_manager_extra_detail_level ConvertString
{
xbox::services::social::manager::social_manager_extra_detail_level detailLevel = xbox::services::social::manager::social_manager_extra_detail_level::no_extra_detail;
if (pal::stricmp(str, "social_manager_extra_detail_level::title_history_level") == 0) detailLevel = xbox::services::social::manager::social_manager_extra_detail_level::title_history_level;
else if (pal::stricmp(str, "social_manager_extra_detail_level::preferred_color_level") == 0) detailLevel = xbox::services::social::manager::social_manager_extra_detail_level::preferred_color_level;
if (pal::stricmp(str, "social_manager_extra_detail_level::title_history_leve_T(") == 0) detailLevel = xbox::services::social::manager::social_manager_extra_detail_level::title_history_level;
else if (pal::stricmp(str, "social_manager_extra_detail_level::preferred_color_leve_T(") == 0) detailLevel = xbox::services::social::manager::social_manager_extra_detail_level::preferred_color_level;
return detailLevel;
}
@ -132,7 +132,7 @@ xbox::services::social::manager::presence_filter ConvertStringToCppPresenceFilte
else if (pal::stricmp(str, "presence_filter::all_online") == 0) filter = xbox::services::social::manager::presence_filter::all_online;
else if (pal::stricmp(str, "presence_filter::all_offline") == 0) filter = xbox::services::social::manager::presence_filter::all_offline;
else if (pal::stricmp(str, "presence_filter::all_title") == 0) filter = xbox::services::social::manager::presence_filter::all_title;
else if (pal::stricmp(str, "presence_filter::all") == 0) filter = xbox::services::social::manager::presence_filter::all;
else if (pal::stricmp(str, "presence_filter::al_T(") == 0) filter = xbox::services::social::manager::presence_filter::all;
return filter;
}
@ -150,22 +150,20 @@ xbox::services::social::manager::relationship_filter ConvertStringToCppRelations
// Pool of XDKS.1 xuids to create social groups from
std::vector<string_t> listXuidStrings
{
L"2814639011617876",L"2814641789541994",L"2814644008675844",L"2814644210052185",L"2814645164579523",L"2814646075485729",L"2814649783195402",L"2814650260879943",
L"2814652370182940",L"2814652714045777",L"2814654391560620",L"2814654975417728",L"2814656000993855",L"2814660006763195",L"2814666715930430",L"2814667316080600",
L"2814669550092398",L"2814669684179632",L"2814669733667211",L"2814671180786692",L"2814679901432274",L"2814613501048225",L"2814614352529204",L"2814615856126401",
L"2814616641363830",L"2814617883586813",L"2814618053453081",L"2814629752527080",L"2814631255161151",L"2814632477267887",L"2814633284389038",L"2814635732495522",
L"2814635779785472",L"2814635974475208",L"2814636979708499",L"2814618092438397",L"2814618260480530",L"2814618319551907",L"2814619559360314",L"2814620368929739",
L"2814620769042115",L"2814621007349381",L"2814623088399025",L"2814623825448960",L"2814624220291971",L"2814624961587858",L"2814626394212372",L"2814626639518570",
L"2814628203722867",L"2814629143923154",L"2814614382301082",L"2814614959737919",L"2814615558140392",L"2814618401629514",L"2814618701087902",L"2814619300882392",
L"2814623785189962",L"2814623956387698",L"2814625066090704",L"2814625471782204",L"2814626946705530",L"2814627006318591",L"2814628046127456",L"2814631487749991",
L"2814631517599783",L"2814632798310691",L"2814633582140204",L"2814634204785789",L"2814634895412664",L"2814635439049207",L"2814638609354868",L"2814639589885754",
L"2814641670947751",L"2814643512602566",L"2814646137630843",L"2814648499394446",L"2814651465227139",L"2814652150012664",L"2814653926747608",L"2814655098938516",
L"2814655264861214",L"2814655417678099",L"2814655883565306",L"2814656031821923",L"2814656159501072",L"2814656780954834",L"2814660657970845",L"2814661604435490",
L"2814663444319727",L"2814663818015575",L"2814665274839967",L"2814667273133504",L"2814670761542037",L"2814672762886609",L"2814673772488023",L"2814674096344056",
L"2814674229538758",L"2814678943953289",L"2814680898042782"
_T("2814639011617876"),_T("2814641789541994"),_T("2814644008675844"),_T("2814644210052185"),_T("2814645164579523"),_T("2814646075485729"),_T("2814649783195402"),_T("2814650260879943"),
_T("2814652370182940"),_T("2814652714045777"),_T("2814654391560620"),_T("2814654975417728"),_T("2814656000993855"),_T("2814660006763195"),_T("2814666715930430"),_T("2814667316080600"),
_T("2814669550092398"),_T("2814669684179632"),_T("2814669733667211"),_T("2814671180786692"),_T("2814679901432274"),_T("2814613501048225"),_T("2814614352529204"),_T("2814615856126401"),
_T("2814616641363830"),_T("2814617883586813"),_T("2814618053453081"),_T("2814629752527080"),_T("2814631255161151"),_T("2814632477267887"),_T("2814633284389038"),_T("2814635732495522"),
_T("2814635779785472"),_T("2814635974475208"),_T("2814636979708499"),_T("2814618092438397"),_T("2814618260480530"),_T("2814618319551907"),_T("2814619559360314"),_T("2814620368929739"),
_T("2814620769042115"),_T("2814621007349381"),_T("2814623088399025"),_T("2814623825448960"),_T("2814624220291971"),_T("2814624961587858"),_T("2814626394212372"),_T("2814626639518570"),
_T("2814628203722867"),_T("2814629143923154"),_T("2814614382301082"),_T("2814614959737919"),_T("2814615558140392"),_T("2814618401629514"),_T("2814618701087902"),_T("2814619300882392"),
_T("2814623785189962"),_T("2814623956387698"),_T("2814625066090704"),_T("2814625471782204"),_T("2814626946705530"),_T("2814627006318591"),_T("2814628046127456"),_T("2814631487749991"),
_T("2814631517599783"),_T("2814632798310691"),_T("2814633582140204"),_T("2814634204785789"),_T("2814634895412664"),_T("2814635439049207"),_T("2814638609354868"),_T("2814639589885754"),
_T("2814641670947751"),_T("2814643512602566"),_T("2814646137630843"),_T("2814648499394446"),_T("2814651465227139"),_T("2814652150012664"),_T("2814653926747608"),_T("2814655098938516"),
_T("2814655264861214"),_T("2814655417678099"),_T("2814655883565306"),_T("2814656031821923"),_T("2814656159501072"),_T("2814656780954834"),_T("2814660657970845"),_T("2814661604435490"),
_T("2814663444319727"),_T("2814663818015575"),_T("2814665274839967"),_T("2814667273133504"),_T("2814670761542037"),_T("2814672762886609"),_T("2814673772488023"),_T("2814674096344056"),
_T("2814674229538758"),_T("2814678943953289"),_T("2814680898042782")
};
#endif
//lua commands
@ -399,7 +397,7 @@ int SocialManagerAddLocalUserCpp_Lua(lua_State *L)
{
#if CPP_TESTS_ENABLED
xbox::services::social::manager::social_manager_extra_detail_level extraDetailLevel = ConvertStringToCppSocialManagerExtraDetailLevel(
GetStringFromLua(L, 1, "social_manager_extra_detail_level::no_extra_detail").c_str());
GetStringFromLua(L, 1, "social_manager_extra_detail_level::no_extra_detai_T(").c_str());
LogToFile("SocialManagerAddLocalUserCpp: social_manager_extra_detail_level: %d", extraDetailLevel);
xbox_live_user_t user = Data()->xalUser;
@ -432,7 +430,7 @@ int SocialManagerCreateSocialUserGroupFromFiltersCpp_Lua(lua_State *L)
{
#if CPP_TESTS_ENABLED
xbox_live_user_t user = Data()->xalUser;
xbox::services::social::manager::presence_filter presenceFilter = ConvertStringToCppPresenceFilter(GetStringFromLua(L, 1, "presence_filter::all").c_str());
xbox::services::social::manager::presence_filter presenceFilter = ConvertStringToCppPresenceFilter(GetStringFromLua(L, 1, "presence_filter::al_T(").c_str());
xbox::services::social::manager::relationship_filter relationshipFilter = ConvertStringToCppRelationshipFilter(GetStringFromLua(L, 2, "relationship_filter::friends").c_str());
LogToFile("SocialManagerCreateSocialUserGroupFromFiltersCpp: presence_filter: %d", presenceFilter);

Просмотреть файл

@ -4,10 +4,12 @@
int HCInitialize_Lua(lua_State *L)
{
//HCInitArgs args = {};
// CODE SNIPPET START: HCInitialize
#if HC_PLATFORM == HC_PLATFORM_ANDROID
HRESULT hr = HCInitialize(&(Data()->initArgs));
#else
HRESULT hr = HCInitialize(nullptr);
#endif
// CODE SNIPPET END
LogToFile("HCInitialize: hr=%s", ConvertHR(hr).c_str());
@ -366,6 +368,7 @@ int HCWebSocketSetHeader_Lua(lua_State *L)
int HCWebSocketConnectAsync_Lua(lua_State *L)
{
//TODO: websocket.org is no longer in service; find a new server
std::string uri = GetStringFromLua(L, 1, "wss://echo.websocket.org");
std::string subProtocol = GetStringFromLua(L, 2, "");

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,6 +10,9 @@ void StopSocialManagerDoWorkHelperCpp();
int XblInitialize_Lua(lua_State *L)
{
// Ensure we properly handle a null process queue
XTaskQueueSetCurrentProcessTaskQueue(nullptr);
CreateQueueIfNeeded();
// CODE SNIPPET START: XblInitialize
@ -26,8 +29,9 @@ int XblInitialize_Lua(lua_State *L)
auto pathString = std::string{ pathArray } + '\\';
args.localStoragePath = pathString.data();
#endif
#if HC_PLATFORM == HC_PLATFORM_IOS
#if HC_PLATFORM == HC_PLATFORM_ANDROID
args.applicationContext = Data()->applicationContext;
args.javaVM = Data()->javaVM;
#endif
HRESULT hr = XblInitialize(&args);
// CODE SNIPPET END

Просмотреть файл

@ -77,6 +77,14 @@ int StartAchievementsManagerDoWorkLoop_Lua(lua_State* L)
std::lock_guard<std::recursive_mutex> lock(Data()->m_luaLock);
achievementsState.doWorkThread = std::thread([]()
{
#if HC_PLATFORM == HC_PLATFORM_ANDROID
JNIEnv* jniEnv = nullptr;
// This should be a background thread that MUST attach a new java thread.
Data()->javaVM->GetEnv(reinterpret_cast<void**>(&jniEnv), JNI_VERSION_1_6);
Data()->javaVM->AttachCurrentThread(&jniEnv, nullptr);
#endif
Data()->m_achievementsDoWorkDone = false;
while (achievementsState.doWork && !Data()->m_quit)
{
@ -88,6 +96,10 @@ int StartAchievementsManagerDoWorkLoop_Lua(lua_State* L)
}
Data()->m_achievementsDoWorkDone = true;
LogToScreen("Exiting do work thread");
#if HC_PLATFORM == HC_PLATFORM_ANDROID
Data()->javaVM->DetachCurrentThread();
#endif
});
return LuaReturnHR(L, S_OK);
}
@ -112,7 +124,11 @@ void StopAchievementsManagerDoWorkHelper()
int SetupAchievementsManagerPerformanceTestMock_Lua(lua_State *L)
{
#if HC_PLATFORM == HC_PLATFORM_ANDROID
std::string addUserMockResponse = ReadFile("PerformanceTestMockResponse.json");
#else
std::string addUserMockResponse = ReadFile("achievements\\PerformanceTestMockResponse.json");
#endif
assert(!addUserMockResponse.empty());
auto hr = HCMockCallCreate(&achievementsState.mockHandle);

Просмотреть файл

@ -22,6 +22,8 @@ int XblGameInviteAddNotificationHandler_Lua(lua_State *L)
LogToScreen(args->inviteHandleId);
LogToScreen("Invite Protocol:");
LogToScreen(args->inviteProtocol);
LogToScreen("Invite Context:");
LogToScreen(args->inviteContext);
LogToScreen("Sender Gamertag:");
LogToScreen(args->senderGamertag);
LogToScreen("Modern Gamertag:");

Просмотреть файл

@ -49,7 +49,7 @@ HRESULT XGameUiShowSendGameInviteAsyncHelper(
int XGameUiShowSendGameInviteAsyncToMPMLobby_Lua(lua_State* L)
{
std::string inviteText = GetStringFromLua(L, 1, "Join Me In My Game!");
std::string inviteText = GetStringFromLua(L, 1, "//MPSD/custominvitestrings_JoinMyGame");
std::string customActivationContext = GetStringFromLua(L, 2, "MyCustomActivationContext");
XblMultiplayerSessionReference sessionReference{};

Просмотреть файл

@ -594,7 +594,7 @@ int XblMultiplayerManagerLobbySessionSetLocalMemberProperties_Lua(lua_State* L)
int XblMultiplayerManagerLobbySessionInviteFriends_Lua(lua_State* L)
{
#if HC_PLATFORM == HC_PLATFORM_WIN32
HRESULT hr = XblMultiplayerManagerLobbySessionInviteFriends(Data()->xalUser, nullptr, "Join my game!");
HRESULT hr = XblMultiplayerManagerLobbySessionInviteFriends(Data()->xalUser, nullptr, "//MPSD/custominvitestrings_JoinMyGame");
#else
HRESULT hr = S_OK;
#endif

Просмотреть файл

@ -323,6 +323,105 @@ int profile_service_get_user_profile_Lua(lua_State *L)
return LuaReturnHR(L, hr);
}
int UnsubscribeToTitleAndDevicePresenceChangeForFriends_Lua(lua_State *L)
{
HRESULT hr = S_OK;
for (XblRealTimeActivitySubscriptionHandle subscriptionHandleDevice : Data()->subscriptionHandleDeviceList)
{
hr = XblPresenceUnsubscribeFromDevicePresenceChange(
Data()->xboxLiveContext,
subscriptionHandleDevice
);
LuaStopTestIfFailed(hr);
assert(SUCCEEDED(hr));
}
for (XblRealTimeActivitySubscriptionHandle subscriptionHandleTitle : Data()->subscriptionHandleTitleList)
{
hr = XblPresenceUnsubscribeFromTitlePresenceChange(
Data()->xboxLiveContext,
subscriptionHandleTitle
);
}
Data()->subscriptionHandleTitleList.clear();
Data()->subscriptionHandleDeviceList.clear();
LogToScreen("UnsubscribeToTitleAndDevicePresenceChangeForFriends: hr=%s", ConvertHR(hr).c_str());
return LuaReturnHR(L, hr);
}
int SubscribeToTitleAndDevicePresenceChangeForFriends_Lua(lua_State *L)
{
auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = Data()->queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock }; // Take over ownership of the XAsyncBlock*
HRESULT hr = XblSocialGetSocialRelationshipsResult(asyncBlock, &state.socialResultHandle);
const XblSocialRelationship* relationships = nullptr;
size_t relationshipsCount = 0;
hr = XblSocialRelationshipResultGetRelationships(state.socialResultHandle, &relationships, &relationshipsCount);
Data()->subscriptionHandleTitleList.clear();
Data()->subscriptionHandleDeviceList.clear();
XblRealTimeActivitySubscriptionHandle subscriptionHandleDevice;
XblRealTimeActivitySubscriptionHandle subscriptionHandleTitle;
LogToScreen("Got %u SocialRelationships:", relationshipsCount);
for (size_t i = 0; i < relationshipsCount; ++i)
{
if (i % 100 == 0)
{
LogToScreen("Sub'ing to friend %d", i);
}
hr = XblPresenceSubscribeToDevicePresenceChange(
Data()->xboxLiveContext,
relationships[i].xboxUserId,
&subscriptionHandleDevice);
LuaStopTestIfFailed(hr);
assert(SUCCEEDED(hr));
hr = XblPresenceSubscribeToTitlePresenceChange(
Data()->xboxLiveContext,
relationships[i].xboxUserId,
Data()->titleId,
&subscriptionHandleTitle);
LuaStopTestIfFailed(hr);
assert(SUCCEEDED(hr));
Data()->subscriptionHandleDeviceList.push_back(subscriptionHandleDevice);
Data()->subscriptionHandleTitleList.push_back(subscriptionHandleTitle);
}
LogToScreen("SubscribeToTitleAndDevicePresenceChangeForFriends: hr=%s", ConvertHR(hr).c_str());
CallLuaFunctionWithHr(hr, "OnSubscribeToTitleAndDevicePresenceChangeForFriends");
};
HRESULT hr = XblSocialGetSocialRelationshipsAsync(
Data()->xboxLiveContext,
Data()->xboxUserId,
XblSocialRelationshipFilter::All,
0,
0,
asyncBlock.get()
);
if (SUCCEEDED(hr))
{
// The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
// If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
asyncBlock.release();
}
LogToFile("SubscribeToTitleAndDevicePresenceChangeForFriends: hr=%s", ConvertHR(hr).c_str());
return LuaReturnHR(L, hr);
}
void SetupAPIs_XblSocial()
{
lua_register(Data()->L, "XblSocialGetSocialRelationshipsAsync", XblSocialGetSocialRelationshipsAsync_Lua);
@ -340,5 +439,8 @@ void SetupAPIs_XblSocial()
lua_register(Data()->L, "XblSocialSubmitReputationFeedbackAsync", XblSocialSubmitReputationFeedbackAsync_Lua);
lua_register(Data()->L, "XblSocialSubmitBatchReputationFeedbackAsync", XblSocialSubmitBatchReputationFeedbackAsync_Lua);
lua_register(Data()->L, "SubscribeToTitleAndDevicePresenceChangeForFriends", SubscribeToTitleAndDevicePresenceChangeForFriends_Lua);
lua_register(Data()->L, "UnsubscribeToTitleAndDevicePresenceChangeForFriends", UnsubscribeToTitleAndDevicePresenceChangeForFriends_Lua);
lua_register(Data()->L, "profile_service_get_user_profile", profile_service_get_user_profile_Lua);
}

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#include "pch_common.h"
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "AndroidAPIExplorerJni", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "AndroidAPIExplorerJni", __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "AndroidAPIExplorerJni", __VA_ARGS__))
#define UNREFERENCED_PARAMETER(P) (P)
#define RETURN_STRING_FROM_ENUM(e) case(e): return #e;

Просмотреть файл

@ -1,6 +1,9 @@
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include "multidevice.h"
#endif
#include "lua.h"
#include "lualib.h"
@ -83,6 +86,8 @@ struct ApiExplorerData
bool gotXalUser{ false };
XTaskQueueHandle queue{ nullptr };
XblContextHandle xboxLiveContext{ nullptr };
std::vector<XblRealTimeActivitySubscriptionHandle> subscriptionHandleDeviceList;
std::vector<XblRealTimeActivitySubscriptionHandle> subscriptionHandleTitleList;
std::string gamertag;
uint64_t xboxUserId{ 0 };
uint32_t titleId{ 0 };
@ -91,6 +96,18 @@ struct ApiExplorerData
HCMockCallHandle nsalMockCall{ nullptr };
bool libHttpClientInit{ false };
// Android Specific Data
#if HC_PLATFORM == HC_PLATFORM_ANDROID
JavaVM *javaVM;
jobject applicationContext;
HCInitArgs initArgs;
/// <summary>The Java Application Context.</summary>
jclass m_mainActivityClass;
jobject m_mainActivityClassInstance;
jmethodID m_getApplicationContext;
#endif
// Achievements Data
XblAchievementsResultHandle achievementsResult{ nullptr };
#if CPP_TESTS_ENABLED

Просмотреть файл

@ -30,3 +30,8 @@ void LogToScreen(_Printf_format_string_ char const* format, ...);
#if HC_PLATFORM == HC_PLATFORM_IOS
void SetupAPNSRegistrationToken(std::string registrationToken);
#endif
// These functions are specific to APIExplorer on Android
#if HC_PLATFORM == HC_PLATFORM_ANDROID
void SetupAndroidContext( JavaVM *javaVM, jobject context, jclass mainActivityClass, jobject mainActivityInstance, jmethodID getApplicationContext);
#endif

Просмотреть файл

@ -2,6 +2,11 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "pch.h"
#include "utils.h"
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include "api_explorer.h"
#include "pal.h"
#include "runner.h"
#endif
#include "cpprest/json.h"
#include "mem_hook.h"
@ -9,7 +14,7 @@
#include <string>
#if HC_PLATFORM == HC_PLATFORM_IOS
#if HC_PLATFORM == HC_PLATFORM_IOS || HC_PLATFORM == HC_PLATFORM_ANDROID
#define E_NOT_VALID_STATE E_FAIL
#endif
@ -43,8 +48,14 @@ void InitApiExplorerData()
if (g_data->m_testsPath.empty())
{
#if HC_PLATFORM != HC_PLATFORM_ANDROID
auto rootFile = pal::FindFile("tests/tests.root");
#else
auto rootFile = pal::FindFile("tests.root");
#endif
assert(!rootFile.empty());
g_data->m_testsPath = rootFile.substr(0, rootFile.find_last_of("/"));
}
}
@ -94,6 +105,7 @@ void Log(_Printf_format_string_ char const* format, ...)
pal::vsprintf(message, 4096, format, varArgs);
va_end(varArgs);
LogToScreen(message);
LogToFile(message);
}
#endif
@ -296,7 +308,7 @@ bool LoadFile(const std::string& fileNameInput)
{
LogToFile("Couldn't find %s", fileNameInput.c_str());
}
return false;
}
@ -327,39 +339,6 @@ void APIRunner_CleanupLeakCheck()
{
auto memHook = GetApiRunnerMemHook();
memHook->LogStats("CleanupLeakCheck");
if (Data()->xboxLiveContext)
{
XblContextCloseHandle(Data()->xboxLiveContext);
Data()->xboxLiveContext = nullptr;
}
memHook->LogStats("CleanupLeakCheck post-XblContextCloseHandle");
if (Data()->xalUser)
{
XalUserCloseHandle(Data()->xalUser);
Data()->xalUser = nullptr;
}
memHook->LogStats("CleanupLeakCheck post-XalUserCloseHandle");
XAsyncBlock block{};
HRESULT hr = XblCleanupAsync(&block);
if (SUCCEEDED(hr))
{
hr = XAsyncGetStatus(&block, true);
}
memHook->LogStats("CleanupLeakCheck post-XblCleanupAsync");
hr = XalCleanupAsync(&block);
if (SUCCEEDED(hr))
{
hr = XAsyncGetStatus(&block, true);
}
if (Data()->queue != nullptr)
{
XTaskQueueCloseHandle(Data()->queue);
Data()->queue = nullptr;
}
memHook->LogStats("CleanupLeakCheck post-XalCleanupAsync");
memHook->LogLeaks();
}
@ -370,8 +349,11 @@ HRESULT RunTestWithoutCleanup(const std::string& scriptName)
bool testLoaded = LoadFile(scriptName);
if (!testLoaded)
{
std::string scriptFailure = "Failed to load " + scriptName;
Log(scriptFailure.c_str());
return E_FAIL;
}
return WaitForTestResult();
}
@ -412,10 +394,14 @@ HRESULT ApiRunnerRunTest(std::string testName)
HRESULT RunSetupScript()
{
std::string sharedFolder = "_luasetup_\\xal";
char message[4096] = {};
#if HC_PLATFORM != HC_PLATFORM_ANDROID
std::string sharedFolder = "_luasetup_\\xal";
sprintf_s(message, "tests\\%s\\setup.lua", sharedFolder.c_str());
#else
std::string sharedFolder = "xal";
sprintf_s(message, "%s/setup.lua", sharedFolder.c_str());
#endif
std::string strFilePath = pal::FindFile(message);
if (strFilePath.empty() || strFilePath.length() < 5)
{
@ -423,7 +409,7 @@ HRESULT RunSetupScript()
return E_NOINTERFACE;
}
return RunTestInternal(strFilePath, true);
return RunTestInternal(message, true);
}
void OnCmdRepeatRunTest(const std::vector<std::string>& cmdLineTokens)
@ -539,10 +525,12 @@ HRESULT RunTestsHelper(TestSet set)
HRESULT hr = RunSetupScript();
if (FAILED(hr))
{
LogToScreen("RunSetupScript() failed with HR = %s", ConvertHR(hr).c_str());
return hr;
}
if (!Data()->gotXalUser)
{
LogToScreen("Data()->GotXalUser was invalid");
return E_NOT_VALID_STATE;
}
@ -623,6 +611,7 @@ HRESULT RunTestsHelper(TestSet set)
{
auto memHook = GetApiRunnerMemHook();
memHook->LogUnhookedStats();
APIRunner_CleanupLeakCheck();
}
CallLuaString("test.summary()");
@ -800,7 +789,17 @@ web::json::array extract_json_array(
std::string ApiRunnerReadFile(std::string fileName)
{
assert(Data() != nullptr); // call ApiRunnerSetupApiExplorer() first
#if HC_PLATFORM == HC_PLATFORM_ANDROID
// In Android, the test files are considered assets.
// These files are copied from the assets folder into the external storage
// when the app is installed and launched on a device.
// Searching for the file is then done using the filename and doesn't use paths like other platforms
std::string fileNameEdited = fileName.substr(0, fileName.find_last_of("\\"));
std::string strFilePath = pal::FindFile(fileNameEdited);
#else
std::string strFilePath = pal::FindFile(fileName);
#endif
if (strFilePath.empty())
{
std::string testPath = "Tests\\" + fileName;
@ -893,14 +892,14 @@ HRESULT ApiRunnerRunTestWithSetup(std::string testName, bool repeat)
return E_UNEXPECTED;
}
Data()->m_runningTests = true;
SetupLua();
if (Data()->m_trackUnhookedMemory)
{
auto memHook = GetApiRunnerMemHook();
memHook->StartMemTracking();
}
Data()->m_runningTests = true;
SetupLua();
HRESULT hr = RunSetupScript();
if (SUCCEEDED(hr))
{
@ -930,6 +929,7 @@ HRESULT ApiRunnerRunTestWithSetup(std::string testName, bool repeat)
{
auto memHook = GetApiRunnerMemHook();
memHook->LogUnhookedStats();
APIRunner_CleanupLeakCheck();
}
CleanupLua();
@ -1266,3 +1266,18 @@ void SetupAPNSRegistrationToken(std::string registrationToken)
Data()->apnsToken = registrationToken;
}
#endif
#if HC_PLATFORM == HC_PLATFORM_ANDROID
void SetupAndroidContext( JavaVM *javaVM, jobject context, jclass mainActivityClass, jobject mainActivityInstance, jmethodID getApplicationContext)
{
Data()->javaVM = javaVM;
Data()->m_mainActivityClass = mainActivityClass;
Data()->m_getApplicationContext = getApplicationContext;
Data()->m_mainActivityClassInstance = mainActivityInstance;
Data()->applicationContext = context;
Data()->initArgs = {};
Data()->initArgs.applicationContext = context;
Data()->initArgs.javaVM = javaVM;
}
#endif

Просмотреть файл

@ -3,6 +3,10 @@
#if HC_PLATFORM == HC_PLATFORM_WIN32
#include <shlobj.h>
#endif
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include "pal.h"
#endif
#include <stdio.h>
std::string g_logFilePath;
@ -56,7 +60,7 @@ void LogToFile(_Printf_format_string_ char const* format, ...)
#endif
}
#if HC_PLATFORM != HC_PLATFORM_UWP && HC_PLATFORM != HC_PLATFORM_WIN32 && HC_PLATFORM != HC_PLATFORM_GDK && HC_PLATFORM != HC_PLATFORM_XDK && HC_PLATFORM != HC_PLATFORM_IOS
#if HC_PLATFORM != HC_PLATFORM_UWP && HC_PLATFORM != HC_PLATFORM_WIN32 && HC_PLATFORM != HC_PLATFORM_GDK && HC_PLATFORM != HC_PLATFORM_XDK && HC_PLATFORM != HC_PLATFORM_IOS && HC_PLATFORM != HC_PLATFORM_ANDROID
void LogToScreen(_Printf_format_string_ char const* format, ...)
{

Просмотреть файл

@ -14,7 +14,9 @@
#include "lapi.c"
#include "lauxlib.c"
#include "lbaselib.c"
#if HC_PLATFORM != HC_PLATFORM_ANDROID
#include "lbitlib.c"
#endif
#include "lcode.c"
#include "lcorolib.c"
#include "lctype.c"

Просмотреть файл

@ -15,6 +15,10 @@
#define TRACE_MAX_FUNCTION_NAME_LENGTH 1024
#endif
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include "runner.h"
#endif
ApiRunerMemHook* g_mem = new ApiRunerMemHook();
bool g_rawMemHookInitTracking{ false };
@ -219,21 +223,47 @@ void ApiRunerMemHook::ResetStats()
m_mapStackLog.clear();
}
void MemHookLog(_Printf_format_string_ char const* format, ...)
{
// Stock impl that just logs to file
// Hook up UI logs for each platform based on platform specific UI display calls
#if HC_PLATFORM_IS_MICROSOFT
char message[8000] = {};
va_list varArgs{};
va_start(varArgs, format);
pal::vsprintf(message, 4096, format, varArgs);
va_end(varArgs);
OutputDebugStringA(message);
OutputDebugStringA("\n");
#else
UNREFERENCED_PARAMETER(format);
#endif
}
void ApiRunerMemHook::LogLeaks()
{
std::lock_guard<std::recursive_mutex> guard(m_lock);
LogToScreen("Leaks: -- START --");
LogToScreen("Leaks: %d mem leaks found", m_allocSizeMap.size());
// Using MemHookLog since long LogToScreen lines can causes mem allocations and thus doesn't work well in this module
MemHookLog("Leaks: -- START --");
for (auto& it : m_allocSizeMap)
{
void* ptr = it.first;
uint64_t size = it.second;
auto& stackLog = m_mapStackLog[ptr];
auto& id = m_allocIdMap[ptr];
LogToScreen("[%d] %0.8x: %d from %s", id, ptr, size, stackLog[4].c_str());
if (stackLog.size() >= 4)
MemHookLog("[%d] %0.8x: %d from %s", id, ptr, size, stackLog[4].c_str());
else
MemHookLog("[%d] %0.8x: %d", id, ptr, size);
}
LogToScreen("Leaks: -- END --");
MemHookLog("Leaks: -- END --");
LogToFile("== Leak CSV Start ==");
MemHookLog("== Leak CSV Start ==");
for (auto& it : m_allocSizeMap)
{
void* ptr = it.first;
@ -244,17 +274,17 @@ void ApiRunerMemHook::LogLeaks()
for (auto& stackLine : stackLog)
{
stackLineId++;
LogToFile("%d,%0.8x,%d,%d,%s", id, ptr, size, stackLineId, stackLine.c_str());
MemHookLog("%d,%0.8x,%d,%d,%s", id, ptr, size, stackLineId, stackLine.c_str());
}
}
LogToFile("== Leak CSV End ==");
MemHookLog("== Leak CSV End ==");
}
void ApiRunerMemHook::LogStats(const std::string& name)
{
std::lock_guard<std::recursive_mutex> guard(m_lock);
LogToScreen("%s mem: %u outstanding alloc, (%u total / %u deleted)", name.c_str(), m_allocated - m_allocDeleted, m_allocated, m_allocDeleted);
MemHookLog("%s mem: %u outstanding alloc, (%u total / %u deleted)", name.c_str(), m_allocated - m_allocDeleted, m_allocated, m_allocDeleted);
}
// IsStackInsideCallback() needs non-allocating case insenstive string compare so using manual impl

Просмотреть файл

@ -11,7 +11,13 @@
#if HC_PLATFORM_IS_MICROSOFT
#pragma warning( pop )
#endif
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include <thread>
#include "multidevice.h"
#include "api_explorer.h"
#include "runner.h"
#include "pal.h"
#endif
#if __has_include("apirunnercloudfns.h")
#include "apirunnercloudfns.h"
#else
@ -571,6 +577,13 @@ HRESULT ApiRunnerMultiDeviceManager::MakeCall(
auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->context = contextPtr.get();
XTaskQueueHandle queue = nullptr;
hr = XTaskQueueCreate(
XTaskQueueDispatchMode::ThreadPool,
XTaskQueueDispatchMode::ThreadPool,
&queue);
RETURN_HR_IF_FAILED(hr);
asyncBlock->queue = queue;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
std::string responseString;

Просмотреть файл

@ -21,18 +21,31 @@ constexpr auto sprintf_s = sprintf;
#endif
#if HC_PLATFORM == HC_PLATFORM_ANDROID
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
#endif
namespace pal
{
void strcpy(char * dst, size_t size, const char* src);
int stricmp(const char* left, const char* right);
int vsprintf(char* message, size_t size,char const* format, va_list varArgs);
char* strtok(char* str, char const* delimiter, char** context);
// Due to java not supporting unsigned numeric values, we have to do regular long on Android
#if HC_PLATFORM != HC_PLATFORM_ANDROID
void Sleep(unsigned long duration);
#else
void Sleep(long duration);
#endif
bool FileExists(std::string fileName); // TODO might only be used on win32
std::vector<std::string> EnumFilesInFolder(std::string folder, std::string spec);
std::string FindFile(std::string fileName);
std::string GetLuaPath();
#if HC_PLATFORM == HC_PLATFORM_ANDROID
std::string OpenFile(std::string filePath);
#endif
}

Просмотреть файл

@ -3,6 +3,12 @@
#include "pch.h"
#include "utils.h"
#if HC_PLATFORM == HC_PLATFORM_ANDROID
#include "runner.h"
#include "pal.h"
#include "api_explorer.h"
#endif
#if HC_PLATFORM == HC_PLATFORM_GDK
#include <XGameErr.h>
#endif
@ -168,6 +174,7 @@ std::string ConvertHR(HRESULT hr)
std::string ReadFile(std::string fileName)
{
std::string filePath = pal::FindFile(fileName);
if (filePath.empty())
{

Просмотреть файл

@ -15,6 +15,7 @@ function common.cleanup()
XalUserCloseHandle()
XblCleanupAsync()
XalCleanupAsync()
XTaskQueueCloseHandle()
end
function common.OnXalTryAddFirstUserSilentlyAsync()

Просмотреть файл

@ -4,6 +4,8 @@ common = require 'common'
function AchievementProgressNotifications_Handler()
print ('AchievementProgressNotifications_Handler')
XblAchievementsAddAchievementProgressChangeHandler()
SetCheckHR(0)
Sleep(5000)
XblAchievementsUpdateAchievementAsync("2", 20)
end
@ -17,12 +19,17 @@ function OnXblAchievementsUpdateAchievementAsync()
print ("OnXblAchievementsUpdateAchievementAsync")
local hr = GetLastError()
SetCheckHR(1)
if hr ~= 0 and hr ~= -2145844944 then -- -2145844944 == 0x80190130 == HTTP_E_STATUS_NOT_MODIFIED
if hr == -2145844944 then -- -2145844944 == 0x80190130 == HTTP_E_STATUS_NOT_MODIFIED
print("Achievement not modified.")
XblAchievementsRemoveAchievementProgressChangeHandler()
test.stopTest()
elseif hr ~= 0 then
test.equal(hr, 0);
print("Failure. hr=" .. hr)
test.stopTest()
end
print ("Waiting to receive notification.")
else
print ("Waiting to receive notification.")
end
end
test.skip = true;

Просмотреть файл

@ -2,6 +2,8 @@
test = require 'u-test'
common = require 'common'
--Bug 35915673 Disabling websocket tests due to websocket.org no longer in service
test.skip = true
test.testWebsocketCloseHandleWhileConnected = function()
print("testWebsocketCloseHandleWhileConnected")

Просмотреть файл

@ -2,6 +2,8 @@
test = require 'u-test'
common = require 'common'
--Bug 35915673 Disabling websocket tests due to websocket.org no longer in service
test.skip = true
test.testWebsocketDisconnectWhileConnecting = function()
print("testWebsocketDisconnectWhileConnecting")

Просмотреть файл

@ -2,6 +2,8 @@
test = require 'u-test'
common = require 'common'
--Bug 35915673 Disabling websocket tests due to websocket.org no longer in service
test.skip = true
test.testWebsocketSend = function()
print("testWebsocketSend")

Просмотреть файл

@ -5,9 +5,17 @@ common = require 'common'
function RTAActivation_Handler()
print("RTAActivation_Handler")
StartSocialManagerDoWorkLoop()
XblRealTimeActivityAddConnectionStateChangeHandler()
XblSocialAddSocialRelationshipChangedHandler()
-- Test isn't valid on all platforms (i.e. on Win32 we set up a notification service subscription by default so the RTA connection
-- won't be torn down just by removing the social relationship changed handler).
isGdk = IsGDKPlatform()
if isGdk then
StartSocialManagerDoWorkLoop()
XblRealTimeActivityAddConnectionStateChangeHandler()
XblSocialAddSocialRelationshipChangedHandler()
else
test.stopTest()
end
end
function OnXblRealTimeActivityAddConnectionStateChangeHandler_Connecting()

Просмотреть файл

@ -3,8 +3,16 @@ common = require 'common'
function RtaActivateDeactivateCpp()
print("RtaActivateDeactivateCpp");
RealTimeActivityServiceAddConnectionStateChangeHandler();
RealTimeActivityServiceActivate();
-- Test isn't valid on all platforms (i.e. on Win32 we set up a notification service subscription by default so the RTA connection
-- won't be torn down just by removing the social relationship changed handler).
isGdk = IsGDKPlatform()
if isGdk then
RealTimeActivityServiceAddConnectionStateChangeHandler();
RealTimeActivityServiceActivate();
else
test.stopTest()
end
end
function OnRealTimeActivityServiceAddConnectionStateChangeHandler_Connected()

Просмотреть файл

@ -3,9 +3,17 @@ common = require 'common'
function SimpleRTA_Handler()
print("SimpleRTA");
XblRealTimeActivityAddConnectionStateChangeHandler();
-- Add a real-time handler to force RTA connection
XblSocialAddSocialRelationshipChangedHandler();
-- Test isn't valid on all platforms (i.e. on Win32 we set up a notification service subscription by default so the RTA connection
-- won't be torn down just by removing the social relationship changed handler).
isGdk = IsGDKPlatform()
if isGdk then
XblRealTimeActivityAddConnectionStateChangeHandler();
-- Add a real-time handler to force RTA connection
XblSocialAddSocialRelationshipChangedHandler();
else
test.stopTest()
end
end
function OnXblRealTimeActivityAddConnectionStateChangeHandler_Connected()

Просмотреть файл

@ -5,8 +5,16 @@ common = require 'common'
function SimpleRTALegacy_Handler()
print("SimpleRTALegacy_Handler");
XblRealTimeActivityAddConnectionStateChangeHandler();
XblRealTimeActivityActivate();
-- Test isn't valid on all platforms (i.e. on Win32 we set up a notification service subscription by default so the RTA connection
-- won't be torn down just by removing the social relationship changed handler).
isGdk = IsGDKPlatform()
if isGdk then
XblRealTimeActivityAddConnectionStateChangeHandler();
XblRealTimeActivityActivate();
else
test.stopTest()
end
end
function OnXblRealTimeActivityAddConnectionStateChangeHandler_Connected()

Просмотреть файл

@ -0,0 +1,45 @@
test = require 'u-test'
common = require 'common'
function SocialSubUnSub_Handler()
XblRealTimeActivityAddConnectionStateChangeHandler();
XblPresenceAddDevicePresenceChangedHandler()
XblPresenceAddTitlePresenceChangedHandler()
XblRealTimeActivityActivate();
end
function OnXblRealTimeActivityAddConnectionStateChangeHandler_Connected()
print("RTA connection connected");
TestLoop()
end
function OnDevicePresenceChanged()
end
function OnTitlePresenceChanged()
end
function TestLoop()
SubscribeToTitleAndDevicePresenceChangeForFriends();
end
loopCount = 0
function OnSubscribeToTitleAndDevicePresenceChangeForFriends()
loopCount = loopCount + 1
if loopCount == 3 then
Sleep(500);
UnsubscribeToTitleAndDevicePresenceChangeForFriends();
Sleep(500);
test.stopTest();
else
print("OnSubscribeToTitleAndDevicePresenceChangeForFriends")
Sleep(500);
UnsubscribeToTitleAndDevicePresenceChangeForFriends();
Sleep(500);
TestLoop()
end
end
test.SocialSubUnSub = function()
common.init(SocialSubUnSub_Handler)
end

Просмотреть файл

@ -458,7 +458,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>uuid.lib;$(Console_Libs);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dbghelp.lib;uuid.lib;$(Console_Libs);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>

Просмотреть файл

@ -17,7 +17,6 @@
<XsapiPlatform Condition="'$(ApplicationType)'=='Windows Store'">UWP</XsapiPlatform>
<XsapiPlatform Condition="'$(ApplicationType)'=='' AND '$(Platform)'!='Durango'">Win32</XsapiPlatform>
<XsapiPlatform Condition="'$(ApplicationType)'=='' AND '$(Platform)'=='Durango'">XDK</XsapiPlatform>
<XsapiPlatform Condition="'$(ApplicationType)'=='Android'">Android</XsapiPlatform>
</PropertyGroup>
<!--Set toolset and project name-->
@ -28,7 +27,6 @@
<XsapiToolset Condition="'$(PlatformToolset)'=='v142'">142</XsapiToolset>
<XsapiToolset Condition="'$(XsapiToolset)'==''">141</XsapiToolset>
<XsapiProjectName Condition="'$(XsapiPlatform)' != 'Android'">Microsoft.Xbox.Services.$(XsapiToolset).$(XsapiPlatform).Cpp</XsapiProjectName>
<XsapiProjectName Condition="'$(XsapiPlatform)' == 'Android'">Microsoft.Xbox.Services.$(XsapiToolset).$(XsapiPlatform)</XsapiProjectName>
<XsapiProjectName Condition="'$(XsapiPlatform)' == 'GDK'">Microsoft.Xbox.Services.$(XsapiToolset).GDK.C</XsapiProjectName>
</PropertyGroup>
@ -49,15 +47,7 @@
<PropertyGroup Condition="'$(XsapiPlatform)' == 'Win32' AND '$(XsapiUnitTests)'!='true'">
<XsapiCllRefs>true</XsapiCllRefs>
</PropertyGroup>
<PropertyGroup Condition="'$(XsapiPlatform)' == 'Android'">
<XsapiXalRefs>true</XsapiXalRefs>
<XsapiXalHeaders>true</XsapiXalHeaders>
<UseCasablanaLite>true</UseCasablanaLite>
<XsapiCllRefs>true</XsapiCllRefs>
<XsapiTCUIHeaders>true</XsapiTCUIHeaders>
</PropertyGroup>
<PropertyGroup Condition="'$(XsapiPlatform)' == 'UWP'">
<XsapiXalRefs>true</XsapiXalRefs>
<XsapiXalHeaders>true</XsapiXalHeaders>
@ -81,7 +71,6 @@
<ClCompile>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;_NO_PPLXIMP;_NO_XSAPIIMP;XBL_API_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(XsapiPlatform)' == 'GDK'">HC_WINHTTP_WEBSOCKETS;HC_PLATFORM_IS_MICROSOFT=1;HC_PLATFORM_GDK=4;HC_PLATFORM=HC_PLATFORM_GDK;HC_DATAMODEL=HC_DATAMODEL_LLP64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(XsapiPlatform)' == 'Android'">__STDC_WANT_LIB_EXT1__=1;ASIO_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(XsapiBuildFromSource)' != ''">XSAPI_BUILT_FROM_SOURCE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>;$(XsapiInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
@ -98,7 +87,6 @@
<Project Condition="'$(XsapiPlatform)' == 'Win32' AND '$(XsapiToolset)' == '140'">{AB77D282-496D-413F-9A51-F78DF740A82A}</Project>
<Project Condition="'$(XsapiPlatform)' == 'XDK'">{8A112040-CDA1-4490-B518-62DFCC451FA7}</Project>
<Project Condition="'$(XsapiPlatform)' == 'GDK'">{60139f62-bf37-4f11-bd93-5fbf4e92100c}</Project>
<Project Condition="'$(XsapiPlatform)' == 'Android'">{5fa18992-3e85-4090-b21e-6ef7fb613a44}</Project>
<Project Condition="'$(XsapiPlatform)' == 'DesktopBridge' AND '$(XsapiToolset)' == '141'">{B0D02E4C-DB36-416C-8F1E-8666B3FAF876}</Project>
</ProjectReference>
</ItemGroup>
@ -188,12 +176,10 @@
<ProjectReference Include="$(XalRoot)Source\Xal\Xal.$(XalPlatform).vcxproj">
<Project Condition="'$(XalPlatform)' == 'Win32'">{7333335C-CD75-4802-8F56-702C0BE2563F}</Project>
<Project Condition="'$(XalPlatform)' == 'UWP'">{7326b85d-b8df-4a59-a2c7-c721a7a1b8cb}</Project>
<Project Condition="'$(XalPlatform)' == 'Android'">{554cba60-e373-40c9-9284-b93e0fc27362}</Project>
</ProjectReference>
<ProjectReference Include="$(XalRoot)External\CompactCoreCLL\CompactCoreCLL.$(XalPlatform).vcxproj">
<Project Condition="'$(XalPlatform)' == 'Win32'">{F321E346-9F67-4291-9A71-D219F892BDEC}</Project>
<Project Condition="'$(XalPlatform)' == 'UWP'">{9E8E68BA-6CBE-408E-8738-320474546551}</Project>
<Project Condition="'$(XalPlatform)' == 'Android'">{2f1f7c6a-1fda-4cce-935d-0e9324d5db92}</Project>
</ProjectReference>
</ItemGroup>