Needed by the VR games Forewarned and Überlaüfer.
I had to put the parameters of the header functions on newlines because they're too long. Did the same for the other headers for consistency. windows.security.cryptography.idl uses a similar style.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by windows.perception.spatial.idl. --- include/windows.foundation.numerics.idl | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/include/windows.foundation.numerics.idl b/include/windows.foundation.numerics.idl index eca99ca29bc..e3a7a45696e 100644 --- a/include/windows.foundation.numerics.idl +++ b/include/windows.foundation.numerics.idl @@ -27,8 +27,36 @@ import "windowscontracts.idl"; import "windows.foundation.idl";
namespace Windows.Foundation.Numerics { + typedef struct Matrix4x4 Matrix4x4; + typedef struct Plane Plane; + typedef struct Quaternion Quaternion; typedef struct Vector3 Vector3;
+ declare { + interface Windows.Foundation.IReference<Windows.Foundation.Numerics.Matrix4x4>; + } + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + struct Matrix4x4 + { + FLOAT M11; + FLOAT M12; + FLOAT M13; + FLOAT M14; + FLOAT M21; + FLOAT M22; + FLOAT M23; + FLOAT M24; + FLOAT M31; + FLOAT M32; + FLOAT M33; + FLOAT M34; + FLOAT M41; + FLOAT M42; + FLOAT M43; + FLOAT M44; + }; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] struct Vector3 { @@ -36,4 +64,20 @@ namespace Windows.Foundation.Numerics { FLOAT Y; FLOAT Z; }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + struct Plane + { + Windows.Foundation.Numerics.Vector3 normal; + FLOAT D; + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + struct Quaternion + { + FLOAT X; + FLOAT Y; + FLOAT Z; + FLOAT W; + }; }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by windows.perception.spatial.surfaces.idl. --- include/Makefile.in | 1 + include/windows.perception.spatial.idl | 180 +++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 include/windows.perception.spatial.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 19dacb850ed..42f5aa47dcb 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -821,6 +821,7 @@ SOURCES = \ windows.media.idl \ windows.media.speechrecognition.idl \ windows.media.speechsynthesis.idl \ + windows.perception.spatial.idl \ windows.security.credentials.idl \ windows.security.cryptography.idl \ windows.storage.streams.idl \ diff --git a/include/windows.perception.spatial.idl b/include/windows.perception.spatial.idl new file mode 100644 index 00000000000..d19330963f7 --- /dev/null +++ b/include/windows.perception.spatial.idl @@ -0,0 +1,180 @@ +/* + * 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.perception.idl"; */ +import "windows.storage.streams.idl"; +/* import "windows.system.remotesystems.idl"; */ + +namespace Windows.Perception.Spatial { + typedef enum SpatialPerceptionAccessStatus SpatialPerceptionAccessStatus; + typedef struct SpatialBoundingBox SpatialBoundingBox; + typedef struct SpatialBoundingFrustum SpatialBoundingFrustum; + typedef struct SpatialBoundingOrientedBox SpatialBoundingOrientedBox; + typedef struct SpatialBoundingSphere SpatialBoundingSphere; + + interface ISpatialBoundingVolume; + interface ISpatialBoundingVolumeStatics; + interface ISpatialCoordinateSystem; + + runtimeclass SpatialBoundingVolume; + runtimeclass SpatialCoordinateSystem; + + declare { + interface Windows.Foundation.Collections.IIterable<Windows.Perception.Spatial.SpatialBoundingVolume *>; + interface Windows.Foundation.Collections.IIterator<Windows.Perception.Spatial.SpatialBoundingVolume *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Perception.Spatial.SpatialPerceptionAccessStatus>; + interface Windows.Foundation.IAsyncOperation<Windows.Perception.Spatial.SpatialPerceptionAccessStatus>; + interface Windows.Foundation.IReference<Windows.Perception.Spatial.SpatialBoundingBox>; + interface Windows.Foundation.IReference<Windows.Perception.Spatial.SpatialBoundingFrustum>; + interface Windows.Foundation.IReference<Windows.Perception.Spatial.SpatialBoundingOrientedBox>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + enum SpatialPerceptionAccessStatus + { + Unspecified = 0, + Allowed = 1, + DeniedByUser = 2, + DeniedBySystem = 3, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + struct SpatialBoundingBox + { + Windows.Foundation.Numerics.Vector3 Center; + Windows.Foundation.Numerics.Vector3 Extents; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + struct SpatialBoundingFrustum + { + Windows.Foundation.Numerics.Plane Near; + Windows.Foundation.Numerics.Plane Far; + Windows.Foundation.Numerics.Plane Right; + Windows.Foundation.Numerics.Plane Left; + Windows.Foundation.Numerics.Plane Top; + Windows.Foundation.Numerics.Plane Bottom; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + struct SpatialBoundingOrientedBox + { + Windows.Foundation.Numerics.Vector3 Center; + Windows.Foundation.Numerics.Vector3 Extents; + Windows.Foundation.Numerics.Quaternion Orientation; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0) + ] + struct SpatialBoundingSphere + { + Windows.Foundation.Numerics.Vector3 Center; + FLOAT Radius; + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.SpatialBoundingVolume), + uuid(fb2065da-68c3-33df-b7af-4c787207999c) + ] + interface ISpatialBoundingVolume : IInspectable + { + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.SpatialBoundingVolume), + uuid(05889117-b3e1-36d8-b017-566181a5b196) + ] + interface ISpatialBoundingVolumeStatics : IInspectable + { + HRESULT FromBox( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *system, + [in] Windows.Perception.Spatial.SpatialBoundingBox box, + [out, retval] Windows.Perception.Spatial.SpatialBoundingVolume **value + ); + HRESULT FromOrientedBox( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *system, + [in] Windows.Perception.Spatial.SpatialBoundingOrientedBox box, + [out, retval] Windows.Perception.Spatial.SpatialBoundingVolume **value + ); + HRESULT FromSphere( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *system, + [in] Windows.Perception.Spatial.SpatialBoundingSphere sphere, + [out, retval] Windows.Perception.Spatial.SpatialBoundingVolume **value + ); + HRESULT FromFrustum( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *system, + [in] Windows.Perception.Spatial.SpatialBoundingFrustum frustum, + [out, retval] Windows.Perception.Spatial.SpatialBoundingVolume **value + ); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.SpatialCoordinateSystem), + uuid(69ebca4b-60a3-3586-a653-59a7bd676d07) + ] + interface ISpatialCoordinateSystem : IInspectable + { + HRESULT TryGetTransformTo( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *target, + [out, retval] Windows.Foundation.IReference<Windows.Foundation.Numerics.Matrix4x4> **value + ); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + static(Windows.Perception.Spatial.ISpatialBoundingVolumeStatics, Windows.Foundation.UniversalApiContract, 2.0), + threading(both) + ] + runtimeclass SpatialBoundingVolume + { + [default] interface Windows.Perception.Spatial.ISpatialBoundingVolume; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpatialCoordinateSystem + { + [default] interface Windows.Perception.Spatial.ISpatialCoordinateSystem; + } +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by windows.perception.spatial.surfaces.idl. --- include/Makefile.in | 1 + include/windows.graphics.directx.idl | 167 +++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 include/windows.graphics.directx.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 42f5aa47dcb..d4b726d4bad 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.idl \ windows.h \ windows.media.closedcaptioning.idl \ windows.media.devices.idl \ diff --git a/include/windows.graphics.directx.idl b/include/windows.graphics.directx.idl new file mode 100644 index 00000000000..251d3d20f2a --- /dev/null +++ b/include/windows.graphics.directx.idl @@ -0,0 +1,167 @@ +/* + * 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"; + +namespace Windows.Graphics.DirectX { + typedef enum DirectXPixelFormat DirectXPixelFormat; + + declare { + interface Windows.Foundation.Collections.IIterable<Windows.Graphics.DirectX.DirectXPixelFormat>; + interface Windows.Foundation.Collections.IIterator<Windows.Graphics.DirectX.DirectXPixelFormat>; + interface Windows.Foundation.Collections.IVectorView<Windows.Graphics.DirectX.DirectXPixelFormat>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0) + ] + enum DirectXPixelFormat + { + Unknown = 0, + R32G32B32A32Typeless = 1, + R32G32B32A32Float = 2, + R32G32B32A32UInt = 3, + R32G32B32A32Int = 4, + R32G32B32Typeless = 5, + R32G32B32Float = 6, + R32G32B32UInt = 7, + R32G32B32Int = 8, + R16G16B16A16Typeless = 9, + R16G16B16A16Float = 10, + R16G16B16A16UIntNormalized = 11, + R16G16B16A16UInt = 12, + R16G16B16A16IntNormalized = 13, + R16G16B16A16Int = 14, + R32G32Typeless = 15, + R32G32Float = 16, + R32G32UInt = 17, + R32G32Int = 18, + R32G8X24Typeless = 19, + D32FloatS8X24UInt = 20, + R32FloatX8X24Typeless = 21, + X32TypelessG8X24UInt = 22, + R10G10B10A2Typeless = 23, + R10G10B10A2UIntNormalized = 24, + R10G10B10A2UInt = 25, + R11G11B10Float = 26, + R8G8B8A8Typeless = 27, + R8G8B8A8UIntNormalized = 28, + R8G8B8A8UIntNormalizedSrgb = 29, + R8G8B8A8UInt = 30, + R8G8B8A8IntNormalized = 31, + R8G8B8A8Int = 32, + R16G16Typeless = 33, + R16G16Float = 34, + R16G16UIntNormalized = 35, + R16G16UInt = 36, + R16G16IntNormalized = 37, + R16G16Int = 38, + R32Typeless = 39, + D32Float = 40, + R32Float = 41, + R32UInt = 42, + R32Int = 43, + R24G8Typeless = 44, + D24UIntNormalizedS8UInt = 45, + R24UIntNormalizedX8Typeless = 46, + X24TypelessG8UInt = 47, + R8G8Typeless = 48, + R8G8UIntNormalized = 49, + R8G8UInt = 50, + R8G8IntNormalized = 51, + R8G8Int = 52, + R16Typeless = 53, + R16Float = 54, + D16UIntNormalized = 55, + R16UIntNormalized = 56, + R16UInt = 57, + R16IntNormalized = 58, + R16Int = 59, + R8Typeless = 60, + R8UIntNormalized = 61, + R8UInt = 62, + R8IntNormalized = 63, + R8Int = 64, + A8UIntNormalized = 65, + R1UIntNormalized = 66, + R9G9B9E5SharedExponent = 67, + R8G8B8G8UIntNormalized = 68, + G8R8G8B8UIntNormalized = 69, + BC1Typeless = 70, + BC1UIntNormalized = 71, + BC1UIntNormalizedSrgb = 72, + BC2Typeless = 73, + BC2UIntNormalized = 74, + BC2UIntNormalizedSrgb = 75, + BC3Typeless = 76, + BC3UIntNormalized = 77, + BC3UIntNormalizedSrgb = 78, + BC4Typeless = 79, + BC4UIntNormalized = 80, + BC4IntNormalized = 81, + BC5Typeless = 82, + BC5UIntNormalized = 83, + BC5IntNormalized = 84, + B5G6R5UIntNormalized = 85, + B5G5R5A1UIntNormalized = 86, + B8G8R8A8UIntNormalized = 87, + B8G8R8X8UIntNormalized = 88, + R10G10B10XRBiasA2UIntNormalized = 89, + B8G8R8A8Typeless = 90, + B8G8R8A8UIntNormalizedSrgb = 91, + B8G8R8X8Typeless = 92, + B8G8R8X8UIntNormalizedSrgb = 93, + BC6HTypeless = 94, + BC6H16UnsignedFloat = 95, + BC6H16Float = 96, + BC7Typeless = 97, + BC7UIntNormalized = 98, + BC7UIntNormalizedSrgb = 99, + Ayuv = 100, + Y410 = 101, + Y416 = 102, + NV12 = 103, + P010 = 104, + P016 = 105, + Opaque420 = 106, + Yuy2 = 107, + Y210 = 108, + Y216 = 109, + NV11 = 110, + AI44 = 111, + IA44 = 112, + P8 = 113, + A8P8 = 114, + B4G4R4A4UIntNormalized = 115, + P208 = 130, + V208 = 131, + V408 = 132, + [contract(Windows.Foundation.UniversalApiContract, 10.0)] + SamplerFeedbackMinMipOpaque = 189, + [contract(Windows.Foundation.UniversalApiContract, 10.0)] + SamplerFeedbackMipRegionUsedOpaque = 190, + }; +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed to compile windows.perception.spatial.surfaces.idl. --- tools/widl/typetree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index ee71a7a2899..e867ea4d26f 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -212,6 +212,7 @@ static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t { case TYPE_BASIC_INT: case TYPE_BASIC_INT32: + case TYPE_BASIC_LONG: n += strappend(buf, len, pos + n, type_basic_get_sign(type) <= 0 ? "i4" : "u4"); return n; case TYPE_BASIC_INT64: @@ -232,7 +233,6 @@ static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t return n; case TYPE_BASIC_INT16: case TYPE_BASIC_INT3264: - case TYPE_BASIC_LONG: case TYPE_BASIC_CHAR: case TYPE_BASIC_HYPER: case TYPE_BASIC_WCHAR:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed to compile windows.perception.spatial.surfaces.idl. --- tools/widl/typetree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index e867ea4d26f..e6304f311dc 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -222,6 +222,9 @@ static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t assert(type_basic_get_sign(type) > 0); /* signature string for signed char isn't specified */ n += strappend(buf, len, pos + n, "u1"); return n; + case TYPE_BASIC_INT16: + n += strappend(buf, len, pos + n, type_basic_get_sign(type) <= 0 ? "i2" : "u2"); + return n; case TYPE_BASIC_FLOAT: n += strappend(buf, len, pos + n, "f4"); return n; @@ -231,7 +234,6 @@ static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t case TYPE_BASIC_BYTE: n += strappend(buf, len, pos + n, "u1"); return n; - case TYPE_BASIC_INT16: case TYPE_BASIC_INT3264: case TYPE_BASIC_CHAR: case TYPE_BASIC_HYPER:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed to compile windows.perception.spatial.surfaces.idl. --- tools/widl/typetree.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index e6304f311dc..408386037b1 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -251,6 +251,22 @@ static size_t append_type_signature(char **buf, size_t *len, size_t pos, type_t n += strappend(buf, len, pos + n, ")"); return n; case TYPE_ARRAY: + n += append_type_signature(buf, len, pos + n, type->details.array.elem.type); + n += strappend(buf, len, pos + n, "["); + if (type_array_has_conformance(type)) + { + n += strappend(buf, len, pos + n, "size_is("); + n += append_type_signature(buf, len, pos + n, type->details.array.size_is->u.tref.type); + n += strappend(buf, len, pos + n, ")"); + } + else if (type_array_has_variance(type)) + { + n += strappend(buf, len, pos + n, "length_is("); + n += append_type_signature(buf, len, pos + n, type->details.array.length_is->u.tref.type); + n += strappend(buf, len, pos + n, ")"); + } + n += strappend(buf, len, pos + n, "]"); + return n; case TYPE_ENCAPSULATED_UNION: case TYPE_UNION: case TYPE_COCLASS:
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + .../windows.perception.spatial.surfaces.idl | 232 ++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 include/windows.perception.spatial.surfaces.idl
diff --git a/include/Makefile.in b/include/Makefile.in index d4b726d4bad..27360fa5f21 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -823,6 +823,7 @@ SOURCES = \ windows.media.speechrecognition.idl \ windows.media.speechsynthesis.idl \ windows.perception.spatial.idl \ + windows.perception.spatial.surfaces.idl \ windows.security.credentials.idl \ windows.security.cryptography.idl \ windows.storage.streams.idl \ diff --git a/include/windows.perception.spatial.surfaces.idl b/include/windows.perception.spatial.surfaces.idl new file mode 100644 index 00000000000..1e852c8a129 --- /dev/null +++ b/include/windows.perception.spatial.surfaces.idl @@ -0,0 +1,232 @@ +/* + * 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.perception.spatial.idl"; +import "windows.storage.streams.idl"; + +namespace Windows.Perception.Spatial.Surfaces { + interface ISpatialSurfaceInfo; + interface ISpatialSurfaceMesh; + interface ISpatialSurfaceMeshBuffer; + interface ISpatialSurfaceMeshOptions; + interface ISpatialSurfaceMeshOptionsStatics; + interface ISpatialSurfaceObserver; + interface ISpatialSurfaceObserverStatics; + interface ISpatialSurfaceObserverStatics2; + + runtimeclass SpatialSurfaceInfo; + runtimeclass SpatialSurfaceMesh; + runtimeclass SpatialSurfaceMeshBuffer; + runtimeclass SpatialSurfaceMeshOptions; + runtimeclass SpatialSurfaceObserver; + + declare { + interface Windows.Foundation.Collections.IMapView<GUID, Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo *>; + interface Windows.Foundation.Collections.IKeyValuePair<GUID, Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo *>; + interface Windows.Foundation.Collections.IIterable<Windows.Foundation.Collections.IKeyValuePair<GUID, Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo *> *>; + interface Windows.Foundation.Collections.IIterator<Windows.Foundation.Collections.IKeyValuePair<GUID, Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo *> *>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Perception.Spatial.Surfaces.SpatialSurfaceMesh *>; + interface Windows.Foundation.IAsyncOperation<Windows.Perception.Spatial.Surfaces.SpatialSurfaceMesh *>; + interface Windows.Foundation.TypedEventHandler<Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver *, IInspectable *>; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo), + uuid(f8e9ebe7-39b7-3962-bb03-57f56e1fb0a1) + ] + interface ISpatialSurfaceInfo : IInspectable + { + [propget] HRESULT Id([out, retval] GUID *value); + [propget] HRESULT UpdateTime([out, retval] Windows.Foundation.DateTime *value); + HRESULT TryGetBounds( + [in] Windows.Perception.Spatial.SpatialCoordinateSystem *system, + [out, retval] Windows.Foundation.IReference<Windows.Perception.Spatial.SpatialBoundingOrientedBox> **value + ); + [overload("TryComputeLatestMeshAsync")] HRESULT TryComputeLatestMeshAsync( + [in] DOUBLE triangles, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Perception.Spatial.Surfaces.SpatialSurfaceMesh *> **value + ); + [overload("TryComputeLatestMeshAsync")] HRESULT TryComputeLatestMeshWithOptionsAsync( + [in] DOUBLE triangles, + [in] Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshOptions *options, + [out, retval] Windows.Foundation.IAsyncOperation<Windows.Perception.Spatial.Surfaces.SpatialSurfaceMesh *> **value + ); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceMesh), + uuid(108f57d9-df0d-3950-a0fd-f972c77c27b4) + ] + interface ISpatialSurfaceMesh : IInspectable + { + [propget] HRESULT SurfaceInfo([out, retval] Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo **value); + [propget] HRESULT CoordinateSystem([out, retval] Windows.Perception.Spatial.SpatialCoordinateSystem **value); + [propget] HRESULT TriangleIndices([out, retval] Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshBuffer **value); + [propget] HRESULT VertexPositions([out, retval] Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshBuffer **value); + [propget] HRESULT VertexPositionScale([out, retval] Windows.Foundation.Numerics.Vector3 *value); + [propget] HRESULT VertexNormals([out, retval] Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshBuffer **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshBuffer), + uuid(93cf59e0-871f-33f8-98b2-03d101458f6f) + ] + interface ISpatialSurfaceMeshBuffer : IInspectable + { + [propget] HRESULT Format([out, retval] Windows.Graphics.DirectX.DirectXPixelFormat *value); + [propget] HRESULT Stride([out, retval] UINT32 *value); + [propget] HRESULT ElementCount([out, retval] UINT32 *value); + [propget] HRESULT Data([out, retval] Windows.Storage.Streams.IBuffer **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshOptions), + uuid(d2759f89-3572-3d2d-a10d-5fee9394aa37) + ] + interface ISpatialSurfaceMeshOptions : IInspectable + { + [propget] HRESULT VertexPositionFormat([out, retval] Windows.Graphics.DirectX.DirectXPixelFormat *value); + [propput] HRESULT VertexPositionFormat([in] Windows.Graphics.DirectX.DirectXPixelFormat value); + [propget] HRESULT TriangleIndexFormat([out, retval] Windows.Graphics.DirectX.DirectXPixelFormat *value); + [propput] HRESULT TriangleIndexFormat([in] Windows.Graphics.DirectX.DirectXPixelFormat value); + [propget] HRESULT VertexNormalFormat([out, retval] Windows.Graphics.DirectX.DirectXPixelFormat *value); + [propput] HRESULT VertexNormalFormat([in] Windows.Graphics.DirectX.DirectXPixelFormat value); + [propget] HRESULT IncludeVertexNormals([out, retval] boolean *value); + [propput] HRESULT IncludeVertexNormals([in] boolean value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceMeshOptions), + uuid(9b340abf-9781-4505-8935-013575caae5e) + ] + interface ISpatialSurfaceMeshOptionsStatics : IInspectable + { + [propget] HRESULT SupportedVertexPositionFormats([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Graphics.DirectX.DirectXPixelFormat> **value); + [propget] HRESULT SupportedTriangleIndexFormats([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Graphics.DirectX.DirectXPixelFormat> **value); + [propget] HRESULT SupportedVertexNormalFormats([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Graphics.DirectX.DirectXPixelFormat> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver), + uuid(10b69819-ddca-3483-ac3a-748fe8c86df5) + ] + interface ISpatialSurfaceObserver : IInspectable + { + HRESULT GetObservedSurfaces([out, retval] Windows.Foundation.Collections.IMapView<GUID, Windows.Perception.Spatial.Surfaces.SpatialSurfaceInfo *> **value); + HRESULT SetBoundingVolume([in] Windows.Perception.Spatial.SpatialBoundingVolume *bounds); + HRESULT SetBoundingVolumes([in] Windows.Foundation.Collections.IIterable<Windows.Perception.Spatial.SpatialBoundingVolume *> *bounds); + [eventadd] HRESULT ObservedSurfacesChanged( + [in] Windows.Foundation.TypedEventHandler<Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver *, IInspectable *> *handler, + [out, retval] EventRegistrationToken *token + ); + [eventremove] HRESULT ObservedSurfacesChanged([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver), + uuid(165951ed-2108-4168-9175-87e027bc9285) + ] + interface ISpatialSurfaceObserverStatics : IInspectable + { + HRESULT RequestAccessAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Perception.Spatial.SpatialPerceptionAccessStatus> **result); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 4.0), + exclusiveto(Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver), + uuid(0f534261-c55d-4e6b-a895-a19de69a42e3) + ] + interface ISpatialSurfaceObserverStatics2 : IInspectable + requires Windows.Perception.Spatial.Surfaces.ISpatialSurfaceObserverStatics + { + HRESULT IsSupported([out, retval] boolean *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpatialSurfaceInfo + { + [default] interface Windows.Perception.Spatial.Surfaces.ISpatialSurfaceInfo; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpatialSurfaceMesh + { + [default] interface Windows.Perception.Spatial.Surfaces.ISpatialSurfaceMesh; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpatialSurfaceMeshBuffer + { + [default] interface Windows.Perception.Spatial.Surfaces.ISpatialSurfaceMeshBuffer; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 2.0), + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + static(Windows.Perception.Spatial.Surfaces.ISpatialSurfaceMeshOptionsStatics, Windows.Foundation.UniversalApiContract, 2.0), + threading(both) + ] + runtimeclass SpatialSurfaceMeshOptions + { + [default] interface Windows.Perception.Spatial.Surfaces.ISpatialSurfaceMeshOptions; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 2.0), + contract(Windows.Foundation.UniversalApiContract, 2.0), + marshaling_behavior(agile), + static(Windows.Perception.Spatial.Surfaces.ISpatialSurfaceObserverStatics, Windows.Foundation.UniversalApiContract, 2.0), + static(Windows.Perception.Spatial.Surfaces.ISpatialSurfaceObserverStatics2, Windows.Foundation.UniversalApiContract, 4.0), + threading(both) + ] + runtimeclass SpatialSurfaceObserver + { + [default] interface Windows.Perception.Spatial.Surfaces.ISpatialSurfaceObserver; + } +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 2 + dlls/windows.perception.stub/Makefile.in | 9 ++ dlls/windows.perception.stub/classes.idl | 23 ++++ dlls/windows.perception.stub/main.c | 55 ++++++++ dlls/windows.perception.stub/observer.c | 117 ++++++++++++++++++ dlls/windows.perception.stub/private.h | 40 ++++++ .../windows.perception.stub/tests/Makefile.in | 5 + .../tests/perception.c | 86 +++++++++++++ .../windows.perception.stub.spec | 5 + 9 files changed, 342 insertions(+) create mode 100644 dlls/windows.perception.stub/Makefile.in create mode 100644 dlls/windows.perception.stub/classes.idl create mode 100644 dlls/windows.perception.stub/main.c create mode 100644 dlls/windows.perception.stub/observer.c create mode 100644 dlls/windows.perception.stub/private.h create mode 100644 dlls/windows.perception.stub/tests/Makefile.in create mode 100644 dlls/windows.perception.stub/tests/perception.c create mode 100644 dlls/windows.perception.stub/windows.perception.stub.spec
diff --git a/configure.ac b/configure.ac index 228002fd922..cac000109d2 100644 --- a/configure.ac +++ b/configure.ac @@ -3125,6 +3125,8 @@ WINE_CONFIG_MAKEFILE(dlls/windows.media.speech/tests) WINE_CONFIG_MAKEFILE(dlls/windows.media) WINE_CONFIG_MAKEFILE(dlls/windows.media/tests) WINE_CONFIG_MAKEFILE(dlls/windows.networking) +WINE_CONFIG_MAKEFILE(dlls/windows.perception.stub) +WINE_CONFIG_MAKEFILE(dlls/windows.perception.stub/tests) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers/tests) WINE_CONFIG_MAKEFILE(dlls/windows.ui) diff --git a/dlls/windows.perception.stub/Makefile.in b/dlls/windows.perception.stub/Makefile.in new file mode 100644 index 00000000000..c19496cdd66 --- /dev/null +++ b/dlls/windows.perception.stub/Makefile.in @@ -0,0 +1,9 @@ +MODULE = windows.perception.stub.dll +IMPORTS = combase + +C_SRCS = \ + main.c \ + observer.c + +IDL_SRCS = \ + classes.idl diff --git a/dlls/windows.perception.stub/classes.idl b/dlls/windows.perception.stub/classes.idl new file mode 100644 index 00000000000..7d0412fa9b2 --- /dev/null +++ b/dlls/windows.perception.stub/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for windows.perception.stub.dll + * + * 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 + */ + +#pragma makedep register + +#include "windows.perception.spatial.surfaces.idl" diff --git a/dlls/windows.perception.stub/main.c b/dlls/windows.perception.stub/main.c new file mode 100644 index 00000000000..094b1b60654 --- /dev/null +++ b/dlls/windows.perception.stub/main.c @@ -0,0 +1,55 @@ +/* WinRT Windows.Perception.Stub 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 "initguid.h" +#include "private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(perception); + +static const char *debugstr_hstring( HSTRING hstr ) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer( hstr, &len ); + return wine_dbgstr_wn( str, len ); +} + +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) +{ + FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **factory ) +{ + const WCHAR *buffer = WindowsGetStringRawBuffer( classid, NULL ); + + TRACE( "class %s, factory %p.\n", debugstr_hstring(classid), factory ); + + *factory = NULL; + + if (!wcscmp( buffer, RuntimeClass_Windows_Perception_Spatial_Surfaces_SpatialSurfaceObserver )) + IActivationFactory_QueryInterface( observer_factory, &IID_IActivationFactory, (void **)factory ); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/windows.perception.stub/observer.c b/dlls/windows.perception.stub/observer.c new file mode 100644 index 00000000000..f41a35beb70 --- /dev/null +++ b/dlls/windows.perception.stub/observer.c @@ -0,0 +1,117 @@ +/* WinRT Windows.Perception.Stub Observer 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 observer +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct observer *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct observer, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct observer *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; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef( IActivationFactory *iface ) +{ + struct observer *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 observer *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, +}; + +static struct observer observer_statics = +{ + {&factory_vtbl}, + 1, +}; + +IActivationFactory *observer_factory = &observer_statics.IActivationFactory_iface; diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h new file mode 100644 index 00000000000..497b3998a02 --- /dev/null +++ b/dlls/windows.perception.stub/private.h @@ -0,0 +1,40 @@ +/* WinRT Windows.Perception.Stub 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 + */ + +#ifndef __WINE_WINDOWS_PERCEPTION_PRIVATE_H +#define __WINE_WINDOWS_PERCEPTION_PRIVATE_H + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Perception_Spatial_Surfaces +#include "windows.perception.spatial.surfaces.h" + +extern IActivationFactory *observer_factory; + +#endif diff --git a/dlls/windows.perception.stub/tests/Makefile.in b/dlls/windows.perception.stub/tests/Makefile.in new file mode 100644 index 00000000000..2bcb68cfb42 --- /dev/null +++ b/dlls/windows.perception.stub/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.perception.stub.dll +IMPORTS = combase + +C_SRCS = \ + perception.c diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c new file mode 100644 index 00000000000..f26a45788a6 --- /dev/null +++ b/dlls/windows.perception.stub/tests/perception.c @@ -0,0 +1,86 @@ +/* + * 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 + */ +#define COBJMACROS +#include "initguid.h" +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Perception_Spatial_Surfaces +#include "windows.perception.spatial.surfaces.h" + +#include "wine/test.h" + +#define check_interface( obj, iid ) check_interface_( __LINE__, obj, iid ) +static void check_interface_( unsigned int line, void *obj, const IID *iid ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == S_OK, "got hr %#lx.\n", hr ); + IUnknown_Release( unk ); +} + +static void test_ObserverStatics(void) +{ + static const WCHAR *observer_statics_name = L"Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver"; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( observer_statics_name, wcslen( observer_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( observer_statics_name ) ); + return; + } + + check_interface( factory, &IID_IUnknown ); + check_interface( factory, &IID_IInspectable ); + check_interface( factory, &IID_IAgileObject ); + + ref = IActivationFactory_Release( factory ); + ok( ref == 1, "got ref %ld.\n", ref ); +} + +START_TEST(perception) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_ObserverStatics(); + + RoUninitialize(); +} diff --git a/dlls/windows.perception.stub/windows.perception.stub.spec b/dlls/windows.perception.stub/windows.perception.stub.spec new file mode 100644 index 00000000000..55a1c9f8d92 --- /dev/null +++ b/dlls/windows.perception.stub/windows.perception.stub.spec @@ -0,0 +1,5 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stub DllGetActivationFactoryPerceptionStub +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stub GetProxyDllInfo
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/observer.c | 30 +++++++++++++++ dlls/windows.perception.stub/private.h | 38 +++++++++++++++++++ .../tests/perception.c | 7 ++++ 3 files changed, 75 insertions(+)
diff --git a/dlls/windows.perception.stub/observer.c b/dlls/windows.perception.stub/observer.c index f41a35beb70..e5cb0bac3ea 100644 --- a/dlls/windows.perception.stub/observer.c +++ b/dlls/windows.perception.stub/observer.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(perception); struct observer { IActivationFactory IActivationFactory_iface; + ISpatialSurfaceObserverStatics ISpatialSurfaceObserverStatics_iface; LONG ref; };
@@ -50,6 +51,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_ISpatialSurfaceObserverStatics )) + { + *out = &impl->ISpatialSurfaceObserverStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -108,9 +116,31 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( observer_statics, ISpatialSurfaceObserverStatics, struct observer, IActivationFactory_iface ) + +static HRESULT WINAPI observer_statics_RequestAccessAsync( ISpatialSurfaceObserverStatics *iface, IAsyncOperation_SpatialPerceptionAccessStatus **result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static const struct ISpatialSurfaceObserverStaticsVtbl observer_statics_vtbl = +{ + observer_statics_QueryInterface, + observer_statics_AddRef, + observer_statics_Release, + /* IInspectable methods */ + observer_statics_GetIids, + observer_statics_GetRuntimeClassName, + observer_statics_GetTrustLevel, + /* ISpatialSurfaceObserverStatics methods */ + observer_statics_RequestAccessAsync, +}; + static struct observer observer_statics = { {&factory_vtbl}, + {&observer_statics_vtbl}, 1, };
diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h index 497b3998a02..a32f8221380 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -37,4 +37,42 @@
extern IActivationFactory *observer_factory;
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) + #endif diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index f26a45788a6..f3d353568f4 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -48,6 +48,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_ObserverStatics(void) { static const WCHAR *observer_statics_name = L"Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver"; + ISpatialSurfaceObserverStatics *observer_statics; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -69,6 +70,12 @@ static void test_ObserverStatics(void) check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject );
+ hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics, (void **)&observer_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = ISpatialSurfaceObserverStatics_Release( observer_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); + ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/observer.c | 30 +++++++++++++++++++ .../tests/perception.c | 5 ++++ 2 files changed, 35 insertions(+)
diff --git a/dlls/windows.perception.stub/observer.c b/dlls/windows.perception.stub/observer.c index e5cb0bac3ea..16f573e4d84 100644 --- a/dlls/windows.perception.stub/observer.c +++ b/dlls/windows.perception.stub/observer.c @@ -27,6 +27,7 @@ struct observer { IActivationFactory IActivationFactory_iface; ISpatialSurfaceObserverStatics ISpatialSurfaceObserverStatics_iface; + ISpatialSurfaceObserverStatics2 ISpatialSurfaceObserverStatics2_iface; LONG ref; };
@@ -58,6 +59,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_ISpatialSurfaceObserverStatics2 )) + { + *out = &impl->ISpatialSurfaceObserverStatics2_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -137,10 +145,32 @@ static const struct ISpatialSurfaceObserverStaticsVtbl observer_statics_vtbl = observer_statics_RequestAccessAsync, };
+DEFINE_IINSPECTABLE( observer_statics2, ISpatialSurfaceObserverStatics2, struct observer, IActivationFactory_iface ) + +static HRESULT WINAPI observer_statics2_IsSupported( ISpatialSurfaceObserverStatics2 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct ISpatialSurfaceObserverStatics2Vtbl observer_statics2_vtbl = +{ + observer_statics2_QueryInterface, + observer_statics2_AddRef, + observer_statics2_Release, + /* IInspectable methods */ + observer_statics2_GetIids, + observer_statics2_GetRuntimeClassName, + observer_statics2_GetTrustLevel, + /* ISpatialSurfaceObserverStatics2 methods */ + observer_statics2_IsSupported, +}; + static struct observer observer_statics = { {&factory_vtbl}, {&observer_statics_vtbl}, + {&observer_statics2_vtbl}, 1, };
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index f3d353568f4..86492908eea 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -48,6 +48,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_ObserverStatics(void) { static const WCHAR *observer_statics_name = L"Windows.Perception.Spatial.Surfaces.SpatialSurfaceObserver"; + ISpatialSurfaceObserverStatics2 *observer_statics2; ISpatialSurfaceObserverStatics *observer_statics; IActivationFactory *factory; HSTRING str; @@ -72,8 +73,12 @@ static void test_ObserverStatics(void)
hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics, (void **)&observer_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics2, (void **)&observer_statics2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr );
ref = ISpatialSurfaceObserverStatics_Release( observer_statics ); + ok( ref == 3, "got ref %ld.\n", ref ); + ref = ISpatialSurfaceObserverStatics2_Release( observer_statics2 ); ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.perception.stub/tests/perception.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 86492908eea..6df954da5bf 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -51,6 +51,7 @@ static void test_ObserverStatics(void) ISpatialSurfaceObserverStatics2 *observer_statics2; ISpatialSurfaceObserverStatics *observer_statics; IActivationFactory *factory; + BOOLEAN value; HSTRING str; HRESULT hr; LONG ref; @@ -76,6 +77,11 @@ static void test_ObserverStatics(void) hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics2, (void **)&observer_statics2 ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ value = TRUE; + hr = ISpatialSurfaceObserverStatics2_IsSupported( observer_statics2, &value ); + todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine ok( !value, "got %d.\n", value ); + ref = ISpatialSurfaceObserverStatics_Release( observer_statics ); ok( ref == 3, "got ref %ld.\n", ref ); ref = ISpatialSurfaceObserverStatics2_Release( observer_statics2 );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by the VR games Forewarned and Überlaüfer. --- dlls/windows.perception.stub/observer.c | 6 ++++-- dlls/windows.perception.stub/tests/perception.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.perception.stub/observer.c b/dlls/windows.perception.stub/observer.c index 16f573e4d84..50643b77981 100644 --- a/dlls/windows.perception.stub/observer.c +++ b/dlls/windows.perception.stub/observer.c @@ -149,8 +149,10 @@ DEFINE_IINSPECTABLE( observer_statics2, ISpatialSurfaceObserverStatics2, struct
static HRESULT WINAPI observer_statics2_IsSupported( ISpatialSurfaceObserverStatics2 *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 ISpatialSurfaceObserverStatics2Vtbl observer_statics2_vtbl = diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index 6df954da5bf..e5126e7827f 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -79,8 +79,8 @@ static void test_ObserverStatics(void)
value = TRUE; hr = ISpatialSurfaceObserverStatics2_IsSupported( observer_statics2, &value ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( !value, "got %d.\n", value ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( !value, "got %d.\n", value );
ref = ISpatialSurfaceObserverStatics_Release( observer_statics ); ok( ref == 3, "got ref %ld.\n", ref );
Rémi Bernon (@rbernon) commented about include/windows.foundation.numerics.idl:
FLOAT Y; FLOAT Z; };
- [contract(Windows.Foundation.UniversalApiContract, 1.0)]
- struct Plane
- {
Windows.Foundation.Numerics.Vector3 normal;
```suggestion:-0+0 Windows.Foundation.Numerics.Vector3 Normal; ```
Rémi Bernon (@rbernon) commented about include/windows.foundation.numerics.idl:
import "windows.foundation.idl";
namespace Windows.Foundation.Numerics {
typedef struct Matrix4x4 Matrix4x4;
typedef struct Plane Plane;
typedef struct Quaternion Quaternion; typedef struct Vector3 Vector3;
declare {
interface Windows.Foundation.IReference<Windows.Foundation.Numerics.Matrix4x4>;
}
[contract(Windows.Foundation.UniversalApiContract, 1.0)]
struct Matrix4x4
Would you mind adding `Matrix3x2`, `Vector2` and `Vector4` as in https://gitlab.winehq.org/wine/wine/-/merge_requests/2311/diffs?commit_id=b2... -but with the relevant typedefs?
I only looked at the IDLs so far, would you mind addressing the comments above and splitting these changes to a separate MR?
On Thu Mar 2 15:40:54 2023 +0000, Rémi Bernon wrote:
Would you mind adding `Matrix3x2`, `Vector2` and `Vector4` as in https://gitlab.winehq.org/wine/wine/-/merge_requests/2311/diffs?commit_id=b2... -but with the relevant typedefs?
Sure, no problem. I also added the missing Vector 3 interface declaration.
MR https://gitlab.winehq.org/wine/wine/-/merge_requests/2317 created.
Rémi Bernon (@rbernon) commented about dlls/windows.perception.stub/tests/perception.c:
check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject );
- hr = IActivationFactory_QueryInterface( factory, &IID_ISpatialSurfaceObserverStatics, (void **)&observer_statics );
- ok( hr == S_OK, "got hr %#lx.\n", hr );
- ref = ISpatialSurfaceObserverStatics_Release( observer_statics );
- ok( ref == 2, "got ref %ld.\n", ref );
You could just call `check_interface` there I guess? Also it doesn't look like `ISpatialSurfaceObserverStatics` iface is actually needed, or are the games querying it?
Fwiw, you don't have to implement every interface, only the default and then the needed ones. It probably doesn't matter too much here.
Looks good, would you mind rebasing?