Needed by the VR game Desperate: Vladivostok.
`IHolographicSpaceStatics2::get_IsSupported()` only returns `FALSE` on 32-bit Windows 10, but the VMs are 64-bit.
-- v3: windows.perception.stub: Implement IHolographicSpaceStatics3::get_IsConfigured(). windows.perception.stub/tests: Add IHolographicSpaceStatics3::get_IsConfigured() tests. windows.perception.stub: Add IHolographicSpaceStatics3 stub interface. include: Add IHolographicSpaceStatics3 interface definition. windows.perception.stub: Implement IHolographicSpaceStatics2::get_IsAvailable(). windows.perception.stub: Implement IHolographicSpaceStatics2::get_IsSupported(). windows.perception.stub/tests: Add IHolographicSpaceStatics2 properties tests. windows.perception.stub: Add IHolographicSpaceStatics2 stub interface. include: Add IHolographicSpaceStatics2 interface definition. include: Add windows.graphics.holographic.idl file. include: Add Windows.Foundation.Deferral definition. include: Add windows.graphics.directx.direct3d11.idl file.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by windows.graphics.holographic.idl. --- include/Makefile.in | 1 + .../windows.graphics.directx.direct3d11.idl | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 include/windows.graphics.directx.direct3d11.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 27360fa5f21..198145d59f9 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -815,6 +815,7 @@ SOURCES = \ windows.gaming.input.idl \ windows.gaming.ui.idl \ windows.globalization.idl \ + windows.graphics.directx.direct3d11.idl \ windows.graphics.directx.idl \ windows.h \ windows.media.closedcaptioning.idl \ diff --git a/include/windows.graphics.directx.direct3d11.idl b/include/windows.graphics.directx.direct3d11.idl new file mode 100644 index 00000000000..f53140545b0 --- /dev/null +++ b/include/windows.graphics.directx.direct3d11.idl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "asyncinfo.idl"; +import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +import "windows.graphics.directx.idl"; + +namespace Windows.Graphics.DirectX.Direct3D11 { + typedef struct Direct3DMultisampleDescription Direct3DMultisampleDescription; + typedef struct Direct3DSurfaceDescription Direct3DSurfaceDescription; + + interface IDirect3DDevice; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + struct Direct3DMultisampleDescription + { + INT32 Count; + INT32 Quality; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + struct Direct3DSurfaceDescription + { + INT32 Width; + INT32 Height; + Windows.Graphics.DirectX.DirectXPixelFormat Format; + Windows.Graphics.DirectX.Direct3D11.Direct3DMultisampleDescription MultisampleDescription; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + uuid(a37624ab-8d5f-4650-9d3e-9eae3d9bc670) + ] + interface IDirect3DDevice : IInspectable + requires Windows.Foundation.IClosable + { + HRESULT Trim(); + } +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by windows.graphics.holographic.idl. --- include/windows.foundation.idl | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index 96bdd1167e6..d89541740a7 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl @@ -62,10 +62,13 @@ namespace Windows.Foundation { typedef struct TimeSpan TimeSpan; interface IAsyncAction; interface IClosable; + interface IDeferral; + interface IDeferralFactory; interface IMemoryBuffer; interface IMemoryBufferFactory; interface IMemoryBufferReference; interface IStringable; + runtimeclass Deferral; runtimeclass MemoryBuffer;
declare { @@ -94,6 +97,12 @@ namespace Windows.Foundation { ] delegate HRESULT AsyncActionCompletedHandler([in] Windows.Foundation.IAsyncAction *action, [in] AsyncStatus status);
+ [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(ed32a372-f3c8-4faa-9cfb-470148da3888) + ] + delegate HRESULT DeferralCompletedHandler(); + [contract(Windows.Foundation.FoundationContract, 1.0)] enum PropertyType { @@ -193,6 +202,27 @@ namespace Windows.Foundation { HRESULT Close(); }
+ [ + contract(Windows.Foundation.FoundationContract, 1.0), + exclusiveto(Windows.Foundation.Deferral), + uuid(d6269732-3b7f-46a7-b40b-4fdca2a2c693) + ] + interface IDeferral : IInspectable + requires Windows.Foundation.IClosable + { + HRESULT Complete(); + } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + exclusiveto(Windows.Foundation.Deferral), + uuid(65a1ecc5-3fb5-4832-8ca9-f061b281d13a) + ] + interface IDeferralFactory : IInspectable + { + HRESULT Create([in] Windows.Foundation.DeferralCompletedHandler *handler, [out, retval] Windows.Foundation.Deferral **result); + } + [ contract(Windows.Foundation.FoundationContract, 1.0), uuid(5a648006-843a-4da9-865b-9d26e5dfad7b) @@ -239,6 +269,17 @@ namespace Windows.Foundation { [eventremove] HRESULT Closed([in] EventRegistrationToken cookie); }
+ [ + activatable(Windows.Foundation.IDeferralFactory, Windows.Foundation.FoundationContract, 1.0), + contract(Windows.Foundation.FoundationContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass Deferral + { + [default] interface Windows.Foundation.IDeferral; + interface Windows.Foundation.IClosable; + } + [ activatable(Windows.Foundation.IMemoryBufferFactory, Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0),
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + include/windows.graphics.holographic.idl | 162 +++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 include/windows.graphics.holographic.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 198145d59f9..7e0b9d89085 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -817,6 +817,7 @@ SOURCES = \ windows.globalization.idl \ windows.graphics.directx.direct3d11.idl \ windows.graphics.directx.idl \ + windows.graphics.holographic.idl \ windows.h \ windows.media.closedcaptioning.idl \ windows.media.devices.idl \ diff --git a/include/windows.graphics.holographic.idl b/include/windows.graphics.holographic.idl new file mode 100644 index 00000000000..d2ac0ee48e8 --- /dev/null +++ b/include/windows.graphics.holographic.idl @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "asyncinfo.idl"; +import "eventtoken.idl"; +import "windowscontracts.idl"; +import "windows.foundation.idl"; +import "windows.foundation.numerics.idl"; +import "windows.graphics.directx.idl"; +import "windows.graphics.directx.direct3d11.idl"; +/* import "windows.perception.idl"; */ +import "windows.perception.spatial.idl"; +/* import "windows.ui.core.idl"; */ + +namespace Windows.Graphics.Holographic { + typedef struct HolographicAdapterId HolographicAdapterId; + + interface IHolographicCamera; + interface IHolographicFrame; + interface IHolographicSpaceStatics; + interface IHolographicSpaceStatics2; + interface IHolographicSpaceStatics3; + interface IHolographicSpaceCameraAddedEventArgs; + interface IHolographicSpaceCameraRemovedEventArgs; + + runtimeclass HolographicCamera; + runtimeclass HolographicFrame; + runtimeclass HolographicSpace; + runtimeclass HolographicSpaceCameraAddedEventArgs; + runtimeclass HolographicSpaceCameraRemovedEventArgs; + + declare { + interface Windows.Foundation.TypedEventHandler<Windows.Graphics.Holographic.HolographicSpace *, IInspectable *>; + interface Windows.Foundation.TypedEventHandler<Windows.Graphics.Holographic.HolographicSpace *, Windows.Graphics.Holographic.HolographicSpaceCameraAddedEventArgs *>; + interface Windows.Foundation.TypedEventHandler<Windows.Graphics.Holographic.HolographicSpace *, Windows.Graphics.Holographic.HolographicSpaceCameraRemovedEventArgs *>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + struct HolographicAdapterId + { + UINT32 LowPart; + INT32 HighPart; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Graphics.Holographic.HolographicSpace), + uuid(4380dba6-5e78-434f-807c-3433d1efe8b7) + ] + interface IHolographicSpace : IInspectable + { + [propget] HRESULT PrimaryAdapterId([out, retval] Windows.Graphics.Holographic.HolographicAdapterId *value); + HRESULT SetDirect3D11Device([in] Windows.Graphics.DirectX.Direct3D11.IDirect3DDevice *value); + [eventadd] HRESULT CameraAdded( + [in] Windows.Foundation.TypedEventHandler<Windows.Graphics.Holographic.HolographicSpace *, Windows.Graphics.Holographic.HolographicSpaceCameraAddedEventArgs *> *handler, + [out, retval] EventRegistrationToken *cookie + ); + [eventremove] HRESULT CameraAdded([in] EventRegistrationToken cookie); + [eventadd] HRESULT CameraRemoved( + [in] Windows.Foundation.TypedEventHandler<Windows.Graphics.Holographic.HolographicSpace *, Windows.Graphics.Holographic.HolographicSpaceCameraRemovedEventArgs *> *handler, + [out, retval] EventRegistrationToken *cookie + ); + [eventremove] HRESULT CameraRemoved([in] EventRegistrationToken cookie); + HRESULT CreateNextFrame([out, retval] Windows.Graphics.Holographic.HolographicFrame **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Graphics.Holographic.HolographicSpaceCameraAddedEventArgs), + uuid(58f1da35-bbb3-3c8f-993d-6c80e7feb99f) + ] + interface IHolographicSpaceCameraAddedEventArgs : IInspectable + { + [propget] HRESULT Camera([out, retval] Windows.Graphics.Holographic.HolographicCamera **value); + HRESULT GetDeferral([out, retval] Windows.Foundation.Deferral **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Graphics.Holographic.HolographicSpaceCameraRemovedEventArgs), + uuid(805444a8-f2ae-322e-8da9-836a0a95a4c1) + ] + interface IHolographicSpaceCameraRemovedEventArgs : IInspectable + { + [propget] HRESULT Camera([out, retval] Windows.Graphics.Holographic.HolographicCamera **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass HolographicCamera + { + [default] interface Windows.Graphics.Holographic.IHolographicCamera; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass HolographicFrame + { + [default] interface Windows.Graphics.Holographic.IHolographicFrame; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + static(Windows.Graphics.Holographic.IHolographicSpaceStatics, Windows.Foundation.UniversalApiContract, 2.0), + static(Windows.Graphics.Holographic.IHolographicSpaceStatics2, Windows.Foundation.UniversalApiContract, 4.0), + static(Windows.Graphics.Holographic.IHolographicSpaceStatics3, Windows.Foundation.UniversalApiContract, 5.0), + threading(both) + ] + runtimeclass HolographicSpace + { + [default] interface Windows.Graphics.Holographic.IHolographicSpace; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass HolographicSpaceCameraAddedEventArgs + { + [default] interface Windows.Graphics.Holographic.IHolographicSpaceCameraAddedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass HolographicSpaceCameraRemovedEventArgs + { + [default] interface Windows.Graphics.Holographic.IHolographicSpaceCameraRemovedEventArgs; + } +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/windows.graphics.holographic.idl | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/windows.graphics.holographic.idl b/include/windows.graphics.holographic.idl index d2ac0ee48e8..cada5796916 100644 --- a/include/windows.graphics.holographic.idl +++ b/include/windows.graphics.holographic.idl @@ -86,6 +86,19 @@ namespace Windows.Graphics.Holographic { HRESULT CreateNextFrame([out, retval] Windows.Graphics.Holographic.HolographicFrame **value); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Graphics.Holographic.HolographicSpace), + uuid(0e777088-75fc-48af-8758-0652f6f07c59) + ] + interface IHolographicSpaceStatics2 : IInspectable + { + [propget] HRESULT IsSupported([out, retval] boolean *value); + [propget] HRESULT IsAvailable([out, retval] boolean *value); + [eventadd] HRESULT IsAvailableChanged([in] Windows.Foundation.EventHandler<IInspectable *> *handler, [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT IsAvailableChanged([in] EventRegistrationToken token); + } + [ contract(Windows.Foundation.UniversalApiContract, 2.0), exclusiveto(Windows.Graphics.Holographic.HolographicSpaceCameraAddedEventArgs),
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/Makefile.in | 1 + dlls/windows.perception.stub/classes.idl | 1 + .../holographicspace.c | 168 ++++++++++++++++++ dlls/windows.perception.stub/main.c | 2 + dlls/windows.perception.stub/private.h | 3 + .../tests/perception.c | 66 +++++-- 6 files changed, 231 insertions(+), 10 deletions(-) create mode 100644 dlls/windows.perception.stub/holographicspace.c
diff --git a/dlls/windows.perception.stub/Makefile.in b/dlls/windows.perception.stub/Makefile.in index c19496cdd66..dd4274e2055 100644 --- a/dlls/windows.perception.stub/Makefile.in +++ b/dlls/windows.perception.stub/Makefile.in @@ -2,6 +2,7 @@ MODULE = windows.perception.stub.dll IMPORTS = combase
C_SRCS = \ + holographicspace.c \ main.c \ observer.c
diff --git a/dlls/windows.perception.stub/classes.idl b/dlls/windows.perception.stub/classes.idl index 7d0412fa9b2..cf5d6c1ee34 100644 --- a/dlls/windows.perception.stub/classes.idl +++ b/dlls/windows.perception.stub/classes.idl @@ -21,3 +21,4 @@ #pragma makedep register
#include "windows.perception.spatial.surfaces.idl" +#include "windows.graphics.holographic.idl" diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c new file mode 100644 index 00000000000..36a315bd26a --- /dev/null +++ b/dlls/windows.perception.stub/holographicspace.c @@ -0,0 +1,168 @@ +/* WinRT Windows.Perception.Stub HolographicSpace Implementation + * + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(perception); + +struct holographicspace +{ + IActivationFactory IActivationFactory_iface; + IHolographicSpaceStatics2 IHolographicSpaceStatics2_iface; + LONG ref; +}; + +static inline struct holographicspace *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct holographicspace, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct holographicspace *impl = impl_from_IActivationFactory( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IInspectable ) || + IsEqualGUID( iid, &IID_IAgileObject ) || + IsEqualGUID( iid, &IID_IActivationFactory )) + { + *out = &impl->IActivationFactory_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + if (IsEqualGUID( iid, &IID_IHolographicSpaceStatics2 )) + { + *out = &impl->IHolographicSpaceStatics2_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef( IActivationFactory *iface ) +{ + struct holographicspace *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI factory_Release( IActivationFactory *iface ) +{ + struct holographicspace *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static HRESULT WINAPI factory_GetIids( IActivationFactory *iface, ULONG *iid_count, IID **iids ) +{ + FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) +{ + FIXME( "iface %p, instance %p stub!\n", iface, instance ); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IInspectable methods */ + factory_GetIids, + factory_GetRuntimeClassName, + factory_GetTrustLevel, + /* IActivationFactory methods */ + factory_ActivateInstance, +}; + +DEFINE_IINSPECTABLE( holographicspace_statics2, IHolographicSpaceStatics2, struct holographicspace, IActivationFactory_iface ) + +static HRESULT WINAPI holographicspace_statics2_get_IsSupported( IHolographicSpaceStatics2 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographicspace_statics2_get_IsAvailable( IHolographicSpaceStatics2 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographicspace_statics2_add_IsAvailableChanged( IHolographicSpaceStatics2 *iface, IEventHandler_IInspectable *handler, + EventRegistrationToken *token ) +{ + FIXME( "iface %p, handler %p, token %p stub!\n", iface, handler, token ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographicspace_statics2_remove_IsAvailableChanged( IHolographicSpaceStatics2 *iface, EventRegistrationToken token ) +{ + FIXME( "iface %p, token %#I64x stub!\n", iface, token.value ); + return E_NOTIMPL; +} + +static const struct IHolographicSpaceStatics2Vtbl holographicspace_statics2_vtbl = +{ + holographicspace_statics2_QueryInterface, + holographicspace_statics2_AddRef, + holographicspace_statics2_Release, + /* IInspectable methods */ + holographicspace_statics2_GetIids, + holographicspace_statics2_GetRuntimeClassName, + holographicspace_statics2_GetTrustLevel, + /* IHolographicSpaceStatics2 methods */ + holographicspace_statics2_get_IsSupported, + holographicspace_statics2_get_IsAvailable, + holographicspace_statics2_add_IsAvailableChanged, + holographicspace_statics2_remove_IsAvailableChanged, +}; + +static struct holographicspace holographicspace_statics = +{ + {&factory_vtbl}, + {&holographicspace_statics2_vtbl}, + 1, +}; + +IActivationFactory *holographicspace_factory = &holographicspace_statics.IActivationFactory_iface; diff --git a/dlls/windows.perception.stub/main.c b/dlls/windows.perception.stub/main.c index 094b1b60654..4403c9cfb3f 100644 --- a/dlls/windows.perception.stub/main.c +++ b/dlls/windows.perception.stub/main.c @@ -49,6 +49,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **fa
if (!wcscmp( buffer, RuntimeClass_Windows_Perception_Spatial_Surfaces_SpatialSurfaceObserver )) IActivationFactory_QueryInterface( observer_factory, &IID_IActivationFactory, (void **)factory ); + if (!wcscmp( buffer, RuntimeClass_Windows_Graphics_Holographic_HolographicSpace )) + IActivationFactory_QueryInterface( holographicspace_factory, &IID_IActivationFactory, (void **)factory );
if (*factory) return S_OK; return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h index a32f8221380..a6ae62916e1 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -34,8 +34,11 @@ #include "windows.foundation.h" #define WIDL_using_Windows_Perception_Spatial_Surfaces #include "windows.perception.spatial.surfaces.h" +#define WIDL_using_Windows_Graphics_Holographic +#include "windows.graphics.holographic.h"
extern IActivationFactory *observer_factory; +extern IActivationFactory *holographicspace_factory;
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ static inline impl_type *impl_from( iface_type *iface ) \ diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index c83986f4b6c..9cc7c40debb 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -30,6 +30,8 @@ #include "windows.foundation.h" #define WIDL_using_Windows_Perception_Spatial_Surfaces #include "windows.perception.spatial.surfaces.h" +#define WIDL_using_Windows_Graphics_Holographic +#include "windows.graphics.holographic.h"
#include "wine/test.h"
@@ -73,20 +75,63 @@ static void test_ObserverStatics(void) check_interface( factory, &IID_ISpatialSurfaceObserverStatics );
hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics2, (void **)&observer_statics2 ); - if (hr == E_NOINTERFACE /* win1607 */) - win_skip("ISpatialSurfaceObserverStatics2 is not supported\n"); - else + if (hr == E_NOINTERFACE) /* win1607 */ { - ok( hr == S_OK, "got hr %#lx.\n", hr ); + win_skip( "ISpatialSurfaceObserverStatics2 is not supported, skipping tests.\n" ); + goto done; + } + + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + value = TRUE; + hr = ISpatialSurfaceObserverStatics2_IsSupported( observer_statics2, &value ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( !value, "got %d.\n", value ); + + ref = ISpatialSurfaceObserverStatics2_Release( observer_statics2 ); + ok( ref == 2, "got ref %ld.\n", ref ); +done: + ref = IActivationFactory_Release( factory ); + ok( ref == 1, "got ref %ld.\n", ref ); +} + +static void test_HolographicSpaceStatics(void) +{ + static const WCHAR *holographicspace_statics_name = L"Windows.Graphics.Holographic.HolographicSpace"; + IHolographicSpaceStatics2 *holographicspace_statics2; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( holographicspace_statics_name, wcslen( holographicspace_statics_name ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory ); + WindowsDeleteString( str ); + ok( hr == S_OK || broken( hr == REGDB_E_CLASSNOTREG ), "got hr %#lx.\n", hr ); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( holographicspace_statics_name ) ); + return; + }
- value = TRUE; - hr = ISpatialSurfaceObserverStatics2_IsSupported( observer_statics2, &value ); - ok( hr == S_OK, "got hr %#lx.\n", hr ); - ok( !value, "got %d.\n", value ); + check_interface( factory, &IID_IUnknown ); + check_interface( factory, &IID_IInspectable ); + check_interface( factory, &IID_IAgileObject );
- ref = ISpatialSurfaceObserverStatics2_Release( observer_statics2 ); - ok( ref == 2, "got ref %ld.\n", ref ); + hr = IActivationFactory_QueryInterface( factory, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); + if (hr == E_NOINTERFACE) /* win1607 */ + { + win_skip( "IHolographicSpaceStatics2 is not supported, skipping tests.\n" ); + goto done; } + + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IHolographicSpaceStatics2_Release( holographicspace_statics2 ); + ok( ref == 2, "got ref %ld.\n", ref ); +done: ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); } @@ -99,6 +144,7 @@ START_TEST(perception) ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr );
test_ObserverStatics(); + test_HolographicSpaceStatics();
RoUninitialize(); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/tests/perception.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 9cc7c40debb..aded4a6fa7d 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -100,6 +100,7 @@ static void test_HolographicSpaceStatics(void) static const WCHAR *holographicspace_statics_name = L"Windows.Graphics.Holographic.HolographicSpace"; IHolographicSpaceStatics2 *holographicspace_statics2; IActivationFactory *factory; + BOOLEAN value; HSTRING str; HRESULT hr; LONG ref; @@ -129,6 +130,16 @@ static void test_HolographicSpaceStatics(void)
ok( hr == S_OK, "got hr %#lx.\n", hr );
+ value = 2; + hr = IHolographicSpaceStatics2_get_IsSupported( holographicspace_statics2, &value ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( value == TRUE, "got %d.\n", value ); + + value = 2; + hr = IHolographicSpaceStatics2_get_IsAvailable( holographicspace_statics2, &value ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( value == FALSE, "got %d.\n", value ); + ref = IHolographicSpaceStatics2_Release( holographicspace_statics2 ); ok( ref == 2, "got ref %ld.\n", ref ); done:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by the VR game Desperate: Vladivostok. --- dlls/windows.perception.stub/holographicspace.c | 6 ++++-- dlls/windows.perception.stub/tests/perception.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index 36a315bd26a..c4ecd798d3e 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -119,8 +119,10 @@ DEFINE_IINSPECTABLE( holographicspace_statics2, IHolographicSpaceStatics2, struc
static HRESULT WINAPI holographicspace_statics2_get_IsSupported( IHolographicSpaceStatics2 *iface, boolean *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; }
static HRESULT WINAPI holographicspace_statics2_get_IsAvailable( IHolographicSpaceStatics2 *iface, boolean *value ) diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index aded4a6fa7d..770f21c3fd7 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -132,7 +132,7 @@ static void test_HolographicSpaceStatics(void)
value = 2; hr = IHolographicSpaceStatics2_get_IsSupported( holographicspace_statics2, &value ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); todo_wine ok( value == TRUE, "got %d.\n", value );
value = 2;
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by the VR game Desperate: Vladivostok. --- dlls/windows.perception.stub/holographicspace.c | 6 ++++-- dlls/windows.perception.stub/tests/perception.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index c4ecd798d3e..a99932f7889 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -127,8 +127,10 @@ static HRESULT WINAPI holographicspace_statics2_get_IsSupported( IHolographicSpa
static HRESULT WINAPI holographicspace_statics2_get_IsAvailable( IHolographicSpaceStatics2 *iface, boolean *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; }
static HRESULT WINAPI holographicspace_statics2_add_IsAvailableChanged( IHolographicSpaceStatics2 *iface, IEventHandler_IInspectable *handler, diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 770f21c3fd7..2fb526ed3d5 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -137,8 +137,8 @@ static void test_HolographicSpaceStatics(void)
value = 2; hr = IHolographicSpaceStatics2_get_IsAvailable( holographicspace_statics2, &value ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( value == FALSE, "got %d.\n", value ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( value == FALSE, "got %d.\n", value );
ref = IHolographicSpaceStatics2_Release( holographicspace_statics2 ); ok( ref == 2, "got ref %ld.\n", ref );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/windows.graphics.holographic.idl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/windows.graphics.holographic.idl b/include/windows.graphics.holographic.idl index cada5796916..568003cd7a3 100644 --- a/include/windows.graphics.holographic.idl +++ b/include/windows.graphics.holographic.idl @@ -99,6 +99,16 @@ namespace Windows.Graphics.Holographic { [eventremove] HRESULT IsAvailableChanged([in] EventRegistrationToken token); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 5.0), + exclusiveto(Windows.Graphics.Holographic.HolographicSpace), + uuid(3b00de3d-b1a3-4dfe-8e79-fec5909e6df8) + ] + interface IHolographicSpaceStatics3 : IInspectable + { + [propget] HRESULT IsConfigured([out, retval] boolean *value); + } + [ contract(Windows.Foundation.UniversalApiContract, 2.0), exclusiveto(Windows.Graphics.Holographic.HolographicSpaceCameraAddedEventArgs),
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../holographicspace.c | 30 +++++++++++++++++++ .../tests/perception.c | 13 ++++++++ 2 files changed, 43 insertions(+)
diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index a99932f7889..52fd6421075 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -26,6 +26,7 @@ struct holographicspace { IActivationFactory IActivationFactory_iface; IHolographicSpaceStatics2 IHolographicSpaceStatics2_iface; + IHolographicSpaceStatics3 IHolographicSpaceStatics3_iface; LONG ref; };
@@ -57,6 +58,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IHolographicSpaceStatics3 )) + { + *out = &impl->IHolographicSpaceStatics3_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -162,10 +170,32 @@ static const struct IHolographicSpaceStatics2Vtbl holographicspace_statics2_vtbl holographicspace_statics2_remove_IsAvailableChanged, };
+DEFINE_IINSPECTABLE( holographicspace_statics3, IHolographicSpaceStatics3, struct holographicspace, IActivationFactory_iface ) + +static HRESULT WINAPI holographicspace_statics3_get_IsConfigured( IHolographicSpaceStatics3 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IHolographicSpaceStatics3Vtbl holographicspace_statics3_vtbl = +{ + holographicspace_statics3_QueryInterface, + holographicspace_statics3_AddRef, + holographicspace_statics3_Release, + /* IInspectable methods */ + holographicspace_statics3_GetIids, + holographicspace_statics3_GetRuntimeClassName, + holographicspace_statics3_GetTrustLevel, + /* IHolographicSpaceStatics3 methods */ + holographicspace_statics3_get_IsConfigured, +}; + static struct holographicspace holographicspace_statics = { {&factory_vtbl}, {&holographicspace_statics2_vtbl}, + {&holographicspace_statics3_vtbl}, 1, };
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 2fb526ed3d5..67c45e2a480 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -99,6 +99,7 @@ static void test_HolographicSpaceStatics(void) { static const WCHAR *holographicspace_statics_name = L"Windows.Graphics.Holographic.HolographicSpace"; IHolographicSpaceStatics2 *holographicspace_statics2; + IHolographicSpaceStatics3 *holographicspace_statics3; IActivationFactory *factory; BOOLEAN value; HSTRING str; @@ -142,6 +143,18 @@ static void test_HolographicSpaceStatics(void)
ref = IHolographicSpaceStatics2_Release( holographicspace_statics2 ); ok( ref == 2, "got ref %ld.\n", ref ); + + hr = IActivationFactory_QueryInterface( factory, &IID_IHolographicSpaceStatics3, (void **)&holographicspace_statics3 ); + if (hr == E_NOINTERFACE) /* win1703 */ + { + win_skip( "IHolographicSpaceStatics3 is not supported, skipping tests.\n" ); + goto done; + } + + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IHolographicSpaceStatics3_Release( holographicspace_statics3 ); + ok( ref == 2, "got ref %ld.\n", ref ); done: ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/tests/perception.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 67c45e2a480..1c763930e05 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -153,6 +153,11 @@ static void test_HolographicSpaceStatics(void)
ok( hr == S_OK, "got hr %#lx.\n", hr );
+ value = 2; + hr = IHolographicSpaceStatics3_get_IsConfigured( holographicspace_statics3, &value ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( value == FALSE, "got %d.\n", value ); + ref = IHolographicSpaceStatics3_Release( holographicspace_statics3 ); ok( ref == 2, "got ref %ld.\n", ref ); done:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by the VR game Desperate: Vladivostok. --- dlls/windows.perception.stub/holographicspace.c | 6 ++++-- dlls/windows.perception.stub/tests/perception.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index 52fd6421075..8a12147f4a8 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -174,8 +174,10 @@ DEFINE_IINSPECTABLE( holographicspace_statics3, IHolographicSpaceStatics3, struc
static HRESULT WINAPI holographicspace_statics3_get_IsConfigured( IHolographicSpaceStatics3 *iface, boolean *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; }
static const struct IHolographicSpaceStatics3Vtbl holographicspace_statics3_vtbl = diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 1c763930e05..d0bee4eb247 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -155,8 +155,8 @@ static void test_HolographicSpaceStatics(void)
value = 2; hr = IHolographicSpaceStatics3_get_IsConfigured( holographicspace_statics3, &value ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( value == FALSE, "got %d.\n", value ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( value == FALSE, "got %d.\n", value );
ref = IHolographicSpaceStatics3_Release( holographicspace_statics3 ); ok( ref == 2, "got ref %ld.\n", ref );
On Tue Mar 14 09:07:33 2023 +0000, Rémi Bernon wrote:
If you only forward declare `IHolographicSpaceStatics` here, you don't need its definition later in the file, as you also don't implement it. This then makes 5ec7b6eecc89f2e88df836e1e68c9d59fa640816 ad31506143de193058129e2981818b6e7fc5c252 8fbfa09fd86eb7306688e0914c44964860165a0d 2e1f8bd100e040e8025c5801cecdf7636187582c aaeb3ffc5ce074ddea6a16e5b28788f73b1fd12c also unnecessary, which to be honest, seems appealing to me at least from a review perspective, given the number of new classes and interfaces. Of course, we might need them later and could be useful to keep them around, but then it would be nice to have it done more gradually if possible. Regarding 04ee932ff5e261b9aceee47542f91aa6b4f115c1, and for similar changes, it'd be nice to make smaller additions, for instance adding one interface definition at a time (and its dependencies if they aren't too much, or add them beforehand), so that reviewing what needs what is easier.
It looks like most of the definitions aren't actually needed.
Sure, if it makes review easier for you then I don't mind doing it. I split up the header as much as I could, I hope this is how you wanted it. There wasn't much to add, the forward declarations were sufficient.
Yeah, it might be useful to keep them around. I spent a long time working on it so it would be nice to keep it, but perhaps I should first split it up into smaller additions for easier review. In any case, here's a branch of the headers in case you need it in the future: https://gitlab.winehq.org/maljaf/wine/-/commits/WinRT-Core
This merge request was approved by Rémi Bernon.
On Fri Mar 17 04:41:47 2023 +0000, Mohamad Al-Jaf wrote:
It looks like most of the definitions aren't actually needed. Sure, if it makes review easier for you then I don't mind doing it. I split up the header as much as I could, I hope this is how you wanted it. There wasn't much to add, the forward declarations were sufficient. Yeah, it might be useful to keep them around. I spent a long time working on it so it would be nice to keep it, but perhaps I should first split it up into smaller additions for easier review. In any case, here's a branch of the headers in case you need it in the future: https://gitlab.winehq.org/maljaf/wine/-/commits/WinRT-Core
Yes, thanks a lot.
Yeah, it might be useful to keep them around. I spent a long time working on it so it would be nice to keep it, but perhaps I should first split it up into smaller additions for easier review. In any case, here's a branch of the headers in case you need it in the future: https://gitlab.winehq.org/maljaf/wine/-/commits/WinRT-Core
I can only imagine the time your spent, and thanks for doing that. It may be arguably useful to have them in Wine, but at the same time it's also a lot of additions.
The amount of code that is is the SDK IDL file is quite overwhelming, I don't know if there's any saner way to have them than rewriting everything by hand. They are actually generated from some binary metadata, so maybe we could do that too (but then where to source this metadata is a good question).
An alternative which I thought about was to implement IDL 3.0 syntax, which I believe allows much terser interface / runtimeclass declaration, and would generate the same header output.
Or, somehow, we could make WIDL compatible with the SDK IDL files, and use them directly, but here like with the .winmd metadata, there's the question of how to source it properly.
In any case I'm really not looking forward the time where we'll need to stub or implement all these new interfaces...