wine-staging/patches/windows.gaming.input-dll/0003-windows.gaming.input-Implement-IGamepadStatics-Gamep.patch

158 lines
5.3 KiB
Diff
Raw Normal View History

From 39cabcb0a109f9705740120186858defe1c1cf2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 17:58:14 +0200
Subject: [PATCH 3/9] windows.gaming.input: Implement IGamepadStatics::Gamepads
stubs.
---
.../windows.gaming.input_main.c | 112 +++++++++++++++++-
1 file changed, 111 insertions(+), 1 deletion(-)
diff --git a/dlls/windows.gaming.input.dll/windows.gaming.input_main.c b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c
index 33c260b27b3..a7d9a89244b 100644
--- a/dlls/windows.gaming.input.dll/windows.gaming.input_main.c
+++ b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c
@@ -32,6 +32,7 @@ struct windows_gaming_input
{
IActivationFactory IActivationFactory_iface;
IGamepadStatics IGamepadStatics_iface;
+ IVectorView_Gamepad IVectorView_Gamepad_iface;
LONG ref;
};
@@ -45,6 +46,113 @@ static inline struct windows_gaming_input *impl_from_IGamepadStatics(IGamepadSta
return CONTAINING_RECORD(iface, struct windows_gaming_input, IGamepadStatics_iface);
}
+static inline struct windows_gaming_input *impl_from_IVectorView_Gamepad(IVectorView_Gamepad *iface)
+{
+ return CONTAINING_RECORD(iface, struct windows_gaming_input, IVectorView_Gamepad_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_QueryInterface(
+ IVectorView_Gamepad *iface, REFIID iid, void **out)
+{
+ TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_IUnknown) ||
+ IsEqualGUID(iid, &IID_IInspectable) ||
+ IsEqualGUID(iid, &IID_IVectorView_Gamepad))
+ {
+ IUnknown_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE vector_view_gamepad_AddRef(
+ IVectorView_Gamepad *iface)
+{
+ struct windows_gaming_input *impl = impl_from_IVectorView_Gamepad(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ TRACE("iface %p, ref %u.\n", iface, ref);
+ return ref;
+}
+
+static ULONG STDMETHODCALLTYPE vector_view_gamepad_Release(
+ IVectorView_Gamepad *iface)
+{
+ struct windows_gaming_input *impl = impl_from_IVectorView_Gamepad(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ TRACE("iface %p, ref %u.\n", iface, ref);
+ return ref;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetIids(
+ IVectorView_Gamepad *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 STDMETHODCALLTYPE vector_view_gamepad_GetRuntimeClassName(
+ IVectorView_Gamepad *iface, HSTRING *class_name)
+{
+ FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetTrustLevel(
+ IVectorView_Gamepad *iface, TrustLevel *trust_level)
+{
+ FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetAt(
+ IVectorView_Gamepad *iface, ULONG index, IGamepad **value)
+{
+ FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_get_Size(
+ IVectorView_Gamepad *iface, ULONG *value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_IndexOf(
+ IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *value)
+{
+ FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetMany(
+ IVectorView_Gamepad *iface, ULONG start_index, IGamepad **items, UINT *value)
+{
+ FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value);
+ return E_NOTIMPL;
+}
+
+static const struct IVectorView_GamepadVtbl vector_view_gamepad_vtbl =
+{
+ vector_view_gamepad_QueryInterface,
+ vector_view_gamepad_AddRef,
+ vector_view_gamepad_Release,
+ /* IInspectable methods */
+ vector_view_gamepad_GetIids,
+ vector_view_gamepad_GetRuntimeClassName,
+ vector_view_gamepad_GetTrustLevel,
+ /* IVectorView<Gamepad> methods */
+ vector_view_gamepad_GetAt,
+ vector_view_gamepad_get_Size,
+ vector_view_gamepad_IndexOf,
+ vector_view_gamepad_GetMany,
+};
+
static HRESULT STDMETHODCALLTYPE gamepad_statics_QueryInterface(
IGamepadStatics *iface, REFIID iid, void **out)
{
@@ -134,7 +242,8 @@ static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads(
{
struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface);
FIXME("iface %p, value %p stub!\n", iface, value);
- return E_NOTIMPL;
+ *value = &impl->IVectorView_Gamepad_iface;
+ return S_OK;
}
static const struct IGamepadStaticsVtbl gamepad_statics_vtbl =
@@ -244,6 +353,7 @@ static struct windows_gaming_input windows_gaming_input =
{
{&activation_factory_vtbl},
{&gamepad_statics_vtbl},
+ {&vector_view_gamepad_vtbl},
0
};
--
2.28.0