Rémi Bernon : windows.gaming.input: Fake empty IGamepadStatics::Gamepads vector.

Alexandre Julliard julliard at winehq.org
Mon Mar 22 17:15:51 CDT 2021


Module: wine
Branch: master
Commit: ae690924916032ad13b821c03f68890c2d5ad119
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ae690924916032ad13b821c03f68890c2d5ad119

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Mar 22 11:17:30 2021 +0100

windows.gaming.input: Fake empty IGamepadStatics::Gamepads vector.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windows.gaming.input/main.c        | 14 +++++++++-----
 dlls/windows.gaming.input/tests/input.c | 18 ++++++++++++++++--
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c
index 5e349d98fab..d7a2f138a14 100644
--- a/dlls/windows.gaming.input/main.c
+++ b/dlls/windows.gaming.input/main.c
@@ -120,21 +120,25 @@ 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;
+    *value = NULL;
+    return E_BOUNDS;
 }
 
 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;
+    *value = 0;
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE vector_view_gamepad_IndexOf(
-    IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *value)
+    IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *found)
 {
-    FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value);
-    return E_NOTIMPL;
+    FIXME("iface %p, element %p, index %p, found %p stub!\n", iface, element, index, found);
+    *index = 0;
+    *found = FALSE;
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetMany(
diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c
index cfd814d5631..fa83261ffc4 100644
--- a/dlls/windows.gaming.input/tests/input.c
+++ b/dlls/windows.gaming.input/tests/input.c
@@ -111,6 +111,8 @@ static void test_Gamepad(void)
     IGamepadStatics *gamepad_statics = NULL;
     IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
     IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
+    IGamepad *gamepad;
+    BOOLEAN found;
     HSTRING str;
     HRESULT hr;
     ULONG size;
@@ -165,8 +167,20 @@ static void test_Gamepad(void)
 
     size = 0xdeadbeef;
     hr = IVectorView_Gamepad_get_Size(gamepads, &size);
-    todo_wine ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr);
-    todo_wine ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size);
+    ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr);
+    ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size);
+
+    gamepad = (IGamepad *)0xdeadbeef;
+    hr = IVectorView_Gamepad_GetAt(gamepads, size, &gamepad);
+    ok(hr == E_BOUNDS, "IVectorView_Gamepad_GetAt failed, hr %#x\n", hr);
+    ok(gamepad == NULL, "IVectorView_Gamepad_GetAt returned %p\n", gamepad);
+
+    size = 0xdeadbeef;
+    found = TRUE;
+    gamepad = (IGamepad *)0xdeadbeef;
+    hr = IVectorView_Gamepad_IndexOf(gamepads, gamepad, &size, &found);
+    ok(hr == S_OK, "IVectorView_Gamepad_IndexOf failed, hr %#x\n", hr);
+    ok(size == 0 && found == FALSE, "IVectorView_Gamepad_IndexOf returned size %d, found %d\n", size, found);
 
     IVectorView_Gamepad_Release(gamepads);
 




More information about the wine-cvs mailing list