Needed by UE4 VR games.
Proton-Issue: https://github.com/ValveSoftware/Proton/issues/6533 Proton-Issue: https://github.com/ValveSoftware/Proton/issues/8457
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../windows.perception.stub/tests/Makefile.in | 2 +- .../tests/perception.c | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-)
diff --git a/dlls/windows.perception.stub/tests/Makefile.in b/dlls/windows.perception.stub/tests/Makefile.in index 9de867787b3..0783751d75e 100644 --- a/dlls/windows.perception.stub/tests/Makefile.in +++ b/dlls/windows.perception.stub/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = windows.perception.stub.dll -IMPORTS = combase +IMPORTS = combase user32
SOURCES = \ perception.c diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 29d7f1ea475..82550c76731 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -102,8 +102,11 @@ static void test_HolographicSpaceStatics(void) static const WCHAR *holographicspace_statics_name = L"Windows.Graphics.Holographic.HolographicSpace"; IHolographicSpaceStatics2 *holographicspace_statics2; IHolographicSpaceStatics3 *holographicspace_statics3; + IHolographicSpaceInterop *holographic_space_interop; + IHolographicSpace *holographic_space; IActivationFactory *factory; BOOLEAN value; + HWND window; HSTRING str; HRESULT hr; LONG ref; @@ -163,6 +166,90 @@ static void test_HolographicSpaceStatics(void)
ref = IHolographicSpaceStatics3_Release( holographicspace_statics3 ); ok( ref == 2, "got ref %ld.\n", ref ); + + hr = IActivationFactory_QueryInterface( factory, &IID_IHolographicSpaceInterop, (void **)&holographic_space_interop ); + if (hr == E_NOINTERFACE) /* win1703 */ + { + win_skip( "IHolographicSpaceInterop is not supported, skipping tests.\n" ); + goto done; + } + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + holographicspace_statics2 = (void *)0xdeadbeef; + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, NULL, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + todo_wine + ok( holographicspace_statics2 == (void *)0xdeadbeef, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, (void *)0xdeadbeef, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); + todo_wine + ok( hr == E_INVALIDARG || broken(hr == E_ACCESSDENIED) /* w1064v1709 */ || broken(hr == E_NOINTERFACE) /* w11 */, "got hr %#lx.\n", hr ); + ok( holographicspace_statics2 == NULL, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); + if (hr == E_ACCESSDENIED) goto done; + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + + holographicspace_statics2 = (void *)0xdeadbeef; + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_ISpatialSurfaceObserverStatics2, (void **)&holographicspace_statics2 ); + todo_wine + ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); + ok( holographicspace_statics2 == NULL, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); + + holographicspace_statics2 = (void *)0xdeadbeef; + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_ISpatialSurfaceObserverStatics2, (void **)&holographicspace_statics2 ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + ok( holographicspace_statics2 == NULL, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); + DestroyWindow( window ); + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); + todo_wine + ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); + DestroyWindow( window ); + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpaceStatics3, (void **)&holographicspace_statics3 ); + todo_wine + ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); + DestroyWindow( window ); + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, 100, 100, 100, 100, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpace, (void **)&holographic_space ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + DestroyWindow( window ); + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IAgileObject, (void **)&holographic_space ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + DestroyWindow( window ); + if (SUCCEEDED( hr )) + { + ref = IHolographicSpace_Release( holographic_space ); + ok( ref == 0, "got ref %ld.\n", ref ); + } + + window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); + ok( IsWindow( window ), "CreateWindowW failed.\n" ); + hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpace, (void **)&holographic_space ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + DestroyWindow( window ); + if (SUCCEEDED( hr )) + { + ref = IHolographicSpace_Release( holographic_space ); + ok( ref == 0, "got ref %ld.\n", ref ); + } + ref = IHolographicSpaceInterop_Release( holographic_space_interop ); + 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/Makefile.in | 4 +- .../holographic_space.c | 389 ++++++++++++++++++ .../holographicspace.c | 237 ----------- dlls/windows.perception.stub/main.c | 2 +- dlls/windows.perception.stub/private.h | 3 +- .../tests/perception.c | 23 +- 6 files changed, 399 insertions(+), 259 deletions(-) create mode 100644 dlls/windows.perception.stub/holographic_space.c delete 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 18c90e697c4..f7b6065cb0d 100644 --- a/dlls/windows.perception.stub/Makefile.in +++ b/dlls/windows.perception.stub/Makefile.in @@ -1,8 +1,8 @@ MODULE = windows.perception.stub.dll -IMPORTS = combase +IMPORTS = combase user32
SOURCES = \ classes.idl \ - holographicspace.c \ + holographic_space.c \ main.c \ observer.c diff --git a/dlls/windows.perception.stub/holographic_space.c b/dlls/windows.perception.stub/holographic_space.c new file mode 100644 index 00000000000..fa701c5d73e --- /dev/null +++ b/dlls/windows.perception.stub/holographic_space.c @@ -0,0 +1,389 @@ +/* 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 holographic_space_statics +{ + IActivationFactory IActivationFactory_iface; + IHolographicSpaceStatics2 IHolographicSpaceStatics2_iface; + IHolographicSpaceStatics3 IHolographicSpaceStatics3_iface; + IHolographicSpaceInterop IHolographicSpaceInterop_iface; + LONG ref; +}; + +static inline struct holographic_space_statics *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct holographic_space_statics, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct holographic_space_statics *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; + } + + if (IsEqualGUID( iid, &IID_IHolographicSpaceStatics3 )) + { + *out = &impl->IHolographicSpaceStatics3_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + if (IsEqualGUID( iid, &IID_IHolographicSpaceInterop )) + { + *out = &impl->IHolographicSpaceInterop_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 holographic_space_statics *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 holographic_space_statics *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( holographic_space_statics2, IHolographicSpaceStatics2, struct holographic_space_statics, IActivationFactory_iface ) + +static HRESULT WINAPI holographic_space_statics2_get_IsSupported( IHolographicSpaceStatics2 *iface, boolean *value ) +{ + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; +} + +static HRESULT WINAPI holographic_space_statics2_get_IsAvailable( IHolographicSpaceStatics2 *iface, boolean *value ) +{ + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; +} + +static HRESULT WINAPI holographic_space_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 holographic_space_statics2_remove_IsAvailableChanged( IHolographicSpaceStatics2 *iface, EventRegistrationToken token ) +{ + FIXME( "iface %p, token %#I64x stub!\n", iface, token.value ); + return E_NOTIMPL; +} + +static const struct IHolographicSpaceStatics2Vtbl holographic_space_statics2_vtbl = +{ + holographic_space_statics2_QueryInterface, + holographic_space_statics2_AddRef, + holographic_space_statics2_Release, + /* IInspectable methods */ + holographic_space_statics2_GetIids, + holographic_space_statics2_GetRuntimeClassName, + holographic_space_statics2_GetTrustLevel, + /* IHolographicSpaceStatics2 methods */ + holographic_space_statics2_get_IsSupported, + holographic_space_statics2_get_IsAvailable, + holographic_space_statics2_add_IsAvailableChanged, + holographic_space_statics2_remove_IsAvailableChanged, +}; + +DEFINE_IINSPECTABLE( holographic_space_statics3, IHolographicSpaceStatics3, struct holographic_space_statics, IActivationFactory_iface ) + +static HRESULT WINAPI holographic_space_statics3_get_IsConfigured( IHolographicSpaceStatics3 *iface, boolean *value ) +{ + TRACE( "iface %p, value %p\n", iface, value ); + + *value = FALSE; + return S_OK; +} + +static const struct IHolographicSpaceStatics3Vtbl holographic_space_statics3_vtbl = +{ + holographic_space_statics3_QueryInterface, + holographic_space_statics3_AddRef, + holographic_space_statics3_Release, + /* IInspectable methods */ + holographic_space_statics3_GetIids, + holographic_space_statics3_GetRuntimeClassName, + holographic_space_statics3_GetTrustLevel, + /* IHolographicSpaceStatics3 methods */ + holographic_space_statics3_get_IsConfigured, +}; + +struct holographic_space +{ + IHolographicSpace IHolographicSpace_iface; + LONG ref; + + HWND window; +}; + +static inline struct holographic_space *impl_from_IHolographicSpace( IHolographicSpace *iface ) +{ + return CONTAINING_RECORD( iface, struct holographic_space, IHolographicSpace_iface ); +} + +static HRESULT WINAPI holographic_space_QueryInterface( IHolographicSpace *iface, REFIID iid, void **out ) +{ + struct holographic_space *impl = impl_from_IHolographicSpace( 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_IHolographicSpace )) + { + *out = &impl->IHolographicSpace_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 holographic_space_AddRef( IHolographicSpace *iface ) +{ + struct holographic_space *impl = impl_from_IHolographicSpace( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI holographic_space_Release( IHolographicSpace *iface ) +{ + struct holographic_space *impl = impl_from_IHolographicSpace( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + + if (!ref) free( impl ); + return ref; +} + +static HRESULT WINAPI holographic_space_GetIids( IHolographicSpace *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 holographic_space_GetRuntimeClassName( IHolographicSpace *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_GetTrustLevel( IHolographicSpace *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_get_PrimaryAdapterId( IHolographicSpace *iface, HolographicAdapterId *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_SetDirect3D11Device( IHolographicSpace *iface, IDirect3DDevice *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_add_CameraAdded( IHolographicSpace *iface, ITypedEventHandler_HolographicSpace_HolographicSpaceCameraAddedEventArgs *handler, + EventRegistrationToken *cookie ) +{ + FIXME( "iface %p, handler %p, cookie %p stub!\n", iface, handler, cookie ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_remove_CameraAdded( IHolographicSpace *iface, EventRegistrationToken cookie ) +{ + FIXME( "iface %p, cookie %#I64x stub!\n", iface, cookie.value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_add_CameraRemoved( IHolographicSpace *iface, ITypedEventHandler_HolographicSpace_HolographicSpaceCameraRemovedEventArgs *handler, + EventRegistrationToken *cookie ) +{ + FIXME( "iface %p, handler %p, cookie %p stub!\n", iface, handler, cookie ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_remove_CameraRemoved( IHolographicSpace *iface, EventRegistrationToken cookie ) +{ + FIXME( "iface %p, cookie %#I64x stub!\n", iface, cookie.value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI holographic_space_CreateNextFrame( IHolographicSpace *iface, IHolographicFrame **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IHolographicSpaceVtbl holographic_space_vtbl = +{ + /* IUnknown methods */ + holographic_space_QueryInterface, + holographic_space_AddRef, + holographic_space_Release, + /* IInspectable methods */ + holographic_space_GetIids, + holographic_space_GetRuntimeClassName, + holographic_space_GetTrustLevel, + /* IHolographicSpace methods */ + holographic_space_get_PrimaryAdapterId, + holographic_space_SetDirect3D11Device, + holographic_space_add_CameraAdded, + holographic_space_remove_CameraAdded, + holographic_space_add_CameraRemoved, + holographic_space_remove_CameraRemoved, + holographic_space_CreateNextFrame, +}; + +DEFINE_IINSPECTABLE( holographic_space_interop, IHolographicSpaceInterop, struct holographic_space_statics, IActivationFactory_iface ) + +static HRESULT WINAPI holographic_space_interop_CreateForWindow( IHolographicSpaceInterop *iface, + HWND window, REFIID iid, void **holographic_space ) +{ + struct holographic_space *impl; + HRESULT hr; + + TRACE( "iface %p, window %p, iid %s, holographic_space %p.\n", iface, window, debugstr_guid( iid ), holographic_space ); + + if (!window) return E_INVALIDARG; + if (!IsWindow( window )) + { + *holographic_space = NULL; + return E_INVALIDARG; + } + if (!(impl = calloc( 1, sizeof( *impl ) ))) return E_OUTOFMEMORY; + + impl->IHolographicSpace_iface.lpVtbl = &holographic_space_vtbl; + impl->ref = 1; + impl->window = window; + + hr = IHolographicSpace_QueryInterface( &impl->IHolographicSpace_iface, iid, holographic_space ); + IHolographicSpace_Release( &impl->IHolographicSpace_iface ); + TRACE( "created IHolographicSpace %p.\n", *holographic_space ); + return hr; +} + +static const struct IHolographicSpaceInteropVtbl holographic_space_interop_vtbl = +{ + holographic_space_interop_QueryInterface, + holographic_space_interop_AddRef, + holographic_space_interop_Release, + /* IInspectable methods */ + holographic_space_interop_GetIids, + holographic_space_interop_GetRuntimeClassName, + holographic_space_interop_GetTrustLevel, + /* IHolographicSpaceInterop methods */ + holographic_space_interop_CreateForWindow, +}; + +static struct holographic_space_statics holographic_space_statics = +{ + {&factory_vtbl}, + {&holographic_space_statics2_vtbl}, + {&holographic_space_statics3_vtbl}, + {&holographic_space_interop_vtbl}, + 1, +}; + +IActivationFactory *holographic_space_factory = &holographic_space_statics.IActivationFactory_iface; diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c deleted file mode 100644 index 53e6be0e712..00000000000 --- a/dlls/windows.perception.stub/holographicspace.c +++ /dev/null @@ -1,237 +0,0 @@ -/* 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; - IHolographicSpaceStatics3 IHolographicSpaceStatics3_iface; - IHolographicSpaceInterop IHolographicSpaceInterop_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; - } - - if (IsEqualGUID( iid, &IID_IHolographicSpaceStatics3 )) - { - *out = &impl->IHolographicSpaceStatics3_iface; - IInspectable_AddRef( *out ); - return S_OK; - } - - if (IsEqualGUID( iid, &IID_IHolographicSpaceInterop )) - { - *out = &impl->IHolographicSpaceInterop_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 ) -{ - TRACE( "iface %p, value %p\n", iface, value ); - - *value = FALSE; - return S_OK; -} - -static HRESULT WINAPI holographicspace_statics2_get_IsAvailable( IHolographicSpaceStatics2 *iface, boolean *value ) -{ - 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, - 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, -}; - -DEFINE_IINSPECTABLE( holographicspace_statics3, IHolographicSpaceStatics3, struct holographicspace, IActivationFactory_iface ) - -static HRESULT WINAPI holographicspace_statics3_get_IsConfigured( IHolographicSpaceStatics3 *iface, boolean *value ) -{ - TRACE( "iface %p, value %p\n", iface, value ); - - *value = FALSE; - return S_OK; -} - -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, -}; - -DEFINE_IINSPECTABLE( holographicspace_interop, IHolographicSpaceInterop, struct holographicspace, IActivationFactory_iface ) - -static HRESULT WINAPI holographicspace_interop_CreateForWindow( IHolographicSpaceInterop *iface, - HWND window, REFIID iid, void **holographic_space ) -{ - FIXME( "iface %p, window %p, iid %s, holographic_space %p.\n", iface, window, debugstr_guid( iid ), holographic_space ); - - *holographic_space = NULL; - return E_NOTIMPL; -} - -static const struct IHolographicSpaceInteropVtbl holographicspace_interop_vtbl = -{ - holographicspace_interop_QueryInterface, - holographicspace_interop_AddRef, - holographicspace_interop_Release, - /* IInspectable methods */ - holographicspace_interop_GetIids, - holographicspace_interop_GetRuntimeClassName, - holographicspace_interop_GetTrustLevel, - /* IHolographicSpaceInterop methods */ - holographicspace_interop_CreateForWindow, -}; - -static struct holographicspace holographicspace_statics = -{ - {&factory_vtbl}, - {&holographicspace_statics2_vtbl}, - {&holographicspace_statics3_vtbl}, - {&holographicspace_interop_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 5db2c3015ca..de3b7d389e8 100644 --- a/dlls/windows.perception.stub/main.c +++ b/dlls/windows.perception.stub/main.c @@ -41,7 +41,7 @@ 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 ); + IActivationFactory_QueryInterface( holographic_space_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 ceaa2944174..bf233e72fd4 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -35,11 +35,12 @@ #define WIDL_using_Windows_Perception_Spatial_Surfaces #include "windows.perception.spatial.surfaces.h" #define WIDL_using_Windows_Graphics_Holographic +#define WIDL_using_Windows_Graphics_DirectX_Direct3D11 #include "windows.graphics.holographic.h" #include "holographicspaceinterop.h"
extern IActivationFactory *observer_factory; -extern IActivationFactory *holographicspace_factory; +extern IActivationFactory *holographic_space_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 82550c76731..f8d73cdf554 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -177,12 +177,9 @@ static void test_HolographicSpaceStatics(void)
holographicspace_statics2 = (void *)0xdeadbeef; hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, NULL, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); - todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); - todo_wine ok( holographicspace_statics2 == (void *)0xdeadbeef, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, (void *)0xdeadbeef, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); - todo_wine ok( hr == E_INVALIDARG || broken(hr == E_ACCESSDENIED) /* w1064v1709 */ || broken(hr == E_NOINTERFACE) /* w11 */, "got hr %#lx.\n", hr ); ok( holographicspace_statics2 == NULL, "got holographicspace_statics2 %p.\n", holographicspace_statics2 ); if (hr == E_ACCESSDENIED) goto done; @@ -192,7 +189,6 @@ static void test_HolographicSpaceStatics(void)
holographicspace_statics2 = (void *)0xdeadbeef; hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_ISpatialSurfaceObserverStatics2, (void **)&holographicspace_statics2 ); - todo_wine ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); ok( holographicspace_statics2 == NULL, "got holographicspace_statics2 %p.\n", holographicspace_statics2 );
@@ -206,14 +202,12 @@ static void test_HolographicSpaceStatics(void) window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); ok( IsWindow( window ), "CreateWindowW failed.\n" ); hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); - todo_wine ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); DestroyWindow( window );
window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); ok( IsWindow( window ), "CreateWindowW failed.\n" ); hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpaceStatics3, (void **)&holographicspace_statics3 ); - todo_wine ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); DestroyWindow( window );
@@ -223,31 +217,24 @@ static void test_HolographicSpaceStatics(void) todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); DestroyWindow( window ); + if (SUCCEEDED( hr )) IHolographicSpace_Release( holographic_space );
window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); ok( IsWindow( window ), "CreateWindowW failed.\n" ); hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IAgileObject, (void **)&holographic_space ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); DestroyWindow( window ); - if (SUCCEEDED( hr )) - { - ref = IHolographicSpace_Release( holographic_space ); - ok( ref == 0, "got ref %ld.\n", ref ); - } + ref = IHolographicSpace_Release( holographic_space ); + ok( ref == 0, "got ref %ld.\n", ref );
window = CreateWindowW( L"static", NULL, WS_VISIBLE, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL ); ok( IsWindow( window ), "CreateWindowW failed.\n" ); hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpace, (void **)&holographic_space ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr );
DestroyWindow( window ); - if (SUCCEEDED( hr )) - { - ref = IHolographicSpace_Release( holographic_space ); - ok( ref == 0, "got ref %ld.\n", ref ); - } + ref = IHolographicSpace_Release( holographic_space ); + ok( ref == 0, "got ref %ld.\n", ref ); ref = IHolographicSpaceInterop_Release( holographic_space_interop ); ok( ref == 2, "got ref %ld.\n", ref ); done:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/tests/perception.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index f8d73cdf554..6840ef99a14 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -104,6 +104,7 @@ static void test_HolographicSpaceStatics(void) IHolographicSpaceStatics3 *holographicspace_statics3; IHolographicSpaceInterop *holographic_space_interop; IHolographicSpace *holographic_space; + HolographicAdapterId adapter_id; IActivationFactory *factory; BOOLEAN value; HWND window; @@ -232,6 +233,14 @@ static void test_HolographicSpaceStatics(void) hr = IHolographicSpaceInterop_CreateForWindow( holographic_space_interop, window, &IID_IHolographicSpace, (void **)&holographic_space ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ hr = IHolographicSpace_get_PrimaryAdapterId( holographic_space, &adapter_id ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine + ok( adapter_id.LowPart == 0, "got adapter_id.LowPart %u.\n", adapter_id.LowPart ); + todo_wine + ok( adapter_id.HighPart == 0, "got adapter_id.HighPart %u.\n", adapter_id.HighPart ); + DestroyWindow( window ); ref = IHolographicSpace_Release( holographic_space ); ok( ref == 0, "got ref %ld.\n", ref );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by UE4 VR games.
Proton-Issue: https://github.com/ValveSoftware/Proton/issues/6533 Proton-Issue: https://github.com/ValveSoftware/Proton/issues/8457 --- dlls/windows.perception.stub/holographic_space.c | 8 ++++++-- dlls/windows.perception.stub/tests/perception.c | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.perception.stub/holographic_space.c b/dlls/windows.perception.stub/holographic_space.c index fa701c5d73e..4640ef48c50 100644 --- a/dlls/windows.perception.stub/holographic_space.c +++ b/dlls/windows.perception.stub/holographic_space.c @@ -274,8 +274,12 @@ static HRESULT WINAPI holographic_space_GetTrustLevel( IHolographicSpace *iface,
static HRESULT WINAPI holographic_space_get_PrimaryAdapterId( IHolographicSpace *iface, HolographicAdapterId *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + TRACE( "iface %p, value %p\n", iface, value ); + + value->LowPart = 0; + value->HighPart = 0; + + return S_OK; }
static HRESULT WINAPI holographic_space_SetDirect3D11Device( IHolographicSpace *iface, IDirect3DDevice *value ) diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 6840ef99a14..7ac0aa0bc97 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -234,11 +234,8 @@ static void test_HolographicSpaceStatics(void) ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IHolographicSpace_get_PrimaryAdapterId( holographic_space, &adapter_id ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( adapter_id.LowPart == 0, "got adapter_id.LowPart %u.\n", adapter_id.LowPart ); - todo_wine ok( adapter_id.HighPart == 0, "got adapter_id.HighPart %u.\n", adapter_id.HighPart );
DestroyWindow( window );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../holographic_space.c | 18 +++++++++++++----- .../windows.perception.stub/tests/perception.c | 3 +++ 2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.perception.stub/holographic_space.c b/dlls/windows.perception.stub/holographic_space.c index 4640ef48c50..df30a406d37 100644 --- a/dlls/windows.perception.stub/holographic_space.c +++ b/dlls/windows.perception.stub/holographic_space.c @@ -22,6 +22,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(perception);
+static EventRegistrationToken dummy_cookie = {.value = 0xdeadbeef}; + struct holographic_space_statics { IActivationFactory IActivationFactory_iface; @@ -285,33 +287,39 @@ static HRESULT WINAPI holographic_space_get_PrimaryAdapterId( IHolographicSpace static HRESULT WINAPI holographic_space_SetDirect3D11Device( IHolographicSpace *iface, IDirect3DDevice *value ) { FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + + if (!value ) return E_INVALIDARG; + return S_OK; }
static HRESULT WINAPI holographic_space_add_CameraAdded( IHolographicSpace *iface, ITypedEventHandler_HolographicSpace_HolographicSpaceCameraAddedEventArgs *handler, EventRegistrationToken *cookie ) { FIXME( "iface %p, handler %p, cookie %p stub!\n", iface, handler, cookie ); - return E_NOTIMPL; + + *cookie = dummy_cookie; + return S_OK; }
static HRESULT WINAPI holographic_space_remove_CameraAdded( IHolographicSpace *iface, EventRegistrationToken cookie ) { FIXME( "iface %p, cookie %#I64x stub!\n", iface, cookie.value ); - return E_NOTIMPL; + return S_OK; }
static HRESULT WINAPI holographic_space_add_CameraRemoved( IHolographicSpace *iface, ITypedEventHandler_HolographicSpace_HolographicSpaceCameraRemovedEventArgs *handler, EventRegistrationToken *cookie ) { FIXME( "iface %p, handler %p, cookie %p stub!\n", iface, handler, cookie ); - return E_NOTIMPL; + + *cookie = dummy_cookie; + return S_OK; }
static HRESULT WINAPI holographic_space_remove_CameraRemoved( IHolographicSpace *iface, EventRegistrationToken cookie ) { FIXME( "iface %p, cookie %#I64x stub!\n", iface, cookie.value ); - return E_NOTIMPL; + return S_OK; }
static HRESULT WINAPI holographic_space_CreateNextFrame( IHolographicSpace *iface, IHolographicFrame **value ) diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 7ac0aa0bc97..34c9415185c 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -238,6 +238,9 @@ static void test_HolographicSpaceStatics(void) ok( adapter_id.LowPart == 0, "got adapter_id.LowPart %u.\n", adapter_id.LowPart ); ok( adapter_id.HighPart == 0, "got adapter_id.HighPart %u.\n", adapter_id.HighPart );
+ hr = IHolographicSpace_SetDirect3D11Device( holographic_space, NULL ); + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + DestroyWindow( window ); ref = IHolographicSpace_Release( holographic_space ); ok( ref == 0, "got ref %ld.\n", ref );