more work

This commit is contained in:
Unixian
2025-01-11 02:49:06 -05:00
parent 7006b18265
commit 58ba4410f6
17 changed files with 312 additions and 34 deletions
@@ -0,0 +1,77 @@
#include "pch.h"
#include "ConnectedStorage.h"
#include "appmodel.h"
#include <shlobj.h>
#include <strsafe.h>
void WinDurango::impl::ConnectedStorage::CreateContainer(const wchar_t* name)
{
}
PWSTR WinDurango::impl::ConnectedStorage::ObtainPackageName()
{
UINT32 length = 0;
LONG rc = GetPackageFamilyName(GetCurrentProcess( ), &length, NULL);
PWSTR familyName = static_cast<PWSTR>(malloc(length * sizeof(*familyName)));
if (familyName == NULL)
{
wprintf(L"[ConnectedStorage] Error allocating memory\n");
return nullptr;
}
rc = GetPackageFamilyName(GetCurrentProcess(), &length, familyName);
if (rc != ERROR_SUCCESS)
wprintf(L"[ConnectedStorage] Error %d retrieving PackageFamilyName\n", rc);
return familyName;
}
void WinDurango::impl::ConnectedStorage::CreateDirectories(const wchar_t* storageType)
{
PWSTR packageName = ObtainPackageName();
if (packageName == nullptr) {
return;
}
WCHAR folderPath[MAX_PATH];
HRESULT hr = StringCchPrintf(folderPath, MAX_PATH, L"%s\\WinDurango\\%s_Storage", _wgetcwd(NULL, 0), packageName);
if (FAILED(hr))
{
wprintf(L"[ConnectedStorage] Error %d formatting folder path\n", hr);
CoTaskMemFree(packageName);
return;
}
if (CreateDirectory(folderPath, NULL) || GetLastError() == ERROR_ALREADY_EXISTS)
{
hr = StringCchCat(folderPath, MAX_PATH, storageType);
if (SUCCEEDED(hr))
{
if (!CreateDirectory(folderPath, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
{
wprintf(L"[ConnectedStorage] Error %d creating storage folder\n", GetLastError());
}
}
else
{
wprintf(L"[ConnectedStorage] Error %d formatting storage folder path\n", hr);
}
}
else
{
wprintf(L"[ConnectedStorage] Error %d creating package folder\n", GetLastError());
}
if (storagePath == nullptr)
storagePath = _wcsdup(folderPath);
CoTaskMemFree(packageName);
free(packageName);
}
void WinDurango::impl::ConnectedStorage::InitializeStorage()
{
//CreateDirectories(L"\\UserStorage");
//printf("[ConnectedStorage] User storage initialized at %S\n", storagePath);
}
@@ -0,0 +1,20 @@
#pragma once
namespace WinDurango::impl
{
class ConnectedStorage
{
public:
void InitializeStorage( );
void CreateContainer(const wchar_t* name);
private:
static PWSTR ObtainPackageName( );
void CreateDirectories(const wchar_t* storageType);
const wchar_t* storagePath;
};
inline ConnectedStorage* s_userStorage;
}
@@ -25,7 +25,7 @@ namespace winrt::Microsoft::Xbox::Services::Presence::implementation
{
PresenceData::PresenceData(hstring const& serviceConfigurationId, hstring const& presenceId)
{
throw hresult_not_implemented();
printf("[PresenceData] PresenceData::PresenceData(hstring const& serviceConfigurationId, hstring const& presenceId) called\n");
}
PresenceData::PresenceData(hstring const& serviceConfigurationId, hstring const& presenceId, winrt::Windows::Foundation::Collections::IVectorView<hstring> const& presenceTokenIds)
{
@@ -45,7 +45,8 @@ namespace winrt::Microsoft::Xbox::Services::Presence::implementation
}
winrt::Windows::Foundation::IAsyncAction PresenceService::SetPresenceAsync(bool isUserActiveInTitle, winrt::Microsoft::Xbox::Services::Presence::PresenceData presenceData)
{
throw hresult_not_implemented();
printf("[PresenceService] SetPresenceAsync called\n");
co_return;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Microsoft::Xbox::Services::Presence::PresenceRecord> PresenceService::GetPresenceAsync(hstring xboxUserId)
{
@@ -1,5 +1,7 @@
#include "pch.h"
#include "Microsoft.Xbox.Services.XboxLiveContext.h"
#include "Microsoft.Xbox.Services.Presence.PresenceService.h"
#include "Microsoft.Xbox.Services.XboxLiveContext.g.cpp"
// WARNING: This file is automatically generated by a tool. Do not directly
@@ -73,7 +75,7 @@ namespace winrt::Microsoft::Xbox::Services::implementation
}
winrt::Microsoft::Xbox::Services::Presence::PresenceService XboxLiveContext::PresenceService()
{
throw hresult_not_implemented();
return winrt::make<Presence::implementation::PresenceService>( );
}
winrt::Microsoft::Xbox::Services::GameServerPlatform::GameServerPlatformService XboxLiveContext::GameServerPlatformService()
{
@@ -1,6 +1,7 @@
#include "pch.h"
#include "Windows.Xbox.ApplicationModel.Store.Product.h"
#include "Windows.Xbox.ApplicationModel.Store.Product.g.cpp"
#include "Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.h"
// WARNING: This file is automatically generated by a tool. Do not directly
// add this file to your project, as any changes you make will be lost.
@@ -45,10 +46,14 @@ namespace winrt::Windows::Xbox::ApplicationModel::Store::implementation
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::ApplicationModel::Store::PrivilegeCheckResult> Product::CheckPrivilegeAsync(winrt::Windows::Xbox::System::IUser user, uint32_t privilegeId, bool attemptResolution, hstring friendlyDisplay)
{
auto args = winrt::make<implementation::ProductPurchasedEventArgs>( );
m_productPurchasedEvent(args);
co_return PrivilegeCheckResult::NoIssue;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::ApplicationModel::Store::PrivilegeCheckResult> Product::CheckPrivilegesAsync(winrt::Windows::Xbox::System::IUser user, winrt::Windows::Foundation::Collections::IVectorView<uint32_t> privilegeIds, bool attemptResolution, hstring friendlyDisplay)
{
auto args = winrt::make<implementation::ProductPurchasedEventArgs>( );
m_productPurchasedEvent(args);
co_return PrivilegeCheckResult::NoIssue;
}
winrt::event_token Product::ProductPurchased(winrt::Windows::Xbox::ApplicationModel::Store::ProductPurchasedEventHandler const& handler)
@@ -0,0 +1,30 @@
#include "pch.h"
#include "Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.h"
#include "Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.g.cpp"
// WARNING: This file is automatically generated by a tool. Do not directly
// add this file to your project, as any changes you make will be lost.
// This file is a stub you can use as a starting point for your implementation.
//
// To add a copy of this file to your project:
// 1. Copy this file from its original location to the location where you store
// your other source files (e.g. the project root).
// 2. Add the copied file to your project. In Visual Studio, you can use
// Project -> Add Existing Item.
// 3. Delete this comment and the 'static_assert' (below) from the copied file.
// Do not modify the original file.
//
// To update an existing file in your project:
// 1. Copy the relevant changes from this file and merge them into the copy
// you made previously.
//
// This assertion helps prevent accidental modification of generated files.
//static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
namespace winrt::Windows::Xbox::ApplicationModel::Store::implementation
{
hstring ProductPurchasedEventArgs::Receipt()
{
throw hresult_not_implemented();
}
}
@@ -0,0 +1,31 @@
#pragma once
#include "Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.g.h"
// WARNING: This file is automatically generated by a tool. Do not directly
// add this file to your project, as any changes you make will be lost.
// This file is a stub you can use as a starting point for your implementation.
//
// To add a copy of this file to your project:
// 1. Copy this file from its original location to the location where you store
// your other source files (e.g. the project root).
// 2. Add the copied file to your project. In Visual Studio, you can use
// Project -> Add Existing Item.
// 3. Delete this comment and the 'static_assert' (below) from the copied file.
// Do not modify the original file.
//
// To update an existing file in your project:
// 1. Copy the relevant changes from this file and merge them into the copy
// you made previously.
//
// This assertion helps prevent accidental modification of generated files.
//static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
namespace winrt::Windows::Xbox::ApplicationModel::Store::implementation
{
struct ProductPurchasedEventArgs : ProductPurchasedEventArgsT<ProductPurchasedEventArgs>
{
ProductPurchasedEventArgs() = default;
hstring Receipt();
};
}
@@ -42,7 +42,7 @@ namespace winrt::Windows::Xbox::Input::implementation
}
winrt::Windows::Xbox::System::User Gamepad::User()
{
return winrt::make<winrt::Windows::Xbox::System::implementation::User>( );
return System::implementation::User::Users( ).GetAt(0);
}
winrt::Windows::Xbox::Input::INavigationReading Gamepad::GetNavigationReading()
{
@@ -117,10 +117,10 @@ namespace winrt::Windows::Xbox::Input::implementation
reading.RightThumbstickX = xiState.Gamepad.sThumbRX / 32768.f;
reading.RightThumbstickY = xiState.Gamepad.sThumbRY / 32768.f;
}
else {
printf("Controller input failure: %x\n", XInputGetState(0, &xiState));
}
}
//else {
// printf("Controller input failure: %x\n", XInputGetState(0, &xiState));
//}
}
if (GetAsyncKeyState('A'))
reading.Buttons |= GamepadButtons::A;
@@ -151,7 +151,7 @@ namespace winrt::Windows::Xbox::Input::implementation
if (GetAsyncKeyState(VK_RCONTROL))
reading.Buttons |= GamepadButtons::RightShoulder;
printf("Reading: %d\n", reading.Buttons);
//printf("Reading: %d\n", reading.Buttons);
return reading;
}
winrt::event_token Gamepad::ReadingChanged(winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Xbox::Input::Gamepad, winrt::Windows::Xbox::Input::IGamepadReadingChangedEventArgs> const& handler)
@@ -19,7 +19,7 @@
// you made previously.
//
// This assertion helps prevent accidental modification of generated files.
//////////static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
//static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
namespace winrt::Windows::Xbox::Storage::implementation
{
@@ -31,6 +31,30 @@ namespace winrt::Windows::Xbox::Storage::implementation
{
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageContainer::SubmitUpdatesAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete)
{
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageContainer::ReadAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToRead)
{
co_await winrt::resume_background( );
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer>> ConnectedStorageContainer::GetAsync(winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToRead)
{
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageContainer::SubmitPropertySetUpdatesAsync(winrt::Windows::Foundation::Collections::IPropertySet blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete)
{
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageContainer::SubmitUpdatesAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete, hstring displayName)
{
throw hresult_not_implemented();
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageContainer::SubmitPropertySetUpdatesAsync(winrt::Windows::Foundation::Collections::IPropertySet blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete, hstring displayName)
{
throw hresult_not_implemented();
}
winrt::Windows::Xbox::Storage::BlobInfoQueryResult ConnectedStorageContainer::CreateBlobInfoQuery(hstring const& blobNamePrefix)
{
throw hresult_not_implemented();
@@ -18,7 +18,7 @@
// you made previously.
//
// This assertion helps prevent accidental modification of generated files.
//////////static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
//static_assert(false, "This file is generated by a tool and will be overwritten. Open this error and view the comment for assistance.");
namespace winrt::Windows::Xbox::Storage::implementation
{
@@ -28,6 +28,12 @@ namespace winrt::Windows::Xbox::Storage::implementation
hstring Name();
winrt::Windows::Xbox::Storage::ConnectedStorageSpace OwningSpace();
winrt::Windows::Foundation::IAsyncAction SubmitUpdatesAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete);
winrt::Windows::Foundation::IAsyncAction ReadAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToRead);
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer>> GetAsync(winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToRead);
winrt::Windows::Foundation::IAsyncAction SubmitPropertySetUpdatesAsync(winrt::Windows::Foundation::Collections::IPropertySet blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete);
winrt::Windows::Foundation::IAsyncAction SubmitUpdatesAsync(winrt::Windows::Foundation::Collections::IMapView<hstring, winrt::Windows::Storage::Streams::IBuffer> blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete, hstring displayName);
winrt::Windows::Foundation::IAsyncAction SubmitPropertySetUpdatesAsync(winrt::Windows::Foundation::Collections::IPropertySet blobsToWrite, winrt::Windows::Foundation::Collections::IIterable<hstring> blobsToDelete, hstring displayName);
winrt::Windows::Xbox::Storage::BlobInfoQueryResult CreateBlobInfoQuery(hstring const& blobNamePrefix);
};
}
@@ -5,6 +5,7 @@
#include "Windows.Xbox.Storage.ConnectedStorageSpace.g.cpp"
#include "Windows.Xbox.System.Console.h"
#include "Windows.Xbox.System.User.h"
#include "../ConnectedStorage/ConnectedStorage.h"
// WARNING: This file is automatically generated by a tool. Do not directly
// add this file to your project, as any changes you make will be lost.
@@ -29,31 +30,73 @@ namespace winrt::Windows::Xbox::Storage::implementation
{
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetForUserAsync(winrt::Windows::Xbox::System::User user)
{
throw hresult_not_implemented();
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
auto storageClass = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetForUserAsync(winrt::Windows::Xbox::System::User user, hstring serviceConfigurationId)
{
throw hresult_not_implemented();
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
userStorageSpace = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetForMachineAsync()
{
co_return nullptr;
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
userStorageSpace = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetForMachineAsync(hstring serviceConfigurationId)
{
throw hresult_not_implemented();
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
userStorageSpace = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetSyncOnDemandForUserAsync(winrt::Windows::Xbox::System::User user)
{
co_return winrt::make<ConnectedStorageSpace>();
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
userStorageSpace = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> ConnectedStorageSpace::GetSyncOnDemandForUserAsync(winrt::Windows::Xbox::System::User user, hstring serviceConfigurationId)
{
throw hresult_not_implemented();
if (userStorageSpace == Storage::ConnectedStorageSpace(nullptr))
{
userStorageSpace = winrt::make<implementation::ConnectedStorageSpace>( );
WinDurango::impl::s_userStorage = new WinDurango::impl::ConnectedStorage( );
WinDurango::impl::s_userStorage->InitializeStorage( );
}
co_return userStorageSpace;
}
winrt::Windows::Xbox::System::User ConnectedStorageSpace::User()
{
return winrt::make<winrt::Windows::Xbox::System::implementation::User>( );
return System::implementation::User::Users( ).GetAt(0);
}
hstring ConnectedStorageSpace::ServiceConfigurationId()
{
@@ -65,8 +108,21 @@ namespace winrt::Windows::Xbox::Storage::implementation
}
winrt::Windows::Xbox::Storage::ConnectedStorageContainer ConnectedStorageSpace::CreateContainer(hstring const& containerName)
{
return winrt::make<implementation::ConnectedStorageContainer>( );
if (WinDurango::impl::s_userStorage == nullptr)
assert("s_userStorage is null");
if (staticContainer == Storage::ConnectedStorageContainer(nullptr))
staticContainer = winrt::make<ConnectedStorageContainer>( );
WinDurango::impl::s_userStorage->CreateContainer(containerName.c_str( ));
return staticContainer;
}
winrt::Windows::Foundation::IAsyncAction ConnectedStorageSpace::DeleteContainerAsync(hstring containerName)
{
co_return;
}
winrt::Windows::Xbox::Storage::ContainerInfoQueryResult ConnectedStorageSpace::CreateContainerInfoQuery(hstring const& containerNamePrefix)
{
throw hresult_not_implemented();
@@ -28,17 +28,20 @@ namespace winrt::Windows::Xbox::Storage::implementation
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetForUserAsync(winrt::Windows::Xbox::System::User user);
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetForUserAsync(winrt::Windows::Xbox::System::User user, hstring serviceConfigurationId);
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetForMachineAsync();
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetForMachineAsync( );
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetForMachineAsync(hstring serviceConfigurationId);
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetSyncOnDemandForUserAsync(winrt::Windows::Xbox::System::User user);
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::Storage::ConnectedStorageSpace> GetSyncOnDemandForUserAsync(winrt::Windows::Xbox::System::User user, hstring serviceConfigurationId);
winrt::Windows::Xbox::System::User User();
hstring ServiceConfigurationId();
bool IsReadOnly();
winrt::Windows::Xbox::System::User User( );
hstring ServiceConfigurationId( );
bool IsReadOnly( );
winrt::Windows::Xbox::Storage::ConnectedStorageContainer CreateContainer(hstring const& containerName);
winrt::Windows::Foundation::IAsyncAction DeleteContainerAsync(hstring containerName);
winrt::Windows::Xbox::Storage::ContainerInfoQueryResult CreateContainerInfoQuery(hstring const& containerNamePrefix);
winrt::Windows::Foundation::IAsyncOperation<int32_t> GetRemainingBytesInQuotaAsync();
winrt::Windows::Foundation::IAsyncOperation<int64_t> GetRemainingBytesInQuota64Async();
winrt::Windows::Foundation::IAsyncOperation<int32_t> GetRemainingBytesInQuotaAsync( );
winrt::Windows::Foundation::IAsyncOperation<int64_t> GetRemainingBytesInQuota64Async( );
inline static winrt::Windows::Xbox::Storage::ConnectedStorageSpace userStorageSpace = { nullptr };
inline static winrt::Windows::Xbox::Storage::ConnectedStorageContainer staticContainer = { nullptr };
};
}
namespace winrt::Windows::Xbox::Storage::factory_implementation
@@ -6,9 +6,9 @@
namespace winrt::Windows::Xbox::System::implementation
{
//winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserAddedEventArgs>> m_userAddedEvent;
winrt::Windows::Xbox::System::UserOnlineState User::OnlineState()
UserOnlineState User::OnlineState()
{
return winrt::Windows::Xbox::System::UserOnlineState::Unknown;
return UserOnlineState::Offline;
}
winrt::event_token User::OnlineStateChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::OnlineStateChangedEventArgs> const& handler)
{
@@ -20,10 +20,16 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Xbox::System::User> User::Users()
{
//System::User dummyUser = winrt::make<System::User>( );
//auto vector = winrt::single_threaded_vector<System::User>( );
//vector.Append(dummyUser);
return winrt::single_threaded_vector<System::User>( ).GetView();
if (staticUser == System::User(nullptr))
staticUser = winrt::make<User>( );
if (staticUsers == Foundation::Collections::IVector<winrt::Windows::Xbox::System::User>(nullptr) || staticUsers.Size() == 0)
{
staticUsers = winrt::single_threaded_vector<System::User>( );
staticUsers.Append(staticUser);
}
return staticUsers.GetView();
}
winrt::event_token User::UserAdded(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserAddedEventArgs> const& handler)
{
@@ -35,7 +41,7 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::event_token User::UserRemoved(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserRemovedEventArgs> const& handler)
{
return {};
return m_userRemovedEvent.add(handler);
}
void User::UserRemoved(winrt::event_token const& token) noexcept
{
@@ -149,10 +155,13 @@ namespace winrt::Windows::Xbox::System::implementation
}
bool User::IsGuest()
{
printf("User.IsGuest -> true\n");
return false;
}
bool User::IsSignedIn()
{
//m_onlineStateChangedEvent( );
printf("User.IsSignedIn -> true\n");
return true;
}
winrt::Windows::Xbox::System::UserLocation User::Location()
@@ -162,8 +171,8 @@ namespace winrt::Windows::Xbox::System::implementation
}
winrt::Windows::Xbox::System::User User::Sponsor()
{
printf("!!!! Windows.Xbox.System.User Sponsor | NOT IMPLEMENTED !!!!\n");
throw hresult_not_implemented();
printf("!!!! Windows.Xbox.System.User Sponsor | NOT IMPLEMENTED !!!!\n");
return nullptr;
}
hstring User::XboxUserHash()
{
@@ -71,6 +71,8 @@ namespace winrt::Windows::Xbox::System::implementation
inline static winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::UserRemovedEventArgs>> m_userRemovedEvent;
inline static winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::SignOutStartedEventArgs>> m_signOutStartedEvent;
inline static winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::System::OnlineStateChangedEventArgs>> m_onlineStateChangedEvent;
inline static winrt::Windows::Xbox::System::User staticUser = {nullptr};
inline static winrt::Windows::Foundation::Collections::IVector<winrt::Windows::Xbox::System::User> staticUsers = {nullptr};
};
}
namespace winrt::Windows::Xbox::System::factory_implementation
+8
View File
@@ -115,6 +115,9 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</Command>
</PostBuildEvent>
<Link>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
@@ -127,9 +130,11 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="ConnectedStorage\ConnectedStorage.h" />
<ClInclude Include="Implementation\Microsoft.Xbox.GameChat.AccessibilitySettingsChangedEventArgs.h" />
<ClInclude Include="Implementation\Microsoft.Xbox.GameChat.ChannelUpdatedEventArgs.h" />
<ClInclude Include="Implementation\Microsoft.Xbox.GameChat.ChatManager.h" />
@@ -392,6 +397,7 @@
<ClInclude Include="Implementation\Windows.Xbox.ApplicationModel.State.Internal.ProtocolQuery.h" />
<ClInclude Include="Implementation\Windows.Xbox.ApplicationModel.Store.Configuration.h" />
<ClInclude Include="Implementation\Windows.Xbox.ApplicationModel.Store.Product.h" />
<ClInclude Include="Implementation\Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.h" />
<ClInclude Include="Implementation\Windows.Xbox.Chat.ChatChannel.h" />
<ClInclude Include="Implementation\Windows.Xbox.Chat.ChatDecoder.h" />
<ClInclude Include="Implementation\Windows.Xbox.Chat.ChatEncoder.h" />
@@ -450,6 +456,7 @@
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ConnectedStorage\ConnectedStorage.cpp" />
<ClCompile Include="Implementation\Microsoft.Xbox.GameChat.AccessibilitySettingsChangedEventArgs.cpp" />
<ClCompile Include="Implementation\Microsoft.Xbox.GameChat.ChannelUpdatedEventArgs.cpp" />
<ClCompile Include="Implementation\Microsoft.Xbox.GameChat.ChatManager.cpp" />
@@ -712,6 +719,7 @@
<ClCompile Include="Implementation\Windows.Xbox.ApplicationModel.State.Internal.ProtocolQuery.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.ApplicationModel.Store.Configuration.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.ApplicationModel.Store.Product.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.Chat.ChatChannel.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.Chat.ChatDecoder.cpp" />
<ClCompile Include="Implementation\Windows.Xbox.Chat.ChatEncoder.cpp" />
+4
View File
@@ -437,6 +437,8 @@
<ClCompile Include="Implementation\Windows.Xbox.Input.GamepadReading.cpp">
<Filter>Implementation</Filter>
</ClCompile>
<ClCompile Include="Implementation\Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.cpp" />
<ClCompile Include="ConnectedStorage\ConnectedStorage.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
@@ -859,6 +861,8 @@
<ClInclude Include="Implementation\Windows.Xbox.Input.GamepadReading.h">
<Filter>Implementation</Filter>
</ClInclude>
<ClInclude Include="Implementation\Windows.Xbox.ApplicationModel.Store.ProductPurchasedEventArgs.h" />
<ClInclude Include="ConnectedStorage\ConnectedStorage.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />