From 6f2199758a6b0c008f2ea35a73ce516fff1409a5 Mon Sep 17 00:00:00 2001 From: endolf Date: Sat, 27 Aug 2005 08:22:19 +0000 Subject: Start of some work to print more debug if force feedback effect creation fails git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@110 e343933a-64c8-49c5-92b1-88f2ce3e89e8 --- plugins/DX8/src/native/input.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'plugins') diff --git a/plugins/DX8/src/native/input.cpp b/plugins/DX8/src/native/input.cpp index 5fd4bcb..1468904 100644 --- a/plugins/DX8/src/native/input.cpp +++ b/plugins/DX8/src/native/input.cpp @@ -320,6 +320,13 @@ BOOL RegisterDummyWindow(HINSTANCE hInstance) return RegisterClassEx(&wcex); } +// Callback for finding out what effects a device supports +BOOL CALLBACK DIEnumEffectsProc(LPCDIEFFECTINFO pei, LPVOID pv) +{ + *((GUID *)pv) = pei->guid; + return DIENUM_STOP; // one is enough +} + /* * Class: org_java_games_input_DirectInputEnvironmentPlugin * Method: directInputCreate @@ -660,6 +667,19 @@ BOOL CALLBACK EnumObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, name); if(ffEnabled) { + + HRESULT hr; + GUID guidEffect; + hr = lpDevice->EnumEffects( + (LPDIENUMEFFECTSCALLBACK) DIEnumEffectsProc, + &guidEffect, + DIEFT_PERIODIC); + if (FAILED(hr)) + { + // Note that success does not mean that any effects were found, + // only that the process went smoothly. + } + // This application needs only one effect: Applying raw forces. DWORD rgdwAxes; LONG rglDirection = 0; -- cgit v1.2.3