Commit 800bbece authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.gaming.input: Implement IGamepadStatics stubs.

parent 5604d344
......@@ -29,7 +29,10 @@
#include "initguid.h"
#include "activation.h"
#define WIDL_using_Windows_Foundation
#define WIDL_using_Windows_Foundation_Collections
#include "windows.foundation.h"
#define WIDL_using_Windows_Gaming_Input
#include "windows.gaming.input.h"
WINE_DEFAULT_DEBUG_CHANNEL(input);
......@@ -46,6 +49,7 @@ static const char *debugstr_hstring(HSTRING hstr)
struct windows_gaming_input
{
IActivationFactory IActivationFactory_iface;
IGamepadStatics IGamepadStatics_iface;
LONG ref;
};
......@@ -54,9 +58,16 @@ static inline struct windows_gaming_input *impl_from_IActivationFactory(IActivat
return CONTAINING_RECORD(iface, struct windows_gaming_input, IActivationFactory_iface);
}
static inline struct windows_gaming_input *impl_from_IGamepadStatics(IGamepadStatics *iface)
{
return CONTAINING_RECORD(iface, struct windows_gaming_input, IGamepadStatics_iface);
}
static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface(
IActivationFactory *iface, REFIID iid, void **out)
{
struct windows_gaming_input *impl = impl_from_IActivationFactory(iface);
TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) ||
......@@ -69,6 +80,13 @@ static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface(
return S_OK;
}
if (IsEqualGUID(iid, &IID_IGamepadStatics))
{
IUnknown_AddRef(iface);
*out = &impl->IGamepadStatics_iface;
return S_OK;
}
FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL;
return E_NOINTERFACE;
......@@ -133,9 +151,104 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl =
windows_gaming_input_ActivateInstance,
};
static HRESULT STDMETHODCALLTYPE gamepad_statics_QueryInterface(
IGamepadStatics *iface, REFIID iid, void **out)
{
struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface);
return windows_gaming_input_QueryInterface(&impl->IActivationFactory_iface, iid, out);
}
static ULONG STDMETHODCALLTYPE gamepad_statics_AddRef(
IGamepadStatics *iface)
{
struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface);
return windows_gaming_input_AddRef(&impl->IActivationFactory_iface);
}
static ULONG STDMETHODCALLTYPE gamepad_statics_Release(
IGamepadStatics *iface)
{
struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface);
return windows_gaming_input_Release(&impl->IActivationFactory_iface);
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_GetIids(
IGamepadStatics *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 gamepad_statics_GetRuntimeClassName(
IGamepadStatics *iface, HSTRING *class_name)
{
FIXME("iface %p, class_name %p stub!\n", iface, class_name);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_GetTrustLevel(
IGamepadStatics *iface, TrustLevel *trust_level)
{
FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadAdded(
IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token)
{
FIXME("iface %p, value %p, token %p stub!\n", iface, value, token);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadAdded(
IGamepadStatics *iface, EventRegistrationToken token)
{
FIXME("iface %p, token %#I64x stub!\n", iface, token.value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadRemoved(
IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token)
{
FIXME("iface %p, value %p, token %p stub!\n", iface, value, token);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved(
IGamepadStatics *iface, EventRegistrationToken token)
{
FIXME("iface %p, token %#I64x stub!\n", iface, token.value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads(
IGamepadStatics *iface, IVectorView_Gamepad **value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static const struct IGamepadStaticsVtbl gamepad_statics_vtbl =
{
gamepad_statics_QueryInterface,
gamepad_statics_AddRef,
gamepad_statics_Release,
/* IInspectable methods */
gamepad_statics_GetIids,
gamepad_statics_GetRuntimeClassName,
gamepad_statics_GetTrustLevel,
/* IGamepadStatics methods */
gamepad_statics_add_GamepadAdded,
gamepad_statics_remove_GamepadAdded,
gamepad_statics_add_GamepadRemoved,
gamepad_statics_remove_GamepadRemoved,
gamepad_statics_get_Gamepads,
};
static struct windows_gaming_input windows_gaming_input =
{
{&activation_factory_vtbl},
{&gamepad_statics_vtbl},
1
};
......
......@@ -138,8 +138,7 @@ static void test_Gamepad(void)
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IGamepadStatics, (void **)&gamepad_statics);
todo_wine ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGamepadStatics failed, hr %#x\n", hr);
if (FAILED(hr)) goto done;
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGamepadStatics failed, hr %#x\n", hr);
hr = IGamepadStatics_QueryInterface(gamepad_statics, &IID_IInspectable, (void **)&tmp_inspectable);
ok(hr == S_OK, "IGamepadStatics_QueryInterface IID_IInspectable failed, hr %#x\n", hr);
......@@ -152,7 +151,8 @@ static void test_Gamepad(void)
IAgileObject_Release(tmp_agile_object);
hr = IGamepadStatics_get_Gamepads(gamepad_statics, &gamepads);
ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr);
todo_wine ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr);
if (FAILED(hr)) goto done;
hr = IVectorView_Gamepad_QueryInterface(gamepads, &IID_IInspectable, (void **)&tmp_inspectable);
ok(hr == S_OK, "IVectorView_Gamepad_QueryInterface failed, hr %#x\n", hr);
......@@ -171,6 +171,7 @@ static void test_Gamepad(void)
IVectorView_Gamepad_Release(gamepads);
done:
token.value = 0xdeadbeef;
hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token);
todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
......@@ -189,7 +190,6 @@ static void test_Gamepad(void)
IGamepadStatics_Release(gamepad_statics);
done:
IAgileObject_Release(agile_object);
IInspectable_Release(inspectable);
IActivationFactory_Release(factory);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment