[Bug 45688] Gamepad appears both as dinput and xinput ( eg. Valkyria Chronicles)

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Aug 29 17:21:48 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=45688

--- Comment #4 from Gabriel Corona <gabriel.corona at enst-bretagne.fr> ---
I tried using the code from
https://docs.microsoft.com/en-us/windows/desktop/xinput/xinput-and-directinput
like thisĀ :

BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* instance, VOID* context)
{
  LPDIRECTINPUTDEVICE8 joystick;
  HRESULT hr = di->CreateDevice(instance->guidInstance, &joystick, NULL);
  if (FAILED(hr))
    return DIENUM_CONTINUE; 

  OLECHAR* bstrGuid;
  StringFromCLSID(instance->guidInstance, &bstrGuid);

  BOOL xinput = IsXInputDevice(&(instance->guidInstance));
  printf("%ls\t%i\n", bstrGuid, xinput ? 1 : 0);

  if (joystick) { 
    joystick->Unacquire();
  }
  return DIENUM_CONTINUE;
}


int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
  HRESULT hr;

  if (FAILED(hr = DirectInput8Create(GetModuleHandle(NULL),
DIRECTINPUT_VERSION, 
                     IID_IDirectInput8, (VOID**)&di, NULL))) {
    return hr;
  }

  LPDIRECTINPUTDEVICE8 joystick;
  if (FAILED(hr = di->EnumDevices(DI8DEVCLASS_GAMECTRL, enumCallback,
                  NULL, DIEDFL_ATTACHEDONLY))) {
    return hr;
  }    
  return 0;
}

Currently this routine seems to tell my dinput gamepad is not a xinput device:
pEnumDevices->Next() is not retuning any result.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list